mirror of
https://github.com/zhenyan121/Cubed.git
synced 2026-08-08 17:57:02 +08:00
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:
@@ -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(); }
|
||||
|
||||
Reference in New Issue
Block a user