exit aim & fire states if ped is not holding a weapon

This commit is contained in:
in0finite 2021-02-23 00:10:11 +01:00
parent c52fd29de8
commit 0589ccb039
2 changed files with 13 additions and 3 deletions

View file

@ -36,10 +36,13 @@ namespace SanAndreasUnity.Behaviours.Peds.States
// we should not switch to non-aim state, but instead, when fire anim finishes, we will switch back to
// aim state
// TODO: but, watch out, weapon may become null - if someone else destroys a weapon or changes current weapon
// to Hand, then weapon will be null - we may never exit fire state, because aim anim will not be updated
// but the current weapon may be destroyed, in which case we will not exit fire state, because aim anim will not be updated
// simply checking if weapon is null and exiting the state should solve the problem
if (!m_ped.IsHoldingWeapon)
{
m_ped.SwitchState<StandState>();
return true;
}
return false;
}

View file

@ -156,6 +156,13 @@ namespace SanAndreasUnity.Behaviours {
return;
// if current weapon was somehow destroyed, switch to Hand slot
if (this.currentWeaponSlot > 0 && null == this.weapons[this.currentWeaponSlot])
{
if (NetStatus.IsServer)
this.currentWeaponSlot = 0;
}
//this.UpdateWeaponTransform ();
if (CurrentWeapon != null) {