Defines the cw.event library, a table of switches that turns named framework events on or off.

cw.event:Hook allows or disallows one event or a whole event class, and the framework asks cw.event:CanRun before effects such as the screen blur and the damage view punch. Events that were never set are allowed.

Summary

Methods

Returns whether an event is allowed to run.
Sets whether an event, or a whole class of events, is allowed to run.

Methods

cw.event:CanRun(eventClass, eventName)

shared gamemodes/catwork/gamemode/core/libraries/sh_event.lua:46

Returns whether an event is allowed to run.

A Boolean set for the whole class takes precedence over per-event settings. Events that were never hooked are allowed.

Parameters

  • eventClass String Event class
  • eventName String Event name within the class

Returns

  • Boolean Whether the event may run

See also

cw.event:Hook(eventClass, eventName, isAllowed)

shared gamemodes/catwork/gamemode/core/libraries/sh_event.lua:25

Sets whether an event, or a whole class of events, is allowed to run.

With an eventName, only that event of the class is set, replacing a setting made for the whole class. Without one, the whole class is set and its per-event settings are dropped.

cw.event:Hook('limb_damage', 'stumble', false)
cw.event:Hook('blur', nil, false)

Parameters

  • eventClass String Event class
  • eventName String Event name within the class, or nil to set the whole class
  • isAllowed Boolean Whether the event may run

See also

Defined in