convert other TryFire() to static function

This commit is contained in:
in0finite 2020-03-22 19:25:24 +01:00
parent 3a9b07cf7b
commit 18136f279f

View file

@ -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;