]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Clean up a bunch of gamemode specific code
authorMario <mario@smbclan.net>
Wed, 14 Oct 2015 14:56:31 +0000 (00:56 +1000)
committerMario <mario@smbclan.net>
Wed, 14 Oct 2015 14:56:31 +0000 (00:56 +1000)
qcsrc/common/gamemodes/gamemode/nexball/nexball.qc
qcsrc/server/cl_player.qc
qcsrc/server/mutators/events.qh
qcsrc/server/mutators/gamemode_ctf.qc
qcsrc/server/mutators/gamemode_keepaway.qc
qcsrc/server/mutators/gamemode_keyhunt.qc
qcsrc/server/mutators/mutator_nades.qc

index decb4c7decf9a1e74fd1c0f6b50c2e443d7a7a9d..959ec857defb34699dde8b58e9246c1b03e1acb3 100644 (file)
@@ -1029,6 +1029,14 @@ MUTATOR_HOOKFUNCTION(nb, WantWeapon)
        return true;
 }
 
+MUTATOR_HOOKFUNCTION(nb, DropSpecialItems)
+{
+       if(frag_target.ballcarried)
+               DropBall(frag_target.ballcarried, frag_target.origin, frag_target.velocity);
+
+       return false;
+}
+
 REGISTER_MUTATOR(nb, g_nexball)
 {
        ActivateTeamplay();
index 1b770121e8a8904b18ffe87312d271a8a885d741..9ab358635b2e47bbbd22030c68da337b5b4a4689 100644 (file)
 
 #include "../common/animdecide.qh"
 
+void Drop_Special_Items(entity player)
+{
+       // called when the player has become stuck or frozen
+       // so objective items aren't stuck with the player
+
+       MUTATOR_CALLHOOK(DropSpecialItems, player);
+}
+
 void CopyBody_Think(void)
 {SELFPARAM();
        if(self.CopyBody_nextthink && time > self.CopyBody_nextthink)
index a9f8b8a9992b8faca90a74f291fb33e429d553f1..1af9a9fbf5986ac9b78a52341dcef6f09179864f 100644 (file)
@@ -760,4 +760,9 @@ MUTATOR_HOOKABLE(GetPlayerStatus, EV_GetPlayerStatus);
     /**/ o(string, ret_string) \
     /**/
 MUTATOR_HOOKABLE(SetWeaponArena, EV_SetWeaponArena);
+
+#define EV_DropSpecialItems(i, o) \
+    /**/ i(entity, frag_target) \
+    /**/
+MUTATOR_HOOKABLE(DropSpecialItems, EV_DropSpecialItems);
 #endif
index 2814a4e4e3dd1137d36fb8789b7022dfe784aff5..016f9bd47a034ab31f651a40d9706afab771e8b5 100644 (file)
@@ -2373,6 +2373,14 @@ MUTATOR_HOOKFUNCTION(ctf, SV_ParseClientCommand)
        return false;
 }
 
+MUTATOR_HOOKFUNCTION(ctf, DropSpecialItems)
+{
+       if(frag_target.flagcarried)
+               ctf_Handle_Throw(frag_target, world, DROP_THROW);
+
+       return false;
+}
+
 
 // ==========
 // Spawnfuncs
index ca1f241d6517bcc4c43e8ef66d6378dc8ef6c612..61289b58f48099d3565c76c86c97b88c87d37282 100644 (file)
@@ -406,6 +406,14 @@ MUTATOR_HOOKFUNCTION(ka, HavocBot_ChooseRole)
        return true;
 }
 
+MUTATOR_HOOKFUNCTION(ka, DropSpecialItems)
+{
+       if(frag_target.ballcarried)
+               ka_DropEvent(frag_target);
+
+       return false;
+}
+
 
 // ==============
 // Initialization
index 71a65c6b596cd7935f287a5400037eabf9300339..4893bf13e599ce5ca1a123c88cc55e9f3e6cdc9b 100644 (file)
@@ -1320,6 +1320,12 @@ MUTATOR_HOOKFUNCTION(kh, HavocBot_ChooseRole)
        return true;
 }
 
+MUTATOR_HOOKFUNCTION(kh, DropSpecialItems)
+{
+       kh_Key_DropAll(frag_target, false);
+       return false;
+}
+
 REGISTER_MUTATOR(kh, g_keyhunt)
 {
        ActivateTeamplay();
index fc1f1d1e7b705890313ce607aeb343c989ebb4a3..45cc4f9c4c973362471413e26fd6a8179ba9a27f 100644 (file)
@@ -243,13 +243,8 @@ void nade_ice_freeze(entity freezefield, entity frost_target, float freeze_time)
        frost_target.frozen_by = freezefield.realowner;
        Send_Effect(EFFECT_ELECTRO_IMPACT, frost_target.origin, '0 0 0', 1);
        Freeze(frost_target, 1/freeze_time, 3, false);
-       if(frost_target.ballcarried)
-       if(g_keepaway) { ka_DropEvent(frost_target); }
-       else { DropBall(frost_target.ballcarried, frost_target.origin, frost_target.velocity);}
-       if(frost_target.flagcarried) { ctf_Handle_Throw(frost_target, world, DROP_THROW); }
-       if(frost_target.nade) { toss_nade(frost_target, '0 0 0', time + 0.05); }
 
-       kh_Key_DropAll(frost_target, false);
+       Drop_Special_Items(frost_target);
 }
 
 void nade_ice_think()
@@ -1160,6 +1155,14 @@ MUTATOR_HOOKFUNCTION(nades, MonsterDies)
        return false;
 }
 
+MUTATOR_HOOKFUNCTION(nades, DropSpecialItems)
+{
+       if(frag_target.nade)
+               toss_nade(frag_target, '0 0 0', time + 0.05);
+
+       return false;
+}
+
 bool nades_RemovePlayer()
 {SELFPARAM();
        nades_Clear(self);