]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Teleport the ball to a spawnpoint if random location failed (fixes a crash), show...
authorMario <mario.mario@y7mail.com>
Fri, 23 May 2014 10:57:19 +0000 (20:57 +1000)
committerMario <mario.mario@y7mail.com>
Fri, 23 May 2014 10:57:19 +0000 (20:57 +1000)
qcsrc/common/notifications.qh
qcsrc/server/mutators/gamemode_keepaway.qc

index 003c0fcc1d64fc4fa0e112576e4342f5933b5d36..117965f7bb016aacb21fbb0ce5733197db86e231 100644 (file)
@@ -637,6 +637,7 @@ void Send_Notification_WOCOVA(
        MSG_CENTER_NOTIF(1, CENTER_JOIN_PREVENT,                0, 0, "",              CPID_PREVENT_JOIN,     "0 0", _("^K1You may not join the game at this time.\nThe player limit reached maximum capacity."), "") \
        MSG_CENTER_NOTIF(1, CENTER_KEEPAWAY_DROPPED,            1, 0, "s1",            CPID_KEEPAWAY,         "0 0", _("^BG%s^BG has dropped the ball!"), "") \
        MSG_CENTER_NOTIF(1, CENTER_KEEPAWAY_PICKUP,             1, 0, "s1",            CPID_KEEPAWAY,         "0 0", _("^BG%s^BG has picked up the ball!"), "") \
+       MSG_CENTER_NOTIF(1, CENTER_KEEPAWAY_PICKUP_SELF,        0, 0, "",              CPID_KEEPAWAY,         "0 0", _("^BGYou picked up the ball"), "") \
        MSG_CENTER_NOTIF(1, CENTER_KEEPAWAY_WARN,               0, 0, "",              CPID_KEEPAWAY_WARN,    "0 0", _("^BGKilling people while you don't have the ball gives no points!"), "") \
        MSG_CENTER_NOTIF(1, CENTER_KEYHUNT_HELP,                0, 0, "",              CPID_KEYHUNT,          "0 0", _("^BGAll keys are in your team's hands!\nHelp the key carriers to meet!"), "") \
        MULTITEAM_CENTER(1, CENTER_KEYHUNT_INTERFERE_, 4,       0, 0, "",              CPID_KEYHUNT,          "0 0", _("^BGAll keys are in ^TC^TT team^BG's hands!\nInterfere ^F4NOW^BG!"), "") \
index ec6ee8cd4c6d83b60ef19dec2e9d575439fb9127..942682c16ff060435497cf6ea7a5bd526bd03ea3 100644 (file)
@@ -25,28 +25,28 @@ void ka_RespawnBall() // runs whenever the ball needs to be relocated
        if(gameover) { return; }
        vector oldballorigin = self.origin;
 
-       if(MoveToRandomMapLocation(self, DPCONTENTS_SOLID | DPCONTENTS_CORPSE | DPCONTENTS_PLAYERCLIP, DPCONTENTS_SLIME | DPCONTENTS_LAVA | DPCONTENTS_SKY | DPCONTENTS_BODY | DPCONTENTS_DONOTENTER, Q3SURFACEFLAG_SKY, 10, 1024, 256))
+       if(!MoveToRandomMapLocation(self, DPCONTENTS_SOLID | DPCONTENTS_CORPSE | DPCONTENTS_PLAYERCLIP, DPCONTENTS_SLIME | DPCONTENTS_LAVA | DPCONTENTS_SKY | DPCONTENTS_BODY | DPCONTENTS_DONOTENTER, Q3SURFACEFLAG_SKY, 10, 1024, 256))
        {
-               makevectors(self.angles);
-               self.movetype = MOVETYPE_BOUNCE;
-               self.velocity = '0 0 200';
-               self.angles = '0 0 0';
-               self.effects = autocvar_g_keepawayball_effects;
-               self.think = ka_RespawnBall;
-               self.nextthink = time + autocvar_g_keepawayball_respawntime;
+               entity spot = SelectSpawnPoint(TRUE);
+               setorigin(self, spot.origin);
+               self.angles = spot.angles;
+       }
 
-               pointparticles(particleeffectnum("electro_combo"), oldballorigin, '0 0 0', 1);
-               pointparticles(particleeffectnum("electro_combo"), self.origin, '0 0 0', 1);
+       makevectors(self.angles);
+       self.movetype = MOVETYPE_BOUNCE;
+       self.velocity = '0 0 200';
+       self.angles = '0 0 0';
+       self.effects = autocvar_g_keepawayball_effects;
+       self.think = ka_RespawnBall;
+       self.nextthink = time + autocvar_g_keepawayball_respawntime;
 
-               WaypointSprite_Spawn("ka-ball", 0, 0, self, '0 0 64', world, self.team, self, waypointsprite_attachedforcarrier, FALSE, RADARICON_FLAGCARRIER, '0 1 1');
-               WaypointSprite_Ping(self.waypointsprite_attachedforcarrier);
+       pointparticles(particleeffectnum("electro_combo"), oldballorigin, '0 0 0', 1);
+       pointparticles(particleeffectnum("electro_combo"), self.origin, '0 0 0', 1);
 
-               sound(self, CH_TRIGGER, "keepaway/respawn.wav", VOL_BASE, ATTEN_NONE); // ATTEN_NONE (it's a sound intended to be heard anywhere)
-       }
-       else
-       {
-               ka_RespawnBall(); // finding a location failed, retry
-       }
+       WaypointSprite_Spawn("ka-ball", 0, 0, self, '0 0 64', world, self.team, self, waypointsprite_attachedforcarrier, FALSE, RADARICON_FLAGCARRIER, '0 1 1');
+       WaypointSprite_Ping(self.waypointsprite_attachedforcarrier);
+
+       sound(self, CH_TRIGGER, "keepaway/respawn.wav", VOL_BASE, ATTEN_NONE); // ATTEN_NONE (it's a sound intended to be heard anywhere)
 }
 
 void ka_TimeScoring()
@@ -102,7 +102,8 @@ void ka_TouchEvent() // runs any time that the ball comes in contact with someth
        // messages and sounds
        ka_EventLog("pickup", other);
        Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_KEEPAWAY_PICKUP, other.netname);
-       Send_Notification(NOTIF_ALL, world, MSG_CENTER, CENTER_KEEPAWAY_PICKUP, other.netname);
+       Send_Notification(NOTIF_ALL_EXCEPT, other, MSG_CENTER, CENTER_KEEPAWAY_PICKUP, other.netname);
+       Send_Notification(NOTIF_ONE, other, MSG_CENTER, CENTER_KEEPAWAY_PICKUP_SELF);
        sound(self.owner, CH_TRIGGER, "keepaway/pickedup.wav", VOL_BASE, ATTEN_NONE); // ATTEN_NONE (it's a sound intended to be heard anywhere)
 
        // scoring