Enemies and now using the GOAP AI to decide when to attack the player, but it's very rough right now. I need to sort out how to store the AI states and use them in the System.

This commit is contained in:
Zed A. Shaw 2025-03-14 11:14:25 -04:00
parent 77f2e94515
commit ad71631809
13 changed files with 61 additions and 30 deletions

View file

@ -9,6 +9,7 @@
#include <optional>
#include "easings.hpp"
#include "json_mods.hpp"
#include "goap.hpp"
namespace components {
@ -45,6 +46,11 @@ namespace components {
struct EnemyConfig {
int hearing_distance = 10;
std::string ai_script;
std::string ai_start_name;
std::string ai_goal_name;
ai::State ai_start;
ai::State ai_goal;
};
struct Debug {
@ -138,7 +144,8 @@ namespace components {
ENROLL_COMPONENT(Weapon, damage);
ENROLL_COMPONENT(Loot, amount);
ENROLL_COMPONENT(Position, location.x, location.y);
ENROLL_COMPONENT(EnemyConfig, hearing_distance);
ENROLL_COMPONENT(EnemyConfig, hearing_distance,
ai_script, ai_start_name, ai_goal_name);
ENROLL_COMPONENT(Motion, dx, dy, random);
ENROLL_COMPONENT(Combat, hp, max_hp, damage, dead);
ENROLL_COMPONENT(Device, config, events);