]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Fix two bugs (multiple captures at once bug, and issue with flag touching bug)
authorSamual <samual@xonotic.org>
Sun, 1 Apr 2012 04:46:17 +0000 (00:46 -0400)
committerSamual <samual@xonotic.org>
Sun, 1 Apr 2012 04:46:17 +0000 (00:46 -0400)
qcsrc/server/mutators/gamemode_ctf.qc
qcsrc/server/mutators/gamemode_ctf.qh

index f130047132c726f55940dc2ab15548a855b293a6..50f11caec82ac3795a87170f7e3cc0cf2c524bf4 100644 (file)
@@ -294,6 +294,8 @@ void ctf_Handle_Throw(entity player, entity reciever, float droptype)
                }
        }
        
+       print("flag.velocity = ", vtos(flag.velocity), ".\n");
+       
        switch(droptype)
        {
                case DROPTYPE_PASS:
@@ -382,6 +384,8 @@ void ctf_Handle_Dropped_Capture(entity flag, entity enemy_flag)
                //shockwave_spawn("models/ctf/shockwavetransring.md3", flag.origin - '0 0 15', -0.8, 0, 1);
        }
        
+       player.next_take_time = time + autocvar_g_ctf_flag_collect_delay;
+       
        // reset the flag
        ctf_RespawnFlag(enemy_flag);
 }
@@ -409,6 +413,7 @@ void ctf_Handle_Capture(entity flag, entity player)
 
        // reset the flag
        if(flag.speedrunning) { ctf_FakeTimeLimit(player, -1); }
+       player.next_take_time = time + autocvar_g_ctf_flag_collect_delay;
        
        ctf_RespawnFlag(player.flagcarried);
 }
@@ -675,6 +680,7 @@ void ctf_FlagTouch()
                {
                        pointparticles(particleeffectnum("kaball_sparks"), self.origin, '0 0 0', 1);
                        sound(self, CH_TRIGGER, self.snd_flag_touch, VOL_BASE, ATTN_NORM);
+                       self.wait = time + FLAG_TOUCHRATE;
                }
                return;
        }
@@ -685,7 +691,7 @@ void ctf_FlagTouch()
                {
                        if((other.team == self.team) && (other.flagcarried) && (other.flagcarried.team != self.team))
                                ctf_Handle_Capture(self, other); // other just captured the enemies flag to his base
-                       else if((other.team != self.team) && (!other.flagcarried) && (!other.ctf_captureshielded))
+                       else if((other.team != self.team) && (!other.flagcarried) && (!other.ctf_captureshielded) && (time > other.next_take_time))
                                ctf_Handle_Pickup_Base(self, other); // other just stole the enemies flag
                        break;
                }
@@ -723,8 +729,6 @@ void ctf_FlagTouch()
                        break;
                }
        }
-       
-       self.wait = time + FLAG_TOUCHRATE;
 }
 
 void ctf_RespawnFlag(entity flag)
index 38f48b4e2bfef71c2abadf2c3f221ff472f6d5c9..e191df71ab334d70994eace6831f81e8438c91c4 100644 (file)
@@ -71,6 +71,7 @@ float ctf_captimerecord; // record time for capturing the flag
 .entity ctf_carrier;
 .entity ctf_dropper; // don't allow spam of dropping the flag
 .float max_flag_health;
+.float next_take_time;
 
 // passing properties
 .entity pass_sender;