#include "../scripting.qh"
#include "../waypoints.qh"
-#include "../../../common/constants.qh"
-#include "../../../common/items/all.qh"
+#include <common/constants.qh>
+#include <common/items/all.qh>
-#include "../../../common/triggers/trigger/jumppads.qh"
+#include <common/triggers/trigger/jumppads.qh>
-#include "../../../lib/warpzone/common.qh"
+#include <lib/warpzone/common.qh>
.float speed;
// TODO: tracewalk() should take care of this job (better path finding under water)
// if we don't have a goal and we're under water look for a waypoint near the "shore" and push it
- if(self.deadflag != DEAD_NO)
+ if(IS_DEAD(self))
if(self.goalcurrent==world)
if(self.waterlevel==WATERLEVEL_SWIMMING || (self.aistatus & AI_STATUS_OUT_WATER))
{
bot_strategytoken_taken = true;
}
- if(self.deadflag != DEAD_NO)
+ if(IS_DEAD(self))
return;
havocbot_chooseenemy();
if(skill >= 5) // bots can only look for unloaded weapons past this skill
if(self.clip_load >= 0) // only if we're not reloading a weapon already
{
- for (int i = WEP_FIRST; i <= WEP_LAST; ++i)
- {
- entity e = Weapons_from(i);
- if ((self.weapons & (e.m_wepset)) && (e.spawnflags & WEP_FLAG_RELOADABLE) && (self.weapon_load[i] < e.reloading_ammo))
- PS(self).m_switchweapon = Weapons_from(i);
- }
+ FOREACH(Weapons, it != WEP_Null, LAMBDA(
+ if((self.weapons & (it.m_wepset)) && (it.spawnflags & WEP_FLAG_RELOADABLE) && (self.weapon_load[it.m_id] < it.reloading_ammo))
+ PS(self).m_switchweapon = it;
+ ));
}
}
}
bunnyhopdistance = vlen(self.origin - gco);
// Run only to visible goals
- if(self.flags & FL_ONGROUND)
+ if(IS_ONGROUND(self))
if(self.speed==maxspeed)
if(checkpvs(self.origin + self.view_ofs, self.goalcurrent))
{
#if 0
// Release jump button
if(!cvar("sv_pogostick"))
- if((self.flags & FL_ONGROUND) == 0)
+ if((IS_ONGROUND(self)) == 0)
{
if(self.velocity.z < 0 || vlen(self.velocity)<maxspeed)
self.BUTTON_JUMP = false;
// Flying
self.BUTTON_HOOK = true;
- if(self.navigation_jetpack_point.z - PL_MAX.z + PL_MIN.z < self.origin.z)
+ if(self.navigation_jetpack_point.z - STAT(PL_MAX, NULL).z + STAT(PL_MIN, NULL).z < self.origin.z)
{
self.movement_x = dir * v_forward * maxspeed;
self.movement_y = dir * v_right * maxspeed;
// If there is a trigger_hurt right below try to use the jetpack or make a rocketjump
if(skill>6)
- if (!(self.flags & FL_ONGROUND))
+ if (!(IS_ONGROUND(self)))
{
tracebox(self.origin, self.mins, self.maxs, self.origin + '0 0 -65536', MOVE_NOMONSTERS, self);
if(tracebox_hits_trigger_hurt(self.origin, self.mins, self.maxs, trace_endpos ))
self.aistatus &= ~AI_STATUS_DANGER_AHEAD;
if(trace_fraction == 1 && self.jumppadcount == 0 && !self.goalcurrent.wphardwired )
- if((self.flags & FL_ONGROUND) || (self.aistatus & AI_STATUS_RUNNING) || self.BUTTON_JUMP == true)
+ if((IS_ONGROUND(self)) || (self.aistatus & AI_STATUS_RUNNING) || self.BUTTON_JUMP == true)
{
// Look downwards
traceline(dst_ahead , dst_down, true, world);
if(skill+self.bot_moveskill >= autocvar_bot_ai_bunnyhop_skilloffset)
havocbot_bunnyhop(dir);
- if ((dir * v_up) >= autocvar_sv_jumpvelocity*0.5 && (self.flags & FL_ONGROUND)) self.BUTTON_JUMP=1;
+ if ((dir * v_up) >= autocvar_sv_jumpvelocity*0.5 && (IS_ONGROUND(self))) self.BUTTON_JUMP=1;
if (((dodge * v_up) > 0) && random()*frametime >= 0.2*bound(0,(10-skill-self.bot_dodgeskill)*0.1,1)) self.BUTTON_JUMP=true;
if (((dodge * v_up) < 0) && random()*frametime >= 0.5*bound(0,(10-skill-self.bot_dodgeskill)*0.1,1)) self.havocbot_ducktime=time+0.3/bound(0.1,skill+self.bot_dodgeskill,10);
}
// if this weapon is scheduled for reloading, don't switch to it during combat
if (self.weapon_load[new_weapon] < 0)
{
- float i, other_weapon_available = false;
- for(i = WEP_FIRST; i <= WEP_LAST; ++i)
- {
- Weapon w = Weapons_from(i);
- // if we are out of ammo for all other weapons, it's an emergency to switch to anything else
- if (w.wr_checkammo1(w) + w.wr_checkammo2(w))
+ bool other_weapon_available = false;
+ FOREACH(Weapons, it != WEP_Null, LAMBDA(
+ if(it.wr_checkammo1(it) + it.wr_checkammo2(it))
other_weapon_available = true;
- }
+ ));
if(other_weapon_available)
return true;
}
{
// If no weapon was chosen get the first available weapon
if(PS(self).m_weapon==WEP_Null)
- for(i = WEP_FIRST; i <= WEP_LAST; ++i) if(i != WEP_BLASTER.m_id)
- {
- if(client_hasweapon(self, Weapons_from(i), true, false))
+ FOREACH(Weapons, it != WEP_Null, LAMBDA(
+ if(client_hasweapon(self, it, true, false))
{
- PS(self).m_switchweapon = Weapons_from(i);
+ PS(self).m_switchweapon = it;
return;
}
- }
+ ));
return;
}