1 #ifndef CORE_SYSTEMS_AI_HPP
2 #define CORE_SYSTEMS_AI_HPP
4 #include <BLIB/ECS.hpp>
5 #include <BLIB/Engine/System.hpp>
25 class AI :
public bl::engine::System {
37 virtual ~AI() =
default;
55 bool makeStanding(bl::ecs::Entity entity, bl::tmap::Direction dir);
83 bool makeWander(bl::ecs::Entity entity,
unsigned int radius);
94 bool moveToPosition(bl::ecs::Entity entity,
const bl::tmap::Position& dest);
105 using StandingTypes =
106 bl::ecs::Require<component::StandingBehavior, bl::tmap::Position, component::Controllable>;
108 bl::ecs::Require<component::SpinBehavior, bl::tmap::Position, component::Controllable>;
109 using FixedPathTypes =
110 bl::ecs::Require<component::FixedPathBehavior, bl::tmap::Position, component::Controllable>;
112 bl::ecs::Require<component::WanderBehavior, bl::tmap::Position, component::Controllable>;
114 using StandingView = bl::ecs::View<StandingTypes>*;
115 using StandingRow = bl::ecs::ComponentSet<StandingTypes>;
116 using SpinView = bl::ecs::View<SpinTypes>*;
117 using SpinRow = bl::ecs::ComponentSet<SpinTypes>;
118 using FixedPathView = bl::ecs::View<FixedPathTypes>*;
119 using FixedPathRow = bl::ecs::ComponentSet<FixedPathTypes>;
120 using WanderView = bl::ecs::View<WanderTypes>*;
121 using WanderRow = bl::ecs::ComponentSet<WanderTypes>;
124 StandingView standing;
127 WanderView wandering;
131 virtual void init(bl::engine::Engine&)
override;
132 virtual void update(std::mutex&,
float dt,
float,
float,
float)
override;
Core classes and functionality for both the editor and game.
Component that dynamically navigates an entity to a specific tile. The entities Controllable componen...
Set of behaviors for NPCs and trainers.
Direction
The direction to spin.
Contains data for when the behavior type is following a path.
Manages NPC's and trainers and their behaviors.
virtual ~AI()=default
Destroys the system.
AI(Systems &owner)
Construct a new AI system.
void removeAi(bl::ecs::Entity ent)
Removes any ai behavior from the given entity. Does not affect path finding.
bool makeSpinning(bl::ecs::Entity entity, file::Behavior::Spinning::Direction dir)
Makes the given entity spin in place. Replaces any existing behavior.
bool addBehavior(bl::ecs::Entity entity, const file::Behavior &behavior)
Helper function for adding the given behavior to the given entity.
bool makeStanding(bl::ecs::Entity entity, bl::tmap::Direction dir)
Makes the given entity stand in place. Replaces any existing behavior on the entity.
bool moveToPosition(bl::ecs::Entity entity, const bl::tmap::Position &dest)
Uses a pathfinder to navigate the entity to the given position and end up facing the given direction....
bool makeFollowPath(bl::ecs::Entity entity, const file::Behavior::Path &path)
Make the entity follow a fixed path. Replaces existing behavior.
bool makeWander(bl::ecs::Entity entity, unsigned int radius)
Makes the given entity wander around within the given radius. Replaces any existing behavior the enti...
Owns all primary systems and a reference to the engine.