DayZ 1.24
Loading...
Searching...
No Matches
DoubleBarrel_Base Class Reference
Inheritance diagram for DoubleBarrel_Base:
[legend]
Collaboration diagram for DoubleBarrel_Base:
[legend]

Private Member Functions

override void InitStateMachine ()
 
override bool CanChamberBullet (int muzzleIndex, Magazine mag)
 
override void SetActions ()
 

Private Attributes

ref WeaponStableState L_L
 
ref WeaponStableState L_E
 
ref WeaponStableState E_L
 
ref WeaponStableState F_L
 
ref WeaponStableState F_F
 
ref WeaponStableState F_E
 
ref WeaponStableState E_F
 
ref WeaponStableState E_E
 

Detailed Description

Definition at line 118 of file DoubleBarrel_Base.c.

Member Function Documentation

◆ CanChamberBullet()

override bool DoubleBarrel_Base::CanChamberBullet ( int muzzleIndex,
Magazine mag )
inlineprivate

Definition at line 294 of file DoubleBarrel_Base.c.

295 {
296 for (int i = 0; i < GetMuzzleCount(); i++)
297 {
298 if (CanChamberFromMag(i, mag))
299 {
300 if (IsChamberEmpty(i))
301 return true;
302
303 if (IsChamberFiredOut(i))
304 return true;
305 }
306 }
307 return false;
308 }
bool IsChamberFiredOut(int idx)

References IsChamberFiredOut().

◆ InitStateMachine()

override void DoubleBarrel_Base::InitStateMachine ( )
inlineprivate

Definition at line 129 of file DoubleBarrel_Base.c.

130 {
131 m_abilities.Insert(new AbilityRecord(WeaponActions.CHAMBERING, WeaponActionChamberingTypes.CHAMBERING_END));
132 m_abilities.Insert(new AbilityRecord(WeaponActions.CHAMBERING, WeaponActionChamberingTypes.CHAMBERING_DOUBLE_1));
133 m_abilities.Insert(new AbilityRecord(WeaponActions.CHAMBERING, WeaponActionChamberingTypes.CHAMBERING_DOUBLE_2));
134 m_abilities.Insert(new AbilityRecord(WeaponActions.CHAMBERING, WeaponActionChamberingTypes.CHAMBERING_DOUBLE_3));
135 m_abilities.Insert(new AbilityRecord(WeaponActions.CHAMBERING, WeaponActionChamberingTypes.CHAMBERING_DOUBLE_4));
136 // setup abilities
137 m_abilities.Insert(new AbilityRecord(WeaponActions.MECHANISM, WeaponActionMechanismTypes.MECHANISM_CLOSED));
138 m_abilities.Insert(new AbilityRecord(WeaponActions.UNJAMMING, WeaponActionUnjammingTypes.UNJAMMING_START));
139 m_abilities.Insert(new AbilityRecord(WeaponActions.UNJAMMING, WeaponActionUnjammingTypes.UNJAMMING_END));
140
141 m_abilities.Insert(new AbilityRecord(WeaponActions.FIRE, WeaponActionFireTypes.FIRE_NORMAL));
142 m_abilities.Insert(new AbilityRecord(WeaponActions.FIRE, WeaponActionFireTypes.FIRE_DRY));
143
144
145 // basic weapon states
154
155
156 WeaponStateBase Mech = new WeaponCharging(this, NULL, WeaponActions.MECHANISM, WeaponActionMechanismTypes.MECHANISM_CLOSED);
157
162
164
169
174
175 WeaponEventBase _fin_ = new WeaponEventHumanCommandActionFinished;
176 WeaponEventBase __L__ = new WeaponEventLoad1Bullet;
177 WeaponEventBase __T__ = new WeaponEventTrigger;
178 //WeaponEventBase __U__ = new WeaponEventUnjam;
179 WeaponEventBase __M__ = new WeaponEventMechanism;
180 WeaponEventBase _abt_ = new WeaponEventHumanCommandActionAborted;
181 WeaponEventBase _rto_ = new WeaponEventReloadTimeout;
182 WeaponEventBase _dto_ = new WeaponEventDryFireTimeout;
183
184 m_fsm = new WeaponFSM();
185
186 m_fsm.AddTransition(new WeaponTransition(E_E, __M__, Mech));
187 m_fsm.AddTransition(new WeaponTransition(L_L, __M__, Mech));
188 m_fsm.AddTransition(new WeaponTransition(L_E, __M__, Mech));
189 m_fsm.AddTransition(new WeaponTransition(E_L, __M__, Mech));
190 m_fsm.AddTransition(new WeaponTransition(F_L, __M__, Mech));
191 m_fsm.AddTransition(new WeaponTransition(F_F, __M__, Mech));
192 m_fsm.AddTransition(new WeaponTransition(F_E, __M__, Mech));
193 m_fsm.AddTransition(new WeaponTransition(E_F, __M__, Mech));
194 m_fsm.AddTransition(new WeaponTransition(Mech, _fin_, E_E));
195
196 m_fsm.AddTransition(new WeaponTransition(Mech, _abt_, F_F, NULL, new GuardAnd(new WeaponGuardChamberFiredOut(this, MuzzleIndex.First), new WeaponGuardChamberFiredOut(this, MuzzleIndex.Second))));
197 m_fsm.AddTransition(new WeaponTransition(Mech, _abt_, F_E, NULL, new GuardAnd(new WeaponGuardChamberFiredOut(this, MuzzleIndex.First), new WeaponGuardChamberEmpty(this, MuzzleIndex.Second))));
198 m_fsm.AddTransition(new WeaponTransition(Mech, _abt_, E_F, NULL, new GuardAnd(new WeaponGuardChamberEmpty(this, MuzzleIndex.First), new WeaponGuardChamberFiredOut(this, MuzzleIndex.Second))));
199 m_fsm.AddTransition(new WeaponTransition(Mech, _abt_, F_L, NULL, new GuardAnd(new WeaponGuardChamberFiredOut(this, MuzzleIndex.First), new WeaponGuardChamberFull(this, MuzzleIndex.Second))));
200 m_fsm.AddTransition(new WeaponTransition(Mech, _abt_, L_L, NULL, new GuardAnd(new WeaponGuardChamberFull(this, MuzzleIndex.First), new WeaponGuardChamberFull(this, MuzzleIndex.Second))));
201 m_fsm.AddTransition(new WeaponTransition(Mech, _abt_, L_E, NULL, new GuardAnd(new WeaponGuardChamberFull(this, MuzzleIndex.First), new WeaponGuardChamberEmpty(this, MuzzleIndex.Second))));
202 m_fsm.AddTransition(new WeaponTransition(Mech, _abt_, E_L, NULL, new GuardAnd(new WeaponGuardChamberEmpty(this, MuzzleIndex.First), new WeaponGuardChamberFull(this, MuzzleIndex.Second))));
203 m_fsm.AddTransition(new WeaponTransition(Mech, _abt_, E_E));
204
205 m_fsm.AddTransition(new WeaponTransition(F_F, __L__, Chamber_E));
206 m_fsm.AddTransition(new WeaponTransition(F_E, __L__, Chamber_E));
207 m_fsm.AddTransition(new WeaponTransition(E_F, __L__, Chamber_E));
208 m_fsm.AddTransition(new WeaponTransition(E_E, __L__, Chamber_E));
209 m_fsm.AddTransition(new WeaponTransition(Chamber_E, _fin_, L_E, NULL, new WeaponGuardChamberEmpty(this, MuzzleIndex.Second)));
210 m_fsm.AddTransition(new WeaponTransition(Chamber_E, _fin_, L_L));
211
212 m_fsm.AddTransition(new WeaponTransition(Chamber_E, _abt_, F_F, NULL, new GuardAnd(new WeaponGuardChamberFiredOut(this, MuzzleIndex.First), new WeaponGuardChamberFiredOut(this, MuzzleIndex.Second))));
213 m_fsm.AddTransition(new WeaponTransition(Chamber_E, _abt_, F_E, NULL, new GuardAnd(new WeaponGuardChamberFiredOut(this, MuzzleIndex.First), new WeaponGuardChamberEmpty(this, MuzzleIndex.Second))));
214 m_fsm.AddTransition(new WeaponTransition(Chamber_E, _abt_, E_F, NULL, new GuardAnd(new WeaponGuardChamberEmpty(this, MuzzleIndex.First), new WeaponGuardChamberFiredOut(this, MuzzleIndex.Second))));
215 m_fsm.AddTransition(new WeaponTransition(Chamber_E, _abt_, L_L, NULL, new GuardAnd(new WeaponGuardChamberFull(this, MuzzleIndex.First), new WeaponGuardChamberFull(this, MuzzleIndex.Second))));
216 m_fsm.AddTransition(new WeaponTransition(Chamber_E, _abt_, L_E, NULL, new GuardAnd(new WeaponGuardChamberFull(this, MuzzleIndex.First), new WeaponGuardChamberEmpty(this, MuzzleIndex.Second))));
217 m_fsm.AddTransition(new WeaponTransition(Chamber_E, _abt_, E_E));
218
219
220 m_fsm.AddTransition(new WeaponTransition(L_E, __L__, Chamber_L_E));
221 m_fsm.AddTransition(new WeaponTransition(Chamber_L_E, _abt_, L_L, NULL, new WeaponGuardChamberFull(this, MuzzleIndex.Second)));
222 m_fsm.AddTransition(new WeaponTransition(Chamber_L_E, _abt_, L_E));
223 m_fsm.AddTransition(new WeaponTransition(Chamber_L_E, _fin_, L_L, NULL, new WeaponGuardChamberFull(this, MuzzleIndex.Second)));
224 m_fsm.AddTransition(new WeaponTransition(Chamber_L_E, _fin_, L_E));
225
226 m_fsm.AddTransition(new WeaponTransition(E_L, __L__, Chamber_E_L));
227 m_fsm.AddTransition(new WeaponTransition(Chamber_E_L, _abt_, L_L, NULL, new WeaponGuardChamberFull(this, MuzzleIndex.First)));
228 m_fsm.AddTransition(new WeaponTransition(Chamber_E_L, _abt_, E_L));
229 m_fsm.AddTransition(new WeaponTransition(Chamber_E_L, _fin_, L_L, NULL, new WeaponGuardChamberFull(this, MuzzleIndex.First)));
230 m_fsm.AddTransition(new WeaponTransition(Chamber_E_L, _fin_, E_L));
231
232 m_fsm.AddTransition(new WeaponTransition(F_L, __L__, Chamber_F_L));
233 m_fsm.AddTransition(new WeaponTransition(Chamber_F_L, _abt_, F_L, NULL, new WeaponGuardChamberFiredOut(this, MuzzleIndex.First)));
234 m_fsm.AddTransition(new WeaponTransition(Chamber_F_L, _abt_, L_L, NULL, new GuardAnd(new WeaponGuardChamberFull(this, MuzzleIndex.First), new WeaponGuardChamberFull(this, MuzzleIndex.Second))));
235 m_fsm.AddTransition(new WeaponTransition(Chamber_F_L, _abt_, E_L, NULL, new GuardAnd(new WeaponGuardChamberEmpty(this, MuzzleIndex.First), new WeaponGuardChamberFull(this, MuzzleIndex.Second))));
236 m_fsm.AddTransition(new WeaponTransition(Chamber_F_L, _abt_, L_E));
237 m_fsm.AddTransition(new WeaponTransition(Chamber_F_L, _fin_, F_L, NULL, new WeaponGuardChamberFiredOut(this, MuzzleIndex.First)));
238 m_fsm.AddTransition(new WeaponTransition(Chamber_F_L, _fin_, L_L, NULL, new GuardAnd(new WeaponGuardChamberFull(this, MuzzleIndex.First), new WeaponGuardChamberFull(this, MuzzleIndex.Second))));
239 m_fsm.AddTransition(new WeaponTransition(Chamber_F_L, _fin_, E_L, NULL, new GuardAnd(new WeaponGuardChamberEmpty(this, MuzzleIndex.First), new WeaponGuardChamberFull(this, MuzzleIndex.Second))));
240 m_fsm.AddTransition(new WeaponTransition(Chamber_F_L, _fin_, L_E));
241
242 m_fsm.AddTransition(new WeaponTransition(L_E, __T__, Trigger_L_E));
243 m_fsm.AddTransition(new WeaponTransition(Trigger_L_E, _fin_, F_E));
244 m_fsm.AddTransition(new WeaponTransition(Trigger_L_E, _rto_, F_E));
245 m_fsm.AddTransition(new WeaponTransition(Trigger_L_E, _abt_, F_E));
246
247 m_fsm.AddTransition(new WeaponTransition(E_L, __T__, Trigger_E_L));
248 m_fsm.AddTransition(new WeaponTransition(Trigger_E_L, _fin_, E_F));
249 m_fsm.AddTransition(new WeaponTransition(Trigger_E_L, _rto_, E_F));
250 m_fsm.AddTransition(new WeaponTransition(Trigger_E_L, _abt_, E_F));
251
252 m_fsm.AddTransition(new WeaponTransition(F_L, __T__, Trigger_F_L));
253 m_fsm.AddTransition(new WeaponTransition(Trigger_F_L, _fin_, F_F));
254 m_fsm.AddTransition(new WeaponTransition(Trigger_F_L, _rto_, F_F));
255 m_fsm.AddTransition(new WeaponTransition(Trigger_F_L, _abt_, F_F));
256
257 m_fsm.AddTransition(new WeaponTransition(L_L, __T__, Trigger_L_L));
258 m_fsm.AddTransition(new WeaponTransition(Trigger_L_L, _fin_, F_F, NULL, new GuardAnd(new WeaponGuardChamberFiredOut(this, MuzzleIndex.First), new WeaponGuardChamberFiredOut(this, MuzzleIndex.Second))));
259 m_fsm.AddTransition(new WeaponTransition(Trigger_L_L, _rto_, F_F, NULL, new GuardAnd(new WeaponGuardChamberFiredOut(this, MuzzleIndex.First), new WeaponGuardChamberFiredOut(this, MuzzleIndex.Second))));
260 m_fsm.AddTransition(new WeaponTransition(Trigger_L_L, _abt_, F_F, NULL, new GuardAnd(new WeaponGuardChamberFiredOut(this, MuzzleIndex.First), new WeaponGuardChamberFiredOut(this, MuzzleIndex.Second))));
261 m_fsm.AddTransition(new WeaponTransition(Trigger_L_L, _fin_, F_L));
262 m_fsm.AddTransition(new WeaponTransition(Trigger_L_L, _rto_, F_L));
263 m_fsm.AddTransition(new WeaponTransition(Trigger_L_L, _abt_, F_L));
264
265 m_fsm.AddTransition(new WeaponTransition(F_F, __T__, Trigger_F_F));
266 m_fsm.AddTransition(new WeaponTransition(Trigger_F_F, _fin_, F_F));
267 m_fsm.AddTransition(new WeaponTransition(Trigger_F_F, _dto_, F_F));
268 m_fsm.AddTransition(new WeaponTransition(Trigger_F_F, _abt_, F_F));
269
270 m_fsm.AddTransition(new WeaponTransition(F_E, __T__, Trigger_F_E));
271 m_fsm.AddTransition(new WeaponTransition(Trigger_F_E, _fin_, F_E));
272 m_fsm.AddTransition(new WeaponTransition(Trigger_F_E, _dto_, F_E));
273 m_fsm.AddTransition(new WeaponTransition(Trigger_F_E, _abt_, F_E));
274
275 m_fsm.AddTransition(new WeaponTransition(E_F, __T__, Trigger_E_F));
276 m_fsm.AddTransition(new WeaponTransition(Trigger_E_F, _fin_, E_F));
277 m_fsm.AddTransition(new WeaponTransition(Trigger_E_F, _dto_, E_F));
278 m_fsm.AddTransition(new WeaponTransition(Trigger_E_F, _abt_, E_F));
279
280 m_fsm.AddTransition(new WeaponTransition(E_E, __T__, Trigger_E_E));
281 m_fsm.AddTransition(new WeaponTransition(Trigger_E_E, _fin_, E_E));
282 m_fsm.AddTransition(new WeaponTransition(Trigger_E_E, _dto_, E_E));
283 m_fsm.AddTransition(new WeaponTransition(Trigger_E_E, _abt_, E_E));
284
285
286 SetInitialState(E_E);
287
288 for (int i = 0; i < GetMuzzleCount(); i++)
289 HideBullet(i);
290 m_fsm.Start();
291
292 }
DoubleBarrelAnimState
enum FSMTransition WeaponTransition
void ChamberMultiBullet(Weapon_Base w=NULL, WeaponStateBase parent=NULL, WeaponActions action=WeaponActions.NONE, int startActionType=-1, int endActionType=-1)
pair ( action, actionType )
Definition Weapon_Base.c:5
ref WeaponStableState L_L
ref WeaponStableState L_E
ref WeaponStableState E_E
ref WeaponStableState E_L
ref WeaponStableState F_L
ref WeaponStableState F_E
ref WeaponStableState F_F
ref WeaponStableState E_F
charging of weapon without ammo to be chambered
signalize mechanism manipulation
Definition Events.c:35
weapon finite state machine
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 ChamberMultiBullet(), E_E, E_F, E_L, F_E, F_F, F_L, L_E, and L_L.

◆ SetActions()

override void DoubleBarrel_Base::SetActions ( )
inlineprivate

Definition at line 310 of file DoubleBarrel_Base.c.

311 {
312 super.SetActions();
314
317 }
void AddAction(typename actionName)
void RemoveAction(typename actionName)
FirearmActionLoadBullet FirearmActionBase FirearmActionLoadBulletQuick()

References AddAction(), FirearmActionLoadBulletQuick(), and RemoveAction().

Member Data Documentation

◆ E_E

ref WeaponStableState DoubleBarrel_Base::E_E
private

Definition at line 127 of file DoubleBarrel_Base.c.

Referenced by InitStateMachine().

◆ E_F

ref WeaponStableState DoubleBarrel_Base::E_F
private

Definition at line 126 of file DoubleBarrel_Base.c.

Referenced by InitStateMachine().

◆ E_L

ref WeaponStableState DoubleBarrel_Base::E_L
private

Definition at line 122 of file DoubleBarrel_Base.c.

Referenced by InitStateMachine().

◆ F_E

ref WeaponStableState DoubleBarrel_Base::F_E
private

Definition at line 125 of file DoubleBarrel_Base.c.

Referenced by InitStateMachine().

◆ F_F

ref WeaponStableState DoubleBarrel_Base::F_F
private

Definition at line 124 of file DoubleBarrel_Base.c.

Referenced by InitStateMachine().

◆ F_L

ref WeaponStableState DoubleBarrel_Base::F_L
private

Definition at line 123 of file DoubleBarrel_Base.c.

Referenced by InitStateMachine().

◆ L_E

ref WeaponStableState DoubleBarrel_Base::L_E
private

Definition at line 121 of file DoubleBarrel_Base.c.

Referenced by InitStateMachine().

◆ L_L

ref WeaponStableState DoubleBarrel_Base::L_L
private

Definition at line 120 of file DoubleBarrel_Base.c.

Referenced by InitStateMachine().


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