This article's documentation is for anything that uses the Source engine. Click here for more information.

Func rot button: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(fixed TODO and header)
No edit summary
 
(11 intermediate revisions by 10 users not shown)
Line 1: Line 1:
{{base brush|func_rot_button}} It is a rotating version of [[func_button]]. When used, it rotates to a pressed position instead of sliding to one.  
{{TabsBar|main=gs|base=func_rot_button}}
{{this is a|brush entity|name=func_rot_button}} It is a rotating version of {{ent|func_button}}. When used, it rotates to a pressed position instead of sliding to one.  


{{in code|class=class_c_rot_button.html CRotButton|file=buttons_8cpp-source.html buttons.cpp}}
{{CD|CRotButton|file1=buttons.cpp|CBaseButton}}


== Keyvalues ==
== Keyvalues ==
{{KV|Master (Obsolete)|string|Legacy support: The name of a master entity. If the master hasn't been activated, this button cannot be used.|deprecated=1}}
{{KV Targetname}}
{{KV|Speed|integer|The speed that the button rotates, in degrees per second.}}
{{KV|Master (Obsolete)|intn=master|string|Legacy support: The name of a master entity. If the master hasn't been activated, this button cannot be used.|deprecated=1}}
{{KV|Health (Obsolete)|integer|Legacy method of specifying whether or not the button can be shot to activate it. Use the 'Damage Activates' spawnflag instead.|deprecated=1}}
{{KV|Speed|intn=speed|integer|The speed that the button rotates, in degrees per second.}}
{{KV|Sounds|choices|Sound when pressed}}
{{KV|Health (Obsolete)|intn=health|integer|Legacy method of specifying whether or not the button can be shot to activate it. Use the 'Damage Activates' spawnflag instead.|deprecated=1}}
:{| class=standard-table
{{KV|Sounds|intn=sounds|choices|Sound when pressed}}
! Value || Description
:*0: None (Silent)
|-
:*21: Squeaky
| <code>0</code> || None (Silent)
:*22: Squeaky Pneumatic
|-
:*23: Ratchet Groan
| <code>21</code> || Squeaky
:*24: Clean Ratchet
|-
:*25: Gas Clunk
| <code>22</code> || Squeaky Pneumatic
|-
| <code>23</code> || Ratchet Groan
|-
| <code>24</code> || Clean Ratchet
|-
| <code>25</code> || Gas Clunk
|}


This sounds are for HL2 and Counter Strike Source.  
{{note|These sounds are for {{hl2}} and {{css}}.  
For other games, you need to check the sounds declared in scripts/game_sounds_world.txt. <br />
For other games, you need to check the sounds declared in scripts/game_sounds_world.txt. <br />
Choose a sound declared with a name like "Buttons.sndXX" (where XX is a number), AND be sure that the sound file exists in the vpk. <br />
Choose a sound declared with a name like "Buttons.sndXX" (where XX is a number), AND be sure that the sound file exists in the vpk.
Then deactivate smartedit, and put the number (XX) as value.
Then deactivate smartedit, and put the number (XX) as value.}}


{{KV|Delay Before Reset (-1 stay)|integer|Amount of time, in seconds, after the button has been pressed before it returns to the starting position. Once it has returned, it can be used again. If the value is set to -1, the button never returns.}}
{{KV|Delay Before Reset (-1 stay)|intn=wait|integer|Amount of time, in seconds, after the button has been pressed before it returns to the starting position. Once it has returned, it can be used again. If the value is set to -1, the button never returns.}}
{{KV|Distance (deg)|integer|The amount, in degrees, that the button should rotate when it's pressed.}}
{{KV|Distance (deg)|intn=distance|integer|The amount, in degrees, that the button should rotate when it's pressed.}}
{{KV|Minimum Light Level|string|The minimum level of ambient light that hits this brush.}}
{{KV|Minimum Light Level|intn=_minlight|string|The minimum level of ambient light that hits this brush.}}
{{KV Targetname}}
{{KV Parentname}}
{{KV Parentname}}
{{KV Origin}}
{{KV Origin}}
Line 40: Line 32:


== Flags ==
== Flags ==
* 1 : Not solid
{{fl|1|Not solid}}
* 2 : Reverse Dir
{{fl|2|Reverse Dir}}
* 32 : Toggle
{{fl|32|Toggle}}
* 64 : X Axis
{{fl|64|X Axis}}
* 128 : Y Axis
{{fl|128|Y Axis}}
* 256 : Touch Activates
{{fl|256|Touch Activates}}
* 512 : Damage Activates
{{fl|512|Damage Activates}}
* 1024 : Use Activates
{{fl|1024|Use Activates}}
* 2048 : Starts locked
{{fl|2048|Starts locked|{{bug|[https://github.com/ValveSoftware/source-sdk-2013/pull/401 Does not work.]  You will need to send the Lock input to this entity again, or manually set m_bLocked to true in [[VScript]].  Fixed in {{Gmod}}}}}}


== Inputs ==
== Inputs ==
{{I Targetname}}
{{I Parentname}}
{{I Parentname}}
{{I Button}}
{{I Button}}
Line 57: Line 48:


== Outputs ==
== Outputs ==
{{O Targetname}}
{{O Button}}
{{O Button}}



Latest revision as of 13:29, 25 May 2025

func_rot_button is a brush entity available in all Source Source games. It is a rotating version of func_button. When used, it rotates to a pressed position instead of sliding to one.

C++ Class hierarchy
CRotButton
CBaseButton
CBaseToggle
CBaseEntity
C++ buttons.cpp

Keyvalues

Name (targetname) <string>[ Edit ]
The name that other entities refer to this entity by, via Inputs/Outputs or other keyvalues (e.g. parentname or target).
Also displayed in Hammer's 2D views and Entity Report.
See also:  Generic Keyvalues, Inputs and Outputs available to all entities

Master (Obsolete) (master) <string> Obsolete
Deprecated.
Legacy support: The name of a master entity. If the master hasn't been activated, this button cannot be used.
Speed (speed) <integer>
The speed that the button rotates, in degrees per second.
Health (Obsolete) (health) <integer> Obsolete
Deprecated.
Legacy method of specifying whether or not the button can be shot to activate it. Use the 'Damage Activates' spawnflag instead.
Sounds (sounds) <choices>
Sound when pressed
  • 0: None (Silent)
  • 21: Squeaky
  • 22: Squeaky Pneumatic
  • 23: Ratchet Groan
  • 24: Clean Ratchet
  • 25: Gas Clunk
Note.pngNote:These sounds are for Half-Life 2 and Counter-Strike: Source.

For other games, you need to check the sounds declared in scripts/game_sounds_world.txt.
Choose a sound declared with a name like "Buttons.sndXX" (where XX is a number), AND be sure that the sound file exists in the vpk.

Then deactivate smartedit, and put the number (XX) as value.


Delay Before Reset (-1 stay) (wait) <integer>
Amount of time, in seconds, after the button has been pressed before it returns to the starting position. Once it has returned, it can be used again. If the value is set to -1, the button never returns.
Distance (deg) (distance) <integer>
The amount, in degrees, that the button should rotate when it's pressed.
Minimum Light Level (_minlight) <string>
The minimum level of ambient light that hits this brush.
Parentname:
Parent (parentname) <targetname>
Specifies a movement parent. An entity will maintain its initial offset from its parent. An attachment point can be added to the end of the name, separated by a comma.

Origin:

Origin (X Y Z) (origin) <origin>
The position of this entity's center in the world. Rotating entities typically rotate around their origin.
Pitch Yaw Roll (Y Z X) (angles) <QAngle>
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.
Global:
Global Entity Name (globalname) <string>
Name by which this entity is linked to another entity in a different map. When the player transitions to a new map, entities in the new map with globalnames matching entities in the previous map will have the previous map's state copied over their state.
Start Disabled (StartDisabled) <boolean>
Stay dormant until activated (with theEnableinput).

Flags

Not solid : [1]
Reverse Dir : [2]
Toggle : [32]
X Axis : [64]
Y Axis : [128]
Touch Activates : [256]
Damage Activates : [512]
Use Activates : [1024]
Starts locked : [2048]
Icon-Bug.pngBug:Does not work. You will need to send the Lock input to this entity again, or manually set m_bLocked to true in VScript. Fixed in Garry's Mod  [todo tested in ?]

Inputs

Parentname:
SetParent <stringRedirectInput/string>
Move with this entity. See Entity Hierarchy (parenting).
SetParentAttachment <stringRedirectInput/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 <stringRedirectInput/string>
As above, but without teleporting. The entity retains its position relative to the attachment at the time of the input being received.
ClearParent
Removes this entity from the the movement hierarchy, leaving it free to move independently.
Button:
Lock
Lock the button, preventing it from functioning.
Unlock
Unlock the button, allowing it to function.
Press
Activate the button as if it was pressed.
PressIn
Activate the button as if it was pressed, sending it to the bottom position.
PressOut
Unpress the button, sending it to the top position.

EnableDisable:

Enable / Disable
Enable/disable this entity from performing its task. It might also disappear from view.

Outputs

Button:
OnDamaged
Fired when the button is damaged.
OnPressed
Fired when the button is pressed.
OnUseLocked
Fired when the button is used while locked.
OnIn
Fired when the button reaches the in/pressed position.
OnOut
Fired when the button reaches the out/released position.

See also