+#include "targettrigger.qh"
spawnfunc(turret_targettrigger);
-void turret_targettrigger_touch();
+void turret_targettrigger_touch(entity this, entity toucher);
-void turret_targettrigger_touch()
-{SELFPARAM();
- entity e;
- if (self.cnt > time) return;
- entity oldself = this;
-
- e = find(world, targetname, self.target);
- while (e)
+void turret_targettrigger_touch(entity this, entity toucher)
+{
+ if (this.cnt > time) return;
+ IL_EACH(g_turrets, it.targetname == this.target,
{
- if (e.turret_flags & TUR_FLAG_RECIEVETARGETS)
- {
- setself(e);
- if(e.turret_addtarget)
- e.turret_addtarget(other,oldself);
- }
-
- e = find(e, targetname, oldself.target);
- }
-
- oldself.cnt = time + 0.5;
-
- setself(this);
+ if (!(it.turret_flags & TUR_FLAG_RECIEVETARGETS)) continue;
+ if (!it.turret_addtarget) continue;
+ it.turret_addtarget(it, toucher, this);
+ });
+ this.cnt = time + 0.5;
}
/*QUAKED turret_targettrigger (.5 .5 .5) ?
*/
spawnfunc(turret_targettrigger)
{
- if(!autocvar_g_turrets) { remove(this); return; }
+ if(!autocvar_g_turrets) { delete(this); return; }
- WITHSELF(this, InitTrigger());
+ InitTrigger(this);
- this.touch = turret_targettrigger_touch;
+ settouch(this, turret_targettrigger_touch);
}