Template:I BaseEntity:zh-cn: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
No edit summary
m (- changed links to :lang suffix redirect pages to the redirected link)
 
(29 intermediate revisions by 6 users not shown)
Line 1: Line 1:
<noinclude>{{otherlang2
{{lang|Template:I BaseEntity}}
|noborder=true
<onlyinclude><includeonly><!--
|ru=Template:I_BaseEntity:ru
|en=Template:I_BaseEntity
}}__NOTOC__


This template is our holder for all [[inputs]] assigned through {{ent|CBaseEntity}}. The template has a very specific syntax that you must follow to apply properly, because new games have added new features throughout the years. See [[Help:Templates]] for more info on named parameters.
  ++ Base ++
<pre>{{I BaseEntity}}</pre>
-->{{ScrollBox|title=Base|noscroll={{{noscroll|1}}}
'''No parameters:''' display inputs for ALL games.
|{{IO:zh-cn|AddContext|添加到实体的 [[Response System/zh|Response Contexts/响应上下文]]列表。格式是<code><key>:<value></code>|param=string}}
<pre>{{I BaseEntity|base=1}}</pre>
{{IO:zh-cn|[[AddOutput]]|在此实体上分配新的键值/输出。对于键值,有些依赖于额外的必要代码来运行,如果它只是通过这个输入改变就行不通。必须遵循严格的格式:{{ExpandBox:zh-cn|<syntaxhighlight lang="PowerShell">
'''Base:''' display inputs that have only existed since whatever game added the class (most have existed since HL2, the first Source game).
// 更改键值的格式: "AddOutput [键] [值]"
<pre>{{I BaseEntity|l4d2=1}}</pre>
//// 原始文本:
'''Game as a parameter:''' display the inputs that <code>base</code> displays, AND inputs that were added to the class, by the specified game. You can specify as many games as needed. You must specify ALL the games you want to include (e.g. <code>l4d2</code> will not automatically include <code>l4d</code> inputs as well).
"OnUser1" "!self,AddOutput,targetname new_name"


All parameters for this template:
// 添加输出的格式: "AddOutput {目标名称}:{输入名称}:{参数}:{延迟}:{最大触发次数,-1 代表无限}"
*<code>base</code>
//// 原始文本:
*<code>l4d2</code>
"OnUser1" "!self,AddOutput,OnUser1:SetParent:!activator:0.0:-1"
*<code>portal2</code>
// 参数可以留空,但仍应包含空的空白。
*<code>prel4d</code> - (DEPRECATED 9/28/18: This parameter existed to hide DispatchEffect for games (ones before l4d) that did not have it. There's many cases of similar inputs and keyvalues that aren't in absolutely everything, and making similar parameters for all of those simply isn't worth the trouble, especially considering having to comb through every existing use of those templates. Parameter is totally removed from code and affects nothing.)
//// 原始文本:
{{note|If you want to edit something on this template, please make sure you edit it in both places. ''Per-game'' inputs are duplicated, for complex technical reasons.}}
"OnUser1" "!self,AddOutput,OnUser1:ClearParent::0.0:-1"
For full documentation on this family of templates, see [[FGD Template Prototype]]. Still confused on something? '''Ask for help''' before editing this template.
</syntaxhighlight>| 语法<nowiki>:</nowiki>}}|param=string }}
{{note|Some <code>CBaseEntity</code> inputs are not covered here. See the talk page.}}
{{IO:zh-cn|ClearContext|从此实体的列表中删除所有上下文。}}
[[Category:Input Templates|Global]]
{{IO:zh-cn|ClearParent|从移动层次结构中删除该实体,使其可以自由移动。}}
----
{{IO:zh-cn|FireUser1|to=FireUser4|触发相应的<code>OnUser</code>输出;详见 [[User Inputs and Outputs]]{{en}}。}}
</noinclude><!--
{{IO:zh-cn|Kill|从这个世界中删除此实体。}}
-->{{minititle|基础}}
{{IO:zh-cn|KillHierarchy|功能类似<code>Kill</code>,尽管此实体与其父实体都被删除了,但比<code>Kill</code>快一点。}}
{{IO:zh|Kill|从这个世界中删除此实体。}}
{{IO:zh-cn|RemoveContext|从实体列表删除一个上下文。名字应与现有上下文进行匹配。}}
{{IO:zh|KillHierarchy|功能类似于<code>Kill</code>,尽管此实体与其父实体都被删除了,但比<code>Kill</code>快一点。}}
{{IO:zh-cn|SetParent|跟随此实体移动,详见 [[Entity Hierarchy (parenting)/zh|实体层级(依赖关系)]]|param=string}}
{{IO:zh|SetParent|跟随此实体移动,详见[[Entity Hierarchy (parenting)]].|param=字符串}}
{{IO:zh-cn|SetParentAttachment|更改此实体到其父级上的特定[[attachment|附属]]{{en}}点。实体将传送,以至于其[[bone|骨骼方位]]{{en}}与附属匹配。在使用此输入前必须设置好实体的父实体。|param=string}}
{{IO:zh|SetParentAttachment|修改此实体到父实体的特定[[attachment|附属]]点。实体会传送,以至于其[[bone|骨骼方位]]与附属匹配。在使用此输入前必须设置好实体的父实体。|param=字符串}}
{{IO:zh-cn|SetParentAttachmentMaintainOffset|同上,但没有传送。在接收到输入时,实体保持其相对于附件的位置。|param=string}}
{{IO:zh|SetParentAttachmentMaintainOffset|同上,但不传送。实体接受到此输出后保留与父级的相对位置。|param=字符串}}
{{IO:zh-cn|Use|与调用 {{ent:zh-cn|+use}} 的玩家相同[玩家按 +use(使用,默认E按钮)];大多数情况下没有影响。|nofgd=1}}
{{IO:zh|ClearParent|取消绑定父实体,以至于此实体可以自由行动。}}
{{IO:zh-cn|DispatchResponse|向实体发送一个上下文。 详见 [[Response]]{{en}} [[Concept]]{{en}}.|param=string|nofgd=1}}<!--
{{IO:zh|[[AddOutput]]|评估此实体的输出/键值(类似于增加输出给某实体)。<br/>格式: <code><key/键> <value/值></code><br/>格式: <code><output name/输出名> <targetname/目标名>:<inputname/输入名>:<parameter/参数>:<delay/延迟>:<最大触发数,-1代表无限。></code>|param=字符串}}
-->{{#if:{{{l4d2|}}}{{{as|}}}| |{{IO:zh-cn|DispatchEffect|在实体的原点坐标设置一个特定效果;参见 [[List of Client Effects]]{{en}}。自从{{l4d|4|suf=:zh-cn}}后由[[particle System Overview:zh-cn|粒子]]系统取代。|param=string|removed={{l4d}}|nofgd=1}} }}
{{IO:zh|FireUser1|to=FireUser4|触发<code>OnUser</code>输出; 详见 [[User Inputs and Outputs]]}}
<!--
{{IO:zh|Use|类似于玩家按 [[+use]](使用,默认E按钮); 也许不会做什么事! 也可以通过创建未指定的输入来调用输出。<br /> 这个输入不存在于Valve的 [[FGD]]中。|nofgd=1}}
  ++ Game Specifics ++
{{IO:zh|DispatchEffect|在实体的原点坐标设置一个特定效果。自从{{l4d}}后由[[particle|粒子]]系统取代。|param=字符串|nofgd=1}}
 
{{IO:zh|DispatchResponse|向实体发送一个上下文。 详见 [[Response]] 和 [[Concept]].|param=字符串|nofgd=1}}
    我们希望尽可能少地使用 #if 块,以防止出现过多的假想换行符
{{IO:zh|AddContext|添加到实体的[[Response System|response contexts/响应上下文]]列表。格式<code><key/键>:<value/值></code>.|param=字符串}}
    IF: L4D2 -->{{#if:{{{l4d2|}}}|
{{IO:zh|RemoveContext|从实体列表删除一个上下文。名字应与现有上下文进行匹配。|param=字符串}}
{{IO:zh-cn|RunScriptFile|从硬盘执行一个 [[VScript/zh|VScript]] 脚本文件,不带文件后缀名。会合并接收实体的脚本域。|param=script|since={{l4d2}}}}
{{IO:zh|ClearContext|删除实体的所有上下文。|param=字符串}}<!--
{{IO:zh-cn|RunScriptCode|在接收输入的实体范围内执行一串 VScript 源代码。通过控制台触发时可能需要字符串引用。{{bugfix|suf=:zh-cn|在 Hammer 中,使用带有字符串的参数会破坏 [[VMF]] 文件的结构,使下一个 Hammer 会话无法查看该文件。|使用文本编辑器手动删除带有字符串的参数。}}|param=string|since={{l4d2}}}}
-->{{#if:{{{l4d2|}}}|<!--
{{IO:zh-cn|CallScriptFunction|调用在接收实体范围内定义的 VScript 函数。|param=string|since={{l4d2}}|nofgd=1}}<!--
-->{{IO:zh|RunScriptFile|从硬盘执行一个[[VScript]]脚本文件,不带文件后缀名。 会合并接收实体的脚本域。|param=script|since=L4D2}}
    {{portal2|}}} 用于遗留支持 -->
{{IO:zh|RunScriptCode|(执行脚本代码。)执行一段接收实体域的脚本源代码。通过控制台触发,可能需要英文双引号。{{bug|在{{l4d2}}中,该代码是触发输出的实体的脚本域中执行, ''非'' 接受输入的实体。}} {{警告|切勿在此输入的元素内使用字符串!它将破坏[[VMF]] ,由嵌套引号引起!你必须用文本编辑器手动删除来修复!}}|param=字符串|since=L4D2}}
| <!-- ELSE IF: NOT BASE [AS / P2] -->{{#if:{{{base|}}}||
{{IO:zh|CallScriptFunction|在接受实体脚本域上执行一段vscript函数。|param=字符串|since=L4D2|nofgd=1}}<!--
{{IO:zh-cn|RunScriptFile|从硬盘执行一个 [[VScript/zh|VScript]] 脚本文件,不带文件后缀名。会合并接收实体的脚本域。|param=script|since={{l4d2}}}}
-->| }}{{#if:{{{portal2|}}}|<!--
{{IO:zh-cn|RunScriptCode|在接收输入的实体范围内执行一串 VScript 源代码。通过控制台触发时可能需要字符串引用。{{bugfix|suf=:zh-cn|在 Hammer 中,使用带有字符串的参数会破坏 [[VMF]]{{en}} 文件的结构,使下一个 Hammer 会话无法查看该文件。|使用文本编辑器手动删除带有字符串的参数。}}|param=string|since={{l4d2}}}}
-->{{IO:zh|SetLocalOrigin|param=坐标|since=AS|nofgd=1|将此实体设置到地图上某点。如果此实体是某实体父级,那么它的子级也会随着偏移。}}
{{IO:zh-cn|CallScriptFunction|在接受实体脚本域上执行一段 VScript 函数。|param=string|since={{l4d2}}|nofgd=1}}
{{IO:zh|SetLocalAngles|param=角度|since=AS|nofgd=1|设置实体的角度(朝向)。}}<!--
{{IO:zh-cn|SetLocalOrigin|param=coordinates|since={{as}}|nofgd=1|将此实体设置到地图中的某个位置。如果此实体是某实体父级,那么它的子级也会随着移动。}}
-->| }}{{#if:{{{l4d2|}}}||{{#if:{{{portal2|}}}||{{#if:{{{base|}}}||<!--
{{IO:zh-cn|SetLocalAngles|param=angles|since={{as}}|nofgd=1|设置该实体的角度。}}<!-- -->}}}} }}</includeonly></onlyinclude>
-->{{IO:zh|RunScriptFile|从硬盘执行一个[[VScript]]脚本文件,不带文件后缀名。会合并接收实体的脚本域。|param=script|since=L4D2}}
{{documentation:zh-cn}}
{{IO:zh|RunScriptCode|(执行脚本代码。)执行一段接收实体域的脚本源代码。通过控制台触发,可能需要英文双引号。{{bug|在{{l4d2}}中,该代码是触发输出的实体的脚本域中执行, ''非'' 接受输入的实体。}} {{警告|切勿在此输入的元素内使用字符串!它将破坏[[VMF]] ,由嵌套引号引起!你必须用文本编辑器手动删除来修复!}}|param=字符串|since=L4D2}}
<!-- 将类别添加到 /doc 子页面,而不是这里 -->
{{IO:zh|CallScriptFunction|在接受实体脚本域上执行一段vscript函数。|param=字符串|since=L4D2|nofgd=1}}
{{IO:zh|SetLocalOrigin|param=坐标|since=AS|nofgd=1|将此实体设置到地图上某点。如果此实体是某实体父级,那么它的子级也会随着偏移。}}
{{IO:zh|SetLocalAngles|param=角度|since=AS|nofgd=1|设置实体的角度(朝向)。}}<!--
-->}}}}}}

Latest revision as of 12:15, 4 July 2024


Template:Doc/subpage:zh-cn

继承CBaseEntityclass 的所有相关输入的信息持有者C++。模板参数对于显示适当的信息至关重要,因为这些年来新游戏增加了新功能。有关命名参数的更多信息,请参见 Help:Templates

此处并未涵盖CBaseEntity的所有输入。但是您可以在 Uncovered Keyvalues 页面看到它们。

Note.pngNote:如果您想在此模板上编辑某些内容,请确保您还编辑了目标实体的页面。出于技术原因,每个游戏的键值可能会重复。参见 FGD Template Prototype

用法

这些必须以特定的语法使用!——所有参数的值都必须为 1,例如:as=1一次只能使用一个游戏参数。

{{I BaseEntity:zh-cn|as=1}}

参数

如果您将参数字段留空(不使用参数),模板将自动回退以显示当前默认游戏的键值。

此模板的所有参数:

  • base- 仅显示与首次添加时相关的信息
  • l4d2- 包含特定于 Left 4 Dead 2 的信息(VScripts
  • as- 包括特定于 Alien Swarm 的信息(SetLocalOrigin 和 SetLocalAngles)
已弃用的内容: 
  • portal2- 出于某种原因用于显示 Alien Swarm 键值。使用它会重定向到 Alien Swarm 键值。
  • prel4d - (DEPRECATED 9/28/18: This parameter existed to hide DispatchEffect for games (ones before l4d) that did not have it. There's many cases of similar inputs and keyvalues that aren't in absolutely everything, and making similar parameters for all of those simply isn't worth the trouble, especially considering having to comb through every existing use of those templates. Parameter is totally removed from code and affects nothing.)
  • tf2 - (DEPRECATED 28/4/2021: Was only used to showSetTeamkeyvalue's TF2 specific information. Use {{I TeamNum}} insteadwhen it starts to exist...)

有关示例,请参阅示例部分。

示例

显示特定于游戏的信息 Alien Swarm

这使得仅显示与 Alien Swarm 相关的信息。

{{I BaseEntity:zh-cn|as=1}}
将会:

显示其基本的信息

仅显示与基础引擎相关的信息。 (Source 2013 / Source 2013 Multiplayer)

{{I BaseEntity:zh-cn|base=1}}
将会:

显示所有游戏的信息

显示此模板可以显示的此键的每个游戏信息。

{{I BaseEntity:zh-cn}}
将会:


另请参阅

  • {{KV BaseEntity:zh-cn}}
  • {{KV BaseAnimating:zh-cn}}
  • {{I BaseAnimating:zh-cn}}