func_button

From Valve Developer Community
Jump to: navigation, search
English


English Русский

Func_button - это брашевая энтити, доступная во всех играх на движке Source. Она разработана, чтобы создавать используемые игроком кнопки. При использовании игроком она принимает вид нажатой кнопки. Для примера, func_button используется для создания (EN)клавишной панели.

Bug.png Ошибка: Не блокируете когда нажата; она не вернётся на место, когда разблокируется.

В коде представлен в виде класса CBaseButton, определённого в buttons.cpp.


Значения параметров

Move Direction (Pitch Yaw Roll) (movedir) <angle> Указывает направление движения кнопки при её использовании.
Speed (speed) <integer> Скорость, с которой движется кнопка, единицы в секунду.
Health (Obsolete) (health) <integer> Устаревший метод определения того, можно ли нажать кнопку, чтобы её активировать. Вместо этого используйте флаг Damage Activates.
Lip (lip) <integer> Длина кнопки, чтобы оставить её торчащей из стены, в которую она отступает при нажатии, в дюймах. Отрицательные значения заставляют кнопку отступать внутрь стены.
Master (Obsolete) (master) <string> Устаревшая поддержка
имя главной энтити. Если master не был активирован, кнопка не может быть нажата.
Sounds (sounds) <choices> Звук, который кнопка издает при нажатии.
Note.png Примечание: Список ниже был составлен для Half-Life 2. Все игры поддерживают это значение, но некоторые не имеют такого количества звуковых файлов. Чтобы отредактировать эти звуки, посмотрите на Buttons.snd (далее следует число из столбца Value в этой таблице) в hl2/scripts/game_sounds_world.txt или соответствующий (EN)файл звукового скрипта вашей игры.
Значение Описание Стандартный звук
Кнопки
0 None (Silent) common/null.wav
1 Big zap & Warmup buttons/button1.wav
2 Access Denied buttons/button2.wav
3 Access Granted buttons/button3.wav
4 Quick Combolock buttons/button4.wav
5 Power Deadbolt 1 buttons/button5.wav
6 Power Deadbolt 2 buttons/button6.wav
7 PLunger buttons/button7.wav
8 Small zap buttons/button8.wav
9 Keycard Sound buttons/button9.wav
10 Buzz buttons/button10.wav
11 Buzz Off buttons/button11.wav
12 Latch Locked doors/latchlocked2.wav
13 Latch Unlocked doors/latchunlocked1.wav
14 Lightswitch buttons/lightswitch2.wav
15 Small bleek buttons/button15.wav
16 Small deny buttons/button16.wav
17 Small doop buttons/button17.wav
18 Small tech deny buttons/button18.wav
19 Click and Combine screen fuzz buttons/button19.wav
20 Roomy Beep buttons/button20.wav
Рычаги
21 lever or wheel: turn + move sqeek buttons/lever1.wav
22 lever or wheel: latch + release gas buttons/lever2.wav
23 lever or wheel: ratchet + sqeek buttons/lever3.wav
24 lever or wheel: large ratchet buttons/lever4.wav
25 lever or wheel: clanky + gas release buttons/lever5.wav
26 lever or wheel: latch + large metal thud buttons/Lever6.wav
27 lever or wheel: smaller ratchet buttons/Lever7.wav
28 lever or wheel: smaller lever move buttons/Lever8.wav
Новые кнопки
31 shock buzz buttons/button21.wav
32 clickbeep buttons/button22.wav
33 tech blip buttons/button23.wav
34 clickbeepbeep open buttons/button24.wav
35 small high blip buttons/button12.wav
36 small tech fuzz blip buttons/button13.wav
37 small click bleep (change to lightswitch) buttons/button14.wav
Кнопки комбайнов
40 combine door lock - locked buttons/combine_button_locked.wav
41 combine blip growl buttons/combine_button1.wav
42 combine squick growl buttons/combine_button2.wav
43 combine whine purr buttons/combine_button3.wav
44 combine click talk buttons/combine_button4.wav
45 combine click growl fizz buttons/combine_button5.wav
46 combine click fizz (deny) buttons/combine_button6.wav
47 combine click talker buttons/combine_button7.wav


Delay Before Reset (-1 stay) (wait) <integer> Количество времени, в секундах, после того как кнопка была нажата, до того как она вернется в начальную позицию. Как только она вернется, она может быть использована вновь. Если значение будет -1, она больше не вернется.
Locked Sound (locked_sound) <choices> Звук воспроизводится, когда игрок пытается использовать кнопку и терпит неудачу, потому что она заблокирована.
Значение Описание Звук по умолчанию
0 None common/null.wav
2 Access Denied buttons/button2.wav
8 Small zap buttons/button8.wav
10 Buzz buttons/button10.wav
11 Buzz Off buttons/button11.wav
12 Latch Locked doors/latchlocked2.wav


Unlocked Sound (unlocked_sound) <choices> Звук воспроизводится когда кнопка разблокирована.
Подтверждаю:кажется, не работает???
Значение Описание Звук по умолчанию
0 None common/null.wav
1 Big zap & Warmup buttons/button1.wav
3 Access Granted buttons/button3.wav
4 Quick Combolock buttons/button4.wav
5 Power Deadbolt 1 buttons/button5.wav
6 Power Deadbolt 2 buttons/button6.wav
7 Plunger buttons/button7.wav
8 Small zap buttons/button8.wav
9 Keycard Sound buttons/button9.wav
10 Buzz buttons/button10.wav
13 Latch Unlocked doors/latchunlocked1.wav
14 Lightswitch buttons/lightswitch2.wav


Locked Sentence (locked_sentence) <choices> Предложение, показываемое когда игрок пытается использовать кнопку, и терпит неудачу, потому что она заблокирована.
Значение Описание
0 None
1 Gen. Access Denied
2 Security Lockout
3 Blast Door
4 Fire Door
5 Chemical Door
6 Radiation Door
7 Gen. Containment
8 Maintenance Door
9 Broken Shut Door
Unlocked Sentence (unlocked_sentence) <choices> A sentence played when the button is unlocked.
Value Description
0 None
1 Gen. Access Granted
2 Security Disengaged
3 Blast Door
4 Fire Door
5 Chemical Door
6 Radiation Door
7 Gen. Containment
8 Maintenance area
Glow Entity (glow) <targetname>
(Во всех играх начиная с {{Left 4 Dead 2|suf=:ru}})Имя энтити, которое получит свечение для этой кнопки после+use.
Note.png Примечание: Движок не может нормально найти Glow entity если оно вне сетки. Он возьмёт несколько энтити, которые рядом с Glow entity, которая находится вне сетки.
Use Look-At Limit (min_use_angle)(Во всех играх начиная с {{Counter-Strike: Global Offensive|suf=:ru}}) <string> Ограничивает полезный угол обзора. -1 - в другую сторону, 0 - перпендикулярно, 1 - туда, куда надо.

Visible Brush:

Minimum Light (_minlight) <float> Минимальное количество света, который светит на этот браш. 0 - никакое, 1 - по-умолчанию, 2 - удвоенное..
Damage Filter Name (damagefilter) <targetname> Когда этот энтити получает урон, то он будет filter:ru этим энтити.
Render Mode:ru (rendermode) <choices>
Ставит не стандартный вид рендерига на этот энтитиSet a non-standard rendering mode on this entity.



Render FX (renderfx) <choices>
Предустановленный шаблон эффектов внешнего вида.


Необходимо сделать: 18-21, 25
Render FX / Transparency (0 - 255) (renderamt) <integer> Количество бесцветности, нужен другой вид рендера, чем "По умолчанию". 0 - невидимый, 255 - полностью видимый.
Render Color (R G B) (rendercolor) <color255> Оттенок цвета.
Shadow Cast Distance (shadowcastdist) <integer> Устанавливает, на сколько далеко энити имеет динамичекую тень. 0 - по умолчанию от энтитиshadow_control:ru.  !FGD
Shadows (vrad_brush_cast_shadows)  !FGD
Disable Shadows (disableshadows) <boolean> Prevent the entity from creating cheap render-to-texture shadows. Does not affect shadow mapping.
Disable Receiving Shadows (disablereceiveshadows) <boolean> Prevent the entity from receiving shadows on itself.
Texture Frame (texframeindex) <integer> <The frame number for any animated textures on this entity.> !FGD
Minimum CPU Level (mincpulevel) <choices>
A user with a CPU level lower than this will not see this object rendered in-game. It's unclear how the CPU level is decided, but most systems are classified as "high".

(Появилось во всех играх с Left 4 Dead)

Maximum CPU Level (maxcpulevel) <choices>

(Появилось во всех играх с Left 4 Dead)

  • 0: Default (по умолчанию)
  • 1: Low (низкий)
  • 2: Medium (средний)
  • 3: High (высокий)
Minimum GPU Level (mingpulevel) <choices>

(Появилось во всех играх с Left 4 Dead)

Maximum GPU Level (maxgpulevel) <choices>

(Появилось во всех играх с Left 4 Dead)

  • 0: Default (по умолчанию)
  • 1: Very low (очень низкий)
  • 2: Low (низкий)
  • 3: Medium (средний)
  • 4: High (высокий)


Brush:

Minimum Bounding Box Size (mins) <vector> !FGD
Maximum Bounding Box Size (maxs) <vector> !FGD
Starting at the brush's origin, mark a bounding box's corner as this far away. Both are required at the same time so one side of the bounding box isn't empty.
Note.png Note: To translate a brush's size in Hammer to these keys, first divide the size value shown in Hammer by 2. Apply the result to themaxskey, then apply the inverted variant (multiply / divide by -1) for theminskey.
Note.png Note: If collisions is already set, it must be set back to Bounding Box (solid 2).
Collisions (solid) <choices>
Method of collision for this entity.
Model Index (modelindex) <short> !FGD
Given the number index from dumping thecl_precacheinfo modelprecachetable, sets entity model to of the index.
Warning.png Warning: If an entity has animations that will be played, then the set model also must have its own sequences, else the game crashes.

Base:

Name (targetname) <string>
The name that other entities use to refer to this entity.
Parent (parentname) <targetname>
Maintain the same initial offset to this entity. An attachment point can also be used if separated by a comma at the end. (parentname [targetname],[attachment])
Tip.png Tip: Entities transition to the next map with their parents
Tip.png Tip: phys_constraintcan be used as a workaround if parenting fails.
Global Entity Name (globalname) <string>
When the player transitions to a new map, entities in the new map with matching globalnames will have their previous map's states copied over to it.
Origin (X Y Z) (origin) <coordinates>
The position of this entity's center in the world. Rotating entities typically rotate around their origin.
Note.png Note: Hammer does not move the entities accordingly only in the editor.
Pitch Yaw Roll (X Y Z) (angles) <angle>
This entity's orientation in the world. Pitch is rotation around the Y axis, yaw is the rotation around the Z axis, roll is the rotation around the X axis.
Note.png Note: This works on brush entities, although Hammer doesn't show the new angles.
Response Contexts (ResponseContext) <string>
Pre-defined response system contexts; Format is [key]:[value],[key]:[value],...and so on.
Tip.png Tip: Can also be filtered for or against!
Classname (classname) <string> !FGD
Determines the characteristics of the entity before it spawns.
Tip.png Tip: Changing classnames using theAddOutputinput can still influence the game's code, like making the classname match one element in the S_PreserveEnts list will make the entity persists on new rounds!
Flags (spawnflags) <integer> !FGD
Toggles exclusive features of an entity, its specific number is determined by the combination of flags added.
Effects (effects) <integer> !FGD
Combination of effect flags to use.
Hammer ID (hammerid) <integer> !FGD
The entity's unique Hammer ID that's auto-generated on map compiles. Mainly used by plugins or debugging commands (like theent_keyvaluecommand). Run-time spawned entities don't have a Hammer ID.
Entity Scripts (vscripts) <scriptlist> (in all games since Left 4 Dead 2)
Space delimited list of VScript files (without file extension) that are executed after all entities have spawned. The scripts are all executed in the same script scope, later ones overwriting any identical variables and functions.
Script think function (thinkfunction) <string> (in all games since Left 4 Dead 2)
Name of a function in this entity's script which will be called automatically every 100 milliseconds (ten times a second) for the duration of the script. It can be used to create timers or to simulate autonomous behavior. The return value (if present) will set the time until the next call. Try to avoid expensive operations in this function, as it may cause performance problems.
Lag Compensation (LagCompensate) <boolean> (in all games since Left 4 Dead 2) !FGD
Set to Yes to lag compensate this entity. Should be used very sparingly!
Disable for Xbox 360 (disableX360) <boolean> (in all games since Left 4 Dead 2) !FGD
If this entity should automatically be given the 'Disable' input on the Xbox 360 version of Source.
Is Automatic-Aim Target (is_autoaim_target) <boolean> (in all games since Counter-Strike: Global Offensive) !FGD
If set to 1, this entity will slow down aiming movement for consoles and joystick controllers when the entity is under the crosshairs.


Флаги

  • 1: Don't move (не двигать)
  • 32: Toggle (режим тумблера)
  • 256: Touch Activates (активация при касании)
  • 512: Damage Activates (активация при уроне)
  • 1024: Use Activates (активация при нажатии)
  • 2048: Starts locked (сразу заперта)
  • 4096: Sparks (искриться при активации)
  • 16384: Non-solid (in all games since Counter-Strike: Global Offensive) (also in Garry's Mod) (не твёрдая)

Ввод

Lock
Запирает кнопку, препятствуя ей функционированию.
Unlock
Отпирает кнопку, позволяя ей функционировать.
Press
Активирует кнопку, как если бы она была нажата.
PressIn
Активирует кнопку, как если бы она была нажата, отправляя её в нижнюю позицию.
PressOut
Отжимает кнопку, возвращяя её в верхнюю позицию.

Visible Brush:

Alpha <integer>
Sets the entity's transparency to a number from 0 (invisible) to 255 (fully visible). Requires the entity to have its Render Mode (rendermode) set to a number other than 0.
AlternativeSorting <boolean>
Swaps the rendering order of the entity. Used to attempt to fix sorting problems when rendering, for example an object rendering in front of translucent materials.
Color <color255>
Sets an RGB color for the entity.
SetDamageFilter <targetname>
Sets a filter for this entity for when it receives damage.
EnableDamageForces
Allows the entity to be pushed by damage done to it (usually force amount correlates with the damage done).
DisableDamageForces
Prevents the entity from being pushed by damage done to it.
EnableShadow
Allows the entity to draw a render target shadow.
DisableShadow
Prevents the entity from drawing a render target shadow.
EnableDraw  (in all games since Portal 2)
Removes EF_NODRAW from the entity.
DisableDraw  (in all games since Portal 2)
Applies EF_NODRAW to the entity. Note that this is different than rendermode 10.
EnableReceivingFlashlight  (in all games since Portal 2)
Makes it so that the entity is lit by env_projectedtextures.
DisableReceivingFlashlight  (in all games since Portal 2)
Prevents the entity from being lit by env_projectedtextures. The shadow made by the texture will still cast.
EnableDrawInFastReflection  (in all games since Portal 2)
Makes the entity be rendered in reflections from water materials using $reflectonlymarkedentities.
DisableDrawInFastReflection  (in all games since Portal 2)
Prevents the entity from rendering in fast reflections.


Base:

AddContext <string>
Adds to the entity's list of response contexts. Format is <key>:<value>.
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:
Syntax:


ClearContext <string>
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
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)
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)
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.
Bug.png Bug: In Hammer, using string arguments will corrupt the VMF file's structure, making the file unviewable for the next Hammer session.
Fix: Remove the string argument manually with a text editor.
CallScriptFunction <string> (in all games since Left 4 Dead 2) !FGD
Execute a VScript function in the scope of the receiving 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.


Вывод

OnDamaged
Включается, когда кнопка получила урон.
OnPressed
Включается, когда кнопка была нажата.
OnUseLocked
Включается, когда кнопка была нажата будучи запертой.
OnIn
Включается, когда кнопка достигла позиции in/pressed (ввод/нажата).
OnOut
Включается, когда кнопка достигла позиции out/released (вывод/отжата).

Base:

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 Left 4 Dead 2)
This output fires when the entity is killed and removed from the game.

Смотрите так же