From: Mario Date: Wed, 14 Oct 2015 15:07:14 +0000 (+1000) Subject: Fix another gamemode specific check X-Git-Tag: xonotic-v0.8.2~1801^2~17 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=ac76859cf45189e696c178c5133384ded8a8767a;p=xonotic%2Fxonotic-data.pk3dir.git Fix another gamemode specific check --- 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); }