]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/g_hook.qc
Properly support team field on trigger_multiple
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / g_hook.qc
index 36e1e4e52ba2458cab620ac962d1b9af6fc634ae..0fc60b2cdc1ffef3f4a2bac6832822e2a0c91db3 100644 (file)
@@ -1,5 +1,8 @@
 #include "g_hook.qh"
 
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
+#include <common/effects/all.qh>
 #include "weapons/common.qh"
 #include "weapons/csqcprojectile.qh"
 #include "weapons/weaponsystem.qh"
@@ -79,11 +82,11 @@ void RemoveGrapplingHooks(entity pl)
        for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
     {
        .entity weaponentity = weaponentities[slot];
+       if(!pl.(weaponentity))
+               continue; // continue incase other slots exist?
        if(pl.(weaponentity).hook)
-       {
                delete(pl.(weaponentity).hook);
-               pl.(weaponentity).hook = NULL;
-       }
+       pl.(weaponentity).hook = NULL;
     }
 
        //pl.disableclientprediction = false;
@@ -91,15 +94,14 @@ void RemoveGrapplingHooks(entity pl)
 
 void RemoveHook(entity this)
 {
-       for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
-    {
-       .entity weaponentity = weaponentities[slot];
-       if(this.realowner.(weaponentity).hook == this)
-               this.realowner.(weaponentity).hook = NULL;
-    }
+       entity player = this.realowner;
+    .entity weaponentity = this.weaponentity_fld;
+
+    if(player.(weaponentity).hook == this)
+       player.(weaponentity).hook = NULL;
 
-    if(this.realowner.move_movetype == MOVETYPE_FLY)
-       set_movetype(this.realowner, MOVETYPE_WALK);
+    if(player.move_movetype == MOVETYPE_FLY)
+       set_movetype(player, MOVETYPE_WALK);
     delete(this);
 }
 
@@ -163,7 +165,7 @@ void GrapplingHookThink(entity this)
                error("Owner lost the hook!\n");
                return;
        }
-       if(LostMovetypeFollow(this) || intermission_running || (round_handler_IsActive() && !round_handler_IsRoundStarted()) || ((this.aiment.flags & FL_PROJECTILE) && this.aiment.classname != "nade"))
+       if(LostMovetypeFollow(this) || game_stopped || (round_handler_IsActive() && !round_handler_IsRoundStarted()) || ((this.aiment.flags & FL_PROJECTILE) && this.aiment.classname != "nade"))
        {
                RemoveHook(this);
                return;