From bb39c30b3ae20f4c1d8eb95651a5b002c664424b Mon Sep 17 00:00:00 2001 From: LegendaryGuard Date: Sun, 27 Nov 2022 13:10:42 +0100 Subject: [PATCH] Move the check inside turret_validate_target main function and remove print_to functions when playing on survival-type gamemodes to fix SVQC spamming errors --- qcsrc/common/mutators/mutator/nades/nades.qc | 4 ++-- qcsrc/common/turrets/sv_turrets.qc | 8 +++----- qcsrc/common/turrets/turret/tesla.qc | 3 --- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/qcsrc/common/mutators/mutator/nades/nades.qc b/qcsrc/common/mutators/mutator/nades/nades.qc index b0702e4b40..5cace0f2f6 100644 --- a/qcsrc/common/mutators/mutator/nades/nades.qc +++ b/qcsrc/common/mutators/mutator/nades/nades.qc @@ -729,7 +729,7 @@ void nade_tandem_spawnitem(entity e, vector org) if((IS_GAMETYPE(FREEZETAG) || IS_GAMETYPE(LMS)) && (itm != ITEM_ArmorSmall || itm != ITEM_HealthSmall)) { - print_to(e, "Non-regular items can't be spawned on survival-type gamemodes"); + // Non-regular items can't be spawned on survival-type gamemodes itm = (random() > 0.5) ? ITEM_ArmorSmall : ITEM_HealthSmall; } @@ -751,6 +751,7 @@ void nade_tandem_dropping(entity this, vector org) e.spawnfunc_checked = true; e.pokenade_type = this.pokenade_type; + // Items can't be spawned on CA and Instagib if(!IS_GAMETYPE(CA) && !autocvar_g_instagib) { switch (this.pokenade_type) @@ -770,7 +771,6 @@ void nade_tandem_dropping(entity this, vector org) default : { nade_tandem_spawnitem(e, org); return; } } } - else print_to(this, "Items can't be spawned on CA and Instagib"); } void tandem_ball_think(entity this) diff --git a/qcsrc/common/turrets/sv_turrets.qc b/qcsrc/common/turrets/sv_turrets.qc index 6b6c89e106..c5ff8b31b6 100644 --- a/qcsrc/common/turrets/sv_turrets.qc +++ b/qcsrc/common/turrets/sv_turrets.qc @@ -704,7 +704,8 @@ float turret_validate_target(entity e_turret, entity e_target, float validate_fl if(!e_target) return -2; - if(e_target.owner == e_turret) + // Don't attack against owner + if(e_target.owner == e_turret || e_target == e_turret.realowner) return -0.5; if(!checkpvs(e_target.origin, e_turret)) @@ -1033,7 +1034,7 @@ void turret_think(entity this) if(this.tur_spawned && this.turret_lifetime != 0) if(time >= this.turret_lifetime) { - tmp_vehcount--; + tmp_turcount--; turret_die(this); return; @@ -1136,9 +1137,6 @@ void turret_think(entity this) // Check if we have a vailid enemy, and try to find one if we dont. - // Don't attack against owner - if(turret_select_target(this) == this.realowner) return; - // g_turrets_targetscan_maxdelay forces a target re-scan at least this often float do_target_scan = 0; if((this.target_select_time + autocvar_g_turrets_targetscan_maxdelay) < time) diff --git a/qcsrc/common/turrets/turret/tesla.qc b/qcsrc/common/turrets/turret/tesla.qc index 8984ead962..4c27bc9acc 100644 --- a/qcsrc/common/turrets/turret/tesla.qc +++ b/qcsrc/common/turrets/turret/tesla.qc @@ -57,9 +57,6 @@ bool turret_tesla_firecheck(entity this) if((this.target_select_time + autocvar_g_turrets_targetscan_maxdelay) < time) do_target_scan = 1; - if(turret_select_target(this) == this.realowner) - return false; - // Old target (if any) invalid? if(this.target_validate_time < time) if (turret_validate_target(this, this.enemy, this.target_validate_flags) <= 0) -- 2.39.2