]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Check game over in the flag think function -- if a flag is dropped or passing, instan...
authorSamual <samual@xonotic.org>
Mon, 2 Apr 2012 14:17:46 +0000 (10:17 -0400)
committerSamual <samual@xonotic.org>
Mon, 2 Apr 2012 14:17:46 +0000 (10:17 -0400)
qcsrc/server/mutators/gamemode_ctf.qc

index dd82a838049be3abe7aaf17c51d52e1fe91dd863..94beaf2cba91f394907f8580ef637d9a2ce8ce17 100644 (file)
@@ -538,6 +538,19 @@ void ctf_FlagDamage(entity inflictor, entity attacker, float damage, float death
        }
 }
 
+void ctf_FlagGameOver(entity flag)
+{
+       if(gameover)
+       {
+               // lock the flag, game is over
+               flag.movetype = MOVETYPE_NONE;
+               flag.takedamage = DAMAGE_NO;
+               flag.solid = SOLID_NOT;
+               flag.nextthink = 0; // stop thinking
+               return;
+       }
+}
+
 void ctf_FlagThink()
 {
        // declarations
@@ -574,6 +587,7 @@ void ctf_FlagThink()
                
                case FLAG_DROPPED:
                {
+                       if(gameover) { ctf_FlagGameOver(self); return; }
                        if(autocvar_g_ctf_flag_return_dropped)
                        {
                                if((vlen(self.origin - self.ctf_spawnorigin) <= autocvar_g_ctf_flag_return_dropped) || (autocvar_g_ctf_flag_return_dropped == -1))
@@ -633,6 +647,7 @@ void ctf_FlagThink()
                
                case FLAG_PASSING: // todo make work with warpzones
                {                       
+                       if(gameover) { ctf_FlagGameOver(self); return; }
                        vector targ_origin = ((self.pass_target.absmin + self.pass_target.absmax) * 0.5);
                        
                        traceline(self.origin, targ_origin, MOVE_NOMONSTERS, self);
@@ -1065,6 +1080,7 @@ MUTATOR_HOOKFUNCTION(ctf_VehicleEnter)
                        setattachment(other.flagcarried, self, ""); 
                        setorigin(other, VEHICLE_FLAG_OFFSET);
                        other.flagcarried.scale = VEHICLE_FLAG_SCALE;
+                       //other.flagcarried.angles = '0 0 0';   
                }
        }
                
@@ -1078,6 +1094,7 @@ MUTATOR_HOOKFUNCTION(ctf_VehicleExit)
                setattachment(self.owner.flagcarried, self.owner, ""); 
                setorigin(self.owner.flagcarried, FLAG_CARRY_OFFSET);
                self.owner.flagcarried.scale = FLAG_SCALE;
+               self.owner.flagcarried.angles = '0 0 0';        
        }
 
        return 0;