diff --git a/code/apps/server/modules/modules/physics.h b/code/apps/server/modules/modules/physics.h index 7a2e54f..031247f 100644 --- a/code/apps/server/modules/modules/physics.h +++ b/code/apps/server/modules/modules/physics.h @@ -10,6 +10,7 @@ typedef struct { ECS_DECLARE_ENTITY(Walking); ECS_DECLARE_ENTITY(Flying); ECS_DECLARE_COMPONENT(Velocity); + ECS_DECLARE_ENTITY(MoveWalk); } Physics; #define PhysicsImportHandles(handles)\ @@ -17,5 +18,6 @@ typedef struct { ECS_IMPORT_ENTITY(handles, Walking);\ ECS_IMPORT_ENTITY(handles, Flying);\ ECS_IMPORT_COMPONENT(handles, Velocity);\ + ECS_IMPORT_ENTITY(handles, MoveWalk);\ void PhysicsImport(ecs_world_t *ecs); diff --git a/code/apps/server/modules/source/physics.c b/code/apps/server/modules/source/physics.c index 4de4af5..d851aa0 100644 --- a/code/apps/server/modules/source/physics.c +++ b/code/apps/server/modules/source/physics.c @@ -1,5 +1,9 @@ #include "modules/physics.h" +void MoveWalk(ecs_iter_t *it) { + +} + void PhysicsImport(ecs_world_t *ecs) { ECS_MODULE(ecs, Physics); ecs_set_name_prefix(ecs, "Physics"); @@ -10,8 +14,11 @@ void PhysicsImport(ecs_world_t *ecs) { ECS_COMPONENT(ecs, Velocity); + ECS_SYSTEM(ecs, MoveWalk, EcsOnUpdate, general.Position, Velocity, SWITCH | Movement, CASE | Walking); + ECS_SET_TYPE(Movement); ECS_SET_ENTITY(Walking); ECS_SET_ENTITY(Flying); ECS_SET_COMPONENT(Velocity); + ECS_SET_ENTITY(MoveWalk); } diff --git a/code/apps/server/source/world/world.c b/code/apps/server/source/world/world.c index b68538b..7fc4fc7 100644 --- a/code/apps/server/source/world/world.c +++ b/code/apps/server/source/world/world.c @@ -2,6 +2,9 @@ #include "librg.h" #include "modules/general.h" #include "world/world.h" +#include "flecs/flecs.h" +#include "flecs/flecs_dash.h" +#include "flecs/flecs_systems_civetweb.h" typedef struct { uint8_t *data; @@ -73,6 +76,14 @@ int32_t world_init(int32_t seed, uint16_t block_size, uint16_t chunk_size, uint1 ecs_set_threads(world.ecs, 4); ecs_set_target_fps(world.ecs, 60); + /* server dashboard */ + { + ECS_IMPORT(world_ecs(), FlecsDash); + ECS_IMPORT(world_ecs(), FlecsSystemsCivetweb); + + ecs_set(world_ecs(), 0, EcsDashServer, {.port = 27001}); + } + world.tracker = librg_world_create(); if (world.tracker == NULL) {