2#include "NetworkServer.hpp"
3#include "NetworkClient.hpp"
4#include "DataStructures.hpp"
13 struct NetworkIdentity;
24 typedef char YesType[1];
25 typedef char NoType[2];
27 template <
typename C>
static YesType& test(
decltype(&C::ClientCreate));
28 template <
typename C>
static NoType& test(...);
32 enum { value =
sizeof(
test<T>(0)) ==
sizeof(YesType) };
37 bool isNetworkEntity(ctti_t
id)
const{
38 return NetworkedObjects.contains(
id);
41 std::optional<Entity> CreateEntity(ctti_t
id,
World* world){
42 std::optional<Entity> value;
43 NetworkedObjects.if_contains(
id, [&](
const auto& fn) {
59 if constexpr (HasClientCreate<T>::value) {
72 NetworkedObjects.erase(
CTTI<T>);
81 return NetworkedObjects.contains(
CTTI<T>);
100 std::unique_ptr<NetworkServer> server;
101 std::unique_ptr<NetworkClient> client;
Definition NetworkManager.hpp:15
static bool IsClient()
Definition NetworkManager.cpp:32
static bool IsNetworked()
Definition NetworkManager.hpp:96
void Destroy(const uuids::uuid &entity_id)
Definition NetworkManager.cpp:22
constexpr void RegisterNetworkedEntity()
Definition NetworkManager.hpp:56
void Spawn(World *source, ctti_t type_id, Entity ent_id, const uuids::uuid &entity_id)
Definition NetworkManager.cpp:9
constexpr void UnregisterNetworkedEntity()
Definition NetworkManager.hpp:71
static bool IsServer()
Definition NetworkManager.cpp:36
constexpr bool IsNetworkedIdentityRegistered()
Definition NetworkManager.hpp:80
T Instantiate(A &&... args)
Definition World.hpp:1093
Definition concurrentqueue.h:747
Definition Animation.hpp:6