Basic wood chopping
This commit is contained in:
15
game/main.c
15
game/main.c
@@ -131,7 +131,7 @@ bool init(void *userData) {
|
||||
.userDataSize=sizeof(ecs_entity_t)
|
||||
});
|
||||
|
||||
ECS_OBSERVER(ECS, entitySpatialRemove, EcsOnRemove, Position, SpatialGridID);
|
||||
ECS_OBSERVER(ECS, entitySpatialRemove, EcsOnRemove, SpatialGridID);
|
||||
ECS_OBSERVER(ECS, entityPathRemove, EcsOnRemove, Path);
|
||||
|
||||
ECS_OBSERVER(ECS, entitySetAnimationState, EcsOnSet, Animation, AnimationType);
|
||||
@@ -150,6 +150,8 @@ bool init(void *userData) {
|
||||
ECS_SYSTEM(ECS, entityMoveToTarget, EcsOnUpdate, Position, Rotation, Velocity, TargetPosition, Steering);
|
||||
ECS_SYSTEM(ECS, entityFollowPath, EcsOnUpdate, Path);
|
||||
|
||||
ECS_SYSTEM(ECS, entityHarvestTaskSystem, EcsOnUpdate, Position, Rotation, HarvestTask);
|
||||
|
||||
ECS_SYSTEM(ECS, entityUpdateAnimationState, EcsOnUpdate, Velocity, AnimationType);
|
||||
ECS_SYSTEM(ECS, entityUpdateAnimation, EcsOnUpdate, Animation, TextureRegion);
|
||||
|
||||
@@ -246,6 +248,10 @@ void imguiRender(float dt, void *userData) {
|
||||
|
||||
igSetNextWindowSize((ImVec2){300, 400}, ImGuiCond_FirstUseEver);
|
||||
igBegin("Debug Menu", NULL, 0);
|
||||
if (igSmallButton("Recruit worker [50 food]")) {
|
||||
createWorker((Position) {1100, 400}, (Size) {10, 10}, game->entityGrid,
|
||||
&game->map.tilesets[2], 1322);
|
||||
}
|
||||
igText("Num paths from pool available: %llu", bzObjectPoolCalcNumFree(game->pools.pathData));
|
||||
const char *inputState = "NONE";
|
||||
switch (input->state) {
|
||||
@@ -287,9 +293,10 @@ void imguiRender(float dt, void *userData) {
|
||||
ecs_entity_t entity = it.entities[i];
|
||||
if (ecs_has(ECS, entity, Harvestable) &&
|
||||
ecs_has(ECS, entity, Resource)) {
|
||||
Resource res = *ecs_get(ECS, entity, Resource);
|
||||
const char *resName = getResourceTypePrettyName(res.type);
|
||||
igText("\tEntity %llu: %d %s", entity, res.amount, resName);
|
||||
Resource *res = ecs_get_mut(ECS, entity, Resource);
|
||||
const char *resName = getResourceTypePrettyName(res->type);
|
||||
igText("\tEntity %llu:", entity);
|
||||
igSliderInt("\t\twood", &res->amount, 0, 20, NULL, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user