DayZ 1.24
Loading...
Searching...
No Matches
Crossbow_Base Class Reference

base for Crossbow @NOTE name copies config base class More...

Inheritance diagram for Crossbow_Base:
[legend]
Collaboration diagram for Crossbow_Base:
[legend]

Private Member Functions

void Crossbow_Base ()
 
override RecoilBase SpawnRecoilObject ()
 
override void InitStateMachine ()
 
override float GetChanceToJam ()
 
override void OnDebugSpawnEx (DebugSpawnParams params)
 
override bool CanBeUsedForSuicide ()
 

Detailed Description

base for Crossbow @NOTE name copies config base class

Definition at line 53 of file Crossbow.c.

Constructor & Destructor Documentation

◆ Crossbow_Base()

void Crossbow_Base::Crossbow_Base ( )
private

Member Function Documentation

◆ CanBeUsedForSuicide()

override bool Crossbow_Base::CanBeUsedForSuicide ( )
inlineprivate

Definition at line 194 of file Crossbow.c.

195 {
196 float ammoDamage;
197 string ammoTypeName;
198 GetCartridgeInfo(GetCurrentMuzzle(), ammoDamage, ammoTypeName);
199 if (ammoTypeName == "Bullet_CupidsBolt")
200 return false;
201
202 return super.CanBeUsedForSuicide();
203 }

◆ GetChanceToJam()

override float Crossbow_Base::GetChanceToJam ( )
inlineprivate

Definition at line 161 of file Crossbow.c.

162 {
163 return 0.0;
164 }

◆ InitStateMachine()

override void Crossbow_Base::InitStateMachine ( )
inlineprivate

Definition at line 62 of file Crossbow.c.

63 {
64 // setup abilities
65 m_abilities.Insert(new AbilityRecord(WeaponActions.MECHANISM, WeaponActionMechanismTypes.MECHANISM_OPENED));
66 m_abilities.Insert(new AbilityRecord(WeaponActions.MECHANISM, WeaponActionMechanismTypes.MECHANISM_SPECIAL));
67 m_abilities.Insert(new AbilityRecord(WeaponActions.CHAMBERING, WeaponActionChamberingTypes.CHAMBERING_CROSSBOW_OPENED));
68 m_abilities.Insert(new AbilityRecord(WeaponActions.CHAMBERING, WeaponActionChamberingTypes.CHAMBERING_CROSSBOW_CLOSED));
69 m_abilities.Insert(new AbilityRecord(WeaponActions.FIRE, WeaponActionFireTypes.FIRE_NORMAL));
70 m_abilities.Insert(new AbilityRecord(WeaponActions.FIRE, WeaponActionFireTypes.FIRE_UNCOCKED));
71 m_abilities.Insert(new AbilityRecord(WeaponActions.FIRE, WeaponActionFireTypes.FIRE_COCKED));
72
73 // setup state machine
74 // basic weapon states
75 WeaponStableState U = new XBUncockedEmpty(this, NULL, XBAnimState.uncocked);
77 WeaponStableState L = new XBLoaded(this, NULL, XBAnimState.cocked);
78 // unstable (intermediate) states
79 WeaponChargingStretch Mech_U = new WeaponChargingStretch(this, NULL, WeaponActions.MECHANISM, WeaponActionMechanismTypes.MECHANISM_OPENED);
80 WeaponEjectBullet Mech_L = new WeaponEjectBullet(this, NULL, WeaponActions.MECHANISM, WeaponActionMechanismTypes.MECHANISM_SPECIAL);
81
82 WeaponChambering Chamber_U = new WeaponChambering(this, NULL, WeaponActions.CHAMBERING, WeaponActionChamberingTypes.CHAMBERING_CROSSBOW_OPENED);
83 WeaponChambering Chamber_C = new WeaponChambering(this, NULL, WeaponActions.CHAMBERING, WeaponActionChamberingTypes.CHAMBERING_CROSSBOW_CLOSED);
84 //CrossbowReChambering Chamber_L = new CrossbowReChambering(this, NULL, WeaponActions.CHAMBERING, WeaponActionChamberingTypes.CHAMBERING_ONEBULLET_CLOSED);
85
88 WeaponStateBase Trigger_L = new WeaponFireLast(this, NULL, WeaponActions.FIRE, WeaponActionFireTypes.FIRE_NORMAL);
89
91
92 // events
93 WeaponEventBase __M__ = new WeaponEventMechanism;
94 WeaponEventBase __T__ = new WeaponEventTrigger;
95 WeaponEventBase __TJ_ = new WeaponEventTriggerToJam;
96 WeaponEventBase __L__ = new WeaponEventLoad1Bullet;
97 WeaponEventBase __U__ = new WeaponEventUnjam;
98 WeaponEventBase _fin_ = new WeaponEventHumanCommandActionFinished;
99 WeaponEventBase _abt_ = new WeaponEventHumanCommandActionAborted;
100 WeaponEventBase _dto_ = new WeaponEventDryFireTimeout;
101
102 m_fsm = new WeaponFSM();
103
104 //Charging
105 m_fsm.AddTransition(new WeaponTransition(C, __M__, C));
106
107 m_fsm.AddTransition(new WeaponTransition(U, __M__, Mech_U));
108 m_fsm.AddTransition(new WeaponTransition(Mech_U, _fin_, U, null, new WeaponGuardWeaponDischarged(this)));
109 m_fsm.AddTransition(new WeaponTransition(Mech_U, _fin_, C));
110 m_fsm.AddTransition(new WeaponTransition(Mech_U, _abt_, U, null, new WeaponGuardWeaponDischarged(this)));
111 m_fsm.AddTransition(new WeaponTransition(Mech_U, _abt_, C));
112
113 m_fsm.AddTransition(new WeaponTransition(L, __M__, Mech_L));
114 m_fsm.AddTransition(new WeaponTransition(Mech_L, _fin_, C, null, new WeaponGuardChamberEmpty(this)));
115 m_fsm.AddTransition(new WeaponTransition(Mech_L, _fin_, L));
116 m_fsm.AddTransition(new WeaponTransition(Mech_L, _abt_, C, null, new WeaponGuardChamberEmpty(this)));
117 m_fsm.AddTransition(new WeaponTransition(Mech_L, _abt_, L));
118
119
120 //Chamber bolt
121 m_fsm.AddTransition(new WeaponTransition(U, __L__, Chamber_U));
122 m_fsm.AddTransition(new WeaponTransition(Chamber_U, _fin_, L, null, new WeaponGuardChamberFull(this)));
123 m_fsm.AddTransition(new WeaponTransition(Chamber_U, _fin_, C, null, new WeaponGuardWeaponCharged(this)));
124 m_fsm.AddTransition(new WeaponTransition(Chamber_U, _fin_, U));
125 m_fsm.AddTransition(new WeaponTransition(Chamber_U, _abt_, L, null, new WeaponGuardChamberFull(this)));
126 m_fsm.AddTransition(new WeaponTransition(Chamber_U, _abt_, C, null, new WeaponGuardWeaponCharged(this)));
127 m_fsm.AddTransition(new WeaponTransition(Chamber_U, _abt_, U));
128
129
130 m_fsm.AddTransition(new WeaponTransition(C, __L__, Chamber_C));
131 m_fsm.AddTransition(new WeaponTransition(Chamber_C, _fin_, L, null, new WeaponGuardChamberFull(this)));
132 m_fsm.AddTransition(new WeaponTransition(Chamber_C, _fin_, C));
133 m_fsm.AddTransition(new WeaponTransition(Chamber_C, _abt_, L, null, new WeaponGuardChamberFull(this)));
134 m_fsm.AddTransition(new WeaponTransition(Chamber_C, _abt_, C));
135
136 m_fsm.AddTransition(new WeaponTransition(C, __T__, Trigger_C));
137 m_fsm.AddTransition(new WeaponTransition(Trigger_C, _fin_, U));
138 m_fsm.AddTransition(new WeaponTransition(Trigger_C, _abt_, U));
139 m_fsm.AddTransition(new WeaponTransition(Trigger_C, _dto_, U));
140 m_fsm.AddTransition(new WeaponTransition(Trigger_C, _abt_, U));
141
142 m_fsm.AddTransition(new WeaponTransition(U, __T__, Trigger_U));
143 m_fsm.AddTransition(new WeaponTransition(Trigger_U, _fin_, U));
144 m_fsm.AddTransition(new WeaponTransition(Trigger_U, _abt_, U));
145 m_fsm.AddTransition(new WeaponTransition(Trigger_U, _dto_, U));
146 m_fsm.AddTransition(new WeaponTransition(Trigger_U, _abt_, U));
147
148 m_fsm.AddTransition(new WeaponTransition(L, __T__, Trigger_L));
149 m_fsm.AddTransition(new WeaponTransition(Trigger_L, _fin_, U));
150 m_fsm.AddTransition(new WeaponTransition(Trigger_L, _abt_, U));
151 m_fsm.AddTransition(new WeaponTransition(Trigger_L, _dto_, U));
152 m_fsm.AddTransition(new WeaponTransition(Trigger_L, _abt_, U));
153
154 SelectionBulletHide();
155 EffectBulletHide(0);
156
157 SetInitialState(U);
158 m_fsm.Start();
159 }
XBAnimState
Definition Crossbow.c:2
void WeaponGuardWeaponDischarged(Weapon_Base w=NULL)
Definition Guards.c:578
enum FSMTransition WeaponTransition
@ U
UNKNOWN.
@ L
LOADED.
pair ( action, actionType )
Definition Weapon_Base.c:5
ref WeaponStableState C
Definition Magnum.c:51
signalize mechanism manipulation
Definition Events.c:35
weapon finite state machine
represents weapon's stable state (i.e. the basic states that the weapon will spend the most time in)
Definition Crossbow.c:27
represent weapon state base
Definition BulletHide.c:2
unjam submachine
WeaponActionChamberingTypes
Definition human.c:856
WeaponActions
actions
Definition human.c:796
WeaponActionUnjammingTypes
Definition human.c:892
WeaponActionFireTypes
Definition human.c:900

References Weapon_Base::C, L, U, and WeaponGuardWeaponDischarged().

◆ OnDebugSpawnEx()

override void Crossbow_Base::OnDebugSpawnEx ( DebugSpawnParams params)
inlineprivate

Definition at line 166 of file Crossbow.c.

167 {
168 //super.OnDebugSpawn();
169
170
171 GetInventory().CreateInInventory("ACOGOptic_6x");
172
174
176 if (params.m_Player)
177 inv = params.m_Player.GetInventory();
178
179 SpawnInInventoryOrGroundPos("Ammo_HuntingBolt", inv, GetPosition());
180 SpawnInInventoryOrGroundPos("Ammo_ImprovisedBolt_1", inv, GetPosition());
181 SpawnInInventoryOrGroundPos("Ammo_ImprovisedBolt_2", inv, GetPosition());
182
183 SpawnInInventoryOrGroundPos("ACOGOptic", inv, GetPosition());
184 entity = SpawnInInventoryOrGroundPos("M68Optic", inv, GetPosition());
185 entity.GetInventory().CreateInInventory("Battery9V");
186 entity = SpawnInInventoryOrGroundPos("M4_T3NRDSOptic", inv, GetPosition());
187 entity.GetInventory().CreateInInventory("Battery9V");
188 entity = SpawnInInventoryOrGroundPos("ReflexOptic", inv, GetPosition());
189 entity.GetInventory().CreateInInventory("Battery9V");
190 entity = SpawnInInventoryOrGroundPos("StarlightOptic", inv, GetPosition());
191 entity.GetInventory().CreateInInventory("Battery9V");
192 }
class JsonUndergroundAreaTriggerData GetPosition
script counterpart to engine's class Inventory
Definition Inventory.c:79

References GetPosition.

◆ SpawnRecoilObject()

override RecoilBase Crossbow_Base::SpawnRecoilObject ( )
inlineprivate

Definition at line 57 of file Crossbow.c.

58 {
59 return new CrossbowRecoil(this);
60 }

The documentation for this class was generated from the following file: