]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Make vehicles work with assault, fix bad coloring when exiting due to teamswap/spectate
authorJakob MG <jakob_mg@hotmail.com>
Wed, 3 Aug 2011 18:58:27 +0000 (20:58 +0200)
committerJakob MG <jakob_mg@hotmail.com>
Wed, 3 Aug 2011 18:58:27 +0000 (20:58 +0200)
qcsrc/server/assault.qc
qcsrc/server/vehicles/racer.qc
qcsrc/server/vehicles/raptor.qc
qcsrc/server/vehicles/spiderbot.qc
qcsrc/server/vehicles/vehicles.qc

index 2a0d8bc5374f456e9f935cc707c48ab3cd1ceb31..85009dd830967c11f8b9d1a3c08953db803f970d 100644 (file)
@@ -313,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;
 
@@ -338,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
index 9fbd6541fc8e6af51254de34bc4a2eb9e772ff91..e3c74c5e190c864a1d0832834729d2fc4b534979 100644 (file)
@@ -669,6 +669,10 @@ void spawnfunc_vehicle_racer()
         self.vehicle_flags |= VHF_HEALTHREGEN;
 
     self.think = racer_dinit;
-    self.nextthink = time + (autocvar_g_vehicles_delayspawn ? autocvar_g_vehicle_racer_respawntime + (random() * autocvar_g_vehicles_delayspawn_jitter) : 0.5);
+    
+    if(g_assault)
+        self.nextthink = time + 0.5;
+    else
+        self.nextthink = time + (autocvar_g_vehicles_delayspawn ? autocvar_g_vehicle_racer_respawntime + (random() * autocvar_g_vehicles_delayspawn_jitter) : 0.5);
 }
 #endif // SVQC
index 26054ae092b7f4e8c2a14521b2769620eba5587f..201c186c37947d65ad983efd0b4c67c1f0484120 100644 (file)
@@ -734,6 +734,10 @@ void spawnfunc_vehicle_raptor()
     precache_sound ("vehicles/raptor_speed.wav");
     
     self.think = raptor_dinit;
-    self.nextthink = time + (autocvar_g_vehicles_delayspawn ? autocvar_g_vehicle_raptor_respawntime + (random() * autocvar_g_vehicles_delayspawn_jitter) : 0.5);
+    
+    if(g_assault)
+        self.nextthink = time + 0.5;
+    else
+        self.nextthink = time + (autocvar_g_vehicles_delayspawn ? autocvar_g_vehicle_raptor_respawntime + (random() * autocvar_g_vehicles_delayspawn_jitter) : 0.5);
 }
 #endif // SVQC
index 8d64ca420fef310560898e3524225c814461ffad..f43ec08e52f35f9a792a172a82c6a9da3e4f0093 100644 (file)
@@ -673,7 +673,11 @@ void spawnfunc_vehicle_spiderbot()
     if(autocvar_g_vehicle_spiderbot_health_regen)
         self.vehicle_flags |= VHF_HEALTHREGEN;
     
-    self.think = vewhicle_spiderbot_dinit;    
-    self.nextthink = time + (autocvar_g_vehicles_delayspawn ? autocvar_g_vehicle_spiderbot_respawntime + (random() * autocvar_g_vehicles_delayspawn_jitter) : 0.5);
+    self.think = vewhicle_spiderbot_dinit;
+    
+    if(g_assault)
+        self.nextthink = time + 0.5;
+    else
+        self.nextthink = time + (autocvar_g_vehicles_delayspawn ? autocvar_g_vehicle_spiderbot_respawntime + (random() * autocvar_g_vehicles_delayspawn_jitter) : 0.5);
 }
 #endif // SVQC
index 901e68ff1b920dea2d533aab2654c978d919188f..d9d77b5f5211957f539c4ee41b1057beec0980a4 100644 (file)
@@ -618,7 +618,9 @@ void vehicles_exit(float eject)
 
     if(!teamplay)
         self.team = 0;
-
+    else
+        self.team = self.tur_head.team;
+    
     if(self.owner.flagcarried)
     {
         self.owner.flagcarried.scale = 0.6;
@@ -629,6 +631,7 @@ void vehicles_exit(float eject)
     sound (self, CH_TRIGGER_SINGLE, "misc/null.wav", 1, ATTN_NORM);
     self.vehicle_exit(eject);
     self.owner = world;
+    vehicles_reset_colors();
     
     if(oldself)
         self = oldself;
@@ -845,7 +848,7 @@ void vehicles_setreturn()
     ret.classname   = "vehicle_return";
     ret.enemy       = self;    
     ret.team        = self.team;
-    ret.think       = vehicles_showwp;        
+    ret.think       = vehicles_showwp;
     
     if(self.deadflag != DEAD_NO)
     {
@@ -856,8 +859,6 @@ void vehicles_setreturn()
     {
         ret.nextthink   = min(time + self.vehicle_respawntime, time + self.vehicle_respawntime - 1);        
     }
-        
-    
     
     setmodel(ret, "null");
     setorigin(ret, self.pos1 + '0 0 96');
@@ -959,7 +960,7 @@ float vehicle_initialize(string  net_name,
 
     if(self.team && !teamplay)
         self.team = 0;
-
+        
     self.vehicle_flags |= VHF_ISVEHICLE;
     
     setmodel(self, bodymodel);
@@ -1018,7 +1019,8 @@ float vehicle_initialize(string  net_name,
 
     self.pos1 = self.origin;
     self.pos2 = self.angles;
-
+    self.tur_head.team = self.team;
+    
     return TRUE;
 }