no message
git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@768 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
@@ -73,97 +73,7 @@ void CACBot::Spawn()
|
||||
|
||||
void CACBot::CheckItemPickup()
|
||||
{
|
||||
if(editmode) return;
|
||||
loopv(ents)
|
||||
{
|
||||
entity &e = ents[i];
|
||||
if(e.type==NOTUSED) continue;
|
||||
|
||||
if (!e.spawned) continue;
|
||||
if (sents.inrange(i) && (!sents[i].spawned)) continue;
|
||||
|
||||
if(OUTBORD(e.x, e.y)) continue;
|
||||
vec v(e.x, e.y, S(e.x, e.y)->floor+m_pMyEnt->eyeheight);
|
||||
|
||||
if(v.dist(m_pMyEnt->o)<2.5)
|
||||
{
|
||||
PickUp(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CACBot::PickUp(int n)
|
||||
{
|
||||
int np = 1;
|
||||
loopv(players) if(players[i]) np++;
|
||||
np = np<3 ? 4 : (np>4 ? 2 : 3); // spawn times are dependent on number of players
|
||||
int ammo = np*2;
|
||||
switch(ents[n].type)
|
||||
{
|
||||
case I_AMMO: AddItem(n, m_pMyEnt->ammo[m_pMyEnt->primary], ammo, m_pMyEnt->primary); break;
|
||||
case I_CLIPS: AddItem(n, m_pMyEnt->ammo[GUN_PISTOL], ammo, GUN_PISTOL); break;
|
||||
case I_GRENADE: AddItem(n, m_pMyEnt->ammo[GUN_GRENADE], ammo, 6); break;
|
||||
case I_HEALTH: AddItem(n, m_pMyEnt->health, ammo, 7); break;
|
||||
case I_ARMOUR: AddItem(n, m_pMyEnt->armour, ammo, 8); break;
|
||||
|
||||
/* case I_HELMET:
|
||||
// (100h/100g only absorbs 166 damage)
|
||||
if(m_pMyEnt->armourtype==A_YELLOW && m_pMyEnt->armour>66) break;
|
||||
AddItem(n, m_pMyEnt->armour, 20);
|
||||
break;
|
||||
|
||||
case I_ARMOUR:
|
||||
AddItem(n, m_pMyEnt->armour, 20);
|
||||
break;
|
||||
|
||||
case OBJ_ITEM:
|
||||
AddItem(n, m_pMyEnt->quadmillis, 60);
|
||||
break;*/
|
||||
|
||||
/* case TRIGGER:
|
||||
ents[n].spawned = false;
|
||||
triggertime = lastmillis;
|
||||
trigger(ents[n].attr1, ents[n].attr2, false); // needs to go over server for multiplayer
|
||||
|
||||
// HACK: Reset ent goal if bot was looking for this ent
|
||||
if (m_pTargetEnt == &ents[n])
|
||||
{
|
||||
m_pTargetEnt = NULL;
|
||||
m_vGoal = g_vecZero;
|
||||
ResetWaypointVars();
|
||||
m_iCheckEntsDelay = lastmillis + RandomLong(5000, 10000);
|
||||
}
|
||||
|
||||
BotManager.PickNextTrigger();
|
||||
break;*/
|
||||
};
|
||||
};
|
||||
|
||||
void CACBot::AddItem(int i, int &v, int spawnsec, int t)
|
||||
{
|
||||
if((i>=sents.length()) || (!sents[i].spawned))
|
||||
return;
|
||||
|
||||
//fixmebot
|
||||
if(v>=itemstats[t].max) // don't pick up if not needed
|
||||
return;
|
||||
|
||||
itemstat &is = itemstats[t];
|
||||
ents[i].spawned = false;
|
||||
v += is.add;
|
||||
if(v>is.max) v = is.max;
|
||||
playsound(is.sound, &m_pMyEnt->o);
|
||||
sents[i].spawned = false;
|
||||
sents[i].spawnsecs = spawnsec;
|
||||
|
||||
// HACK: Reset ent goal if bot was looking for for this ent
|
||||
if (m_pTargetEnt == &ents[i])
|
||||
{
|
||||
m_pTargetEnt = NULL;
|
||||
m_vGoal = g_vecZero;
|
||||
ResetWaypointVars();
|
||||
m_iCheckEntsDelay = lastmillis + RandomLong(5000, 10000);
|
||||
};
|
||||
checkitems(m_pMyEnt);
|
||||
}
|
||||
|
||||
// AC Bot class end
|
||||
|
||||
Reference in New Issue
Block a user