From: Jakob MG Date: Wed, 3 Aug 2011 18:58:27 +0000 (+0200) Subject: Make vehicles work with assault, fix bad coloring when exiting due to teamswap/spectate X-Git-Tag: xonotic-v0.5.0~122^2^2~12 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=830f33856ca7b9aba204bfd0d729cd970008277f;p=xonotic%2Fxonotic-data.pk3dir.git Make vehicles work with assault, fix bad coloring when exiting due to teamswap/spectate --- diff --git a/qcsrc/server/assault.qc b/qcsrc/server/assault.qc index 2a0d8bc53..85009dd83 100644 --- a/qcsrc/server/assault.qc +++ b/qcsrc/server/assault.qc @@ -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 diff --git a/qcsrc/server/vehicles/racer.qc b/qcsrc/server/vehicles/racer.qc index 9fbd6541f..e3c74c5e1 100644 --- a/qcsrc/server/vehicles/racer.qc +++ b/qcsrc/server/vehicles/racer.qc @@ -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 diff --git a/qcsrc/server/vehicles/raptor.qc b/qcsrc/server/vehicles/raptor.qc index 26054ae09..201c186c3 100644 --- a/qcsrc/server/vehicles/raptor.qc +++ b/qcsrc/server/vehicles/raptor.qc @@ -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 diff --git a/qcsrc/server/vehicles/spiderbot.qc b/qcsrc/server/vehicles/spiderbot.qc index 8d64ca420..f43ec08e5 100644 --- a/qcsrc/server/vehicles/spiderbot.qc +++ b/qcsrc/server/vehicles/spiderbot.qc @@ -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 diff --git a/qcsrc/server/vehicles/vehicles.qc b/qcsrc/server/vehicles/vehicles.qc index 901e68ff1..d9d77b5f5 100644 --- a/qcsrc/server/vehicles/vehicles.qc +++ b/qcsrc/server/vehicles/vehicles.qc @@ -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; }