Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
weaponstablestate.c File Reference

Go to the source code of this file.

Enumerations

enum  MuzzleState { U = -1, E = 0, F = 1, L = 2 }
 

Functions

void WeaponStableState (Weapon_Base w=NULL, WeaponStateBase parent=NULL, int anim_state=-1)
 
void SyncAnimState ()
 
override void OnEntry (WeaponEventBase e)
 
override void OnUpdate (float dt)
 
override void OnExit (WeaponEventBase e)
 
override bool IsIdle ()
 
int GetCurrentStateID ()
 
Weapon state properties

Properties defining the state in several properties for other systems Override these to set them up

Several systems depends on this: WeaponFSM.RandomizeFSMState, which picks out a suitable FSM state when attaching magazine through CE WeaponFSM.ValidateAndRepair, which will attempt to identify a desync and repair the FSM state if so

@WARNING So it is important to set these up correctly to prevent any desync of weapon FSM and actual wepon state

bool IsRepairEnabled ()
 Whether WeaponFSM.ValidateAndRepair should be applied on this state @NOTE: This property was implemented at the same time as ValARep To have it disabled by default In case there are modders who created their own state But potentially did not set up their properties correctly As having ValARep run on an improper setup would result in horrible VME spam and desync @WARNING: When enabling repair, it is imperative that all properties are set up correctly. More...
 
bool HasBullet ()
 Whether there is a bullet in the chamber @NOTE: This should only be false when it is empty So this is true when there is a bullet in the chamber Regardless of the bullet being loaded, firedout or jammed. More...
 
bool HasMagazine ()
 Whether there is a magazine attached. More...
 
bool IsJammed ()
 Whether the gun is jammed. More...
 
bool IsDischarged ()
 Whether the gun is discharged. More...
 
bool IsWeaponOpen ()
 Whether the gun is open. More...
 
void InitMuzzleArray ()
 Override with the filling of m_muzzleHasBullet. More...
 
bool IsSingleState ()
 Special one for when the weapon only has one singular state (like Magnum) More...
 
Weapon state properties helpers

Several helpers for better access of certain properties

MuzzleState GetMuzzleState (int idx)
 Get chamber state of the muzzle at index. More...
 
int GetMuzzleStateCount ()
 
bool IsChamberValid (int idx)
 
bool IsChamberFiredOut (int idx)
 
bool IsChamberFull (int idx)
 
void ValidateMuzzleArray ()
 Safety check and error message in case not set up correctly. More...
 

Variables

enum MuzzleState m_animState
 
ref array< MuzzleStatem_muzzleHasBullet = new array<MuzzleState>()
 

Enumeration Type Documentation

◆ MuzzleState

Enumerator

UNKNOWN.

EMPTY.

FIRED.

LOADED.

Definition at line 14 of file weaponstablestate.c.

Function Documentation

◆ GetCurrentStateID()

int GetCurrentStateID ( )

Definition at line 93 of file weaponstablestate.c.

◆ GetMuzzleState()

MuzzleState GetMuzzleState ( int  idx)

Get chamber state of the muzzle at index.

Definition at line 150 of file weaponstablestate.c.

◆ GetMuzzleStateCount()

int GetMuzzleStateCount ( )

Definition at line 151 of file weaponstablestate.c.

◆ HasBullet()

bool HasBullet ( )

Whether there is a bullet in the chamber @NOTE: This should only be false when it is empty So this is true when there is a bullet in the chamber Regardless of the bullet being loaded, firedout or jammed.

Definition at line 122 of file weaponstablestate.c.

◆ HasMagazine()

bool HasMagazine ( )

Whether there is a magazine attached.

Definition at line 125 of file weaponstablestate.c.

◆ InitMuzzleArray()

void InitMuzzleArray ( )

Override with the filling of m_muzzleHasBullet.

Definition at line 137 of file weaponstablestate.c.

◆ IsChamberFiredOut()

bool IsChamberFiredOut ( int  idx)

Definition at line 153 of file weaponstablestate.c.

◆ IsChamberFull()

bool IsChamberFull ( int  idx)

Definition at line 154 of file weaponstablestate.c.

◆ IsChamberValid()

bool IsChamberValid ( int  idx)

Definition at line 152 of file weaponstablestate.c.

◆ IsDischarged()

bool IsDischarged ( )

Whether the gun is discharged.

Definition at line 131 of file weaponstablestate.c.

◆ IsIdle()

override bool IsIdle ( )

Definition at line 91 of file weaponstablestate.c.

◆ IsJammed()

bool IsJammed ( )

Whether the gun is jammed.

Definition at line 128 of file weaponstablestate.c.

◆ IsRepairEnabled()

bool IsRepairEnabled ( )

Whether WeaponFSM.ValidateAndRepair should be applied on this state @NOTE: This property was implemented at the same time as ValARep To have it disabled by default In case there are modders who created their own state But potentially did not set up their properties correctly As having ValARep run on an improper setup would result in horrible VME spam and desync @WARNING: When enabling repair, it is imperative that all properties are set up correctly.

Definition at line 115 of file weaponstablestate.c.

◆ IsSingleState()

bool IsSingleState ( )

Special one for when the weapon only has one singular state (like Magnum)

Definition at line 140 of file weaponstablestate.c.

◆ IsWeaponOpen()

bool IsWeaponOpen ( )

Whether the gun is open.

Definition at line 134 of file weaponstablestate.c.

◆ OnEntry()

override void OnEntry ( WeaponEventBase  e)

Definition at line 72 of file weaponstablestate.c.

◆ OnExit()

override void OnExit ( WeaponEventBase  e)

Definition at line 85 of file weaponstablestate.c.

◆ OnUpdate()

override void OnUpdate ( float  dt)

Definition at line 80 of file weaponstablestate.c.

◆ SyncAnimState()

void SyncAnimState ( )

Definition at line 39 of file weaponstablestate.c.

◆ ValidateMuzzleArray()

void ValidateMuzzleArray ( )

Safety check and error message in case not set up correctly.

Definition at line 159 of file weaponstablestate.c.

◆ WeaponStableState()

void WeaponStableState ( Weapon_Base  w = NULL,
WeaponStateBase  parent = NULL,
int  anim_state = -1 
)

Definition at line 32 of file weaponstablestate.c.

Variable Documentation

◆ m_animState

enum MuzzleState m_animState

◆ m_muzzleHasBullet

ref array<MuzzleState> m_muzzleHasBullet = new array<MuzzleState>()

Definition at line 30 of file weaponstablestate.c.