+#pragma once
+
/**
* Purpose: common player state, usable on client and server
* Client: singleton representing the viewed player
PlayerState PS(entity this) { assert(IS_CLIENT(this)); return this._ps; }
#endif
-void PlayerState_attach(entity this)
-{
- // TODO: dynamic
- // this._ps = NEW(PlayerState, this);
-}
-
-void PlayerState_detach(entity this)
-{
- // TODO: dynamic
- // if (!PS(this)) return; // initial connect
- // remove(PS(this));
- // this._ps = NULL;
-}
+// TODO: renew on death
+void PlayerState_attach(entity this);
+void PlayerState_detach(entity this);
/**
* Purpose: common client state, usable on client and server
ClientState CS(entity this) { assert(IS_CLIENT(this)); assert(this._cs); return this._cs; }
#endif
-void ClientState_attach(entity this)
-{
- this._cs = NEW(ClientState, this);
- this._ps = NEW(PlayerState, this); // TODO: dynamic
-}
-
-void ClientState_detach(entity this)
-{
- remove(CS(this));
- this._cs = NULL;
- this._ps = NULL; // TODO: dynamic
-}
+void ClientState_attach(entity this);
+void ClientState_detach(entity this);