do some logic only on server

This commit is contained in:
in0finite 2020-07-01 19:36:39 +02:00
parent 96829ef506
commit 6725e3ce57

View file

@ -1,5 +1,6 @@
using System.Linq;
using SanAndreasUnity.Behaviours.Audio;
using SanAndreasUnity.Net;
using SanAndreasUnity.Utilities;
using UnityEngine;
@ -43,6 +44,9 @@ namespace SanAndreasUnity.Behaviours.Vehicles
void OnDamaged()
{
if (!NetStatus.IsServer)
return;
var damageInfo = this.Damageable.LastDamageInfo;
if (this.Health <= 0)
@ -83,7 +87,10 @@ namespace SanAndreasUnity.Behaviours.Vehicles
if (this.IsUnderFlame && Time.time - this.TimeWhenBecameUnderFlame >= 5)
{
// enough time passed since vehicle flamed - explode it
this.Explode();
if (NetStatus.IsServer)
{
this.Explode();
}
}
}