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 by itself after wait seconds or stays in until pressed again. Source's CBaseButton. It can be pressed by use, by the player walking into it, by damage, or by input. Not simulated: the master that has to be triggered first, as nothing here can be one, and the spark effect, of which only the sound plays.
public sealed class FuncButton : BaseToggleInheritance
object ← BaseEntity ← BaseModelEntity ← BaseToggle ← FuncButton
Inherited Members
BaseToggle.Speed, BaseToggle.Lip, BaseModelEntity.Solid, BaseModelEntity.ModelNode, BaseEntity.Scene, BaseEntity.RootNode, BaseEntity.Transform, BaseEntity.RigidTransform, BaseEntity.LayerName, BaseEntity.EntitySystem, BaseEntity.Data, BaseEntity.SpawnData, BaseEntity.NameFixup, 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.IsCollidable, BaseEntity.TouchingEntities, BaseEntity.HasSpawnFlags<TSpawnFlags>(TSpawnFlags), BaseEntity.Spawn(), BaseEntity.Activate(), BaseEntity.Think(), BaseEntity.RoundStart(), BaseEntity.MoveDone(), BaseEntity.TryGetTouchBounds(out Vector3, out Vector3), BaseEntity.ObjectCaps, BaseEntity.Use(BaseEntity?), BaseEntity.Teleport(Vector3, Vector3?), BaseEntity.AcceptInput(string, EntityInputData), BaseEntity.SetNextThink(float), BaseEntity.SetMoveDoneTime(float), BaseEntity.GetSurfaceVelocity(Vector3), BaseEntity.AngleMod(float)
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
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
IsLocked
Gets whether the button refuses to be pressed. The Lock input sets it.
public bool IsLocked { get; }Property Value
IsUsable
Gets whether the player is shown the button can be used. Source's networked m_usable, a hint for the client: is what decides whether use reaches the button.
public bool IsUsable { get; }Property Value
ObjectCaps
Gets whether the player can press this button with use. Source's CBaseButton::ObjectCaps.
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 of -1 means.
public bool StaysPushed { get; }Property Value
Wait
Gets the seconds the button stays in before coming back out; -1 stays in for good.
public float Wait { get; }Property Value
Methods
Activate()
Called once every entity in the map has spawned, for anything that needs to resolve other entities by name. Source's Activate.
public override void Activate()MoveDone()
Runs when comes due, after the tick's movement was applied.
public override void MoveDone()OnTouch(BaseEntity)
Source's CBaseButton::ButtonTouch, for as long as the touch is armed.
protected override void OnTouch(BaseEntity other)Parameters
other BaseEntity
Spawn()
Sets up the entity: loads its model, reads class-specific keyvalues, and schedules its first think. Called by right after construction, before the entity enters the world.
public override void Spawn()TakeDamage(BaseEntity?)
Reports damage dealt to the button, which presses it when it has . Source's CBaseButton::OnTakeDamage. 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 comes due.
public override void Think()Use(BaseEntity?)
Runs when the player presses use on the button. Source's CBaseButton::ButtonUse, which is only hooked up for buttons with .
public override void Use(BaseEntity? activator)Parameters
activator BaseEntity?

