]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/mutators/gamemode_keepaway.qc
Keepaway: synchronize game start with ball respawn and make sure that while the count...
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / mutators / gamemode_keepaway.qc
index 6b62e7da1b65d7bda40c0e618cb12bbddd7d3c17..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();
 }
 
 
@@ -192,9 +201,8 @@ void havocbot_goalrating_ball(float ratingscale, vector org)
                t = (self.health + self.armorvalue) / (ball_owner.health + ball_owner.armorvalue);
                navigation_routerating(ball_owner, t * ratingscale, 2000);
        }
-
-       // Ball has been dropped so collect.
-       navigation_routerating(ka_ball, ratingscale, 2000);
+       else // Ball has been dropped so collect.
+               navigation_routerating(ka_ball, ratingscale, 2000);
 }
 
 void havocbot_role_ka_carrier()