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

momentary_rot_button

From Valve Developer Community
Jump to: navigation, search
English (en)中文 (zh)Translate (Translate)

momentary_rot_button is a brush entity available in all Source Source games.

Class hierarchy
CMomentaryRotButton
CRotButton
CBaseButton
CBaseToggle
CBaseEntity
buttons.cpp

It is designed to be used for rotating wheels, where the player can rotate them to arbitrary positions before stopping.

Icon-Bug.pngBug:If the Toggle (Disable Auto Return) flag is enabled and usage is paused, the button will start turning backwards the next time it is used. It will still fire the "OnPressed" outputs as usual, but just rotating the other way.

The button will turn backwards until the starting position is reached. At which point the button will look like it stops turning, but it can still be held down until theOnReachedPosition output will fire.

PlacementTip.pngWorkaround:Disable the Toggle (Disable Auto Return) flag and set the Auto-return speed to 0.00000000000000000000000000001. That way it does, technically, turn backwards on its own, but it seemingly stands still. Allowing the button to keep turning forwards when used again.
  [todo tested in?]


Keyvalues

Name (targetname) <string>
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

Speed (deg/sec) (speed) <integer>
The amount, in degrees, that the wheel turns per second.
Master (Obsolete) (master) <string>
Legacy support: The name of a master entity. If the master hasn't been activated, this button cannot be used.
Sounds (sounds) <choices>
Sound to play after being turned.
Value Description
0 None
1 Big zap & Warmup
2 Access Denied
3 Access Granted
4 Quick Combolock
5 Power Deadbolt 1
6 Power Deadbolt 2
7 Plunger
8 Small zap
9 Keycard Sound
21 Squeaky
22 Squeaky Pneumatic
23 Ratchet Groan
24 Clean Ratchet
25 Gas Clunk
Distance (distance) <integer>
The maximum amount, in degrees, that the wheel is allowed to rotate.
Auto-return speed (returnspeed) <integer>
If the 'Toggle' spawnflag is not set, the speed at which the wheel auto-returns when left alone, in degrees per second.
Start Position (startposition) <float>
Postion when spawned. The value is a range between 0.0 and 1.0, where 0 is the unrotated position and 1 is the rotated position + 'Distance'.
Start Direction (startdirection) <choices>
Which way the wheel turns.
  • -1 : Forward
  • 1 : Backward
Solid BSP (solidbsp) <boolean>
Set this if this brush is in hierarchy with a moving object of some kind, and the player can stand on this brush.

Flags

  •  Not Solid : [1]
  •  Toggle (Disable Auto Return) : [32]
  •  X Axis : [64]
  •  Y Axis : [128]
  •  Use Activates : [1024]
  •  Starts locked : [2048]
  •  Jiggle when used while locked : [8192]
  •  Non-Solid : [16384] (only in Garry's Mod)
Note.pngNote:doesn't do anything

Inputs

Lock
Lock the button, preventing it from functioning.
Unlock
Unlock the button, allowing it to function.
SetPosition <string>
Move to a position. The parameter must be a value between 0 and 1, where 0 is the unrotated position and 1 is the rotated position + 'Distance'.
SetPositionImmediately <string>
Immediately teleport to a position. The parameter must be a value between 0 and 1, where 0 is the unrotated position and 1 is the rotated position + 'Distance'.
_DisableUpdateTarget  !FGD
Prevent the Position output from firing. Used to implement "jiggle when locked" by firing SetPosition inputs.
_EnableUpdateTarget  !FGD
Allow the Position output to fire again. Used to implement "jiggle when locked" by firing SetPosition inputs.

Outputs

Position <integer>
Fired whenever the button moves. The output is the position of button from 0 to 1, where 0 is the unrotated position and 1 is the rotated position + 'Distance'.
OnPressed <integer>
Fired when the button is first pressed.
OnUnpressed <integer>
Fired when the button is first released from being pressed.
OnFullyClosed
Fired when the button has reached position 1, the rotated position + 'Distance'.
OnFullyOpen
Fired when the button has reached position 0, the unrotated starting position.
OnReachedPosition
Fired whenever the button reaches a goal position: i.e. when it becomes open, becomes closed, or reaches the point specified by a 'SetPosition' input.

See also