destroy player's vehicles when he disconnects

This commit is contained in:
in0finite 2019-07-16 00:17:34 +02:00
parent a6713c24da
commit 5fe0a8fe46
3 changed files with 25 additions and 7 deletions

View file

@ -34,6 +34,15 @@ namespace SanAndreasUnity.Net
Local = this;
}
void OnDisable()
{
// destroy player's vehicles
if (NetStatus.IsServer)
{
this.DestroyPlayersVehicles();
}
}
public bool CanPlayerSpawnVehicle()
{
@ -116,14 +125,19 @@ namespace SanAndreasUnity.Net
void CmdRequestToDestroyMyVehicles()
{
F.RunExceptionSafe( () => {
m_myVehicles.RemoveDeadObjects();
foreach (var v in m_myVehicles)
{
Destroy(v.gameObject);
}
this.DestroyPlayersVehicles();
});
}
void DestroyPlayersVehicles()
{
m_myVehicles.RemoveDeadObjects();
foreach (var v in m_myVehicles)
{
Destroy(v.gameObject);
}
}
public void RequestTeleport(Vector3 pos, Quaternion rot)
{
this.CmdRequestTeleport(pos, rot);

View file

@ -8,6 +8,10 @@
- remove spamming logs:
- wheel sync list: flush it before adding to it
- when player disconnects, destroy his vehicles
- test situation when player connects, and there are peds sitting in vehicles
***

View file

@ -20,12 +20,12 @@
- Does 'O' button changes quality level ?
- Reduce physics time step to 30 - make it configurable in options
- Play sounds: horn ; empty weapon slot ; ped damage ; footsteps in run and sprint states ;
- Script execution order: HUD before pause menu and windows ; fps counter after all ;
- Add option to change fixed delta time ?
- Optimize Console.Update() - don't do trim excess for every log message
- don't fade high LOD meshes