fix NRE in EnableOrDisableGunFlash()

This commit is contained in:
in0finite 2019-07-11 18:07:59 +02:00
parent fe257c58ec
commit e835786257
2 changed files with 18 additions and 24 deletions

View file

@ -509,34 +509,30 @@ namespace SanAndreasUnity.Behaviours
public virtual void EnableOrDisableGunFlash ()
{
Ped ped = m_ped;
if (null == this.GunFlash)
return;
// enable/disable gun flash
if (this.GunFlash != null) {
bool shouldBeVisible = false;
Ped ped = m_ped;
// if (this.HasFlag (GunFlag.AIMWITHARM)) {
// shouldBeVisible = m_aimAnimTimeForAimWithArmWeapon.BetweenExclusive (this.AimAnimMaxTime, this.AimAnimMaxTime + this.GunFlashDuration);
// }
// else
{
bool shouldBeVisible = false;
if (AimAnimState != null && AimAnimState.enabled) {
// aim anim is being played
if (ped != null && ped.IsFiring)
{
if (AimAnimState != null && AimAnimState.enabled) {
// aim anim is being played
if (AimAnimState.time.BetweenExclusive (this.AimAnimMaxTime, this.AimAnimMaxTime + this.GunFlashDuration)) {
// muzzle flash should be visible
shouldBeVisible = true;
}
if (AimAnimState.time.BetweenExclusive (this.AimAnimMaxTime, this.AimAnimMaxTime + this.GunFlashDuration)) {
// muzzle flash should be visible
shouldBeVisible = true;
}
}
shouldBeVisible &= ped.IsFiring;
this.GunFlash.gameObject.SetActive (shouldBeVisible);
}
this.GunFlash.gameObject.SetActive (shouldBeVisible);
}
public virtual void UpdateGunFlashRotation ()

View file

@ -6,8 +6,6 @@
- add ability for client to request:
- add num weapons to misc stats ?
- if ped model is changed while sitting in vehicle as a passenger, anim is set to idle
- roll state: client doesn't know the direction of rolling ; when doing more rolls one after another, client doesn't play anim anymore ; sometimes rolling continues even if WASD keys are not pressed ;
@ -16,18 +14,18 @@
- add dates to logs
- remove spamming logs: weapon slot changed ; ped changed model ;
- remove spamming logs:
- sometimes, current vehicle is null on client
- vehicle states should handle situation when current vehicle is null (on client)
- draw map window even when there is no local ped
***
- weapon sound should be 3d
- EnableOrDisableGunFlash() throws NRE when ped dies
***
- **vehicle is bumping on clients** - disable (or destroy) wheel colliders, and sync them - this should not be done on local player, see below