Syntax: Select all
# ../players/entity.py
@property
def userid(self):
"""Return the player's userid."""
return self.playerinfo.get_userid()
Replacing that with the following seems to work correctly:
Syntax: Select all
engine_server.get_player_userid(self.edict)
However, the objects are still freed and no longer valid.
EDIT: The only instance that seems to always been alive is the edict_t pointer. However, I agree caching the instances is definitely boosting the accessing speed and I'm wondering if hooking the CBaseEntity destructor and marking the object as no longer valid using a guard variable that then raise in __getattr__ could worth the effort. Seems to be the only direct way to know when the engine is freeding that specific entity pointer.