Turret tur = get_turretinfo(this.m_id);
tur.tr_setup(tur, this);
+
+ setorigin(this, this.origin); // make sure it's linked to the area grid
}
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))
#undef TRY
}
-bool turret_closetotarget(entity this, vector targ)
+bool turret_closetotarget(entity this, vector targ, float range)
{
- vector path_extra_size = '64 64 64';
+ vector path_extra_size = '1 1 1' * range;
return boxesoverlap(targ - path_extra_size, targ + path_extra_size, this.absmin - path_extra_size, this.absmax + path_extra_size);
}
}
if(!(this.spawnflags & TSF_SUSPENDED))
- droptofloor(this);
+ DropToFloor_QC_DelayedInit(this);
this.netname = tur.netname;
load_unit_settings(this, 0);