Hi asherkin,
I've explored IServerTools and it looks promising. In parralel I've also read the "Entity Properties" wiki page and tried the Datamap Properties example, which was almost the same as my need for health, except I swapped the "set" usecase to a "get" usecase.
Still, I'm stuck in the same "headers and compiling" issues.
I've added this include in my file :
#include "itoolentity.h"
...which grants me access to the IServerTools interface, but this header only defines a forward declaration to CBaseEntity, so I cannot access anything related to it.
Compiling with the added snippet from the "Entity Properties" wiki page gives me this error, as I don't have a Class declaration of CBaseEntity:
1>------ Build started: Project: my_plugin, Configuration: Debug - Orange Box Valve Win32 ------
1> my_watcher.cpp
1>c:\users\manuel\code\source_mods\metamod-source\projects\my_plugin\my_watcher.cpp(51): error C2027: use of undefined type 'CBaseEntity'
1> c:\users\manuel\code\source_mods\hl2sdk-sdk2013\public\gametrace.h(22) : see declaration of 'CBaseEntity'
1>c:\users\manuel\code\source_mods\metamod-source-my\projects\my_plugin\my_watcher.cpp(51): error C2227: left of '->GetDataDescMap' must point to class/struct/union/generic type
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
I tried including "baseentity.h" and it load up a shitload of missing references (see below),pretty much the same with "baseentity_shared.h", and even worse if I try, naively, to include "cbase.h", I always end up stuck with missing classes like "CNetworkHandle" or such.
I think I'm missing a piece of information on how to get access to class methods of the CBaseEntity class...
Sorry if this is a noob C++ question, I'm still learning.
Do you have any tips?
The shitload of missing references:
1>------ Build started: Project: my_plugin, Configuration: Debug - Orange Box Valve Win32 ------
1> my_watcher.cpp
1>c:\users\manuel\code\source_mods\hl2sdk-sdk2013\game\server\entitylist.h(74): error C2504: 'CBaseEntityList' : base class undefined
1>c:\users\manuel\code\source_mods\hl2sdk-sdk2013\game\server\entitylist.h(179): error C3861: 'LookupEntity': identifier not found
1>c:\users\manuel\code\source_mods\hl2sdk-sdk2013\game\server\entitylist.h(18
: error C3861: 'LookupEntity': identifier not found
1>c:\users\manuel\code\source_mods\hl2sdk-sdk2013\game\server\entitylist.h(197): error C3861: 'LookupEntity': identifier not found
1>c:\users\manuel\code\source_mods\hl2sdk-sdk2013\game\server\entitylist.h(206): error C3861: 'LookupEntity': identifier not found
1>c:\users\manuel\code\source_mods\hl2sdk-sdk2013\game\server\entitylist.h(256): error C2146: syntax error : missing ';' before identifier 'hEnt'
1>c:\users\manuel\code\source_mods\hl2sdk-sdk2013\game\server\entitylist.h(256): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\manuel\code\source_mods\hl2sdk-sdk2013\game\server\entityoutput.h(67): error C2061: syntax error : identifier 'ISave'
1>c:\users\manuel\code\source_mods\hl2sdk-sdk2013\game\server\entityoutput.h(6
: error C2061: syntax error : identifier 'IRestore'
1>c:\users\manuel\code\source_mods\hl2sdk-sdk2013\game\server\entityoutput.h(82): error C2079: 'CBaseEntityOutput::m_Value' uses undefined class 'variant_t'
1>c:\users\manuel\code\source_mods\hl2sdk-sdk2013\game\server\entityoutput.h(74): error C2228: left of '.FieldType' must have class/struct/union
1> type is 'int'
1>c:\users\manuel\code\source_mods\hl2sdk-sdk2013\game\server\entityoutput.h(136): error C2228: left of '.SetVector3D' must have class/struct/union
1> type is 'int'
1>c:\users\manuel\code\source_mods\hl2sdk-sdk2013\game\server\entityoutput.h(141): error C2228: left of '.SetVector3D' must have class/struct/union
1> type is 'int'
1>c:\users\manuel\code\source_mods\hl2sdk-sdk2013\game\server\entityoutput.h(142): error C2664: 'void CBaseEntityOutput::FireOutput(variant_t,CBase Entity *,CBaseEntity *,float)' : cannot convert argument 1 from 'int' to 'variant_t'
1> Source or target has incomplete type
1>c:\users\manuel\code\source_mods\hl2sdk-sdk2013\game\server\entityoutput.h(147): error C2228: left of '.Vector3D' must have class/struct/union
1> type is 'int'
1>c:\users\manuel\code\source_mods\hl2sdk-sdk2013\game\server\entityoutput.h(15
: error C2228: left of '.SetPositionVector3D' must have class/struct/union
1> type is 'int'
1>c:\users\manuel\code\source_mods\hl2sdk-sdk2013\game\server\entityoutput.h(163): error C2228: left of '.SetPositionVector3D' must have class/struct/union
1> type is 'int'
1>c:\users\manuel\code\source_mods\hl2sdk-sdk2013\game\server\entityoutput.h(164): error C2664: 'void CBaseEntityOutput::FireOutput(variant_t,CBase Entity *,CBaseEntity *,float)' : cannot convert argument 1 from 'int' to 'variant_t'
1> Source or target has incomplete type
1>c:\users\manuel\code\source_mods\hl2sdk-sdk2013\game\server\entityoutput.h(169): error C2228: left of '.Vector3D' must have class/struct/union
1> type is 'int'
1>c:\users\manuel\code\source_mods\hl2sdk-sdk2013\game\server\entityoutput.h(190): error C2065: 'EHANDLE' : undeclared identifier
1>c:\users\manuel\code\source_mods\hl2sdk-sdk2013\game\server\entityoutput.h(190): error C2923: 'CEntityOutputTemplate' : 'EHANDLE' is not a valid template type argument for parameter 'Type'
1>c:\users\manuel\code\source_mods\hl2sdk-sdk2013\game\shared\collisionproperty.h(61): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\manuel\code\source_mods\hl2sdk-sdk2013\game\shared\collisionproperty.h(61): warning C4183: 'DECLARE_PREDICTABLE': missing return type; assumed to be a member function returning 'int'
1>c:\users\manuel\code\source_mods\hl2sdk-sdk2013\game\shared\collisionproperty.h(28
: error C2065: 'DT_CollisionProperty' : undeclared identifier
1>c:\users\manuel\code\source_mods\hl2sdk-sdk2013\game\shared\collisionproperty.h(28
: error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\manuel\code\source_mods\hl2sdk-sdk2013\game\server\servernetworkproperty.h(7 2): error C2061: syntax error : identifier 'EHANDLE'
1>c:\users\manuel\code\source_mods\hl2sdk-sdk2013\game\server\servernetworkproperty.h(1 21): error C2146: syntax error : missing ';' before identifier 'm_hParent'
1>c:\users\manuel\code\source_mods\hl2sdk-sdk2013\game\server\servernetworkproperty.h(1 21): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\manuel\code\source_mods\hl2sdk-sdk2013\game\server\servernetworkproperty.h(1 70): error C2065: 'EHANDLE' : undeclared identifier
1>c:\users\manuel\code\source_mods\hl2sdk-sdk2013\game\server\servernetworkproperty.h(1 70): error C2146: syntax error : missing ')' before identifier 'hParent'
1>c:\users\manuel\code\source_mods\hl2sdk-sdk2013\game\server\servernetworkproperty.h(1 70): error C2761: 'void CServerNetworkProperty::SetNetworkParent(void )' : member function redeclaration not allowed
1>c:\users\manuel\code\source_mods\hl2sdk-sdk2013\game\server\servernetworkproperty.h(1 70): error C2059: syntax error : ')'
1>c:\users\manuel\code\source_mods\hl2sdk-sdk2013\game\server\servernetworkproperty.h(1 71): error C2143: syntax error : missing ';' before '{'
1>c:\users\manuel\code\source_mods\hl2sdk-sdk2013\game\server\servernetworkproperty.h(1 71): error C2447: '{' : missing function header (old-style formal list?)
1>c:\users\manuel\code\source_mods\hl2sdk-sdk2013\game\server\servernetworkproperty.h(2 22): error C3861: 'ENTINDEX': identifier not found
1>c:\users\manuel\code\source_mods\hl2sdk-sdk2013\game\server\baseentity.h(39): error C2143: syntax error : missing ';' before '<'
1>c:\users\manuel\code\source_mods\hl2sdk-sdk2013\game\server\baseentity.h(39): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\manuel\code\source_mods\hl2sdk-sdk2013\game\server\baseentity.h(210): error C2079: 'inputdata_t::value' uses undefined class 'variant_t'
1>c:\users\manuel\code\source_mods\hl2sdk-sdk2013\game\server\baseentity.h(377): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\manuel\code\source_mods\hl2sdk-sdk2013\game\server\baseentity.h(377): warning C4183: 'DECLARE_PREDICTABLE': missing return type; assumed to be a member function returning 'int'
1>c:\users\manuel\code\source_mods\hl2sdk-sdk2013\game\server\baseentity.h(821): error C2065: 'CPredictableId' : undeclared identifier
1>c:\users\manuel\code\source_mods\hl2sdk-sdk2013\game\server\baseentity.h(821): error C2923: 'CNetworkVarBase' : 'CPredictableId' is not a valid template type argument for parameter 'Type'
1>c:\users\manuel\code\source_mods\hl2sdk-sdk2013\game\server\baseentity.h(1020): error C2061: syntax error : identifier 'touchlink_t'
1>c:\users\manuel\code\source_mods\hl2sdk-sdk2013\game\server\baseentity.h(1022): error C2143: syntax error : missing ';' before '*'
1>c:\users\manuel\code\source_mods\hl2sdk-sdk2013\game\server\baseentity.h(1022): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\manuel\code\source_mods\hl2sdk-sdk2013\game\server\baseentity.h(1022): warning C4183: 'AddEntityToGroundList': missing return type; assumed to be a member function returning 'int'
1>c:\users\manuel\code\source_mods\hl2sdk-sdk2013\game\server\baseentity.h(1026): error C2061: syntax error : identifier 'groundlink_t'
1>c:\users\manuel\code\source_mods\hl2sdk-sdk2013\game\server\baseentity.h(1156): error C2146: syntax error : missing ';' before identifier 'm_hDamageFilter'
1>c:\users\manuel\code\source_mods\hl2sdk-sdk2013\game\server\baseentity.h(1156): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\manuel\code\source_mods\hl2sdk-sdk2013\game\server\baseentity.h(1505): error C2143: syntax error : missing ';' before '*'
1>c:\users\manuel\code\source_mods\hl2sdk-sdk2013\game\server\baseentity.h(1505): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\manuel\code\source_mods\hl2sdk-sdk2013\game\server\baseentity.h(1505): warning C4183: 'PhysicsMarkEntityAsTouched': missing return type; assumed to be a member function returning 'int'
1>c:\users\manuel\code\source_mods\hl2sdk-sdk2013\game\server\baseentity.h(1609): error C2146: syntax error : missing ';' before identifier 'm_pParent'
1>c:\users\manuel\code\source_mods\hl2sdk-sdk2013\game\server\baseentity.h(1609): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\manuel\code\source_mods\hl2sdk-sdk2013\game\server\baseentity.h(1617): error C2061: syntax error : identifier 'm_hMoveParent'
1>c:\users\manuel\code\source_mods\hl2sdk-sdk2013\game\server\baseentity.h(1617): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\manuel\code\source_mods\hl2sdk-sdk2013\game\server\baseentity.h(1617): warning C4183: 'CNetworkHandle': missing return type; assumed to be a member function returning 'int'
1>c:\users\manuel\code\source_mods\hl2sdk-sdk2013\game\server\baseentity.h(1619): error C2146: syntax error : missing ';' before identifier 'm_hMoveChild'
1>c:\users\manuel\code\source_mods\hl2sdk-sdk2013\game\server\baseentity.h(1619): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\manuel\code\source_mods\hl2sdk-sdk2013\game\server\baseentity.h(1621): error C2146: syntax error : missing ';' before identifier 'm_hMovePeer'
1>c:\users\manuel\code\source_mods\hl2sdk-sdk2013\game\server\baseentity.h(1621): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\manuel\code\source_mods\hl2sdk-sdk2013\game\server\baseentity.h(1627): error C2061: syntax error : identifier 'm_hOwnerEntity'
1>c:\users\manuel\code\source_mods\hl2sdk-sdk2013\game\server\baseentity.h(1627): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\manuel\code\source_mods\hl2sdk-sdk2013\game\server\baseentity.h(1627): error C2535: 'int CBaseEntity::CNetworkHandle(CBaseEntity)' : member function already defined or declared
1> c:\users\manuel\code\source_mods\hl2sdk-sdk2013\game\server\baseentity.h(1617) : see declaration of 'CBaseEntity::CNetworkHandle'
1>c:\users\manuel\code\source_mods\hl2sdk-sdk2013\game\server\baseentity.h(1627): warning C4183: 'CNetworkHandle': missing return type; assumed to be a member function returning 'int'
1>c:\users\manuel\code\source_mods\hl2sdk-sdk2013\game\server\baseentity.h(162
: error C2061: syntax error : identifier 'm_hEffectEntity'
1>c:\users\manuel\code\source_mods\hl2sdk-sdk2013\game\server\baseentity.h(162
: error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\manuel\code\source_mods\hl2sdk-sdk2013\game\server\baseentity.h(162
: error C2535: 'int CBaseEntity::CNetworkHandle(CBaseEntity)' : member function already defined or declared
1> c:\users\manuel\code\source_mods\hl2sdk-sdk2013\game\server\baseentity.h(1617) : see declaration of 'CBaseEntity::CNetworkHandle'
1>c:\users\manuel\code\source_mods\hl2sdk-sdk2013\game\server\baseentity.h(162
: warning C4183: 'CNetworkHandle': missing return type; assumed to be a member function returning 'int'
1>c:\users\manuel\code\source_mods\hl2sdk-sdk2013\game\server\baseentity.h(1647): error C2061: syntax error : identifier 'm_hGroundEntity'
1>c:\users\manuel\code\source_mods\hl2sdk-sdk2013\game\server\baseentity.h(1647): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\manuel\code\source_mods\hl2sdk-sdk2013\game\server\baseentity.h(1647): warning C4183: 'CNetworkHandleInternal': missing return type; assumed to be a member function returning 'int'
1>c:\users\manuel\code\source_mods\hl2sdk-sdk2013\game\server\baseentity.h(166
: error C2146: syntax error : missing ';' before identifier 'm_pBlocker'
1>c:\users\manuel\code\source_mods\hl2sdk-sdk2013\game\server\baseentity.h(166
: error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\manuel\code\source_mods\hl2sdk-sdk2013\game\server\baseentity.h(1729): error C2059: syntax error : '<'
1>c:\users\manuel\code\source_mods\hl2sdk-sdk2013\game\server\baseentity.h(1729): error C2238: unexpected token(s) preceding ';'
1>c:\users\manuel\code\source_mods\hl2sdk-sdk2013\game\server\baseentity.h(1901): error C2065: 'm_hMoveParent' : undeclared identifier
1>c:\users\manuel\code\source_mods\hl2sdk-sdk2013\game\server\baseentity.h(1901): error C2228: left of '.Get' must have class/struct/union
1> type is 'unknown-type'
1>c:\users\manuel\code\source_mods\hl2sdk-sdk2013\game\server\baseentity.h(1906): error C2065: 'm_hMoveChild' : undeclared identifier
1>c:\users\manuel\code\source_mods\hl2sdk-sdk2013\game\server\baseentity.h(1906): error C2228: left of '.Get' must have class/struct/union
1> type is 'unknown-type'
1>c:\users\manuel\code\source_mods\hl2sdk-sdk2013\game\server\baseentity.h(1911): error C2065: 'm_hMovePeer' : undeclared identifier
1>c:\users\manuel\code\source_mods\hl2sdk-sdk2013\game\server\baseentity.h(1911): error C2228: left of '.Get' must have class/struct/union
1> type is 'unknown-type'
1>c:\users\manuel\code\source_mods\hl2sdk-sdk2013\game\server\baseentity.h(1917): error C2065: 'm_pParent' : undeclared identifier
1>c:\users\manuel\code\source_mods\hl2sdk-sdk2013\game\server\baseentity.h(1917): error C2228: left of '.Get' must have class/struct/union
1> type is 'unknown-type'
1>c:\users\manuel\code\source_mods\hl2sdk-sdk2013\game\server\baseentity.h(2290): error C3861: 'INDEXENT': identifier not found
1>c:\users\manuel\code\source_mods\hl2sdk-sdk2013\game\server\baseentity.h(2297): error C3861: 'INDEXENT': identifier not found
1>c:\users\manuel\code\source_mods\hl2sdk-sdk2013\game\server\baseentity.h(2642): error C2065: 'FCAP_ACROSS_TRANSITION' : undeclared identifier
1>c:\users\manuel\code\source_mods\hl2sdk-sdk2013\game\server\baseentity.h(2654): error C2065: 'FCAP_ACROSS_TRANSITION' : undeclared identifier
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========