-void havocbot_goalrating_ons_offenseitems(entity this, float ratingscale, vector org, float sradius)
-{
- bool needarmor = false, needweapons = false;
-
- // Needs armor/health?
- if(GetResourceAmount(this, RESOURCE_HEALTH) < 100)
- needarmor = true;
-
- // Needs weapons?
- int c = 0;
- FOREACH(Weapons, it != WEP_Null, {
- if(STAT(WEAPONS, this) & (it.m_wepset))
- if(++c >= 4)
- break;
- });
-
- if(c<4)
- needweapons = true;
-
- if(!needweapons && !needarmor)
- return;
-
- LOG_DEBUG(this.netname, " needs weapons ", ftos(needweapons));
- LOG_DEBUG(this.netname, " needs armor ", ftos(needarmor));
-
- // See what is around
- IL_EACH(g_items, it.bot_pickup,
- {
- // gather health and armor only
- if (it.solid)
- if ( ((GetResourceAmount(it, RESOURCE_HEALTH) || GetResourceAmount(it, RESOURCE_ARMOR)) && needarmor) || (STAT(WEAPONS, it) && needweapons ) )
- if (vdist(it.origin - org, <, sradius))
- {
- int t = it.bot_pickupevalfunc(this, it);
- if (t > 0)
- navigation_routerating(this, it, t * ratingscale, 500);
- }
- });
-}
-