Limit how many workers can harvest the same resource

This commit is contained in:
2024-02-05 09:19:59 +01:00
parent ab0fef8ebf
commit d55ed29f97
11 changed files with 87 additions and 19 deletions

View File

@@ -3,6 +3,13 @@
#include "../game_state.h"
#include "../ai_actions.h"
void resetHarvestCount(ecs_iter_t *it) {
Harvestable *harvestable = ecs_field(it, Harvestable, 1);
for (i32 i = 0; i < it->count; i++) {
harvestable[i].harvestCount = 0;
}
}
void updateAISystem(ecs_iter_t *it) {
Game *game = ecs_singleton_get_mut(ECS, Game);