mirror of
https://github.com/GTA-ASM/SanAndreasUnity
synced 2024-11-23 04:23:04 +00:00
exit drive-by state if ped doesn't have gun weapon
This commit is contained in:
parent
eb937dd512
commit
9e7378d1ca
2 changed files with 26 additions and 1 deletions
|
@ -63,6 +63,28 @@ namespace SanAndreasUnity.Behaviours.Peds.States
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool CanEnterState(Vehicle vehicle, Vehicle.SeatAlignment seatAlignment)
|
||||||
|
{
|
||||||
|
var w = m_ped.CurrentWeapon;
|
||||||
|
return null != w && w.IsGun;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void UpdateState()
|
||||||
|
{
|
||||||
|
// exit drive-by state if ped doesn't have gun weapon
|
||||||
|
if (m_isServer)
|
||||||
|
{
|
||||||
|
var w = m_ped.CurrentWeapon;
|
||||||
|
if (null == w || !w.IsGun)
|
||||||
|
{
|
||||||
|
m_ped.GetStateOrLogError<VehicleSittingState>().EnterVehicle(this.CurrentVehicle, this.CurrentVehicleSeatAlignment);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
base.UpdateState();
|
||||||
|
}
|
||||||
|
|
||||||
protected override void UpdateAnimsInternal()
|
protected override void UpdateAnimsInternal()
|
||||||
{
|
{
|
||||||
this.UpdateAnimsInternal(true);
|
this.UpdateAnimsInternal(true);
|
||||||
|
|
|
@ -115,7 +115,10 @@ namespace SanAndreasUnity.Behaviours.Peds.States
|
||||||
public override void OnAimButtonPressed()
|
public override void OnAimButtonPressed()
|
||||||
{
|
{
|
||||||
if (m_isServer)
|
if (m_isServer)
|
||||||
m_ped.GetStateOrLogError<DriveByState>().EnterVehicle(this.CurrentVehicle, this.CurrentVehicleSeatAlignment);
|
{
|
||||||
|
if (m_ped.GetStateOrLogError<DriveByState>().CanEnterState(this.CurrentVehicle, this.CurrentVehicleSeatAlignment))
|
||||||
|
m_ped.GetStateOrLogError<DriveByState>().EnterVehicle(this.CurrentVehicle, this.CurrentVehicleSeatAlignment);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
base.OnAimButtonPressed();
|
base.OnAimButtonPressed();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue