Class FuncButton
Namespace: ValveResourceFormat.Renderer.Entities
Assembly: Renderer.dll
func_button. A brush that slides in along its movedir when pressed, fires its outputs, and either comes back out after wait seconds or stays in until pressed again. It can be pressed by use, touch, damage or input. Not simulated: master, as nothing here can be one, and the spark effect. Only its sound plays.
public class FuncButton : BaseToggleInheritance
object ← BaseEntity ← BaseModelEntity ← BaseToggle ← FuncButton
Derived
Inherited Members
BaseToggle.Speed, BaseToggle.Lip, BaseToggle.MoveDirection, BaseToggle.FinalDestination, BaseToggle.IsLinearMoving, BaseToggle.IsPusher, BaseToggle.TurnsByAngleComponents, BaseToggle.LinearMove(Vector3), BaseToggle.AngularMove(Vector3, float), BaseToggle.FinishLinearMove(), BaseToggle.GetAxisDirection(bool, bool), BaseToggle.ResolveEntitySpaceMoveDirection(), BaseToggle.GetTravelDistance(Vector3), BaseModelEntity.Solid, BaseModelEntity.ModelNode, BaseModelEntity.Physics, BaseModelEntity.LoadedModel, BaseModelEntity.NonEmpty(string?), BaseModelEntity.CreateRootNode(), BaseModelEntity.BuildsCollider, BaseModelEntity.InputColor(EntityInputData), BaseModelEntity.InputAlpha(EntityInputData), BaseModelEntity.InputSetRenderAttribute(EntityInputData), BaseModelEntity.InputClearRenderAttribute(EntityInputData), BaseModelEntity.InputLightingOrigin(EntityInputData), BaseModelEntity.DispatchInput(string, EntityInputData), BaseEntity.Scene, BaseEntity.RootNode, BaseEntity.Transform, BaseEntity.RigidTransform, BaseEntity.EntitySystem, BaseEntity.Data, BaseEntity.SpawnData, BaseEntity.NameFixup, BaseEntity.SpawnGroup, BaseEntity.KeyValues, BaseEntity.Classname, BaseEntity.TargetName, BaseEntity.SpawnFlags, BaseEntity.SpawnTransform, BaseEntity.Owner, BaseEntity.MoveParent, BaseEntity.EntityScale, BaseEntity.ModelName, BaseEntity.Origin, BaseEntity.Angles, BaseEntity.WorldOrigin, BaseEntity.WorldAngles, BaseEntity.Velocity, BaseEntity.AngularVelocity, BaseEntity.NextThink, BaseEntity.MoveDoneTime, BaseEntity.IsRemoved, BaseEntity.Collider, BaseEntity.IsSolid, BaseEntity.IsTrigger, BaseEntity.IsDrawn, BaseEntity.IsShown, BaseEntity.IsCollidable, BaseEntity.TouchingEntities, BaseEntity.CreateRootNode(), BaseEntity.CreateEditorNode(ObjectTypeFlags), BaseEntity.CreateEffect(string?, ParticleSnapshot?, bool), BaseEntity.HasSpawnFlags<TSpawnFlags>(TSpawnFlags), BaseEntity.Spawn(), BaseEntity.Activate(), BaseEntity.Think(), BaseEntity.RoundStart(), BaseEntity.MoveDone(), BaseEntity.TryGetTouchBounds(out Vector3, out Vector3), BaseEntity.AcceptsTouchFrom(BaseEntity), BaseEntity.OnStartTouch(BaseEntity), BaseEntity.OnTouch(BaseEntity), BaseEntity.OnEndTouch(BaseEntity), BaseEntity.ObjectCaps, BaseEntity.Use(BaseEntity?), BaseEntity.Teleport(Vector3, Vector3?), BaseEntity.JumpTo(Vector3, Vector3), BaseEntity.AcceptInput(string, EntityInputData), BaseEntity.InputKill(EntityInputData), BaseEntity.InputFireUser1(EntityInputData), BaseEntity.InputFireUser2(EntityInputData), BaseEntity.InputFireUser3(EntityInputData), BaseEntity.InputFireUser4(EntityInputData), BaseEntity.SetNextThink(float), BaseEntity.SetMoveDoneTime(float), BaseEntity.PhysicsSimulate(float), BaseEntity.TurnsByAngleComponents, BaseEntity.IsPusher, BaseEntity.IsUnblockableByPlayer, BaseEntity.MovesWithoutPushing, BaseEntity.PushesPlayerAsTrain, BaseEntity.HasVPhysicsSolid, BaseEntity.OnStartBlocked(BaseEntity), BaseEntity.OnBlocked(BaseEntity), BaseEntity.OnEndBlocked(), BaseEntity.GetSurfaceVelocity(Vector3), BaseEntity.TurnBody(Vector3, Vector3), BaseEntity.SetOriginAndAngles(Vector3, Vector3), BaseEntity.SetWorldOriginAndAngles(Vector3, Vector3), BaseEntity.AddNode(SceneNode, bool), BaseEntity.OnRemove(), BaseEntity.UpdateTransform(), BaseEntity.UpdateColliderTransform(), BaseEntity.UpdateRenderTransform(float), BaseEntity.SnapInterpolation(), BaseEntity.AngleMod(float), BaseEntity.DispatchInput(string, EntityInputData)
Constructors
FuncButton(EntitySystem, EntitySpawnInfo)
Initializes a func_button from its keyvalues.
public FuncButton(EntitySystem system, EntitySpawnInfo spawnInfo)Parameters
system EntitySystem
spawnInfo EntitySpawnInfo
Properties
DisplayText
Gets the text shown when looking at the button, the displaytext keyvalue.
public string? DisplayText { get; }Property Value
string?
GlowEntity
Gets the entity that glows to show the button can be used, named by the glow keyvalue.
public BaseEntity? GlowEntity { get; }Property Value
IsDisabled
Gets whether use is ignored. The Disable input sets it; touch, damage and inputs still press it.
public bool IsDisabled { get; }Property Value
bool
IsLocked
Gets whether the button refuses to be pressed. The Lock input sets it.
public bool IsLocked { get; }Property Value
bool
IsUsable
Gets whether the client shows the button as usable, a hint only: FuncButton.ObjectCaps decides whether use reaches it.
public bool IsUsable { get; }Property Value
bool
IsUseActivated
Gets whether use presses the button, which FuncButton.SpawnFlag.UseActivates asks for.
protected virtual bool IsUseActivated { get; }Property Value
bool
ObjectCaps
Gets whether the player can press this button with use.
public override EntityCapability ObjectCaps { get; }Property Value
PositionIn
Gets the position the button is pressed in to.
public Vector3 PositionIn { get; }Property Value
PositionOut
Gets the position the button rests at, out.
public Vector3 PositionOut { get; }Property Value
StaysPushed
Gets whether the button stays in once pressed, which a FuncButton.Wait of -1 means.
public bool StaysPushed { get; }Property Value
bool
Wait
Gets the seconds the button stays in before coming back out; -1 stays in for good.
public float Wait { get; }Property Value
float
Methods
Activate()
Called once every entity of its spawn group has spawned, to resolve other entities by name.
public override void Activate()DispatchInput(string, EntityInputData)
Runs the handler declared with EntityInputAttribute for an input.
protected override bool DispatchInput(string inputName, EntityInputData data)Parameters
inputName string
data EntityInputData
Returns
bool
true when a handler ran.
MoveDone()
Runs when BaseEntity.MoveDoneTime comes due, after the tick's movement was applied.
public override void MoveDone()OnTouch(BaseEntity)
Presses the button by touch, for as long as the touch is armed.
protected override void OnTouch(BaseEntity other)Parameters
other BaseEntity
Spawn()
Sets up the entity (model, class keyvalues, first think). Called once the entity's spawn group has created all entities of the group, after the move parent has spawned.
public override void Spawn()Remarks
An override calls this first: it builds the node from BaseEntity.CreateRootNode() and snaps the entity onto its parent's attachment, which the rest of the override reads.
TakeDamage(BaseEntity?)
Reports damage dealt to the button, which presses it when it has FuncButton.SpawnFlag.DamageActivates. Nothing deals damage yet, so this waits for whatever does.
public void TakeDamage(BaseEntity? attacker)Parameters
attacker BaseEntity?
Who dealt the damage, who becomes the activator of the press.
Think()
Runs when BaseEntity.NextThink comes due.
public override void Think()Use(BaseEntity?)
Presses the button on use, if FuncButton.IsUseActivated.
public override void Use(BaseEntity? activator)Parameters
activator BaseEntity?

