LOG_DEBUG(this.netname, " needs armor ", ftos(needarmor));
// See what is around
- FOREACH_ENTITY_FLOAT(bot_pickup, true,
+ IL_EACH(g_items, it.bot_pickup,
{
// gather health and armor only
if (it.solid)
this.classname = "item_buff";
this.solid = SOLID_TRIGGER;
this.flags = FL_ITEM;
+ this.bot_pickup = true;
+ this.bot_pickupevalfunc = commodity_pickupevalfunc;
+ this.bot_pickupbasevalue = 1000;
+ IL_PUSH(g_items, this);
setthink(this, buff_Think);
settouch(this, buff_Touch);
this.reset = buff_Reset;
if(player.buffs & BUFF_MAGNET.m_itemid)
{
vector pickup_size;
- FOREACH_ENTITY_FLAGS(flags, FL_ITEM,
+ IL_EACH(g_items, true,
{
if(it.buffs)
pickup_size = '1 1 1' * autocvar_g_buffs_magnet_range_buff;
// marker for item team search
LOG_TRACE("Initializing item team ", ftos(this.team));
RandomSelection_Init();
- FOREACH_ENTITY_FLOAT(team, this.team,
+ IL_EACH(g_items, it.team == this.team,
{
- if(it.flags & FL_ITEM)
if(it.classname != "item_flag_team" && it.classname != "item_key_team")
RandomSelection_Add(it, 0, string_null, it.cnt, 0);
});
e.state = 0;
Item_Show(e, 1);
- FOREACH_ENTITY_FLOAT(team, this.team,
+ IL_EACH(g_items, it.team == this.team,
{
- if(it.flags & FL_ITEM)
if(it.classname != "item_flag_team" && it.classname != "item_key_team")
{
if(it != e)
this.weapons = WepSet_FromWeapon(Weapons_from(weaponid));
this.flags = FL_ITEM | itemflags;
+ IL_PUSH(g_items, this);
if(MUTATOR_CALLHOOK(FilterItem, this)) // error means we do not want the item
{
if(move_out_of_solid(this))
{
this.flags = FL_ITEM;
+ IL_PUSH(g_items, this);
this.velocity = trigger_push_calculatevelocity(this.origin, this.realowner, 128);
tracetoss(this, this);
if(vdist(trace_endpos - this.realowner.origin, <, 128))
vector o;
ratingscale = ratingscale * 0.0001; // items are rated around 10000 already
- FOREACH_ENTITY_FLOAT(bot_pickup, true,
+ IL_EACH(g_items, it.bot_pickup,
{
o = (it.absmin + it.absmax) * 0.5;
friend_distance = 10000; enemy_distance = 10000;
void botframe_deleteuselesswaypoints()
{
- FOREACH_ENTITY_FLOAT(bot_pickup, true,
+ IL_EACH(g_items, it.bot_pickup,
{
// NOTE: this protects waypoints if they're the ONLY nearest
// waypoint. That's the intention.
break;
}
- if((draggee.flags & FL_ITEM) && (vlen(draggee.velocity) < 32))
+ if((draggee.flags & FL_ITEM) && (vdist(draggee.velocity, <, 32)))
{
draggee.velocity = '0 0 0';
SET_ONGROUND(draggee); // floating items are FUN
IntrusiveList g_projectiles;
STATIC_INIT(g_projectiles) { g_projectiles = IL_NEW(); }
+
+IntrusiveList g_items;
+STATIC_INIT(g_items) { g_items = IL_NEW(); }
if (j) LOG_INFOF("%d spawnpoints have no nearest waypoint (marked by player model)\n", j);
j = 0;
- FOREACH_ENTITY_FLAGS(flags, FL_ITEM,
+ IL_EACH(g_items, true,
{
it.effects &= ~(EF_NODEPTHTEST | EF_RED | EF_BLUE);
it.colormod = '0.5 0.5 0.5';
});
- FOREACH_ENTITY_FLAGS(flags, FL_ITEM,
+ IL_EACH(g_items, true,
{
if (navigation_findnearestwaypoint(it, false)) continue;
LOG_INFO("item without waypoint: ", etos(it), " ", vtos(it.origin), "\n");
if (j) LOG_INFOF("%d items have no nearest waypoint and cannot be walked away from (marked with red light)\n", j);
j = 0;
- FOREACH_ENTITY_FLAGS(flags, FL_ITEM,
+ IL_EACH(g_items, true,
{
if (navigation_findnearestwaypoint(it, true)) continue;
LOG_INFO("item without waypoint: ", etos(it), " ", vtos(it.origin), "\n");
break;
if(!sp)
{
- for(sp = NULL; (sp = findflags(sp, flags, FL_ITEM)); )
- if(checkpvs(mstart, sp))
- if((traceline(mstart, sp.origin + (sp.mins + sp.maxs) * 0.5, MOVE_NORMAL, e), trace_fraction) >= 1)
- break;
+ IL_EACH(g_items, checkpvs(mstart, it),
+ {
+ if((traceline(mstart, it.origin + (it.mins + it.maxs) * 0.5, MOVE_NORMAL, e), trace_fraction) >= 1)
+ {
+ sp = it;
+ break;
+ }
+ });
+
if(!sp)
continue;
}
flag.classname = "item_flag_team";
flag.target = "###item###"; // wut?
flag.flags = FL_ITEM | FL_NOTARGET;
+ IL_PUSH(g_items, flag);
flag.solid = SOLID_TRIGGER;
flag.takedamage = DAMAGE_NO;
flag.damageforcescale = autocvar_g_ctf_flag_damageforcescale;
void havocbot_goalrating_ctf_carrieritems(entity this, float ratingscale, vector org, float sradius)
{
- FOREACH_ENTITY_FLOAT(bot_pickup, true,
+ IL_EACH(g_items, it.bot_pickup,
{
// gather health and armor only
if (it.solid)
settouch(this, dompointtouch);
this.solid = SOLID_TRIGGER;
this.flags = FL_ITEM;
+ IL_PUSH(g_items, this);
setsize(this, '-32 -32 -32', '32 32 32');
setorigin(this, this.origin + '0 0 20');
droptofloor(this);
e.glow_color = autocvar_g_keepawayball_trail_color;
e.glow_trail = true;
e.flags = FL_ITEM;
+ IL_PUSH(g_items, e);
e.pushable = true;
e.reset = ka_Reset;
settouch(e, ka_TouchEvent);
key.angles_y += key.owner.angles.y;
#endif
key.flags = FL_ITEM;
+ IL_PUSH(g_items, key);
key.solid = SOLID_TRIGGER;
set_movetype(key, MOVETYPE_TOSS);
key.pain_finished = time + autocvar_g_balance_keyhunt_delay_return;
void Weapon_whereis(Weapon this, entity cl)
{
if (!autocvar_g_showweaponspawns) return;
- FOREACH_ENTITY_FLOAT(weapon, this.m_id,
+ IL_EACH(g_items, it.weapon == this.m_id,
{
if (it.classname == "droppedweapon" && autocvar_g_showweaponspawns < 2)
continue;
- if (!(it.flags & FL_ITEM))
- continue;
entity wp = WaypointSprite_Spawn(
WP_Weapon,
-2, 0,