From: LegendaryGuard Date: Fri, 1 Jul 2022 23:54:05 +0000 (+0200) Subject: Now vehicles can't be respawned after being spawned and destroyed, plus add nodrop... X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=90bdc0018a41ff45997e456b89e9b4ce398fb484;p=xonotic%2Fxonotic-data.pk3dir.git Now vehicles can't be respawned after being spawned and destroyed, plus add nodrop option parameter in spawnvehicle function --- diff --git a/qcsrc/common/mutators/mutator/nades/nades.qc b/qcsrc/common/mutators/mutator/nades/nades.qc index 98bb3dc879..61449fcb71 100644 --- a/qcsrc/common/mutators/mutator/nades/nades.qc +++ b/qcsrc/common/mutators/mutator/nades/nades.qc @@ -1012,7 +1012,8 @@ void nade_emerald_boom(entity this) this.origin, true, false, - true + true, + false ); if(!e) diff --git a/qcsrc/common/vehicles/sv_vehicles.qc b/qcsrc/common/vehicles/sv_vehicles.qc index 3fb9f38b09..c41889a056 100644 --- a/qcsrc/common/vehicles/sv_vehicles.qc +++ b/qcsrc/common/vehicles/sv_vehicles.qc @@ -521,6 +521,9 @@ void vehicles_setreturn(entity veh) { if (veh.cannot_respawn) { + sound (veh, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM); + Send_Effect(EFFECT_EXPLOSION_BIG, veh.origin + '0 0 100', '0 0 0', 1); + delete(veh); return; } @@ -529,7 +532,8 @@ void vehicles_setreturn(entity veh) } else { - ret.nextthink = min(time + veh.respawntime, time + veh.respawntime - 1); + if (!veh.cannot_respawn) // if true, don't respawn + ret.nextthink = min(time + veh.respawntime, time + veh.respawntime - 1); } setorigin(ret, veh.pos1 + '0 0 96'); @@ -1303,7 +1307,7 @@ bool vehicle_initialize(entity this, Vehicle info, bool nodrop) return true; } -entity spawnvehicle (entity e, string vehicle, Vehicle veh, entity spawnedby, entity own, vector orig, bool no_respwn, bool removeifinvalid, bool optional) +entity spawnvehicle (entity e, string vehicle, Vehicle veh, entity spawnedby, entity own, vector orig, bool no_respwn, bool removeifinvalid, bool optional, bool nodrop) { e.spawnflags = VHF_MULTISLOT; @@ -1348,7 +1352,7 @@ entity spawnvehicle (entity e, string vehicle, Vehicle veh, entity spawnedby, en return NULL; // no good } // select a random valid vehicle type if no valid vehicle was provided - return spawnvehicle(e, "random", VEH_Null, spawnedby, own, orig, no_respwn, removeifinvalid, optional); + return spawnvehicle(e, "random", VEH_Null, spawnedby, own, orig, no_respwn, removeifinvalid, optional, nodrop); } } @@ -1368,7 +1372,7 @@ entity spawnvehicle (entity e, string vehicle, Vehicle veh, entity spawnedby, en e.spawnfunc_checked = true; // spawn! - vehicle_initialize(e, veh, true); + vehicle_initialize(e, veh, nodrop); return e; } diff --git a/qcsrc/common/vehicles/sv_vehicles.qh b/qcsrc/common/vehicles/sv_vehicles.qh index 141c025e21..a28fe077eb 100644 --- a/qcsrc/common/vehicles/sv_vehicles.qh +++ b/qcsrc/common/vehicles/sv_vehicles.qh @@ -106,7 +106,7 @@ float vehicles_exit_running; .float vehicle_enter_delay; // prevent players jumping to and from vehicles instantly -entity spawnvehicle(entity e, string vehicle, Vehicle veh, entity spawnedby, entity own, vector orig, bool no_respwn, bool removeifinvalid, bool optional); +entity spawnvehicle(entity e, string vehicle, Vehicle veh, entity spawnedby, entity own, vector orig, bool no_respwn, bool removeifinvalid, bool optional, bool nodrop); void vehicles_exit(entity vehic, int eject); bool vehicle_initialize(entity this, Vehicle info, float nodrop); bool vehicle_impulse(entity this, int imp);