IntrusiveList g_radaricons;
STATIC_INIT(g_radaricons) { g_radaricons = IL_NEW(); }
+IntrusiveList g_onsgenerators;
+STATIC_INIT(g_onsgenerators) { g_onsgenerators = IL_NEW(); }
+
bool button_zoom;
bool spectatorbutton_zoom;
bool button_attack2;
}
}
- if(ons_roundlost)
+ if(ons_roundlost) // TODO: move this junk to a client mutator for onslaught (possible using the WantEventchase hook)
{
- FOREACH_ENTITY_CLASS("onslaught_generator", it.health <= 0, {
+ IL_EACH(g_onsgenerators, it.health <= 0,
+ {
gen = it;
break;
});
entityclass(Rubble);
class(Rubble).float creationtime;
-void RubbleLimit(string cname, float limit, void(entity) deleteproc)
+IntrusiveList g_rubble;
+STATIC_INIT(g_rubble) { g_rubble = IL_NEW(); }
+
+void RubbleLimit(string cname, int limit, void(entity) deleteproc)
{
// remove rubble of the same type if it's at the limit
// remove multiple rubble if the limit has been decreased
entity oldest = NULL;
float oldesttime = 0;
// compare to all other matching entities
- FOREACH_ENTITY_CLASS(cname, true,
+ IL_EACH(g_rubble, it.classname == cname,
{
++c;
if(!oldest || oldesttime > it.creationtime)
entity e = spawn();
e.classname = cname;
e.creationtime = time;
+ IL_PUSH(g_rubble, e);
return e;
}
setsize(this, GENERATOR_MIN, GENERATOR_MAX);
}
-void generator_construct(entity this)
+void generator_construct(entity this, bool isnew)
{
this.netname = "Generator";
this.classname = "onslaught_generator";
+ if(isnew)
+ IL_PUSH(g_onsgenerators, this);
+
setorigin(this, this.origin);
setmodel(this, MDL_ONS_GEN);
setsize(this, GENERATOR_MIN, GENERATOR_MAX);
this.count = 40;
generator_changeteam(this);
- generator_construct(this);
+ generator_construct(this, isnew);
}
if(sf & GSF_STATUS)