The ClientDisconnectedEventTypeID event is a useful way for mods to detect when clients disconnect from the server, for managing state, etc. However, the ClientDisconnectedEventTypeID event is not sent if the disconnecting client is not bound to any SurvivorBase instance.
The following modification of the MissionServer script class can be used to demonstrate the issue:
modded class MissionServer { override void OnEvent(EventType eventTypeId, Param params) { if (eventTypeId == ClientDisconnectedEventTypeID) { ClientDisconnectedEventParams par = ClientDisconnectedEventParams.Cast(params); PrintFormat("Client disconnected => %1 %2 %3 %4", par.param1, par.param2, par.param3, par.param4); } super.OnEvent(eventTypeId, params); } };
Under normal circumstances, the above code will generate the following script log output when a player disconnects:
SCRIPT : Client disconnected => PlayerIdentity<a9058060> SurvivorBase<ad9a34e0> 15 0
If a client disconnects without a bound SurvivorBase instance, no such log is output.
Intuitively, it feels like the ClientDisconnectedEventTypeID event should be sent in this situation, with a valid, non-NULL PlayerIdentity instance as param1, but with NULL as param2.