]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Fix monsters still trying to follow dead teammates
authorMario <mario.mario@y7mail.com>
Fri, 8 Feb 2013 01:30:39 +0000 (12:30 +1100)
committerMario <mario.mario@y7mail.com>
Fri, 8 Feb 2013 01:30:39 +0000 (12:30 +1100)
qcsrc/server/mutators/gamemode_rts.qc

index 1779091de5ef0f92554a0661f8291a02945c684c..4607abff6994ba401f2e31ed85fec16a7635c1fa 100644 (file)
@@ -179,7 +179,6 @@ MUTATOR_HOOKFUNCTION(rts_PlayerThink)
                                {
                                        WaypointSprite_Spawn("Following", 1, 0, e, '0 0 1' * sheight, world, self.team, self, sprite, FALSE, RADARICON_DANGER, ((teamplay) ? TeamColor(self.team) : '1 0 0'));
                                        head.goalentity = e;
-                                       head.enemy = e.enemy;
                                }
                                else // its not a monster or an enemy, so revert to waypoint
                                {
@@ -286,6 +285,8 @@ MUTATOR_HOOKFUNCTION(rts_MonsterThink)
 
 MUTATOR_HOOKFUNCTION(rts_MonsterDies)
 {
+       entity e;
+       
        if(IsDifferentTeam(frag_attacker, frag_target) && frag_attacker.team)
                TeamScore_AddToTeam(frag_attacker.team, ST_SCORE, 1);
        
@@ -302,6 +303,11 @@ MUTATOR_HOOKFUNCTION(rts_MonsterDies)
                if(frag_attacker.monster_score == 25)
                        Monster_LevelUp(frag_attacker);
        }
+       
+       for(e = world; (e = findentity(e, goalentity, self)); )
+       {
+               e.goalentity = world; // fix teammates if they still see us as a valid target
+       }
 
        self.effects &~= EF_SELECTABLE;
        self.selected = FALSE;