mirror of
https://github.com/GTA-ASM/SanAndreasUnity
synced 2024-11-14 16:27:19 +00:00
do some logic only on server
This commit is contained in:
parent
96829ef506
commit
6725e3ce57
1 changed files with 8 additions and 1 deletions
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue