]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/assault.qc
Merge remote branch 'origin/master' into samual/updatecommands
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / assault.qc
index c4fe3874780886834ba6e7744e7aa5bc3501f7a4..85009dd830967c11f8b9d1a3c08953db803f970d 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");
@@ -70,8 +67,12 @@ void assault_objective_decrease_use() {
                return;
        }
 
-       if(other.assault_sprite.classname == "sprite_waypoint")
+       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!
 
@@ -92,6 +93,17 @@ void assault_objective_decrease_use() {
 
                        oldself = self;
                        self = oldself.enemy;
+                               if(self.message)
+                               {
+                                       entity player;
+                                       string s;
+                                       FOR_EACH_PLAYER(player)
+                                       {
+                                               s = strcat(self.message, "\n");
+                                               centerprint(player, s);
+                                       }
+                               }
+                                       
                                oldactivator = activator;
                                activator = oldself;
                                        SUB_UseTargets();
@@ -137,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');
        }
 }
 
@@ -251,31 +271,30 @@ void assault_roundstart_use() {
        activator = self;
        SUB_UseTargets();
 
-       /*
+       
 #ifdef TTURRETS_ENABLED
-entity ent,oldself;
+       entity ent, oldself;
 
        //(Re)spawn all turrets
        oldself = self;
        ent = find(world, classname, "turret_main");
        while(ent) {
-       // Swap turret teams
-       if(ent.team == COLOR_TEAM1)
-       ent.team = COLOR_TEAM2;
-       else
-       ent.team = COLOR_TEAM1;
+               // Swap turret teams
+               if(ent.team == COLOR_TEAM1)
+                       ent.team = COLOR_TEAM2;
+               else
+                       ent.team = COLOR_TEAM1;
 
-       self = ent;
+               self = ent;
 
-       // Dubbles as teamchange
-       turret_stdproc_respawn();
-       //ent.turret_spawnfunc();
+               // Dubbles as teamchange
+               turret_stdproc_respawn();
 
-       ent = find(ent, classname, "turret_main");
+               ent = find(ent, classname, "turret_main");
        }
        self = oldself;
 #endif
-*/
+
 
 }
 
@@ -294,9 +313,31 @@ void spawnfunc_target_assault_roundstart() {
 
 // trigger new round
 // reset objectives, toggle spawnpoints, reset triggers, ...
-void assault_new_round() {
+void vehicles_clearrturn();
+void vehicles_spawn();
+void assault_new_round() 
+{
+    entity oldself;
        //bprint("ASSAULT: new round\n");
 
+       oldself = self;
+       // Eject players from vehicles
+    FOR_EACH_PLAYER(self)
+    {
+        if(self.vehicle)
+            vehicles_exit(VHEF_RELESE);        
+    }
+    
+    self = findchainflags(vehicle_flags, VHF_ISVEHICLE);
+    while(self)
+    {
+        vehicles_clearrturn();
+        vehicles_spawn();
+        self = self.chain;
+    }
+
+    self = oldself;
+
        // up round counter
        self.winning = self.winning + 1;
 
@@ -319,7 +360,7 @@ void assault_new_round() {
                                ent.team_saved = COLOR_TEAM1;
                }
        }
-
+       
        // reset the level with a countdown
        cvar_set("timelimit", ftos(ceil(time - game_starttime) / 60));
        ReadyRestartForce(); // sets game_starttime