REPENTOGON icon indicating copy to clipboard operation
REPENTOGON copied to clipboard

Include a predicate argument for MC_EXECUTE_CMD

Open EliteMasterEric opened this issue 9 months ago • 2 comments
trafficstars

Currently, registering a callback for the MC_EXECUTE_CMD does not allow for an additional argument to filter by what command used. Mods registering to this callback should be able to optionally filter by the command being used.

Example:

-- This adds a callback which is only executed if the "cmd" argument to the callback matches "spawn_item"
mod:AddCallback(ModCallbacks.MC_EXECUTE_CMD, debug_spawn_item, "spawn_item")

This would eliminate the need for mods using Repentogon to include if cmd == "spawn_item" at the beginning of every command's callback. It would also be a minor performance save as the comparison would be made before executing the Lua callback.

EliteMasterEric avatar Feb 10 '25 15:02 EliteMasterEric