Generalize NPC AI stepping logic

The MobAI::Mobs map still needs to be removed.
This commit is contained in:
2021-03-31 21:05:49 +02:00
parent 3325397d17
commit 65462d01e3
7 changed files with 65 additions and 55 deletions

View File

@@ -11,6 +11,11 @@ enum class MobState {
DEAD
};
namespace MobAI {
// needs to be declared before Mob's constructor
void step(CombatNPC*, time_t);
};
struct Mob : public CombatNPC {
// general
MobState state = MobState::INACTIVE;
@@ -76,6 +81,7 @@ struct Mob : public CombatNPC {
appearanceData.iHP = maxHealth;
type = EntityType::MOB;
_stepAI = MobAI::step;
}
// constructor for /summon
@@ -98,8 +104,6 @@ namespace MobAI {
extern bool simulateMobs;
extern std::map<int32_t, Mob*> Mobs;
void init();
// TODO: make this internal later
void incNextMovement(Mob *mob, time_t currTime=0);
bool aggroCheck(Mob *mob, time_t currTime);