DayZ 1.24
Loading...
Searching...
No Matches
Pistol_Base.c
Go to the documentation of this file.
9
10// naming convention of the states respect following order:
11// closed/opened | charged/discharged | bullet/nobullet | magazine/nomag
26
28{
29 override void OnEntry(WeaponEventBase e) { if (LogManager.IsWeaponLogEnable()) wpnPrint("[wpnstate] { CD00 closed dischgd nobull nomag"); super.OnEntry(e); }
30 override void OnExit(WeaponEventBase e) { super.OnExit(e); if (LogManager.IsWeaponLogEnable()) wpnPrint("[wpnstate] } CD00 closed dischgd nobull nomag"); }
31 override int GetCurrentStateID() { return PistolStableStateID.CLO_DIS_BU0_MA0; }
32 override bool HasBullet() { return false; }
33 override bool HasMagazine() { return false; }
34 override bool IsJammed() { return false; }
35 override bool IsDischarged() { return true; }
36 override bool IsRepairEnabled() { return true; }
38};
41 override void OnEntry(WeaponEventBase e) { if (LogManager.IsWeaponLogEnable()) wpnPrint("[wpnstate] { CC00 closed charged nobull nomag"); super.OnEntry(e); }
42 override void OnExit(WeaponEventBase e) { super.OnExit(e); if (LogManager.IsWeaponLogEnable()) wpnPrint("[wpnstate] } CC00 closed charged nobull nomag"); }
43 override int GetCurrentStateID() { return PistolStableStateID.CLO_CHG_BU0_MA0; }
44 override bool HasBullet() { return false; }
45 override bool HasMagazine() { return false; }
46 override bool IsJammed() { return false; }
47 override bool IsRepairEnabled() { return true; }
49};
51{
52 override void OnEntry(WeaponEventBase e) { if (LogManager.IsWeaponLogEnable()) wpnPrint("[wpnstate] { CC10 closed charged bullet nomag"); super.OnEntry(e); }
53 override void OnExit(WeaponEventBase e) { super.OnExit(e); if (LogManager.IsWeaponLogEnable()) wpnPrint("[wpnstate] } CC10 closed charged bullet nomag"); }
54 override int GetCurrentStateID() { return PistolStableStateID.CLO_CHG_BU1_MA0; }
55 override bool HasBullet() { return true; }
56 override bool HasMagazine() { return false; }
57 override bool IsJammed() { return false; }
58 override bool IsRepairEnabled() { return true; }
60};
62{
63 override void OnEntry(WeaponEventBase e) { if (LogManager.IsWeaponLogEnable()) wpnPrint("[wpnstate] { CJF0 closed jammed bullet nomag"); super.OnEntry(e); }
64 override void OnExit(WeaponEventBase e) { super.OnExit(e); if (LogManager.IsWeaponLogEnable()) wpnPrint("[wpnstate] } CJF0 closed jammed bullet nomag"); }
65 override int GetCurrentStateID() { return PistolStableStateID.CLO_JAM_BU1_MA0; }
66 override bool HasBullet() { return true; }
67 override bool HasMagazine() { return false; }
68 override bool IsJammed() { return true; }
69 override bool IsBoltOpen() { return true; }
70 override bool IsRepairEnabled() { return true; }
72};
74{
75 override void OnEntry(WeaponEventBase e) { if (LogManager.IsWeaponLogEnable()) wpnPrint("[wpnstate] { OD00 opened dischgd nobullet nomag"); m_weapon.SetCharged(false); m_weapon.SetWeaponOpen(true); super.OnEntry(e); }
76 override void OnExit(WeaponEventBase e) { super.OnExit(e); if (LogManager.IsWeaponLogEnable()) wpnPrint("[wpnstate] } 0D00 opened dischgd nobullet nomag"); }
77 override int GetCurrentStateID() { return PistolStableStateID.OPE_DIS_BU0_MA0; }
78 override bool HasBullet() { return false; }
79 override bool HasMagazine() { return false; }
80 override bool IsJammed() { return false; }
81 override bool IsBoltOpen() { return true; }
82 override bool IsDischarged() { return true; }
83 override bool IsRepairEnabled() { return true; }
85};
87{
88 override void OnEntry(WeaponEventBase e) { if (LogManager.IsWeaponLogEnable()) wpnPrint("[wpnstate] { CC01 closed charged nobullet mag"); super.OnEntry(e); }
89 override void OnExit(WeaponEventBase e) { super.OnExit(e); if (LogManager.IsWeaponLogEnable()) wpnPrint("[wpnstate] } CC01 closed charged nobullet mag"); }
90 override int GetCurrentStateID() { return PistolStableStateID.CLO_CHG_BU0_MA1; }
91 override bool HasBullet() { return false; }
92 override bool HasMagazine() { return true; }
93 override bool IsJammed() { return false; }
94 override bool IsRepairEnabled() { return true; }
96};
98{
99 override void OnEntry(WeaponEventBase e) { if (LogManager.IsWeaponLogEnable()) wpnPrint("[wpnstate] { CD01 closed dischgd nobullet mag"); m_weapon.SetCharged(false); super.OnEntry(e); }
100 override void OnExit(WeaponEventBase e) { super.OnExit(e); if (LogManager.IsWeaponLogEnable()) wpnPrint("[wpnstate] } CD01 closed dischgd nobullet mag"); }
101 override int GetCurrentStateID() { return PistolStableStateID.CLO_DIS_BU0_MA1; }
102 override bool HasBullet() { return false; }
103 override bool HasMagazine() { return true; }
104 override bool IsJammed() { return false; }
105 override bool IsRepairEnabled() { return true; }
107};
109{
110 override void OnEntry(WeaponEventBase e) { if (LogManager.IsWeaponLogEnable()) wpnPrint("[wpnstate] { CJF1 closed jammed bullet mag"); super.OnEntry(e); }
111 override void OnExit(WeaponEventBase e) { super.OnExit(e); if (LogManager.IsWeaponLogEnable()) wpnPrint("[wpnstate] } CJF1 closed jammed bullet mag"); }
112 override int GetCurrentStateID() { return PistolStableStateID.CLO_JAM_BU1_MA1; }
113 override bool HasBullet() { return true; }
114 override bool HasMagazine() { return true; }
115 override bool IsJammed() { return true; }
116 override bool IsBoltOpen() { return true; }
117 override bool IsRepairEnabled() { return true; }
119};
121{
122 override void OnEntry(WeaponEventBase e) { if (LogManager.IsWeaponLogEnable()) wpnPrint("[wpnstate] { CC11 closed charged bullet mag"); super.OnEntry(e); }
123 override void OnExit(WeaponEventBase e) { super.OnExit(e); if (LogManager.IsWeaponLogEnable()) wpnPrint("[wpnstate] } CC11 closed charged bullet mag"); }
124 override int GetCurrentStateID() { return PistolStableStateID.CLO_CHG_BU1_MA1; }
125 override bool HasBullet() { return true; }
126 override bool HasMagazine() { return true; }
127 override bool IsJammed() { return false; }
128 override bool IsRepairEnabled() { return true; }
130};
132{
133 override void OnEntry(WeaponEventBase e) { if (LogManager.IsWeaponLogEnable()) wpnPrint("[wpnstate] { OD01 opened dischgd nobullet mag"); m_weapon.SetWeaponOpen(true); super.OnEntry(e); }
134 override void OnExit(WeaponEventBase e) { super.OnExit(e); if (LogManager.IsWeaponLogEnable()) wpnPrint("[wpnstate] } 0D01 opened dischgd nobullet mag"); }
135 override int GetCurrentStateID() { return PistolStableStateID.OPE_DIS_BU0_MA1; }
136 override bool HasBullet() { return false; }
137 override bool HasMagazine() { return true; }
138 override bool IsJammed() { return false; }
139 override bool IsBoltOpen() { return true; }
140 override bool IsRepairEnabled() { return true; }
142};
143
144
149class Pistol_Base extends Weapon_Base
150{
161
163 {
164 return super.CanChamberBullet(muzzleIndex, mag) && IsChamberEmpty(muzzleIndex);
165 }
166
168 {
169 }
170
171 override void InitStateMachine()
172 {
173 m_abilities.Insert(new AbilityRecord(WeaponActions.RELOAD, WeaponActionReloadTypes.RELOADPISTOL_MAGAZINE_BULLET_CLOSED));
174 m_abilities.Insert(new AbilityRecord(WeaponActions.RELOAD, WeaponActionReloadTypes.RELOADPISTOL_NOMAGAZINE_BULLET_CLOSED));
175 m_abilities.Insert(new AbilityRecord(WeaponActions.RELOAD, WeaponActionReloadTypes.RELOADPISTOL_MAGAZINE_NOBULLET_CLOSED_COCKED));
176 m_abilities.Insert(new AbilityRecord(WeaponActions.RELOAD, WeaponActionReloadTypes.RELOADPISTOL_NOMAGAZINE_NOBULLET_CLOSED_COCKED));
177 m_abilities.Insert(new AbilityRecord(WeaponActions.RELOAD, WeaponActionReloadTypes.RELOADPISTOL_MAGAZINE_NOBULLET_CLOSED_UNCOCKED));
178 m_abilities.Insert(new AbilityRecord(WeaponActions.RELOAD, WeaponActionReloadTypes.RELOADPISTOL_NOMAGAZINE_NOBULLET_CLOSED_UNCOCKED));
179 m_abilities.Insert(new AbilityRecord(WeaponActions.RELOAD, WeaponActionReloadTypes.RELOADPISTOL_NOMAGAZINE_NOBULLET_OPENED));
180 m_abilities.Insert(new AbilityRecord(WeaponActions.RELOAD, WeaponActionReloadTypes.RELOADPISTOL_MAGAZINE_NOBULLET_OPENED));
181 m_abilities.Insert(new AbilityRecord(WeaponActions.RELOAD, WeaponActionReloadTypes.RELOAD_MAGAZINE_DETACH));
182
183 m_abilities.Insert(new AbilityRecord(WeaponActions.CHAMBERING, WeaponActionChamberingTypes.CHAMBERING_ONEBULLET_CLOSED));
184 m_abilities.Insert(new AbilityRecord(WeaponActions.CHAMBERING, WeaponActionChamberingTypes.CHAMBERING_ONEBULLET_OPENED));
185
186 m_abilities.Insert(new AbilityRecord(WeaponActions.MECHANISM, WeaponActionMechanismTypes.MECHANISM_CLOSED));
187 m_abilities.Insert(new AbilityRecord(WeaponActions.MECHANISM, WeaponActionMechanismTypes.MECHANISM_OPENED));
188 m_abilities.Insert(new AbilityRecord(WeaponActions.MECHANISM, WeaponActionMechanismTypes.MECHANISM_CLOSED_UNCOCKED));
189
190 m_abilities.Insert(new AbilityRecord(WeaponActions.UNJAMMING, WeaponActionUnjammingTypes.UNJAMMING_START));
191 m_abilities.Insert(new AbilityRecord(WeaponActions.UNJAMMING, WeaponActionUnjammingTypes.UNJAMMING_END));
192
193 m_abilities.Insert(new AbilityRecord(WeaponActions.FIRE, WeaponActionFireTypes.FIRE_NORMAL));
194 m_abilities.Insert(new AbilityRecord(WeaponActions.FIRE, WeaponActionFireTypes.FIRE_LAST));
195 m_abilities.Insert(new AbilityRecord(WeaponActions.FIRE, WeaponActionFireTypes.FIRE_COCKED));
196 m_abilities.Insert(new AbilityRecord(WeaponActions.FIRE, WeaponActionFireTypes.FIRE_UNCOCKED));
197 m_abilities.Insert(new AbilityRecord(WeaponActions.FIRE, WeaponActionFireTypes.FIRE_JAM));
198
199 // setup state machine
200 // basic weapon states
201 // open-closed | discharged-charged | nobullet-bullet | nomag-mag
202 // regexp: [OC][CDJ][01][01]
203 CD00 = new Pistol_CLO_DIS_BU0_MA0(this, NULL, PistolAnimState.DEFAULT);
204 CC00 = new Pistol_CLO_CHG_BU0_MA0(this, NULL, PistolAnimState.CLOSED_CHARGED);
205 CC10 = new Pistol_CLO_CHG_BU1_MA0(this, NULL, PistolAnimState.CLOSED_CHARGED);
206 CJF0 = new Pistol_CLO_JAM_BU1_MA0(this, NULL, PistolAnimState.JAMMED);
207 OD00 = new Pistol_OPE_DIS_BU0_MA0(this, NULL, PistolAnimState.OPENED_DISCHARGED);
208 CD01 = new Pistol_CLO_DIS_BU0_MA1(this, NULL, PistolAnimState.DEFAULT);
209 CC01 = new Pistol_CLO_CHG_BU0_MA1(this, NULL, PistolAnimState.CLOSED_CHARGED);
210 CC11 = new Pistol_CLO_CHG_BU1_MA1(this, NULL, PistolAnimState.CLOSED_CHARGED);
211 CJF1 = new Pistol_CLO_JAM_BU1_MA1(this, NULL, PistolAnimState.JAMMED);
212 OD01 = new Pistol_OPE_DIS_BU0_MA1(this, NULL, PistolAnimState.OPENED_DISCHARGED);
213
214 // unstable (intermediate) states
215 WeaponCharging Mech_CD00 = new WeaponCharging(this, NULL, WeaponActions.MECHANISM, WeaponActionMechanismTypes.MECHANISM_CLOSED_UNCOCKED);
217 WeaponCharging Mech_CD01 = new WeaponCharging(this, NULL, WeaponActions.MECHANISM, WeaponActionMechanismTypes.MECHANISM_CLOSED_UNCOCKED);
221
222 WeaponCharging Mech_CC10 = new WeaponCharging(this, NULL, WeaponActions.MECHANISM, WeaponActionMechanismTypes.MECHANISM_CLOSED); // eject with no mag
223 WeaponCharging Mech_CC11 = new WeaponCharging(this, NULL, WeaponActions.MECHANISM, WeaponActionMechanismTypes.MECHANISM_CLOSED); // eject with mag
224
225
226 WeaponDryFire Trigger_CC00 = new WeaponDryFire(this, NULL, WeaponActions.FIRE, WeaponActionFireTypes.FIRE_COCKED); // cock without clip
231 WeaponDryFire Trigger_CC01 = new WeaponDryFire(this, NULL, WeaponActions.FIRE, WeaponActionFireTypes.FIRE_COCKED); // cock with clip
234
235 WeaponFireAndChamberNext Trigger_CC11 = new WeaponFireAndChamberNext(this, NULL, WeaponActions.FIRE, WeaponActionFireTypes.FIRE_NORMAL);
236 WeaponStateBase Trigger_CC10 = new WeaponFireLast(this, NULL, WeaponActions.FIRE, WeaponActionFireTypes.FIRE_NORMAL); // fire last no mag
237 WeaponStateBase Trigger_CC11L = new WeaponFireLast(this, NULL, WeaponActions.FIRE, WeaponActionFireTypes.FIRE_LAST); // fire last with mag
238
241
244
245 WeaponChambering Chamber_CD00 = new WeaponChambering(this, NULL, WeaponActions.CHAMBERING, WeaponActionChamberingTypes.CHAMBERING_ONEBULLET_CLOSED_UNCOCKED);
246 WeaponChambering Chamber_CC00 = new WeaponChambering(this, NULL, WeaponActions.CHAMBERING, WeaponActionChamberingTypes.CHAMBERING_ONEBULLET_CLOSED);
247 WeaponChambering Chamber_OD00 = new WeaponChambering(this, NULL, WeaponActions.CHAMBERING, WeaponActionChamberingTypes.CHAMBERING_ONEBULLET_OPENED);
248 WeaponChambering Chamber_CD01 = new WeaponChambering(this, NULL, WeaponActions.CHAMBERING, WeaponActionChamberingTypes.CHAMBERING_ONEBULLET_CLOSED_UNCOCKED);
249 WeaponChambering Chamber_CC01 = new WeaponChambering(this, NULL, WeaponActions.CHAMBERING, WeaponActionChamberingTypes.CHAMBERING_ONEBULLET_CLOSED);
250 WeaponChambering Chamber_OD01 = new WeaponChambering(this, NULL, WeaponActions.CHAMBERING, WeaponActionChamberingTypes.CHAMBERING_ONEBULLET_OPENED);
251
252 WeaponAttachMagazine Attach_CC10 = new WeaponAttachMagazine(this, NULL, WeaponActions.RELOAD, WeaponActionReloadTypes.RELOADPISTOL_NOMAGAZINE_BULLET_CLOSED);
253 WeaponAttachMagazine Attach_CJF0 = new WeaponAttachMagazine(this, NULL, WeaponActions.RELOAD, WeaponActionReloadTypes.RELOADPISTOL_NOMAGAZINE_BULLET_CLOSED);
254 WeaponAttachMagazine Attach_CD00 = new WeaponAttachMagazine(this, NULL, WeaponActions.RELOAD, WeaponActionReloadTypes.RELOADPISTOL_NOMAGAZINE_NOBULLET_CLOSED_UNCOCKED);
255 WeaponAttachMagazine Attach_CC00 = new WeaponAttachMagazine(this, NULL, WeaponActions.RELOAD, WeaponActionReloadTypes.RELOADPISTOL_NOMAGAZINE_NOBULLET_CLOSED_COCKED);
256 WeaponAttachMagazine Attach_OD00 = new WeaponAttachMagazine(this, NULL, WeaponActions.RELOAD, WeaponActionReloadTypes.RELOADPISTOL_NOMAGAZINE_NOBULLET_OPENED);
257
258 WeaponReplacingMagAndChamberNext Reload_CD01 = new WeaponReplacingMagAndChamberNext(this, NULL, WeaponActions.RELOAD, WeaponActionReloadTypes.RELOADPISTOL_MAGAZINE_NOBULLET_CLOSED_UNCOCKED);
259 WeaponReplacingMagAndChamberNext Reload_CC01 = new WeaponReplacingMagAndChamberNext(this, NULL, WeaponActions.RELOAD, WeaponActionReloadTypes.RELOADPISTOL_MAGAZINE_NOBULLET_CLOSED_COCKED);
263
264 WeaponDetachingMag Detach_CC11 = new WeaponDetachingMag(this, NULL, WeaponActions.RELOAD, WeaponActionReloadTypes.RELOAD_MAGAZINE_DETACH);
265 WeaponDetachingMag Detach_CC01 = new WeaponDetachingMag(this, NULL, WeaponActions.RELOAD, WeaponActionReloadTypes.RELOAD_MAGAZINE_DETACH);
266 WeaponDetachingMag Detach_CD01 = new WeaponDetachingMag(this, NULL, WeaponActions.RELOAD, WeaponActionReloadTypes.RELOAD_MAGAZINE_DETACH);
267 WeaponDetachingMag Detach_OD01 = new WeaponDetachingMag(this, NULL, WeaponActions.RELOAD, WeaponActionReloadTypes.RELOAD_MAGAZINE_DETACH);
268 WeaponDetachingMag Detach_CJF1 = new WeaponDetachingMag(this, NULL, WeaponActions.RELOAD, WeaponActionReloadTypes.RELOAD_MAGAZINE_DETACH);
269
270 // events
271 WeaponEventBase __M__ = new WeaponEventMechanism;
272 WeaponEventBase __T__ = new WeaponEventTrigger;
273 WeaponEventBase __TJ_ = new WeaponEventTriggerToJam;
274 WeaponEventBase __U__ = new WeaponEventUnjam;
275 WeaponEventBase __L__ = new WeaponEventLoad1Bullet;
276 WeaponEventBase __A__ = new WeaponEventAttachMagazine;
277 WeaponEventBase __D__ = new WeaponEventDetachMagazine;
278 WeaponEventBase __S__ = new WeaponEventSwapMagazine;
279 WeaponEventBase _fin_ = new WeaponEventHumanCommandActionFinished;
280 WeaponEventBase _rto_ = new WeaponEventReloadTimeout;
281 WeaponEventBase _dto_ = new WeaponEventDryFireTimeout;
282 WeaponEventBase _abt_ = new WeaponEventHumanCommandActionAborted;
283
284 m_fsm = new WeaponFSM();
285
286 //WeaponGuardWeaponDischarged
287 //WeaponGuardWeaponOpen
288
289 // charging
290 m_fsm.AddTransition(new WeaponTransition(CD00, __M__, Mech_CD00)); // charge from closed
291 m_fsm.AddTransition(new WeaponTransition(Mech_CD00, _fin_, CC00, NULL, new WeaponGuardWeaponDischarged(this)));
292 m_fsm.AddTransition(new WeaponTransition(Mech_CD00, _fin_, CD00));
293 m_fsm.AddTransition(new WeaponTransition(Mech_CD00, _abt_, CC00, NULL, new WeaponGuardWeaponDischarged(this)));
294 m_fsm.AddTransition(new WeaponTransition(Mech_CD00, _abt_, CD00));
295
296 m_fsm.AddTransition(new WeaponTransition(CC00, __M__, Mech_CC00)); // charge from charged
297 m_fsm.AddTransition(new WeaponTransition(Mech_CC00, _fin_, CC00));
298 m_fsm.AddTransition(new WeaponTransition(Mech_CC00, _abt_, CC00));
299
300 m_fsm.AddTransition(new WeaponTransition(OD00, __M__, Mech_OD00)); // charge from opened
301 m_fsm.AddTransition(new WeaponTransition(Mech_OD00, _fin_, CD00, NULL, new WeaponGuardWeaponOpen(this)));
302 m_fsm.AddTransition(new WeaponTransition(Mech_OD00, _fin_, CC00));
303 m_fsm.AddTransition(new WeaponTransition(Mech_OD00, _abt_, CD00, NULL, new WeaponGuardWeaponOpen(this)));
304 m_fsm.AddTransition(new WeaponTransition(Mech_OD00, _abt_, CC00));
305
306 m_fsm.AddTransition(new WeaponTransition(OD01, __M__, Mech_OD01)); // charge from opened with mag
307 m_fsm.AddTransition(new WeaponTransition(Mech_OD01, _fin_, OD01, NULL, new WeaponGuardWeaponOpen(this)));
308 m_fsm.AddTransition(new WeaponTransition(Mech_OD01, _fin_, CC01, NULL, new WeaponGuardCurrentChamberEmpty(this)));
309 m_fsm.AddTransition(new WeaponTransition(Mech_OD01, _fin_, CC11));
310 m_fsm.AddTransition(new WeaponTransition(Mech_OD01, _abt_, OD01, NULL, new WeaponGuardWeaponOpen(this)));
311 m_fsm.AddTransition(new WeaponTransition(Mech_OD01, _abt_, CC01, NULL, new WeaponGuardCurrentChamberEmpty(this)));
312 m_fsm.AddTransition(new WeaponTransition(Mech_OD01, _abt_, CC11));
313
314 m_fsm.AddTransition(new WeaponTransition(CD01, __M__, Mech_CD01)); // charge from closed=1 with mag
315 m_fsm.AddTransition(new WeaponTransition(Mech_CD01, _fin_, CD01, NULL, new WeaponGuardWeaponDischarged(this)));
316 m_fsm.AddTransition(new WeaponTransition(Mech_CD01, _fin_, CC01, NULL, new WeaponGuardCurrentChamberEmpty(this)));
317 m_fsm.AddTransition(new WeaponTransition(Mech_CD01, _fin_, CC11));
318 m_fsm.AddTransition(new WeaponTransition(Mech_CD01, _abt_, CD01, NULL, new WeaponGuardWeaponDischarged(this)));
319 m_fsm.AddTransition(new WeaponTransition(Mech_CD01, _abt_, CC01, NULL, new WeaponGuardCurrentChamberEmpty(this)));
320 m_fsm.AddTransition(new WeaponTransition(Mech_CD01, _abt_, CC11));
321
322 m_fsm.AddTransition(new WeaponTransition(CC01, __M__, Mech_CC01)); // charge from closed/charged with mag
323 m_fsm.AddTransition(new WeaponTransition(Mech_CC01, _fin_, CC01, NULL, new WeaponGuardCurrentChamberEmpty(this)));
324 m_fsm.AddTransition(new WeaponTransition(Mech_CC01, _fin_, CC11));
325 m_fsm.AddTransition(new WeaponTransition(Mech_CC01, _abt_, CC01, NULL, new WeaponGuardCurrentChamberEmpty(this)));
326 m_fsm.AddTransition(new WeaponTransition(Mech_CC01, _abt_, CC11));
327
328 // eject good cartridge
329 m_fsm.AddTransition(new WeaponTransition(CC10, __M__, Mech_CC10)); // eject chamber nomag
330 m_fsm.AddTransition(new WeaponTransition(Mech_CC10, _fin_, CC00, NULL, new WeaponGuardCurrentChamberEmpty(this)));
331 m_fsm.AddTransition(new WeaponTransition(Mech_CC10, _fin_, CC10));
332 m_fsm.AddTransition(new WeaponTransition(Mech_CC10, _abt_, CC00, NULL, new WeaponGuardCurrentChamberEmpty(this)));
333 m_fsm.AddTransition(new WeaponTransition(Mech_CC10, _abt_, CC10));
334
335 m_fsm.AddTransition(new WeaponTransition(CC11, __M__, Mech_CC11)); // eject with mag with ammo
336 m_fsm.AddTransition(new WeaponTransition(Mech_CC11, _fin_, CC01, NULL, new WeaponGuardCurrentChamberEmpty(this)));
337 m_fsm.AddTransition(new WeaponTransition(Mech_CC11, _fin_, CC11));
338 m_fsm.AddTransition(new WeaponTransition(Mech_CC11, _abt_, CC01, NULL, new WeaponGuardCurrentChamberEmpty(this)));
339 m_fsm.AddTransition(new WeaponTransition(Mech_CC11, _abt_, CC11));
340
341 // Trigger_CC11e
342 m_fsm.AddTransition(new WeaponTransition(CC00, __T__, Trigger_CC00)); // fire.cocked
343 m_fsm.AddTransition(new WeaponTransition(Trigger_CC00, _fin_, CD00));
344 m_fsm.AddTransition(new WeaponTransition(Trigger_CC00, _dto_, CD00));
345 m_fsm.AddTransition(new WeaponTransition(Trigger_CC00, _abt_, CD00));
346
347 m_fsm.AddTransition(new WeaponTransition(CD00, __T__, Trigger_CD00)); // fire.uncocked
348 m_fsm.AddTransition(new WeaponTransition(Trigger_CD00, _fin_, CD00));
349 m_fsm.AddTransition(new WeaponTransition(Trigger_CD00, _dto_, CD00));
350 m_fsm.AddTransition(new WeaponTransition(Trigger_CD00, _abt_, CD00));
351
352 m_fsm.AddTransition(new WeaponTransition(OD00, __T__, Trigger_OD00)); // opened fire.uncocked
353 m_fsm.AddTransition(new WeaponTransition(Trigger_OD00, _fin_, OD00));
354 m_fsm.AddTransition(new WeaponTransition(Trigger_OD00, _dto_, OD00));
355 m_fsm.AddTransition(new WeaponTransition(Trigger_OD00, _abt_, OD00));
356
357 m_fsm.AddTransition(new WeaponTransition(CD01, __T__, Trigger_CD01)); // fire.uncocked w mag
358 m_fsm.AddTransition(new WeaponTransition(Trigger_CD01, _fin_, CD01));
359 m_fsm.AddTransition(new WeaponTransition(Trigger_CD01, _dto_, CD01));
360 m_fsm.AddTransition(new WeaponTransition(Trigger_CD01, _abt_, CD01));
361
362 m_fsm.AddTransition(new WeaponTransition(OD01, __T__, Trigger_OD01)); // opened fire.uncocked w mag
363 m_fsm.AddTransition(new WeaponTransition(Trigger_OD01, _fin_, OD01));
364 m_fsm.AddTransition(new WeaponTransition(Trigger_OD01, _dto_, OD01));
365 m_fsm.AddTransition(new WeaponTransition(Trigger_OD01, _abt_, OD01));
366
367 m_fsm.AddTransition(new WeaponTransition(CJF0, __T__, Trigger_CJF0)); // opened fire.uncocked w mag
368 m_fsm.AddTransition(new WeaponTransition(Trigger_CJF0, _fin_, CJF0));
369 m_fsm.AddTransition(new WeaponTransition(Trigger_CJF0, _dto_, CJF0));
370 m_fsm.AddTransition(new WeaponTransition(Trigger_CJF0, _abt_, CJF0));
371
372 m_fsm.AddTransition(new WeaponTransition(CJF1, __T__, Trigger_CJF1)); // opened fire.uncocked w mag
373 m_fsm.AddTransition(new WeaponTransition(Trigger_CJF1, _fin_, CJF1));
374 m_fsm.AddTransition(new WeaponTransition(Trigger_CJF1, _dto_, CJF1));
375 m_fsm.AddTransition(new WeaponTransition(Trigger_CJF1, _abt_, CJF1));
376
377
378 m_fsm.AddTransition(new WeaponTransition(CC10, __T__, Trigger_CC10)); // or fire.last (if not jammed)
379 m_fsm.AddTransition(new WeaponTransition(Trigger_CC10, _fin_, CC00));
380 m_fsm.AddTransition(new WeaponTransition(Trigger_CC10, _rto_, CC00));
381 m_fsm.AddTransition(new WeaponTransition(Trigger_CC10, _abt_, CC00));
382
383 m_fsm.AddTransition(new WeaponTransition(CC10, __TJ_, Trigger_CC10J)); // or fire.last (if not jammed)
384 m_fsm.AddTransition(new WeaponTransition(Trigger_CC10J, _fin_, CJF0));
385 m_fsm.AddTransition(new WeaponTransition(Trigger_CC10J, _rto_, CJF0));
386 m_fsm.AddTransition(new WeaponTransition(Trigger_CC10J, _abt_, CJF0));
387
388
389 m_fsm.AddTransition(new WeaponTransition(CC11, __T__, Trigger_CC11, NULL, new WeaponGuardHasAmmo(this))); // fire.normal + chamber next
390 m_fsm.AddTransition(new WeaponTransition(Trigger_CC11, _fin_, CC11));
391 m_fsm.AddTransition(new WeaponTransition(Trigger_CC11, _rto_, CC11));
392 m_fsm.AddTransition(new WeaponTransition(Trigger_CC11, _abt_, CC11));
393
394 m_fsm.AddTransition(new WeaponTransition(CC11, __T__, Trigger_CC11L, NULL, new GuardNot(new WeaponGuardHasAmmo(this)))); // fire.last with mag
395 m_fsm.AddTransition(new WeaponTransition(Trigger_CC11L, _fin_, OD01));
396 m_fsm.AddTransition(new WeaponTransition(Trigger_CC11L, _rto_, OD01));
397 m_fsm.AddTransition(new WeaponTransition(Trigger_CC11L, _abt_, OD01));
398
399 m_fsm.AddTransition(new WeaponTransition(CC11, __TJ_, Trigger_CC11J)); // fire.last with mag
400 m_fsm.AddTransition(new WeaponTransition(Trigger_CC11J, _fin_, CJF1));
401 m_fsm.AddTransition(new WeaponTransition(Trigger_CC11J, _rto_, CJF1));
402 m_fsm.AddTransition(new WeaponTransition(Trigger_CC11J, _abt_, CJF1));
403
404 m_fsm.AddTransition(new WeaponTransition(CC01, __T__, Trigger_CC01)); // fire.cocked with mag
405 m_fsm.AddTransition(new WeaponTransition(Trigger_CC01, _fin_, CD01));
406 m_fsm.AddTransition(new WeaponTransition(Trigger_CC01, _dto_, CD01));
407 m_fsm.AddTransition(new WeaponTransition(Trigger_CC01, _abt_, CD01));
408
409 // load cartridge
410 m_fsm.AddTransition(new WeaponTransition(CD00, __L__, Chamber_CD00)); // chamber from closed=1
411 m_fsm.AddTransition(new WeaponTransition(Chamber_CD00, _fin_, OD00, NULL, new WeaponGuardWeaponOpen(this)));
412 m_fsm.AddTransition(new WeaponTransition(Chamber_CD00, _fin_, CD00, NULL, new WeaponGuardWeaponDischarged(this)));
413 m_fsm.AddTransition(new WeaponTransition(Chamber_CD00, _fin_, CC10));
414 m_fsm.AddTransition(new WeaponTransition(Chamber_CD00, _abt_, OD00, NULL, new WeaponGuardWeaponOpen(this)));
415 m_fsm.AddTransition(new WeaponTransition(Chamber_CD00, _abt_, CD00, NULL, new WeaponGuardWeaponDischarged(this)));
416 m_fsm.AddTransition(new WeaponTransition(Chamber_CD00, _abt_, CC10));
417
418 m_fsm.AddTransition(new WeaponTransition(OD00, __L__, Chamber_OD00)); // chamber from opened
419 m_fsm.AddTransition(new WeaponTransition(Chamber_OD00, _fin_, OD00, NULL, new WeaponGuardWeaponOpen(this)));
420 m_fsm.AddTransition(new WeaponTransition(Chamber_OD00, _fin_, CC10));
421 m_fsm.AddTransition(new WeaponTransition(Chamber_OD00, _abt_, OD00, NULL, new WeaponGuardWeaponOpen(this)));
422 m_fsm.AddTransition(new WeaponTransition(Chamber_OD00, _abt_, CC10));
423
424 m_fsm.AddTransition(new WeaponTransition(CC00, __L__, Chamber_CC00)); // chamber from closed charged
425 m_fsm.AddTransition(new WeaponTransition(Chamber_CC00, _fin_, OD00, NULL, new WeaponGuardWeaponOpen(this)));
426 m_fsm.AddTransition(new WeaponTransition(Chamber_CC00, _fin_, CC00, NULL, new WeaponGuardCurrentChamberEmpty(this)));
427 m_fsm.AddTransition(new WeaponTransition(Chamber_CC00, _fin_, CC10));
428 m_fsm.AddTransition(new WeaponTransition(Chamber_CC00, _abt_, OD00, NULL, new WeaponGuardWeaponOpen(this)));
429 m_fsm.AddTransition(new WeaponTransition(Chamber_CC00, _abt_, CC00, NULL, new WeaponGuardCurrentChamberEmpty(this)));
430 m_fsm.AddTransition(new WeaponTransition(Chamber_CC00, _abt_, CC10));
431
432 // load cartridge with mag
433 m_fsm.AddTransition(new WeaponTransition(CD01, __L__, Chamber_CD01, NULL, new WeaponGuardHasMag(this))); // chamber from closed=1 with mag
434 m_fsm.AddTransition(new WeaponTransition(Chamber_CD01, _fin_, OD01, NULL, new WeaponGuardWeaponOpen(this)));
435 m_fsm.AddTransition(new WeaponTransition(Chamber_CD01, _fin_, CD01, NULL, new WeaponGuardCurrentChamberEmpty(this)));
436 m_fsm.AddTransition(new WeaponTransition(Chamber_CD01, _fin_, CC11));
437 m_fsm.AddTransition(new WeaponTransition(Chamber_CD01, _abt_, OD01, NULL, new WeaponGuardWeaponOpen(this)));
438 m_fsm.AddTransition(new WeaponTransition(Chamber_CD01, _abt_, CD01, NULL, new WeaponGuardCurrentChamberEmpty(this)));
439 m_fsm.AddTransition(new WeaponTransition(Chamber_CD01, _abt_, CC11));
440
441 m_fsm.AddTransition(new WeaponTransition(CC01, __L__, Chamber_CC01, NULL, new WeaponGuardHasMag(this))); // chamber from closed=1 with mag
442 m_fsm.AddTransition(new WeaponTransition(Chamber_CC01, _fin_, OD01, NULL, new WeaponGuardWeaponOpen(this)));
443 m_fsm.AddTransition(new WeaponTransition(Chamber_CC01, _fin_, CC01, NULL, new WeaponGuardCurrentChamberEmpty(this)));
444 m_fsm.AddTransition(new WeaponTransition(Chamber_CC01, _fin_, CC11));
445 m_fsm.AddTransition(new WeaponTransition(Chamber_CC01, _abt_, OD01, NULL, new WeaponGuardWeaponOpen(this)));
446 m_fsm.AddTransition(new WeaponTransition(Chamber_CC01, _abt_, CC01, NULL, new WeaponGuardCurrentChamberEmpty(this)));
447 m_fsm.AddTransition(new WeaponTransition(Chamber_CC01, _abt_, CC11));
448
449 m_fsm.AddTransition(new WeaponTransition(OD01, __L__, Chamber_OD01, NULL, new WeaponGuardHasMag(this))); // chamber from opened with mag
450 m_fsm.AddTransition(new WeaponTransition(Chamber_OD01, _fin_, OD01, NULL, new WeaponGuardCurrentChamberEmpty(this)));
451 m_fsm.AddTransition(new WeaponTransition(Chamber_OD01, _fin_, CC11));
452 m_fsm.AddTransition(new WeaponTransition(Chamber_OD01, _abt_, OD01, NULL, new WeaponGuardCurrentChamberEmpty(this)));
453 m_fsm.AddTransition(new WeaponTransition(Chamber_OD01, _abt_, CC11));
454
455 m_fsm.AddTransition(new WeaponTransition(CJF0, __A__, Attach_CJF0, NULL, new WeaponGuardCanAttachMag(this))); // attach from JAM/b1/m0
456 m_fsm.AddTransition(new WeaponTransition(Attach_CJF0, _fin_, CJF1, NULL, new WeaponGuardHasMag(this)));
457 m_fsm.AddTransition(new WeaponTransition(Attach_CJF0, _fin_, CJF0));
458 m_fsm.AddTransition(new WeaponTransition(Attach_CJF0, _abt_, CJF1, NULL, new WeaponGuardHasMag(this)));
459 m_fsm.AddTransition(new WeaponTransition(Attach_CJF0, _abt_, CJF0));;
460
461 // zdokumentovano az sem
462 // attach mag with no ammo
463 m_fsm.AddTransition(new WeaponTransition(CD00, __A__, Attach_CD00, NULL, new WeaponGuardCanAttachMag(this))); // attach from CLO/b0/m0
464 m_fsm.AddTransition(new WeaponTransition(Attach_CD00, _fin_, CD00, NULL, new GuardNot(new WeaponGuardHasMag(this))));
465 m_fsm.AddTransition(new WeaponTransition(Attach_CD00, _fin_, CD01, NULL, new WeaponGuardWeaponDischarged(this)));
466 m_fsm.AddTransition(new WeaponTransition(Attach_CD00, _fin_, CC01, NULL, new WeaponGuardCurrentChamberEmpty(this)));
467 m_fsm.AddTransition(new WeaponTransition(Attach_CD00, _fin_, CC11));
468 m_fsm.AddTransition(new WeaponTransition(Attach_CD00, _abt_, CD00, NULL, new GuardNot(new WeaponGuardHasMag(this))));
469 m_fsm.AddTransition(new WeaponTransition(Attach_CD00, _abt_, CD00, NULL, new WeaponGuardWeaponDischarged(this)));
470 m_fsm.AddTransition(new WeaponTransition(Attach_CD00, _abt_, CC01, NULL, new WeaponGuardCurrentChamberEmpty(this)));
471 m_fsm.AddTransition(new WeaponTransition(Attach_CD00, _abt_, CC11));
472
473 m_fsm.AddTransition(new WeaponTransition(CC10, __A__, Attach_CC10, NULL, new WeaponGuardCanAttachMag(this))); // attach from CLO/b1/m0
474 m_fsm.AddTransition(new WeaponTransition(Attach_CC10, _fin_, CC11, NULL, new WeaponGuardHasMag(this)));
475 m_fsm.AddTransition(new WeaponTransition(Attach_CC10, _fin_, CC10));
476 m_fsm.AddTransition(new WeaponTransition(Attach_CC10, _abt_, CC11, NULL, new WeaponGuardHasMag(this)));
477 m_fsm.AddTransition(new WeaponTransition(Attach_CC10, _abt_, CC10));
478
479 m_fsm.AddTransition(new WeaponTransition(OD00, __A__, Attach_OD00, NULL, new WeaponGuardCanAttachMag(this))); // attach from OPE/b0/m0
480 m_fsm.AddTransition(new WeaponTransition(Attach_OD00, _fin_, OD00, NULL, new GuardNot(new WeaponGuardHasMag(this))));
481 m_fsm.AddTransition(new WeaponTransition(Attach_OD00, _fin_, OD01, NULL, new WeaponGuardWeaponOpen(this)));
482 m_fsm.AddTransition(new WeaponTransition(Attach_OD00, _fin_, CC01, NULL, new WeaponGuardCurrentChamberEmpty(this)));
483 m_fsm.AddTransition(new WeaponTransition(Attach_OD00, _fin_, CC11));
484 m_fsm.AddTransition(new WeaponTransition(Attach_OD00, _abt_, OD00, NULL, new GuardNot(new WeaponGuardHasMag(this))));
485 m_fsm.AddTransition(new WeaponTransition(Attach_OD00, _abt_, OD01, NULL, new WeaponGuardWeaponOpen(this)));
486 m_fsm.AddTransition(new WeaponTransition(Attach_OD00, _abt_, CC01, NULL, new WeaponGuardCurrentChamberEmpty(this)));
487 m_fsm.AddTransition(new WeaponTransition(Attach_OD00, _abt_, CC11));
488
489 m_fsm.AddTransition(new WeaponTransition(CC00, __A__, Attach_CC00, NULL, new WeaponGuardCanAttachMag(this))); // attach from CLO/b0/m0 charged
490 m_fsm.AddTransition(new WeaponTransition(Attach_CC00, _fin_, CC11, NULL, new WeaponGuardCurrentChamberFull(this)));
491 m_fsm.AddTransition(new WeaponTransition(Attach_CC00, _fin_, CC01, NULL, new WeaponGuardHasMag(this)));
492 m_fsm.AddTransition(new WeaponTransition(Attach_CC00, _fin_, CC00));
493 m_fsm.AddTransition(new WeaponTransition(Attach_CC00, _abt_, CC11, NULL, new WeaponGuardCurrentChamberFull(this)));
494 m_fsm.AddTransition(new WeaponTransition(Attach_CC00, _abt_, CC01, NULL, new WeaponGuardHasMag(this)));
495 m_fsm.AddTransition(new WeaponTransition(Attach_CC00, _abt_, CC00));
496
497 // replace magazine
498 m_fsm.AddTransition(new WeaponTransition(CD01, __S__, Reload_CD01, NULL, new WeaponGuardCanSwapMag(this))); // swap in CLO/b0/m1
499 m_fsm.AddTransition(new WeaponTransition(Reload_CD01, _fin_, CC11, NULL, new WeaponGuardCurrentChamberFull(this)));
500 m_fsm.AddTransition(new WeaponTransition(Reload_CD01, _fin_, CC01, NULL, new WeaponGuardWeaponCharged(this)));
501 m_fsm.AddTransition(new WeaponTransition(Reload_CD01, _fin_, CD01, NULL, new WeaponGuardHasMag(this)));
502 m_fsm.AddTransition(new WeaponTransition(Reload_CD01, _fin_, CD00));
503 m_fsm.AddTransition(new WeaponTransition(Reload_CD01, _abt_, CC11, NULL, new WeaponGuardCurrentChamberFull(this)));
504 m_fsm.AddTransition(new WeaponTransition(Reload_CD01, _abt_, CC01, NULL, new WeaponGuardWeaponCharged(this)));
505 m_fsm.AddTransition(new WeaponTransition(Reload_CD01, _abt_, CD01, NULL, new WeaponGuardHasMag(this)));
506 m_fsm.AddTransition(new WeaponTransition(Reload_CD01, _abt_, CD00));
507
508
509 m_fsm.AddTransition(new WeaponTransition(CC11, __S__, Reload_CC11, NULL, new WeaponGuardCanSwapMag(this))); // swap in CLO/b1/m1
510 m_fsm.AddTransition(new WeaponTransition(Reload_CC11, _fin_, CC11, NULL, new WeaponGuardHasMag(this)));
511 m_fsm.AddTransition(new WeaponTransition(Reload_CC11, _fin_, CC10));
512 m_fsm.AddTransition(new WeaponTransition(Reload_CC11, _abt_, CC11, NULL, new WeaponGuardHasMag(this)));
513 m_fsm.AddTransition(new WeaponTransition(Reload_CC11, _abt_, CC10));
514
515 m_fsm.AddTransition(new WeaponTransition(CC01, __S__, Reload_CC01, NULL, new WeaponGuardCanSwapMag(this))); // CLO/b0/m1 swap with empty mag (no chamber)
516 m_fsm.AddTransition(new WeaponTransition(Reload_CC01, _fin_, CC11, NULL, new WeaponGuardCurrentChamberFull(this)));
517 m_fsm.AddTransition(new WeaponTransition(Reload_CC01, _fin_, CC01, NULL, new WeaponGuardHasMag(this)));
518 m_fsm.AddTransition(new WeaponTransition(Reload_CC01, _fin_, CC00));
519 m_fsm.AddTransition(new WeaponTransition(Reload_CC01, _abt_, CC11, NULL, new WeaponGuardCurrentChamberFull(this)));
520 m_fsm.AddTransition(new WeaponTransition(Reload_CC01, _abt_, CC01, NULL, new WeaponGuardHasMag(this)));
521 m_fsm.AddTransition(new WeaponTransition(Reload_CC01, _abt_, CC00));
522
523 m_fsm.AddTransition(new WeaponTransition(OD01, __S__, Reload_OD01, NULL, new WeaponGuardCanSwapMag(this))); // OPE/b0/m1 swap with empty mag (no chamber)
524 m_fsm.AddTransition(new WeaponTransition(Reload_OD01, _fin_, OD00, NULL, new GuardNot(new WeaponGuardHasMag(this))));
525 m_fsm.AddTransition(new WeaponTransition(Reload_OD01, _fin_, OD01, NULL, new WeaponGuardWeaponOpen(this)));
526 m_fsm.AddTransition(new WeaponTransition(Reload_OD01, _fin_, CC01, NULL, new WeaponGuardCurrentChamberEmpty(this)));
527 m_fsm.AddTransition(new WeaponTransition(Reload_OD01, _fin_, CC11));
528 m_fsm.AddTransition(new WeaponTransition(Reload_OD01, _abt_, OD00, NULL, new GuardNot(new WeaponGuardHasMag(this))));
529 m_fsm.AddTransition(new WeaponTransition(Reload_OD01, _abt_, OD01, NULL, new WeaponGuardWeaponOpen(this)));
530 m_fsm.AddTransition(new WeaponTransition(Reload_OD01, _abt_, CC01, NULL, new WeaponGuardCurrentChamberEmpty(this)));
531 m_fsm.AddTransition(new WeaponTransition(Reload_OD01, _abt_, CC11));
532
533 m_fsm.AddTransition(new WeaponTransition(CJF1, __S__, Reload_CJF1, NULL, new WeaponGuardCanSwapMag(this))); // swap in JAM/b1/m1
534 m_fsm.AddTransition(new WeaponTransition(Reload_CJF1, _fin_, CJF1, NULL, new WeaponGuardHasMag(this)));
535 m_fsm.AddTransition(new WeaponTransition(Reload_CJF1, _fin_, CJF0));
536 m_fsm.AddTransition(new WeaponTransition(Reload_CJF1, _abt_, CJF1, NULL, new WeaponGuardHasMag(this)));
537 m_fsm.AddTransition(new WeaponTransition(Reload_CJF1, _abt_, CJF0));
538
539
540 // detach magazine
541 m_fsm.AddTransition(new WeaponTransition(OD01, __D__, Detach_OD01, NULL, new WeaponGuardCanDetachMag(this))); // detach from OPE/b0/m1
542 m_fsm.AddTransition(new WeaponTransition(Detach_OD01, _fin_, OD01, NULL, new WeaponGuardHasMag(this)));
543 m_fsm.AddTransition(new WeaponTransition(Detach_OD01, _fin_, OD00));
544 m_fsm.AddTransition(new WeaponTransition(Detach_OD01, _abt_, OD01, NULL, new WeaponGuardHasMag(this)));
545 m_fsm.AddTransition(new WeaponTransition(Detach_OD01, _abt_, OD00));
546
547 m_fsm.AddTransition(new WeaponTransition(CC11, __D__, Detach_CC11, NULL, new WeaponGuardCanDetachMag(this))); // detach from CLO/b1/m1
548 m_fsm.AddTransition(new WeaponTransition(Detach_CC11, _fin_, CC11, NULL, new WeaponGuardHasMag(this)));
549 m_fsm.AddTransition(new WeaponTransition(Detach_CC11, _fin_, CC10));
550 m_fsm.AddTransition(new WeaponTransition(Detach_CC11, _abt_, CC11, NULL, new WeaponGuardHasMag(this)));
551 m_fsm.AddTransition(new WeaponTransition(Detach_CC11, _abt_, CC10));
552
553 m_fsm.AddTransition(new WeaponTransition(CC01, __D__, Detach_CC01, NULL, new WeaponGuardCanDetachMag(this))); // detach from CLO/b0/m1
554 m_fsm.AddTransition(new WeaponTransition(Detach_CC01, _fin_, CC01, NULL, new WeaponGuardHasMag(this)));
555 m_fsm.AddTransition(new WeaponTransition(Detach_CC01, _fin_, CC00));
556 m_fsm.AddTransition(new WeaponTransition(Detach_CC01, _abt_, CC01, NULL, new WeaponGuardHasMag(this)));
557 m_fsm.AddTransition(new WeaponTransition(Detach_CC01, _abt_, CC00));
558
559 m_fsm.AddTransition(new WeaponTransition(CD01, __D__, Detach_CD01, NULL, new WeaponGuardCanDetachMag(this))); // detach from CLO/b0/m1 dischg
560 m_fsm.AddTransition(new WeaponTransition(Detach_CD01, _fin_, CD01, NULL, new WeaponGuardHasMag(this)));
561 m_fsm.AddTransition(new WeaponTransition(Detach_CD01, _fin_, CD00));
562 m_fsm.AddTransition(new WeaponTransition(Detach_CD01, _abt_, CD01, NULL, new WeaponGuardHasMag(this)));
563 m_fsm.AddTransition(new WeaponTransition(Detach_CD01, _abt_, CD00));
564
565 m_fsm.AddTransition(new WeaponTransition(CJF1, __D__, Detach_CJF1, NULL, new WeaponGuardCanDetachMag(this))); // detach from CLO/b1/m1 jammed
566 m_fsm.AddTransition(new WeaponTransition(Detach_CJF1, _fin_, CJF1, NULL, new WeaponGuardHasMag(this)));
567 m_fsm.AddTransition(new WeaponTransition(Detach_CJF1, _fin_, CJF0));
568 m_fsm.AddTransition(new WeaponTransition(Detach_CJF1, _abt_, CJF1, NULL, new WeaponGuardHasMag(this)));
569 m_fsm.AddTransition(new WeaponTransition(Detach_CJF1, _abt_, CJF0));
570
571
572 // unjam
573 m_fsm.AddTransition(new WeaponTransition(CJF0, __U__, Unjam_CJF0)); // unjam nomag
574 m_fsm.AddTransition(new WeaponTransition(Unjam_CJF0, _fin_, CJF0, NULL, new WeaponGuardJammed(this)));
575 m_fsm.AddTransition(new WeaponTransition(Unjam_CJF0, _fin_, CC00));
576 m_fsm.AddTransition(new WeaponTransition(Unjam_CJF0, _abt_, CJF0, NULL, new WeaponGuardJammed(this)));
577 m_fsm.AddTransition(new WeaponTransition(Unjam_CJF0, _abt_, CC00));
578
579 m_fsm.AddTransition(new WeaponTransition(CJF1, __U__, Unjam_CJF1)); // unjam with mag with ammo
580 m_fsm.AddTransition(new WeaponTransition(Unjam_CJF1, _fin_, CJF1, NULL, new WeaponGuardJammed(this)));
581 m_fsm.AddTransition(new WeaponTransition(Unjam_CJF1, _fin_, CC01, NULL, new WeaponGuardCurrentChamberEmpty(this)));
582 m_fsm.AddTransition(new WeaponTransition(Unjam_CJF1, _fin_, CC11));
583 m_fsm.AddTransition(new WeaponTransition(Unjam_CJF1, _abt_, CJF1, NULL, new WeaponGuardJammed(this)));
584 m_fsm.AddTransition(new WeaponTransition(Unjam_CJF1, _abt_, CC01, NULL, new WeaponGuardCurrentChamberEmpty(this)));
585 m_fsm.AddTransition(new WeaponTransition(Unjam_CJF1, _abt_, CC11));
586
587
588 SetInitialState(CD00);
589 SelectionBulletHide();
590 HideMagazine();
591 m_fsm.Start();
592 }
593
594 override float GetChanceToJam()
595 {
596 float chanceToJam = super.GetChanceToJam();
597 Magazine mag = GetMagazine(GetCurrentMuzzle());
598
599 if (mag)
600 chanceToJam = chanceToJam + ((1.0 - chanceToJam) * mag.GetChanceToJam());
601 else
602 chanceToJam = chanceToJam + ((1.0 - chanceToJam) * 0.06);
603
604 return chanceToJam;
605 }
606
607 /*override bool GetInventoryHandAnimation(notnull InventoryLocation loc, out int value)
608 {
609 int id;
610 string name = "";
611 if ( loc.GetParent() && loc.GetParent().GetInventory().GetCurrentAttachmentSlotInfo(id,name) && name == "Hips" )
612 {
613 //value = WeaponHideShowTypes.HIDESHOW_SLOT_2HDRIGHTBACK;
614 value = WeaponHideShowTypes.HIDESHOW_SLOT_PISTOLBELT;
615 return true;
616 }
617
618 return false;
619 }*/
620
621 override void SetActions()
622 {
623 super.SetActions();
625 //AddAction(ActionAdvancedDetachMagazine);
626 }
627};
628
void wpnPrint(string s)
Definition Debug.c:1
void AddAction(typename actionName)
override bool IsRepairEnabled()
Definition Crossbow.c:23
override bool IsJammed()
Definition Crossbow.c:22
override bool HasBullet()
Definition Crossbow.c:20
override void InitMuzzleArray()
Definition Crossbow.c:24
override bool HasMagazine()
Definition Crossbow.c:21
class WeaponGuardIsDestroyed extends WeaponGuardBase m_weapon
Definition Guards.c:602
void WeaponGuardHasAmmo(Weapon_Base w=NULL)
Definition Guards.c:99
void WeaponGuardWeaponDischarged(Weapon_Base w=NULL)
Definition Guards.c:578
void WeaponGuardWeaponOpen(Weapon_Base w=NULL)
Definition Guards.c:604
override int GetCurrentStateID()
Definition Hand_States.c:29
override void OnExit(HandEventBase e)
Definition Hand_States.c:28
HandStateEquipped OnEntry
PistolAnimState
Definition Pistol_Base.c:3
@ CLOSED_CHARGED
closed and charged
Definition Pistol_Base.c:6
@ DEFAULT
default weapon state, closed and discharged
Definition Pistol_Base.c:4
@ OPENED_DISCHARGED
opened and discharged
Definition Pistol_Base.c:5
@ JAMMED
jammed weapon
Definition Pistol_Base.c:7
CLO_DIS_BU0_MA0
Definition Pistol_Base.c:31
CLO_CHG_BU0_MA0
Definition Pistol_Base.c:32
UNKNOWN
Definition Pistol_Base.c:30
PistolStableStateID
Definition Pistol_Base.c:13
CLO_JAM_BU1_MA0
Definition Pistol_Base.c:34
OPE_DIS_BU0_MA1
Definition Pistol_Base.c:40
CLO_CHG_BU1_MA1
Definition Pistol_Base.c:39
OPE_DIS_BU0_MA0
Definition Pistol_Base.c:35
CLO_CHG_BU1_MA0
Definition Pistol_Base.c:33
CLO_DIS_BU0_MA1
Definition Pistol_Base.c:37
CLO_JAM_BU1_MA1
Definition Pistol_Base.c:38
CLO_CHG_BU0_MA1
Definition Pistol_Base.c:36
enum FSMTransition WeaponTransition
MuzzleState
ref array< MuzzleState > m_muzzleHasBullet
bool IsDischarged()
Whether the gun is discharged.
pair ( action, actionType )
Definition Weapon_Base.c:5
static bool IsWeaponLogEnable()
Definition Debug.c:799
base for semi auto weapons @NOTE name copies config base class
ref WeaponStableState CD00
override void InitStateMachine()
ref WeaponStableState CC11
ref WeaponStableState CC01
ref WeaponStableState OD00
override void SetActions()
ref WeaponStableState CC10
override float GetChanceToJam()
void Pistol_Base()
ref WeaponStableState CD01
ref WeaponStableState CJF0
override bool CanChamberBullet(int muzzleIndex, Magazine mag)
ref WeaponStableState CJF1
ref WeaponStableState OD01
ref WeaponStableState CC00
charging of weapon without ammo to be chambered
signalize mechanism manipulation
Definition Events.c:35
weapon finite state machine
replace current magazine with new one
represents weapon's stable state (i.e. the basic states that the weapon will spend the most time in)
Definition Crossbow.c:27
override bool IsBoltOpen()
Definition Pistol_Base.c:81
override bool IsJammed()
Definition Pistol_Base.c:46
override bool IsDischarged()
Definition Pistol_Base.c:82
override void OnExit(WeaponEventBase e)
Definition Pistol_Base.c:42
override void InitMuzzleArray()
Definition Pistol_Base.c:48
override void OnEntry(WeaponEventBase e)
Definition Pistol_Base.c:41
override bool HasBullet()
Definition Pistol_Base.c:44
override int GetCurrentStateID()
Definition Pistol_Base.c:43
override bool IsRepairEnabled()
Definition Pistol_Base.c:47
override bool HasMagazine()
Definition Pistol_Base.c:45
represent weapon state base
Definition BulletHide.c:2
handle jamming state set jam/unjam state for weapon
Definition SKS.c:53
override bool IsBoltOpen()
Definition Pistol_Base.c:69
override void InitMuzzleArray()
Definition Pistol_Base.c:71
override bool HasMagazine()
Definition Pistol_Base.c:67
override bool IsRepairEnabled()
Definition Pistol_Base.c:70
override void OnEntry(WeaponEventBase e)
Definition Pistol_Base.c:63
override int GetCurrentStateID()
Definition Pistol_Base.c:65
override bool IsJammed()
Definition Pistol_Base.c:68
override bool HasBullet()
Definition Pistol_Base.c:66
override void OnExit(WeaponEventBase e)
Definition Pistol_Base.c:64
unjam submachine
WeaponActionChamberingTypes
Definition human.c:856
WeaponActions
actions
Definition human.c:796
WeaponActionReloadTypes
Definition human.c:812
WeaponActionUnjammingTypes
Definition human.c:892
WeaponActionFireTypes
Definition human.c:900