Workaround
Allows users to fix external bugs and conflicts
Last updated
Allows users to fix external bugs and conflicts
Last updated
Code:
Realm: Shared
TODO
string
name
Name of the workaround, used in the menu
guthscp.REALMS
realm
Realm of the workaround, this define in which realm (server, client or both) the workaround should behave (allowing to call WORKAROUND:on_enabled
and WORKAROUND:on_disabled
accordingly). For example, if you want to fix a server-side hook, you should define the workaround on the server realm.
(internal)
string
id
Identifier of the workaround, used for registering in the system.
This variable should NOT be edited manually, this is automatically set to the identifier you gave in the guthscp.workaround.register
call.
(internal)
bool
_is_enabled
Is the workaround currently enabled? Set by WORKAROUND:set_enabled
.
(internal)
bool
_is_active
Is the workaround able to be enabled? Set to the result of WORKAROUND:init
method when called by the workaround system.
Returns whenever the workaround should be active. This can informs that the workaround can't function due to a lack of a certain hook or dependency.
Called either during the GM:InitPostEntity
hook or during hot reload.
Called when the workaround is enabled on the targeted realm.
Called when the workaround is disabled on the targeted realm.
Registers the current callback of the specified hook at given slot. Returns whether the hook has been found.
Finds a hook matching the callback condition and register it at given slot. Useful for finding hooks with randomized identifiers. Returns whether the hook has been found.
Overrides the game hook's callback from slot
. Doesn't modify the internal registery.
Deletes the game hook's callback from slot
. Doesn't modify the internal registery.
Restores the game hook's callback at given slot to registered callback. Doesn't modify the internal registery.
Returns whenever the workaround is enabled.
Returns whenever the workaround is active.
Changes current state. Do nothing if in-active or if is_enabled
matchs workaround's state. Calls WORKAROUND:on_enabled
or WORKAROUND:on_disabled
(depending on is_enabled
) if the call's realm is matching targeted realm. Do not synchronizes or saves by itself.
Synchronizes the workaround either to server (client-side), to ply
or to all clients.
(overridable)
bool
init()
(overridable)
void
on_enabled()
(overridable)
void
on_disabled()
bool
register_hook( any slot, string name, any id )
bool
find_hook( any slot, string name, function<bool>( string, function ) condition )
bool
override_hook( any slot, function callback )
bool
remove_hook( any slot )
bool
restore_hook( any slot )
bool
is_enabled()
const
bool
is_active()
const
void
set_enabled( bool is_enabled )
void
sync( Player ply = nil )