R-Type 0.1
Loading...
Searching...
No Matches
NetworkEntity.hpp
1#pragma once
2
3#include <cstdint>
4#include <nlohmann/json.hpp>
5
6#include <Registry.hpp>
7#include <cstdint>
8
9namespace component {
19 std::uint32_t id{0};
20 std::uint16_t archetypeId{0};
21};
22
29inline void networkEntityFromJson(rtk::ecs::Registry &reg, std::size_t entity,
30 const nlohmann::json &data) {
31 component::NetworkEntity networkEntity{};
32 networkEntity.id = data.value("id", 0u);
33 networkEntity.archetypeId =
34 data.value("archetypeId", static_cast<std::uint16_t>(0));
35
36 reg.get_components<component::NetworkEntity>().insert_at(entity,
37 networkEntity);
38}
39
41} // namespace component
void networkEntityFromJson(rtk::ecs::Registry &reg, std::size_t entity, const nlohmann::json &data)
Adds a NetworkEntity to an entity from its blueprint data.
Definition NetworkEntity.hpp:29
Links a local entity to its replicated counterpart.
Definition NetworkEntity.hpp:18
std::uint16_t archetypeId
Archetype id of the entity blueprint.
Definition NetworkEntity.hpp:20
std::uint32_t id
Network id assigned by the server.
Definition NetworkEntity.hpp:19