Implement farming
This commit is contained in:
@@ -106,13 +106,20 @@ void inputUnitAction(Game *game, InputState *input) {
|
||||
ecs_entity_t entity = it.entities[i];
|
||||
Position target = *ecs_get(ECS, taskEntity, Position);
|
||||
|
||||
f32 proximity = 6.0f;
|
||||
if (resource.type == RES_FOOD)
|
||||
proximity = 2.0f;
|
||||
|
||||
Worker *worker = ecs_get_mut(ECS, entity, Worker);
|
||||
worker->carryRes = resource.type;
|
||||
|
||||
setAIBehaviour(entity, game->BTs.workerHarvest, &(AIBlackboard) {
|
||||
.as.worker = {
|
||||
.harvestType = resource.type,
|
||||
.harvestTarget = taskEntity,
|
||||
.harvestPos = target,
|
||||
},
|
||||
.proximity = 6.0f,
|
||||
.proximity = proximity,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user