]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Keepaway: synchronize game start with ball respawn and make sure that while the count...
authorterencehill <piuntn@gmail.com>
Wed, 15 Jul 2015 18:26:52 +0000 (20:26 +0200)
committerterencehill <piuntn@gmail.com>
Wed, 15 Jul 2015 18:26:52 +0000 (20:26 +0200)
qcsrc/server/mutators/gamemode_keepaway.qc

index 1a91658a66f64ba47a269ce14115383df8e9f8b7..ed69612d15c42e6f0e5abe4cf0e02c4ed811f30b 100644 (file)
@@ -25,6 +25,7 @@ void ka_EventLog(string mode, entity actor) // use an alias for easy changing an
                GameLogEcho(strcat(":ka:", mode, ((actor != world) ? (strcat(":", ftos(actor.playerid))) : "")));
 }
 
+void ka_TouchEvent();
 void ka_RespawnBall() // runs whenever the ball needs to be relocated
 {
        if(gameover) { return; }
@@ -42,6 +43,7 @@ void ka_RespawnBall() // runs whenever the ball needs to be relocated
        self.velocity = '0 0 200';
        self.angles = '0 0 0';
        self.effects = autocvar_g_keepawayball_effects;
+       self.touch = ka_TouchEvent;
        self.think = ka_RespawnBall;
        self.nextthink = time + autocvar_g_keepawayball_respawntime;
 
@@ -169,7 +171,14 @@ void ka_Reset() // used to clear the ballcarrier whenever the match switches fro
        if((self.owner) && (IS_PLAYER(self.owner)))
                ka_DropEvent(self.owner);
 
-       ka_RespawnBall();
+       if(time < game_starttime)
+       {
+               self.think = ka_RespawnBall;
+               self.touch = func_null;
+               self.nextthink = game_starttime;
+       }
+       else
+               ka_RespawnBall();
 }