From: Mario Date: Tue, 11 Jun 2013 05:08:16 +0000 (+1000) Subject: Use a bad trick to allow nades only in mutators which disallow throwing X-Git-Tag: xonotic-v0.8.0~366^2~22 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=4ef0130f60df244beb387b83e115301a196d2ac0;p=xonotic%2Fxonotic-data.pk3dir.git Use a bad trick to allow nades only in mutators which disallow throwing --- diff --git a/qcsrc/server/mutators/mutator_minstagib.qc b/qcsrc/server/mutators/mutator_minstagib.qc index 4a26bdb5f..9b4bd7012 100644 --- a/qcsrc/server/mutators/mutator_minstagib.qc +++ b/qcsrc/server/mutators/mutator_minstagib.qc @@ -203,6 +203,7 @@ MUTATOR_HOOKFUNCTION(minstagib_SplitHealthArmor) MUTATOR_HOOKFUNCTION(minstagib_ForbidThrowing) { // weapon dropping on death handled by FilterItem + nades_CheckThrow(); return TRUE; } diff --git a/qcsrc/server/mutators/mutator_nades.qc b/qcsrc/server/mutators/mutator_nades.qc index a7c0fea51..b81451cd0 100644 --- a/qcsrc/server/mutators/mutator_nades.qc +++ b/qcsrc/server/mutators/mutator_nades.qc @@ -260,13 +260,10 @@ float CanThrowNade() return TRUE; } -MUTATOR_HOOKFUNCTION(nades_ForbidThrowing) +void nades_CheckThrow() { - if(!g_weaponarena || !g_minstagib) - return FALSE; // TODO: fix this to support all modes that disable weapon dropping - if(!CanThrowNade()) - return FALSE; + return; if(!self.nade) { @@ -288,8 +285,6 @@ MUTATOR_HOOKFUNCTION(nades_ForbidThrowing) toss_nade(self, (v_forward * 0.75 + v_up * 0.2 + v_right * 0.05) * _force, 0); } } - - return TRUE; } MUTATOR_HOOKFUNCTION(nades_VehicleEnter) @@ -375,7 +370,6 @@ MUTATOR_HOOKFUNCTION(nades_BuildMutatorsPrettyString) MUTATOR_DEFINITION(mutator_nades) { - MUTATOR_HOOK(ForbidThrowCurrentWeapon, nades_ForbidThrowing, CBC_ORDER_ANY); MUTATOR_HOOK(VehicleEnter, nades_VehicleEnter, CBC_ORDER_ANY); MUTATOR_HOOK(PlayerPreThink, nades_PlayerPreThink, CBC_ORDER_ANY); MUTATOR_HOOK(PlayerSpawn, nades_PlayerSpawn, CBC_ORDER_ANY); diff --git a/qcsrc/server/mutators/mutator_nades.qh b/qcsrc/server/mutators/mutator_nades.qh new file mode 100644 index 000000000..9591b811e --- /dev/null +++ b/qcsrc/server/mutators/mutator_nades.qh @@ -0,0 +1 @@ +void() nades_CheckThrow; \ No newline at end of file diff --git a/qcsrc/server/mutators/mutator_riflearena.qc b/qcsrc/server/mutators/mutator_riflearena.qc index b1a65f469..520777805 100644 --- a/qcsrc/server/mutators/mutator_riflearena.qc +++ b/qcsrc/server/mutators/mutator_riflearena.qc @@ -63,6 +63,7 @@ MUTATOR_HOOKFUNCTION(ra_StartItems) MUTATOR_HOOKFUNCTION(ra_ForbidThrowCurrentWeapon) { + nades_CheckThrow(); return TRUE; } diff --git a/qcsrc/server/progs.src b/qcsrc/server/progs.src index a98580589..6894c9909 100644 --- a/qcsrc/server/progs.src +++ b/qcsrc/server/progs.src @@ -45,6 +45,7 @@ mutators/gamemode_keepaway.qh mutators/gamemode_nexball.qh mutators/gamemode_lms.qh mutators/mutator_dodging.qh +mutators/mutator_nades.qh //// tZork Turrets //// tturrets/include/turrets_early.qh