Fix and integrate BT

This commit is contained in:
2024-01-10 14:42:21 +01:00
parent a9d20cb7f9
commit 3ba5c8932b
16 changed files with 551 additions and 109 deletions

View File

@@ -1,5 +1,6 @@
#include "entity_factory.h"
#include "unit_actions.h"
#include "ai_actions.h"
ecs_entity_t entityCreateEmpty() {
ecs_entity_t e = ecs_new_id(ECS);
@@ -35,7 +36,11 @@ ecs_entity_t entityCreateWorker(const Position position, Game *game) {
.curFrame = 0,
.elapsed = 0.0f,
});
ecs_set(ECS, e, UnitAction, { NULL, NULL });
ecs_set(ECS, e, BzBTState, {
.root = NULL,
.nodeStatePool = game->pools.btNodeState
});
ecs_set(ECS, e, AIBlackboard, {.entity = e});
ecs_add_id(ECS, e, Selectable);
ecs_set(ECS, e, Unit, {
.acceleration = 80.0f,