> Hi,
>
> Also no entities send network updates automatically unless they have a
> model
> by default. It is easy to override this behavior.
>
Yup, that's been taken care of. I'm setting EFL_FORCE_CHECK_TRANSMIT in
the base class' Activate function. (And yes, that's being called by the
derived class.) The entity transmits, but the weird thing is that only
variables in the base class make it to the client...
>
> Make sure you have a LINK_ENTITY_TO_CLASS that links the entity properly
> on
> both the server and client, as well.
>
> server
> LINK_ENTITY_TO_CLASS( derivedentity, CDerivedClass );
>
> Client
> LINK_ENTITY_TO_CLASS( derivedentity, C_DerivedClass );
>
Ah, yeah. I omitted that from my original post. Well, I had the server
part, anyway. Added the client-side line, but that didn't change anything.
Just for the heck of it, I added LINK_ENTITY_TO_CLASS macros for the base
class, too, but again, nothing...
>
> This is probably an obvious question, but it's always best to make
> sure obvious ones were considered...
>
> Are you sure the derived class is actually the one being instantiated
> (on both client and server)?
>
Yes, the derived class is associated with an entity in Hammer (as above)
and loads as expected. I've actually verified the code is running on the
server -- it loads the class-specific option, sets the network var, and
then the client just fails to get it.
This is in single-player, if that makes any difference...
>>
>> In my mod, I've got a base class, something like:
>>
>> // --- server ---
>>
>> class CBaseClass : public CBaseEntity
>> {
>> public:
>> DECLARE_CLASS( CBaseClass, CBaseEntity );
>> DECLARE_SERVERCLASS();
>>
>> private:
>> CNetworkVar( int, m_index );
>> };
>>
>> IMPLEMENT_SERVERCLASS_ST( CBaseClass, DT_BaseClass )
>> SendPropInt( SENDINFO( m_index ), 10, SPROP_UNSIGNED ),
>> END_SEND_TABLE()
>>
>> // --- client ---
>>
>> class C_BaseClass : public C_BaseEntity
>> {
>> public:
>> DECLARE_CLASS( C_BaseClass, C_BaseEntity );
>> DECLARE_CLIENTCLASS();
>>
>> int m_index; // couldn't get this to work under private:
>> };
>>
>> IMPLEMENT_CLIENTCLASS_DT( C_BaseClass, DT_BaseClass, CBaseClass )
>> RecvPropInt( RECVINFO( m_index ) ),
>> END_RECV_TABLE()
>>
>> So far, so good, right? Follows the wiki, Valve's code, etc.
> Compiles
>> with no errors. Load up the mod, and it works as expected.
>>
>> Now, here's the fun part. If I derive a class from my base class,
> like so:
>>
>> // --- server ---
>>
>> class CDerivedClass : public CBaseClass
>> {
>> public:
>> DECLARE_CLASS( CDerivedClass, CBaseClass );
>> DECLARE_SERVERCLASS();
>>
>> private:
>> CNetworkVar( int, m_something );
>> };
>>
>> IMPLEMENT_SERVERCLASS_ST( CDerivedClass, DT_DerivedClass )
>> SendPropInt( SENDINFO( m_something ), 10, SPROP_UNSIGNED ),
>> END_SEND_TABLE()
>>
>> // --- client ---
>>
>> class C_DerivedClass : public C_BaseClass
>> {
>> public:
>> DECLARE_CLASS( C_DerivedClass, C_BaseClass );
>> DECLARE_CLIENTCLASS();
>>
>> int m_something;
>> };
>>
>> IMPLEMENT_CLIENTCLASS_DT( C_DerivedClass, DT_DerivedClass,
>> CDerivedClass )
>> RecvPropInt( RECVINFO( m_something ) ),
>> END_RECV_TABLE()
>>
>> ...the code compiles and runs just fine, but the client side of
>> the
>> derived class *never* gets any updates when m_something is set. What
>> blows
>> my mind is that I can cut and paste the code into the base class, and it
>> will behave exactly as it should. What the heck is going on here?
>> There's
>> no indication that I can find in Valve's code or the wiki that I'm doing
>> anything wrong, or that more/different code is needed. Someone mentioned
>> CNetworkVarForDerived, but that doesn't seem to be the ideal solution,
>> since you're still declaring a variable in the base class, and I want
>> completely unique variables in some of the derived classes.
_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders