From 18136f279f390acc79eebc1be312acd790de0652 Mon Sep 17 00:00:00 2001 From: in0finite Date: Sun, 22 Mar 2020 19:25:24 +0100 Subject: [PATCH] convert other TryFire() to static function --- .../Ped/States/BaseAimMovementState.cs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/Assets/Scripts/Behaviours/Ped/States/BaseAimMovementState.cs b/Assets/Scripts/Behaviours/Ped/States/BaseAimMovementState.cs index abc8f7ae..65edbc75 100644 --- a/Assets/Scripts/Behaviours/Ped/States/BaseAimMovementState.cs +++ b/Assets/Scripts/Behaviours/Ped/States/BaseAimMovementState.cs @@ -418,21 +418,26 @@ namespace SanAndreasUnity.Behaviours.Peds.States } - protected virtual bool TryFire () + public static bool TryFire (Ped ped) { - if (m_weapon != null) + if (ped.CurrentWeapon != null) { - if (m_isServer) + if (Net.NetStatus.IsServer) { - if (m_ped.IsControlledByLocalPlayer || null == m_ped.PlayerOwner) - return TryFire(m_ped, m_weapon.GetFirePos(), m_weapon.GetFireDir()); + if (ped.IsControlledByLocalPlayer || null == ped.PlayerOwner) + return TryFire(ped, ped.CurrentWeapon.GetFirePos(), ped.CurrentWeapon.GetFireDir()); else // this ped is owned by remote client - return TryFire(m_ped, m_ped.NetFirePos, m_ped.NetFireDir); + return TryFire(ped, ped.NetFirePos, ped.NetFireDir); } } return false; } + protected virtual bool TryFire() + { + return TryFire(m_ped); + } + public static bool TryFire (Ped ped, Vector3 firePos, Vector3 fireDir) { bool isServer = Net.NetStatus.IsServer;