From ac76859cf45189e696c178c5133384ded8a8767a Mon Sep 17 00:00:00 2001 From: Mario Date: Thu, 15 Oct 2015 01:07:14 +1000 Subject: [PATCH] Fix another gamemode specific check --- qcsrc/server/command/common.qc | 2 +- qcsrc/server/mutators/events.qh | 6 ++++++ qcsrc/server/mutators/gamemode_invasion.qc | 6 ++++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/qcsrc/server/command/common.qc b/qcsrc/server/command/common.qc index fee82a7e4..8d8045872 100644 --- a/qcsrc/server/command/common.qc +++ b/qcsrc/server/command/common.qc @@ -425,7 +425,7 @@ void CommonCommand_editmob(int request, entity caller, int argc) case "butcher": { if(caller) { print_to(caller, "This command is not available to players"); return; } - if(g_invasion) { print_to(caller, "This command does not work during an invasion!"); return; } + if(MUTATOR_CALLHOOK(AllowMobButcher)) { LOG_INFO(ret_string, "\n"); return; } int tmp_remcount = 0; entity tmp_entity; diff --git a/qcsrc/server/mutators/events.qh b/qcsrc/server/mutators/events.qh index 1af9a9fbf..e446816e5 100644 --- a/qcsrc/server/mutators/events.qh +++ b/qcsrc/server/mutators/events.qh @@ -765,4 +765,10 @@ MUTATOR_HOOKABLE(SetWeaponArena, EV_SetWeaponArena); /**/ i(entity, frag_target) \ /**/ MUTATOR_HOOKABLE(DropSpecialItems, EV_DropSpecialItems); + +/** + * called when an admin tries to kill all monsters + * return 1 to prevent spawning + */ +MUTATOR_HOOKABLE(AllowMobButcher, EV_NO_ARGS); #endif diff --git a/qcsrc/server/mutators/gamemode_invasion.qc b/qcsrc/server/mutators/gamemode_invasion.qc index c6f6a02f6..f1b942919 100644 --- a/qcsrc/server/mutators/gamemode_invasion.qc +++ b/qcsrc/server/mutators/gamemode_invasion.qc @@ -411,6 +411,12 @@ MUTATOR_HOOKFUNCTION(inv, GetTeamCount, CBC_ORDER_EXCLUSIVE) return false; } +MUTATOR_HOOKFUNCTION(inv, AllowMobButcher) +{ + ret_string = "This command does not work during an invasion!"; + return true; +} + void invasion_ScoreRules(float inv_teams) { if(inv_teams) { CheckAllowedTeams(world); } -- 2.39.2