RavEngine
Loading...
Searching...
No Matches
NetworkIdentity.hpp
1#pragma once
2#include "ComponentWithOwner.hpp"
3#include "Queryable.hpp"
4#include "Uuid.hpp"
5#include <steam/isteamnetworkingutils.h>
6
7namespace RavEngine {
8 struct NetworkIdentity : public ComponentWithOwner, public Queryable<NetworkIdentity>{
9 private:
10 uuids::uuid NetworkID;
11 ctti_t NetTypeID = 0; // the CTTI type of the T when it was constructed via Instantiate<T>, on clients this is set to 0
12 public:
13
14 //default constructor - used on Server (triggers spawn message)
15 NetworkIdentity(Entity owner, ctti_t ent_type_id) : NetworkID(uuids::uuid::create()), NetTypeID(ent_type_id), ComponentWithOwner(owner) {}
16
17 //Used on clients
18 NetworkIdentity(Entity owner, const uuids::uuid& id) : NetworkID(id),ComponentWithOwner(owner){
19 // don't trigger spawn message
20 }
21
22 MOVE_NO_COPY(NetworkIdentity);
23
24 inline const decltype(NetworkID)& GetNetworkID() const{
25 return NetworkID;
26 }
27
28 inline decltype(NetTypeID) GetNetTypeID() const {
29 return NetTypeID;
30 }
31
33
42 bool IsOwner() const;
43 };
44}
Definition ComponentWithOwner.hpp:6
Definition concurrentqueue.h:747
Definition Animation.hpp:6
Definition Entity.hpp:11
Definition NetworkIdentity.hpp:8
bool IsOwner() const
Definition NetworkIdentity.cpp:5
Definition Queryable.hpp:21
Definition Uuid.hpp:7