mirror of
https://github.com/OpenFusionProject/OpenFusion.git
synced 2025-12-17 02:20:05 +00:00
Generalize NPC AI stepping logic
The MobAI::Mobs map still needs to be removed.
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user