diff options
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/client/chatcommands.lua | 5 | ||||
-rw-r--r-- | builtin/client/register.lua | 1 | ||||
-rw-r--r-- | builtin/game/chat.lua | 5 | ||||
-rw-r--r-- | builtin/game/register.lua | 1 |
4 files changed, 12 insertions, 0 deletions
diff --git a/builtin/client/chatcommands.lua b/builtin/client/chatcommands.lua index 5cb1b40bb..0e8d4dd03 100644 --- a/builtin/client/chatcommands.lua +++ b/builtin/client/chatcommands.lua @@ -23,6 +23,11 @@ core.register_on_sending_chat_message(function(message) return true end + -- Run core.registered_on_chatcommand callbacks. + if core.run_callbacks(core.registered_on_chatcommand, 5, cmd, param) then + return true + end + local cmd_def = core.registered_chatcommands[cmd] if cmd_def then core.set_last_run_mod(cmd_def.mod_origin) diff --git a/builtin/client/register.lua b/builtin/client/register.lua index c1b4965c1..acd36ab36 100644 --- a/builtin/client/register.lua +++ b/builtin/client/register.lua @@ -63,6 +63,7 @@ core.registered_on_mods_loaded, core.register_on_mods_loaded = make_registration core.registered_on_shutdown, core.register_on_shutdown = make_registration() core.registered_on_receiving_chat_message, core.register_on_receiving_chat_message = make_registration() core.registered_on_sending_chat_message, core.register_on_sending_chat_message = make_registration() +core.registered_on_chatcommand, core.register_on_chatcommand = make_registration() core.registered_on_death, core.register_on_death = make_registration() core.registered_on_hp_modification, core.register_on_hp_modification = make_registration() core.registered_on_damage_taken, core.register_on_damage_taken = make_registration() diff --git a/builtin/game/chat.lua b/builtin/game/chat.lua index 1d277730a..945707623 100644 --- a/builtin/game/chat.lua +++ b/builtin/game/chat.lua @@ -58,6 +58,11 @@ core.register_on_chat_message(function(name, message) param = param or "" + -- Run core.registered_on_chatcommands callbacks. + if core.run_callbacks(core.registered_on_chatcommands, 5, name, cmd, param) then + return true + end + local cmd_def = core.registered_chatcommands[cmd] if not cmd_def then core.chat_send_player(name, "-!- Invalid command: " .. cmd) diff --git a/builtin/game/register.lua b/builtin/game/register.lua index 1034d4f2b..3de67c04b 100644 --- a/builtin/game/register.lua +++ b/builtin/game/register.lua @@ -584,6 +584,7 @@ core.unregister_biome = make_wrap_deregistration(core.register_biome, core.clear_registered_biomes, core.registered_biomes) core.registered_on_chat_messages, core.register_on_chat_message = make_registration() +core.registered_on_chatcommands, core.register_on_chatcommand = make_registration() core.registered_globalsteps, core.register_globalstep = make_registration() core.registered_playerevents, core.register_playerevent = make_registration() core.registered_on_mods_loaded, core.register_on_mods_loaded = make_registration() |