From f52f5a645b1473cda23d07590ba89d79ac645bd6 Mon Sep 17 00:00:00 2001 From: LegendaryGuard Date: Fri, 24 Jun 2022 03:30:00 +0200 Subject: [PATCH] Improving functions and add them into headers --- qcsrc/common/mutators/mutator/nades/nades.qc | 4 ++-- qcsrc/common/turrets/sv_turrets.qc | 13 ++++++------- qcsrc/common/turrets/sv_turrets.qh | 1 + qcsrc/common/vehicles/sv_vehicles.qc | 7 ++++--- qcsrc/common/vehicles/sv_vehicles.qh | 1 + 5 files changed, 14 insertions(+), 12 deletions(-) diff --git a/qcsrc/common/mutators/mutator/nades/nades.qc b/qcsrc/common/mutators/mutator/nades/nades.qc index 9899b3ea08..b05bdb2f76 100644 --- a/qcsrc/common/mutators/mutator/nades/nades.qc +++ b/qcsrc/common/mutators/mutator/nades/nades.qc @@ -1005,8 +1005,7 @@ void nade_emerald_boom(entity this) this.realowner, this.origin, false, - false, - 1 + false ); vehspawncount++; @@ -1027,6 +1026,7 @@ void nade_emerald_boom(entity this) this.realowner, this.realowner, this.origin, + false, false, false, 1 diff --git a/qcsrc/common/turrets/sv_turrets.qc b/qcsrc/common/turrets/sv_turrets.qc index 902ddff3c5..0e049d25a0 100644 --- a/qcsrc/common/turrets/sv_turrets.qc +++ b/qcsrc/common/turrets/sv_turrets.qc @@ -1416,12 +1416,12 @@ 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 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) { e.spawnflags = TSF_SUSPENDED; if(!respwn) { e.spawnflags |= TSL_NO_RESPAWN; } - // if(invincible) { e.damage_flags |= TFL_DMG_NO; } + if(invincible) { e.damage_flags |= TFL_DMG_NO; } setorigin(e, orig); bool allow_any = boolean(turret == "anyrandom"); @@ -1457,22 +1457,21 @@ 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, removeifinvalid, moveflag); + return spawnturret(e, "random", TUR_Null, spawnedby, own, orig, respwn, invincible, removeifinvalid, moveflag); } } e.realowner = spawnedby; - // TODO: Create a turret .entity moveflag - //if(moveflag && e.turret_flags == TUR_FLAG_MOVE) - // e.monster_moveflags = moveflag; + if(moveflag) + e.turret_flags = TUR_FLAG_MOVE; if(IS_PLAYER(spawnedby)) { if(teamplay) e.team = spawnedby.team; // colors handled in spawn code - // TODO: Create a turret .entity moveflag + // TODO: Create a "following player" feature when turret has moveflag //if(autocvar_g_monsters_owners) // e.monster_follow = own; // using .owner makes the monster non-solid for its master diff --git a/qcsrc/common/turrets/sv_turrets.qh b/qcsrc/common/turrets/sv_turrets.qh index cdd9e57bfa..d1edfeef9f 100644 --- a/qcsrc/common/turrets/sv_turrets.qh +++ b/qcsrc/common/turrets/sv_turrets.qh @@ -9,6 +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 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); diff --git a/qcsrc/common/vehicles/sv_vehicles.qc b/qcsrc/common/vehicles/sv_vehicles.qc index 83fd479bfe..3e4bf459a1 100644 --- a/qcsrc/common/vehicles/sv_vehicles.qc +++ b/qcsrc/common/vehicles/sv_vehicles.qc @@ -1292,10 +1292,11 @@ 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, int moveflag) +entity spawnvehicle (entity e, string vehicle, Vehicle veh, entity spawnedby, entity own, vector orig, bool respwn, bool removeifinvalid) { e.spawnflags = VHF_MULTISLOT; - + + // TODO: Make a respawn option, the following line isn't functional if(!respwn) { e.spawnflags |= VHF_ISVEHICLE; } setorigin(e, orig); bool allow_any = boolean(vehicle == "anyrandom"); @@ -1331,7 +1332,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, moveflag); + return spawnvehicle(e, "random", VEH_Null, spawnedby, own, orig, respwn, removeifinvalid); } } diff --git a/qcsrc/common/vehicles/sv_vehicles.qh b/qcsrc/common/vehicles/sv_vehicles.qh index 95ab1cfa28..f9f4433470 100644 --- a/qcsrc/common/vehicles/sv_vehicles.qh +++ b/qcsrc/common/vehicles/sv_vehicles.qh @@ -103,6 +103,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); 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