IPressableclass

A component that can be pressed. Like a button. This could be by a player USE'ing it, or by a player walking on it, or by an NPC. A call to Press should ALWAYS call release afterwards. Generally this is done by the player, where holding E presses the button, and releasing E stops pressing it. You need to handle edge cases where the player dies while holding etc.

objectIPressable
Namespace
global
Assembly
Sandbox.Engine
Declaration
public abstract interface Sandbox.Component.IPressable

Methods8

Showing 8 methods

public virtual bool CanPress(Sandbox.Component.IPressable.Event e)PUBLICVIRTUAL

Return true if the press is possible right now

ParameterTypeDescription
eEvent
Returns:bool

public virtual void Hover(Sandbox.Component.IPressable.Event e)PUBLICVIRTUAL

A player has started looking at this

ParameterTypeDescription
eEvent
Returns:void

public virtual void Look(Sandbox.Component.IPressable.Event e)PUBLICVIRTUAL

A player is still looking at this. Called every frame.

ParameterTypeDescription
eEvent
Returns:void

public virtual bool Press(Sandbox.Component.IPressable.Event e)PUBLICVIRTUAL

Pressed. Returns true on success, else false. If it returns true then you should call Release when the press finishes. Not everything expects it, but some stuff will.

ParameterTypeDescription
eEvent
Returns:bool

public virtual bool Pressing(Sandbox.Component.IPressable.Event e)PUBLICVIRTUAL

Still being pressed. Return true to allow the press to continue, false cancel the press

ParameterTypeDescription
eEvent
Returns:bool

public virtual void Release(Sandbox.Component.IPressable.Event e)PUBLICVIRTUAL

To be called when the press finishes. You should only call this after a successful press - ie when Press hass returned true.

ParameterTypeDescription
eEvent
Returns:void

On this page