Skip to main content

EntityInputHookAttribute

Marks a method as an entity-input hook. The method is auto-registered on plugin load and dropped on unload.

public sealed class EntityInputHookAttribute : Attribute

Namespace: DeadworksManaged.Api
Inherits / implements: Attribute
Source: Events/EntityInputHookAttribute.cs#L22

Notes​

Pre handlers must return HookResult. Post handlers must return void. Use "*" as a wildcard for either className or inputName.

Example​

[EntityInputHook("func_button", "Kill")]
public HookResult OnKillInput(EntityInputEvent e) {
return HookResult.Stop; // veto: button won't kill the activator
}

[EntityInputHook("*", "Toggle", HookMode.Post)]
public void OnToggleObserved(EntityInputEvent e) { /* post: cannot block */ }

Constructors​

new EntityInputHookAttribute()​

Signature

public EntityInputHookAttribute(string className, string inputName, HookMode mode = HookMode.Pre)

Source: Events/EntityInputHookAttribute.cs#L32

Properties​

EntityInputHookAttribute.ClassName​

Designer name of the receiving entity (e.g. "func_button") or "*" for any.

Signature

public string ClassName { get; }

Source: Events/EntityInputHookAttribute.cs#L24

EntityInputHookAttribute.InputName​

Input name (e.g. "Kill", "Toggle") or "*" for any.

Signature

public string InputName { get; }

Source: Events/EntityInputHookAttribute.cs#L27

EntityInputHookAttribute.Mode​

When the handler runs relative to the original input. Defaults to HookMode.Pre.

Signature

public HookMode Mode { get; }

Source: Events/EntityInputHookAttribute.cs#L30