]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/ctf.qc
Merge branch 'master' into terencehill/centerprint_stuff
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / ctf.qc
index d76eba938da2dc96af647ba9ca3d26ea0734b63a..df44f5d2e8ab2861ab1409f731512df0db2cd921 100644 (file)
@@ -49,7 +49,7 @@ float ctf_captureshield_shielded(entity p)
 
        // player is in the worse half, if >= half the players are better than him, or consequently, if < half of the players are worse
        // use this rule here
-       
+
        if(players_worseeq >= players_total * captureshield_max_ratio)
                return FALSE;
 
@@ -125,15 +125,9 @@ void ctf_flag_spawnstuff()
        self.basewaypoint = self.nearestwaypoint;
 
        if(self.team == COLOR_TEAM1)
-       {
-               WaypointSprite_SpawnFixed("redbase", self.origin + '0 0 61', self, sprite);
-               WaypointSprite_UpdateTeamRadar(self.sprite, RADARICON_FLAG, colormapPaletteColor(COLOR_TEAM1 - 1, FALSE));
-       }
+               WaypointSprite_SpawnFixed("redbase", self.origin + '0 0 61', self, sprite, RADARICON_FLAG, colormapPaletteColor(COLOR_TEAM1 - 1, FALSE));
        else
-       {
-               WaypointSprite_SpawnFixed("bluebase", self.origin + '0 0 61', self, sprite);
-               WaypointSprite_UpdateTeamRadar(self.sprite, RADARICON_FLAG, colormapPaletteColor(COLOR_TEAM2 - 1, FALSE));
-       }
+               WaypointSprite_SpawnFixed("bluebase", self.origin + '0 0 61', self, sprite, RADARICON_FLAG, colormapPaletteColor(COLOR_TEAM2 - 1, FALSE));
 }
 
 float ctf_score_value(string parameter)
@@ -296,11 +290,11 @@ void DropFlag(entity e, entity penalty_receiver, entity attacker)
        ctf_captureshield_update(p, 0); // shield only
        e.playerid = attacker.playerid;
        e.ctf_droptime = time;
-       WaypointSprite_Spawn("flagdropped", 0, 0, e, '0 0 1' * 61, world, COLOR_TEAM1 + COLOR_TEAM2 - e.team, e, waypointsprite_attachedforcarrier, FALSE);
+       WaypointSprite_Spawn("flagdropped", 0, 0, e, '0 0 1' * 61, world, COLOR_TEAM1 + COLOR_TEAM2 - e.team, e, waypointsprite_attachedforcarrier, FALSE, RADARICON_FLAG, '0 1 1');
+       WaypointSprite_Ping(e.waypointsprite_attachedforcarrier);
        
        if(p.waypointsprite_attachedforcarrier)
        {
-               WaypointSprite_Ping(p.waypointsprite_attachedforcarrier);
                WaypointSprite_DetachCarrier(p);
        }
        else
@@ -515,10 +509,10 @@ void FlagTouch()
        {
                if (other.next_take_time > time)
                        return;
-                       
+
                if (autocvar_g_ctf_flag_pickup_effects) // pickup effect
                        pointparticles(particleeffectnum("smoke_ring"), 0.5 * (self.absmin + self.absmax), '0 0 0', 1);
-                       
+
                // pick up
                self.flagpickuptime = time; // used for timing runs
                self.speedrunning = other.speedrunning; // if speedrunning, flag will self-return and teleport the owner back after the record
@@ -546,8 +540,7 @@ void FlagTouch()
                self.movetype = MOVETYPE_NONE;
                setorigin(self, FLAG_CARRY_POS);
                setattachment(self, other, "");
-               WaypointSprite_AttachCarrier("flagcarrier", other);
-               WaypointSprite_UpdateTeamRadar(other.waypointsprite_attachedforcarrier, RADARICON_FLAGCARRIER, '1 1 0');
+               WaypointSprite_AttachCarrier("flagcarrier", other, RADARICON_FLAGCARRIER, '1 1 0');
                WaypointSprite_Ping(self.sprite);
 
                return;
@@ -603,7 +596,7 @@ void FlagTouch()
 
                        if (autocvar_g_ctf_flag_pickup_effects) // field pickup effect
                                pointparticles(particleeffectnum("smoke_ring"), 0.5 * (self.absmin + self.absmax), '0 0 0', 1);
-                       
+
                        // pick up
                        self.solid = SOLID_NOT;
                        setorigin(self, self.origin); // relink
@@ -636,8 +629,7 @@ void FlagTouch()
                        setattachment(self, other, "");
                        self.damageforcescale = 0;
                        self.takedamage = DAMAGE_NO;
-                       WaypointSprite_AttachCarrier("flagcarrier", other);
-                       WaypointSprite_UpdateTeamRadar(other.waypointsprite_attachedforcarrier, RADARICON_FLAGCARRIER, '1 1 0');
+                       WaypointSprite_AttachCarrier("flagcarrier", other, RADARICON_FLAGCARRIER, '1 1 0');
                }
        }
 };
@@ -742,7 +734,7 @@ void item_flag_postspawn()
                if(self.team == COLOR_TEAM2)
                        // Blue
                        self.glow_color = 210;
-                       
+
                self.glow_size = 25;
                self.glow_trail = 1;
        }
@@ -1087,7 +1079,7 @@ entity(float cteam) ctf_team_has_commander =
        entity pl;
        if(cteam != COLOR_TEAM1 || cteam != COLOR_TEAM2)
                return world;
-       
+
        FOR_EACH_REALPLAYER(pl) {
                if(pl.team == cteam && pl.iscommander) {
                        return pl;
@@ -1105,7 +1097,7 @@ void(entity e, float st) ctf_setstate =
 void(float cteam) ctf_new_commander =
 {
        entity pl, plmax;
-       
+
        plmax = world;
        FOR_EACH_REALPLAYER(pl) {
                if(pl.team == cteam) {
@@ -1130,14 +1122,14 @@ void(float cteam) ctf_new_commander =
 void() ctf_clientconnect =
 {
        self.iscommander = FALSE;
-       
+
        if(!self.team || self.classname != "player") {
                ctf_setstate(self, -1);
        } else
                ctf_setstate(self, 0);
 
        self.team_saved = self.team;
-       
+
        if(self.team != 0 && self.classname == "player" && !ctf_team_has_commander(self.team)) {
                ctf_new_commander(self.team);
        }
@@ -1162,9 +1154,9 @@ void() ctf_playerchanged =
                        ctf_setstate(self, -1);
                ctf_new_commander(self.team_saved);
        }
-       
+
        self.team_saved = self.team;
-       
+
        ctf_new_commander(self.team);
 };