From 6b242c6d1ec5f542fc833db04c1cc04a302a1075 Mon Sep 17 00:00:00 2001 From: LegendaryGuard Date: Sat, 25 Jun 2022 12:49:42 +0200 Subject: [PATCH] Add effects for spawned turrets from the nade or anything, plus add a verify parameter on both functions --- qcsrc/common/mutators/mutator/nades/nades.qc | 6 ++++-- qcsrc/common/turrets/sv_turrets.qc | 14 ++++++++++---- qcsrc/common/turrets/sv_turrets.qh | 3 ++- qcsrc/common/vehicles/sv_vehicles.qc | 8 ++++---- qcsrc/common/vehicles/sv_vehicles.qh | 4 ++-- 5 files changed, 22 insertions(+), 13 deletions(-) diff --git a/qcsrc/common/mutators/mutator/nades/nades.qc b/qcsrc/common/mutators/mutator/nades/nades.qc index b05bdb2f76..60faafe9ac 100644 --- a/qcsrc/common/mutators/mutator/nades/nades.qc +++ b/qcsrc/common/mutators/mutator/nades/nades.qc @@ -1005,7 +1005,8 @@ void nade_emerald_boom(entity this) this.realowner, this.origin, false, - false + false, + true ); vehspawncount++; @@ -1029,7 +1030,8 @@ void nade_emerald_boom(entity this) false, false, false, - 1 + 1, + true ); turspawncount++; diff --git a/qcsrc/common/turrets/sv_turrets.qc b/qcsrc/common/turrets/sv_turrets.qc index 0e049d25a0..c88727aa81 100644 --- a/qcsrc/common/turrets/sv_turrets.qc +++ b/qcsrc/common/turrets/sv_turrets.qc @@ -1416,9 +1416,10 @@ bool turret_initialize(entity this, Turret tur) return true; } -entity spawnturret (entity e, string turret, Turret tur, entity spawnedby, entity own, vector orig, bool respwn, bool invincible, bool removeifinvalid, int moveflag) +entity spawnturret (entity e, string turret, Turret tur, entity spawnedby, entity own, vector orig, bool respwn, bool invincible, bool removeifinvalid, int moveflag, bool optional) { e.spawnflags = TSF_SUSPENDED; + e.optionalsetup = optional; if(!respwn) { e.spawnflags |= TSL_NO_RESPAWN; } if(invincible) { e.damage_flags |= TFL_DMG_NO; } @@ -1457,7 +1458,7 @@ entity spawnturret (entity e, string turret, Turret tur, entity spawnedby, entit return NULL; // no good } // select a random valid turret type if no valid turret was provided - return spawnturret(e, "random", TUR_Null, spawnedby, own, orig, respwn, invincible, removeifinvalid, moveflag); + return spawnturret(e, "random", TUR_Null, spawnedby, own, orig, respwn, invincible, removeifinvalid, moveflag, optional); } } @@ -1472,16 +1473,21 @@ entity spawnturret (entity e, string turret, Turret tur, entity spawnedby, entit e.team = spawnedby.team; // colors handled in spawn code // TODO: Create a "following player" feature when turret has moveflag - //if(autocvar_g_monsters_owners) + //if(autocvar_g_monsters_owners && e.move_movetype == MOVETYPE_WALK) // e.monster_follow = own; // using .owner makes the monster non-solid for its master e.angles_y = spawnedby.angles_y; } if(!(e.spawnflags & TSF_SUSPENDED)) { delete(e); return NULL; } // remove even if told not to, as we didn't spawn any kind of turret - + turret_initialize(e, tur); + //LOG_INFOF("^1tur.netname^3: %s", tur.netname); + + if (e.optionalsetup) + e.tur_head.effects = (EF_DIMLIGHT | EF_FULLBRIGHT); + return e; } #endif diff --git a/qcsrc/common/turrets/sv_turrets.qh b/qcsrc/common/turrets/sv_turrets.qh index d1edfeef9f..1bd0b43aae 100644 --- a/qcsrc/common/turrets/sv_turrets.qh +++ b/qcsrc/common/turrets/sv_turrets.qh @@ -9,7 +9,7 @@ bool autocvar_g_turrets_reloadcvars; float autocvar_g_turrets_targetscan_maxdelay; float autocvar_g_turrets_targetscan_mindelay; -entity spawnturret(entity e, string turret, Turret tur, entity spawnedby, entity own, vector orig, bool respwn, bool invincible, bool removeifinvalid, int moveflag); +entity spawnturret(entity e, string turret, Turret tur, entity spawnedby, entity own, vector orig, bool respwn, bool invincible, bool removeifinvalid, int moveflag, bool optional); entity turret_projectile(entity actor, Sound _snd, float _size, float _health, float _death, float _proj_type, float _cull, float _cli_anim); void turret_projectile_explode(entity this); float turret_validate_target(entity e_turret, entity e_target, float validate_flags); @@ -26,6 +26,7 @@ TR_PROPS_COMMON(X, , ) .float shot_volly_refire; // refire after completed volly */ +.bool optionalsetup; // optional setup .float ticrate; // interal ai think rate .entity tur_head; // top part of the turret .entity tur_defend; // defend this entity diff --git a/qcsrc/common/vehicles/sv_vehicles.qc b/qcsrc/common/vehicles/sv_vehicles.qc index 6986d7033e..329e74e735 100644 --- a/qcsrc/common/vehicles/sv_vehicles.qc +++ b/qcsrc/common/vehicles/sv_vehicles.qc @@ -424,7 +424,7 @@ void vehicles_reset_colors(entity this, entity player) if (this.optionalsetup) this.effects = EF_DIMLIGHT; else - this.effects = eff; + this.effects = eff; Vehicle info = this.vehicledef; //REGISTRY_GET(Vehicles, this.vehicleid); info.vr_setcolors(info, this); @@ -1295,10 +1295,10 @@ 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 respwn, bool removeifinvalid) +entity spawnvehicle (entity e, string vehicle, Vehicle veh, entity spawnedby, entity own, vector orig, bool respwn, bool removeifinvalid, bool optional) { e.spawnflags = VHF_MULTISLOT; - e.optionalsetup = true; + e.optionalsetup = optional; // TODO: Make a respawn option, the following line isn't functional if(!respwn) { e.spawnflags |= VHF_ISVEHICLE; } @@ -1336,7 +1336,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, respwn, removeifinvalid); + return spawnvehicle(e, "random", VEH_Null, spawnedby, own, orig, respwn, removeifinvalid, optional); } } diff --git a/qcsrc/common/vehicles/sv_vehicles.qh b/qcsrc/common/vehicles/sv_vehicles.qh index cfaefba962..c293a287d6 100644 --- a/qcsrc/common/vehicles/sv_vehicles.qh +++ b/qcsrc/common/vehicles/sv_vehicles.qh @@ -82,7 +82,7 @@ const int MAX_AXH = 4; .float lock_strength; .float lock_time; .float lock_soundtime; -.bool optionalsetup; +.bool optionalsetup; // vehicle functions .void(int _spawnflag) vehicle_spawn; /// Vehicles custom fucntion to be efecuted when vehicle (re)spawns @@ -104,7 +104,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 respwn, bool removeifinvalid); +entity spawnvehicle(entity e, string vehicle, Vehicle veh, entity spawnedby, entity own, vector orig, bool respwn, bool removeifinvalid, bool optional); void vehicles_exit(entity vehic, int eject); bool vehicle_initialize(entity this, Vehicle info, float nodrop); bool vehicle_impulse(entity this, int imp); -- 2.39.2