mirror of
https://github.com/GTA-ASM/SanAndreasUnity
synced 2024-11-26 22:10:17 +00:00
exit aim & fire states if ped is not holding a weapon
This commit is contained in:
parent
c52fd29de8
commit
0589ccb039
2 changed files with 13 additions and 3 deletions
|
@ -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
|
// we should not switch to non-aim state, but instead, when fire anim finishes, we will switch back to
|
||||||
// aim state
|
// aim state
|
||||||
|
|
||||||
// TODO: but, watch out, weapon may become null - if someone else destroys a weapon or changes current weapon
|
// but the current weapon may be destroyed, in which case we will not exit fire state, because aim anim will not be updated
|
||||||
// to Hand, then weapon will be null - we may never 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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -156,6 +156,13 @@ namespace SanAndreasUnity.Behaviours {
|
||||||
return;
|
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 ();
|
//this.UpdateWeaponTransform ();
|
||||||
|
|
||||||
if (CurrentWeapon != null) {
|
if (CurrentWeapon != null) {
|
||||||
|
|
Loading…
Reference in a new issue