feat(entity): add client-to-server entity creation and destruction requests

Extend the network protocol with `C2SEntityCreateRequest` and `C2SEntityDestoryRequest` packets. Refactor entity managers to split public client-facing create/destroy methods that send requests over the network, from internal handlers that process received packets. Add utility functions for converting protobuf Vec3 to glm::vec3.
This commit is contained in:
2026-07-30 15:53:09 +08:00
parent 826c6600d0
commit d6f304e6ca
13 changed files with 102 additions and 10 deletions

View File

@@ -17,8 +17,9 @@ void ServerEntityManager::init() {
m_factories.try_emplace("cubed:pig", [this]() {
BaseServerCreature c;
c.hitbox = HitboxManager::instance().get_hitbox_id("cubed:pig");
return add_entity(Entity{m_next}, EntityInfo{"cubed:pig", ""},
std::move(c), PigTag{});
return create_entity_in_factory(Entity{m_next},
EntityInfo{"cubed:pig", ""},
std::move(c), PigTag{});
});
}
void ServerEntityManager::update() { handle_task(); }