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.
Methods8
Showing 8 methods
public virtual void Blur(Sandbox.Component.IPressable.Event e)
A player has stopped looking at this
| Parameter | Type | Description |
|---|---|---|
| e | Event | — |
void—public virtual bool CanPress(Sandbox.Component.IPressable.Event e)
Return true if the press is possible right now
| Parameter | Type | Description |
|---|---|---|
| e | Event | — |
bool—public virtual System.Nullable`1<Sandbox.Component.IPressable.Tooltip> GetTooltip(Sandbox.Component.IPressable.Event e)
Get a tooltip to show when looking at this pressable
| Parameter | Type | Description |
|---|---|---|
| e | Event | — |
public virtual void Hover(Sandbox.Component.IPressable.Event e)
A player has started looking at this
| Parameter | Type | Description |
|---|---|---|
| e | Event | — |
void—public virtual void Look(Sandbox.Component.IPressable.Event e)
A player is still looking at this. Called every frame.
| Parameter | Type | Description |
|---|---|---|
| e | Event | — |
void—public virtual bool Press(Sandbox.Component.IPressable.Event e)
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.
| Parameter | Type | Description |
|---|---|---|
| e | Event | — |
bool—public virtual bool Pressing(Sandbox.Component.IPressable.Event e)
Still being pressed. Return true to allow the press to continue, false cancel the press
| Parameter | Type | Description |
|---|---|---|
| e | Event | — |
bool—public virtual void Release(Sandbox.Component.IPressable.Event e)
To be called when the press finishes. You should only call this after a successful press - ie when Press hass returned true.
| Parameter | Type | Description |
|---|---|---|
| e | Event | — |
void—No results match this filter.