]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/assault.qc
Rewrite of vote code.
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / assault.qc
index 0d7da73572a3083af09aff6a296b55afbe4fabf2..2a0d8bc5374f456e9f935cc707c48ab3cd1ceb31 100644 (file)
@@ -30,9 +30,6 @@ void assault_objective_reset() {
 }
 
 void assault_objective_use() {
-       if(other.classname == "info_player_deathmatch") // a spawn, a spawn
-               return;
-
        // activate objective
        self.health = 100;
        //print("^2Activated objective ", self.targetname, "=", etos(self), "\n");
@@ -71,7 +68,11 @@ void assault_objective_decrease_use() {
        }
 
        if(other.assault_sprite)
+       {
                WaypointSprite_Disown(other.assault_sprite, waypointsprite_deadlifetime);
+               if(other.classname == "func_assault_destructible")
+                       other.sprite = world;
+       }
        else
                return; // already activated! cannot activate again!
 
@@ -148,18 +149,26 @@ void target_objective_decrease_activate()
        for(ent = world; (ent = find(ent, target, self.targetname)); )
        {
                if(ent.assault_sprite != world)
+               {
                        WaypointSprite_Disown(ent.assault_sprite, waypointsprite_deadlifetime);
+                       if(ent.classname == "func_assault_destructible")
+                               ent.sprite = world;
+               }
 
-               spr = WaypointSprite_SpawnFixed("<placeholder>", 0.5 * (ent.absmin + ent.absmax), ent, assault_sprite);
+               spr = WaypointSprite_SpawnFixed("<placeholder>", 0.5 * (ent.absmin + ent.absmax), ent, assault_sprite, RADARICON_OBJECTIVE, '1 0.5 0');
                spr.assault_decreaser = self;
                spr.waypointsprite_visible_for_player = assault_decreaser_sprite_visible;
                spr.classname = "sprite_waypoint";
                WaypointSprite_UpdateRule(spr, assault_attacker_team, SPRITERULE_TEAMPLAY);
                if(ent.classname == "func_assault_destructible")
+               {
                        WaypointSprite_UpdateSprites(spr, "as-defend", "as-destroy", "as-destroy");
+                       WaypointSprite_UpdateMaxHealth(spr, ent.max_health);
+                       WaypointSprite_UpdateHealth(spr, ent.health);
+                       ent.sprite = spr;
+               }
                else
                        WaypointSprite_UpdateSprites(spr, "as-defend", "as-push", "as-push");
-               WaypointSprite_UpdateTeamRadar(spr, RADARICON_OBJECTIVE, '1 0.5 0');
        }
 }