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

func_rot_button

From Valve Developer Community
Jump to: navigation, search

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.


class hierarchy
CRotButton defined in buttons.cpp
CBaseButton
CBaseToggle
CBaseEntity


Keyvalues

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.

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

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.

Angles:
Pitch Yaw Roll (Y Z X) (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.

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.

EnableDisable:

Start Disabled (StartDisabled) <boolean>
Stay dormant until activated (with theEnableinput).

Flags

  •  [1] : Not solid
  •  [2] : Reverse Dir
  •  [32] : Toggle
  •  [64] : X Axis
  •  [128] : Y Axis
  •  [256] : Touch Activates
  •  [512] : Damage Activates
  •  [1024] : Use Activates
  •  [2048] : Starts locked
    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

Inputs


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.

Parentname:
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.
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


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.

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