From 6725e3ce575b2e82aa4ba1c3c376343de8fa3bef Mon Sep 17 00:00:00 2001 From: in0finite Date: Wed, 1 Jul 2020 19:36:39 +0200 Subject: [PATCH] do some logic only on server --- Assets/Scripts/Behaviours/Vehicles/Vehicle_Damage.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Assets/Scripts/Behaviours/Vehicles/Vehicle_Damage.cs b/Assets/Scripts/Behaviours/Vehicles/Vehicle_Damage.cs index 42741d6c..4f1c1b7a 100644 --- a/Assets/Scripts/Behaviours/Vehicles/Vehicle_Damage.cs +++ b/Assets/Scripts/Behaviours/Vehicles/Vehicle_Damage.cs @@ -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(); + } } }