Env_sun

From Valve Developer Community
Jump to: navigation, search
English (en)русский (ru)中文 (zh)
... Icon-Important.png

译者:joyo_a(百度ID)

Note.pngNote:此翻译仅供参考。本译文是翻译2017年9月1日修改的文章。如果原文有大改动,请以最新修改日期的原文为准。

env_sun是所有起源游戏中可用的点实体。

实体描述

它将太阳或月亮效果(发光的sprite)放置在没有视差的天空盒中,给人的印象是几乎无限远。env_sun实体不提供任何实际的照明;它仅仅是太阳的视觉表现。使用light_environment为你的地图提供实际的阳光。除与阴影控制无关的CSGO外,使用shadow_control作为动态阴影可能会影响级联照明。

设置env_sun:设置Pitch Yaw Roll。Pitch表示太阳在天空中偏高或偏低。Yaw表示偏左或偏右。Roll是无关的,不需要设置。info_player_start可以用来定位太阳的位置;你可以设定它的角度,想象一条线从背后出来指向天空,其指向的位置就是太阳在游戏中的位置。然后复制并粘贴它的Pitch、Yaw和Roll到env_sun中(记得之后删除info_player_start)。将使用角度(Use Angles)设置为是(这意味着它将使用“Pitch Yaw Roll”的设置)。将“Pitch”设置为实际Pitch的负数(此数字会覆盖“Pitch Yaw Roll”键值中的Pitch)。太阳颜色是太阳的基本颜色。叠加颜色是过渡材质的颜色。覆盖层提供了一个很好的过渡到太阳的全面眩光,并平滑当太阳进入视野时所出现的渐变效果。大小是太阳的大小。将其设置为小于叠加大小的数值;16是微小的太阳,而256是巨大的太阳。设置叠加大小为比太阳大的数值。

这个实体的属性适用于整个地图。地图中存在这个实体的多个实例可能会导致错误。

  • 你也可以将输入发送到env_sun实体,方法是将其指向“env_sun”而不是使用目标名称。
  • 与天空相互作用的效果:纯净的黄色太阳和明亮的蓝色天空相互作用将使得太阳在游戏中表现为白色的太阳;改变颜色来解决这个问题。

键值

Viewer entity <targetname>
用于确定太阳位于天空盒中的实体的名称。太阳应该排队从这个实体到env_sun实体。
UseAngles <boolean>
定位env_sun的旧方法是将其指向目标。新的方法是指定角度。如果使用新方法,请将此属性设置为YES。
Pitch <integer>
该值设定太阳的Pitch位置。它覆盖角度(angles)键值中的Pitch值,即使保留为0,所以需要指定其数值。与角度(angles)键值相反,这个Pitch的旋转是从水平方向逆时针测量的,所以90是直线向上的,而-90是直线向下的。(这只是正常Pitch值的负值。)
Sun Color (R G B) <color255>
太阳的颜色。
Overlay Color (R G B) <color255>
设置值为0 0 0的使用旧方法。
Blank image.pngTodo: 解释一下旧的方法。
Size <integer>
太阳的大小。
Overlay Size <integer>
设置值为-1意味着覆盖层使用旧方法。
Material Name <sprite>
内部发光的材质。
Overlay Material Name <sprite>
覆盖层发光的材质。
HDR color scale. <float>
在HDR模式下运行时,浮点(float)值用于多种sprite颜色。

Targetname:
Name (targetname) <string>
The targetname that other entities refer to this entity by.

输入

TurnOn
启用太阳渲染。
TurnOff
禁用太阳渲染。
SetColor <color255>
改变太阳的颜色。格式:<红 0-255> <绿 0-255> <蓝 0-255>

Base:
AddContext <string>
Adds to the entity's list of response contexts. See Context.
AddOutput <string>
Assigns a new keyvalue/output on this entity. For keyvalues, some rely on extra necessary code to be ran and won't work if its simply just changed through this input. There is a strict format that must be followed:
// Format of changing KeyValues: "AddOutput [key] [value]"
//// Raw text:
"OnUser1" "!self,AddOutput,targetname new_name"

// Format of adding an Output: "AddOutput {targetname}:{inputname}:{parameter}:{delay}:{max times to fire, -1 means infinite}"
//// Raw text:
"OnUser1" "!self,AddOutput,OnUser1:SetParent:!activator:0.0:-1"
// Arguments can be left blank, but the empty blank should still be contained.
//// Raw text:
"OnUser1" "!self,AddOutput,OnUser1:ClearParent::0.0:-1"
ClearContext
Removes all contexts from this entity's list.
ClearParent
Removes this entity from the the movement hierarchy, leaving it free to move independently.
FireUser1 to FireUser4
Fires the respectiveOnUseroutputs; see User Inputs and Outputs.
Kill
Removes this entity and any entities parented to it from the world.
KillHierarchy
Functions the same as Kill, although this entity and any entities parented to it are killed on the same frame, being marginally faster thanKillinput.
RemoveContext <string>
Remove a context from this entity's list. The name should match the key of an existing context.
SetParent <string>
Move with this entity. See Entity Hierarchy (parenting).
SetParentAttachment <string>
Change this entity to attach to a specific attachment point on its parent. The entity will teleport so that the position of its root bone matches that of the attachment. Entities must be parented before being sent this input.
SetParentAttachmentMaintainOffset <string>
As above, but without teleporting. The entity retains its position relative to the attachment at the time of the input being received.
Use  !FGD
Same as a player invoking +use; no effect in most cases.
DispatchResponse <string> !FGD
Dispatches a response to the entity. See Response and Concept.
DispatchEffect <string> (removed since Left 4 Dead) !FGD
Dispatches a special effect from the entity's origin; See also List of Client Effects. Replaced by the particle system since Left 4 Dead.
RunScriptFile <script> (in all games since Left 4 Dead 2) (also in Team Fortress 2)
Execute a VScript file from disk, without file extension. The script contents are merged with the script scope of the receiving entity.
RunScriptCode <string> (in all games since Left 4 Dead 2) (also in Team Fortress 2)
Execute a string of VScript source code in the scope of the entity receiving the input. String quotation may be needed when fired via console.
Icon-Bug.pngBug:In Hammer, using string arguments will corrupt the VMF file's structure, making the file unviewable for the next Hammer session.
Note.pngFix:Remove the string argument manually with a text editor.
Note.pngNote:Team Fortress 2 Backtick characters ` are replaced with quotation marks at runtime, allowing quotation marks to be used when normally not possible.
CallScriptFunction <string> (in all games since Left 4 Dead 2) (also in Team Fortress 2) !FGD
Calls a VScript function defined in the scope of the receiving entity.
TerminateScriptScope  (only in Team Fortress 2) !FGD
Destroys the script scope of the receving entity.
SetLocalOrigin <coordinates> (in all games since Alien Swarm) !FGD
Send this entity to a spot in the map. If the entity is parented to something, it will be offset from the parent by this amount.
SetLocalAngles <angles> (in all games since Alien Swarm) !FGD
Set this entity's angles.

输出


Targetname:
OnUser1 to OnUser4
These outputs each fire in response to the firing of the like-numbered FireUser1 to FireUser4 Input; see User Inputs and Outputs.
OnKilled  (only in Left 4 Dead)
This output fires when the entity is killed and removed from the game.

关于Env_Sun的教程(俄语)

教程作者:Project-S

description of env_sun (Видимое солнце)

youtu.be/2H-ZtuoyK04

Env_Sun + Light_Environment (ещё одно видео о солнце)

youtu.be/WcGIrc0nWnw