}
- FOREACH_ENTITY_FLOAT(railgunhit, 1,
+ IL_EACH(g_railgunhit, it.railgunhit,
{
it.railgunhit = 0;
});
+ IL_CLEAR(g_railgunhit);
}
}
entity toast(entity actor, entity from, float range, float damage)
{
- entity e;
+ float dd = range + 1;
entity etarget = NULL;
- float d,dd;
- float r;
-
- dd = range + 1;
-
- e = findradius(from.origin,range);
- while (e)
+ FOREACH_ENTITY_RADIUS(from.origin, range, it != from && !it.railgunhit,
{
- if ((e.railgunhit != 1) && (e != from))
+ float r = turret_validate_target(actor, it, actor.target_validate_flags);
+ if(r > 0)
{
- r = turret_validate_target(actor,e,actor.target_validate_flags);
- if (r > 0)
+ traceline(from.origin, 0.5 * (it.absmin + it.absmax), MOVE_WORLDONLY, from);
+ if(trace_fraction == 1.0)
{
- traceline(from.origin,0.5 * (e.absmin + e.absmax),MOVE_WORLDONLY,from);
- if (trace_fraction == 1.0)
+ float d = vlen(it.origin - from.origin);
+ if(d < dd)
{
- d = vlen(e.origin - from.origin);
- if (d < dd)
- {
- dd = d;
- etarget = e;
- }
+ dd = d;
+ etarget = it;
}
}
}
- e = e.chain;
- }
+ });
if (etarget)
{
- te_csqc_lightningarc(from.origin,etarget.origin);
+ te_csqc_lightningarc(from.origin, etarget.origin);
Damage(etarget, actor, actor, damage, DEATH_TURRET_TESLA.m_id, etarget.origin, '0 0 0');
etarget.railgunhit = 1;
+ IL_PUSH(g_railgunhit, etarget);
}
return etarget;
IntrusiveList g_damagedbycontents;
STATIC_INIT(g_damagedbycontents) { g_damagedbycontents = IL_NEW(); }
+
+IntrusiveList g_railgunhit;
+STATIC_INIT(g_railgunhit) { g_railgunhit = IL_NEW(); }
{
it.solid = SOLID_BSP;
it.ctrace_solidchanged = true;
+ IL_PUSH(g_ctrace_changed, it);
}
});
crosshair_trace(pl);
- FOREACH_ENTITY_FLOAT(ctrace_solidchanged, true,
+ IL_EACH(g_ctrace_changed, it.ctrace_solidchanged,
{
it.solid = SOLID_TRIGGER;
it.ctrace_solidchanged = false;
});
+
+ IL_CLEAR(g_ctrace_changed);
}
void WarpZone_crosshair_trace(entity pl)
{
float sound_allowed(float dest, entity e);
void InitializeEntity(entity e, void(entity this) func, float order);
+
+IntrusiveList g_ctrace_changed;
+STATIC_INIT(g_ctrace_changed) { g_ctrace_changed = IL_NEW(); }
flocker.health = 10;
flocker.pos1 = normalize(flocker.velocity + randomvec() * 0.1);
+ IL_PUSH(g_flockers, flocker);
+
this.cnt = this.cnt -1;
}
if(!this.enemy)
{
- FOREACH_ENTITY_FLOAT(flock_id, this.flock_id,
+ IL_EACH(g_flockers, it.flock_id == this.flock_id,
{
if(it == this.owner || it == ee)
continue;
this.enemy.nextthink = time + 10;
this.enemy.flock_id = this.flock_id;
this.enemy.owner = this;
+
+ IL_PUSH(g_flockers, this);
+ IL_PUSH(g_flockers, this.enemy);
}
#endif
vector steerlib_arrive(entity this, vector point, float maximal_distance);
vector steerlib_attract2(entity this, vector point, float min_influense, float max_distance, float max_influense);
//vector steerlib_pull(entity this, vector point);
+
+IntrusiveList g_flockers;
+STATIC_INIT(g_flockers) { g_flockers = IL_NEW(); }
break;
// make the entity non-solid so we can hit the next one
+ IL_PUSH(g_railgunhit, trace_ent);
trace_ent.railgunhit = true;
trace_ent.railgunhitloc = end;
trace_ent.railgunhitsolidbackup = trace_ent.solid;
float endq3surfaceflags = trace_dphitq3surfaceflags;
// find all the entities the railgun hit and restore their solid state
- FOREACH_ENTITY_FLOAT(railgunhit, true,
+ IL_EACH(g_railgunhit, it.railgunhit,
{
it.solid = it.railgunhitsolidbackup;
});
}
// find all the entities the railgun hit and hurt them
- FOREACH_ENTITY_FLOAT(railgunhit, true,
+ IL_EACH(g_railgunhit, it.railgunhit,
{
+ // removal from the list is handled below
+
// get the details we need to call the damage function
vector hitloc = it.railgunhitloc;
it.railgundistance = 0;
});
+ IL_CLEAR(g_railgunhit);
+
// calculate hits and fired shots for hitscan
accuracy_add(this, this.(weaponentity).m_weapon.m_id, 0, min(bdamage, totaldmg));