DayZ 1.24
Loading...
Searching...
No Matches
BoltActionRifleExternalMagazine_Base.c
Go to the documentation of this file.
2{
3 DEFAULT = 0,
4 JAMMED = 1,
5};
6
19
21{
22 override void OnEntry(WeaponEventBase e) { if (LogManager.IsWeaponLogEnable()) wpnPrint("[wpnfsm] " + Object.GetDebugName(m_weapon) + " { close nobull nomag"); super.OnEntry(e); }
23 override void OnExit(WeaponEventBase e) { super.OnExit(e); if (LogManager.IsWeaponLogEnable()) wpnPrint("[wpnfsm] " + Object.GetDebugName(m_weapon) + " } close nobull nomag"); }
24 override int GetCurrentStateID() { return BAREMStableStateID.BAREM_CLO_BU0_MA0; }
25 override bool HasBullet() { return false; }
26 override bool HasMagazine() { return false; }
27 override bool IsJammed() { return false; }
28 override bool IsRepairEnabled() { return true; }
30};
32{
33 override void OnEntry(WeaponEventBase e) { if (LogManager.IsWeaponLogEnable()) wpnPrint("[wpnfsm] " + Object.GetDebugName(m_weapon) + " { close bullet nomag"); super.OnEntry(e);}
34 override void OnExit(WeaponEventBase e) { super.OnExit(e); if (LogManager.IsWeaponLogEnable()) wpnPrint("[wpnfsm] " + Object.GetDebugName(m_weapon) + " } close bullet nomag"); }
35 override int GetCurrentStateID() { return BAREMStableStateID.BAREM_CLO_BU1_MA0; }
36 override bool HasBullet() { return true; }
37 override bool HasMagazine() { return false; }
38 override bool IsJammed() { return false; }
39 override bool IsRepairEnabled() { return true; }
41};
43{
44 override void OnEntry(WeaponEventBase e) { if (LogManager.IsWeaponLogEnable()) wpnPrint("[wpnfsm] " + Object.GetDebugName(m_weapon) + " { close bullet mag"); super.OnEntry(e);}
45 override void OnExit(WeaponEventBase e) { super.OnExit(e); if (LogManager.IsWeaponLogEnable()) wpnPrint("[wpnfsm] " + Object.GetDebugName(m_weapon) + " } close bullet mag"); }
46 override int GetCurrentStateID() { return BAREMStableStateID.BAREM_CLO_BU1_MA1; }
47 override bool HasBullet() { return true; }
48 override bool HasMagazine() { return true; }
49 override bool IsJammed() { return false; }
50 override bool IsRepairEnabled() { return true; }
52};
54{
55 override void OnEntry(WeaponEventBase e) { if (LogManager.IsWeaponLogEnable()) wpnPrint("[wpnfsm] " + Object.GetDebugName(m_weapon) + " { close nobull mag"); super.OnEntry(e); }
56 override void OnExit(WeaponEventBase e) { super.OnExit(e); if (LogManager.IsWeaponLogEnable()) wpnPrint("[wpnfsm] " + Object.GetDebugName(m_weapon) + " } close nobull mag"); }
57 override int GetCurrentStateID() { return BAREMStableStateID.BAREM_CLO_BU0_MA1; }
58 override bool HasBullet() { return false; }
59 override bool HasMagazine() { return true; }
60 override bool IsJammed() { return false; }
61 override bool IsRepairEnabled() { return true; }
63};
65{
66 override void OnEntry(WeaponEventBase e) { if (LogManager.IsWeaponLogEnable()) wpnPrint("[wpnfsm] " + Object.GetDebugName(m_weapon) + " { close fireout bullet nomag"); super.OnEntry(e);}
67 override void OnExit(WeaponEventBase e) { super.OnExit(e); if (LogManager.IsWeaponLogEnable()) wpnPrint("[wpnfsm] " + Object.GetDebugName(m_weapon) + " } close fireout bullet nomag"); }
68 override int GetCurrentStateID() { return BAREMStableStateID.BAREM_CLO_BUF_MA0; }
69 override bool HasBullet() { return true; }
70 override bool HasMagazine() { return false; }
71 override bool IsJammed() { return false; }
72 override bool IsRepairEnabled() { return true; }
74};
76{
77 override void OnEntry(WeaponEventBase e) { if (LogManager.IsWeaponLogEnable()) wpnPrint("[wpnfsm] " + Object.GetDebugName(m_weapon) + " { close fireout bull mag"); super.OnEntry(e); }
78 override void OnExit(WeaponEventBase e) { super.OnExit(e); if (LogManager.IsWeaponLogEnable()) wpnPrint("[wpnfsm] " + Object.GetDebugName(m_weapon) + " } close fireout bull mag"); }
79 override int GetCurrentStateID() { return BAREMStableStateID.BAREM_CLO_BUF_MA1; }
80 override bool HasBullet() { return true; }
81 override bool HasMagazine() { return true; }
82 override bool IsJammed() { return false; }
83 override bool IsRepairEnabled() { return true; }
85};
87{
88 override void OnEntry(WeaponEventBase e) { if (LogManager.IsWeaponLogEnable()) wpnPrint("[wpnfsm] " + Object.GetDebugName(m_weapon) + " { jammed bullet nomag"); super.OnEntry(e); }
89 override void OnExit(WeaponEventBase e) { super.OnExit(e); if (LogManager.IsWeaponLogEnable()) wpnPrint("[wpnfsm] " + Object.GetDebugName(m_weapon) + " } jammed bullet nomag"); }
90 override int GetCurrentStateID() { return BAREMStableStateID.BAREM_JAM_BU1_MA0; }
91 override bool HasBullet() { return true; }
92 override bool HasMagazine() { return false; }
93 override bool IsJammed() { return true; }
94 override bool IsBoltOpen() { return true; }
95 override bool IsRepairEnabled() { return true; }
97};
99{
100 override void OnEntry(WeaponEventBase e) { if (LogManager.IsWeaponLogEnable()) wpnPrint("[wpnfsm] " + Object.GetDebugName(m_weapon) + " { jammed bullet mag"); super.OnEntry(e); }
101 override void OnExit(WeaponEventBase e) { super.OnExit(e); if (LogManager.IsWeaponLogEnable()) wpnPrint("[wpnfsm] " + Object.GetDebugName(m_weapon) + " } jammed bullet mag"); }
102 override int GetCurrentStateID() { return BAREMStableStateID.BAREM_JAM_BU1_MA1; }
103 override bool HasBullet() { return true; }
104 override bool HasMagazine() { return true; }
105 override bool IsJammed() { return true; }
106 override bool IsBoltOpen() { return true; }
107 override bool IsRepairEnabled() { return true; }
109};
110
111
113{
122
123 override void InitStateMachine()
124 {
125
126 m_abilities.Insert(new AbilityRecord(WeaponActions.RELOAD, GetWeaponSpecificCommand(WeaponActions.RELOAD, WeaponActionReloadTypes.RELOADSRIFLE_MAGAZINE_BULLET)));
127 m_abilities.Insert(new AbilityRecord(WeaponActions.RELOAD, GetWeaponSpecificCommand(WeaponActions.RELOAD, WeaponActionReloadTypes.RELOADSRIFLE_NOMAGAZINE_BULLET)));
128 m_abilities.Insert(new AbilityRecord(WeaponActions.RELOAD, GetWeaponSpecificCommand(WeaponActions.RELOAD, WeaponActionReloadTypes.RELOADSRIFLE_MAGAZINE_NOBULLET)));
129 m_abilities.Insert(new AbilityRecord(WeaponActions.RELOAD, GetWeaponSpecificCommand(WeaponActions.RELOAD, WeaponActionReloadTypes.RELOADSRIFLE_NOMAGAZINE_NOBULLET)));
130 m_abilities.Insert(new AbilityRecord(WeaponActions.RELOAD, GetWeaponSpecificCommand(WeaponActions.RELOAD, WeaponActionReloadTypes.RELOADRIFLE_MAGAZINE_DETACH)));
131
132 m_abilities.Insert(new AbilityRecord(WeaponActions.CHAMBERING, GetWeaponSpecificCommand(WeaponActions.CHAMBERING, WeaponActionChamberingTypes.CHAMBERING_ONEBULLET_CLOSED)));
133
134 m_abilities.Insert(new AbilityRecord(WeaponActions.MECHANISM, GetWeaponSpecificCommand(WeaponActions.MECHANISM, WeaponActionMechanismTypes.MECHANISM_CLOSED)));
135
136 m_abilities.Insert(new AbilityRecord(WeaponActions.UNJAMMING, GetWeaponSpecificCommand(WeaponActions.UNJAMMING, WeaponActionUnjammingTypes.UNJAMMING_START)));
137 m_abilities.Insert(new AbilityRecord(WeaponActions.UNJAMMING, GetWeaponSpecificCommand(WeaponActions.UNJAMMING, WeaponActionUnjammingTypes.UNJAMMING_END)));
138
139 m_abilities.Insert(new AbilityRecord(WeaponActions.FIRE, GetWeaponSpecificCommand(WeaponActions.FIRE, WeaponActionFireTypes.FIRE_JAM)));
140 m_abilities.Insert(new AbilityRecord(WeaponActions.FIRE, GetWeaponSpecificCommand(WeaponActions.FIRE, WeaponActionFireTypes.FIRE_NORMAL)));
141 m_abilities.Insert(new AbilityRecord(WeaponActions.FIRE, GetWeaponSpecificCommand(WeaponActions.FIRE, WeaponActionFireTypes.FIRE_DRY)));
142 //m_abilities.Insert(new AbilityRecord(WeaponActions.FIRE, WeaponActionFireTypes.FIRE_UNCOCKED));
143
144 // setup state machine
145 // basic weapon states
146 // close-jammed | nobullet-bullet-fireout bullet | nomag-mag
147 // regexp: [CLJ][01F][01]
148 C00 = new BAREM_CLO_BU0_MA0(this, NULL, RBLAnimState.DEFAULT);
149 C10 = new BAREM_CLO_BU1_MA0(this, NULL, RBLAnimState.DEFAULT);
150 C01 = new BAREM_CLO_BU0_MA1(this, NULL, RBLAnimState.DEFAULT);
151 C11 = new BAREM_CLO_BU1_MA1(this, NULL, RBLAnimState.DEFAULT);
152 CF0 = new BAREM_CLO_BUF_MA0(this, NULL, RBLAnimState.DEFAULT);
153 CF1 = new BAREM_CLO_BUF_MA1(this, NULL, RBLAnimState.DEFAULT);
154 JF0 = new BAREM_JAM_BU1_MA0(this, NULL, RBLAnimState.JAMMED);
155 JF1 = new BAREM_JAM_BU1_MA1(this, NULL, RBLAnimState.JAMMED);
156
157 // unstable (intermediate) states
158 WeaponStateBase Mech_C00 = new WeaponCharging(this, NULL, WeaponActions.MECHANISM, GetWeaponSpecificCommand(WeaponActions.MECHANISM, WeaponActionMechanismTypes.MECHANISM_CLOSED));
159 WeaponStateBase Mech_C01 = new WeaponCharging(this, NULL, WeaponActions.MECHANISM, GetWeaponSpecificCommand(WeaponActions.MECHANISM, WeaponActionMechanismTypes.MECHANISM_CLOSED));
160 WeaponStateBase Mech_C10 = new WeaponCharging(this, NULL, WeaponActions.MECHANISM, GetWeaponSpecificCommand(WeaponActions.MECHANISM, WeaponActionMechanismTypes.MECHANISM_CLOSED));
161 WeaponStateBase Mech_C11 = new WeaponCharging(this, NULL, WeaponActions.MECHANISM, GetWeaponSpecificCommand(WeaponActions.MECHANISM, WeaponActionMechanismTypes.MECHANISM_CLOSED));
162 WeaponStateBase Mech_CF0 = new WeaponCharging(this, NULL, WeaponActions.MECHANISM, GetWeaponSpecificCommand(WeaponActions.MECHANISM, WeaponActionMechanismTypes.MECHANISM_CLOSED));
163 WeaponStateBase Mech_CF1 = new WeaponCharging(this, NULL, WeaponActions.MECHANISM, GetWeaponSpecificCommand(WeaponActions.MECHANISM, WeaponActionMechanismTypes.MECHANISM_CLOSED));
164
165 WeaponStateBase Trigger_C00 = new WeaponDryFire(this, NULL, WeaponActions.FIRE, GetWeaponSpecificCommand(WeaponActions.FIRE, WeaponActionFireTypes.FIRE_DRY)); // cock without clip
166 WeaponStateBase Trigger_C10 = new WeaponFire(this, NULL, WeaponActions.FIRE, GetWeaponSpecificCommand(WeaponActions.FIRE, WeaponActionFireTypes.FIRE_NORMAL)); // cock with clip
167 WeaponStateBase Trigger_C11 = new WeaponFire(this, NULL, WeaponActions.FIRE, GetWeaponSpecificCommand(WeaponActions.FIRE, WeaponActionFireTypes.FIRE_NORMAL));
168 WeaponStateBase Trigger_C01 = new WeaponDryFire(this, NULL, WeaponActions.FIRE, GetWeaponSpecificCommand(WeaponActions.FIRE, WeaponActionFireTypes.FIRE_DRY));
169 WeaponStateBase Trigger_CF0 = new WeaponDryFire(this, NULL, WeaponActions.FIRE, GetWeaponSpecificCommand(WeaponActions.FIRE, WeaponActionFireTypes.FIRE_DRY));
170 WeaponStateBase Trigger_CF1 = new WeaponDryFire(this, NULL, WeaponActions.FIRE, GetWeaponSpecificCommand(WeaponActions.FIRE, WeaponActionFireTypes.FIRE_DRY));
171 WeaponStateBase Trigger_JF0 = new WeaponDryFire(this, NULL, WeaponActions.FIRE, GetWeaponSpecificCommand(WeaponActions.FIRE, WeaponActionFireTypes.FIRE_DRY));
172 WeaponStateBase Trigger_JF1 = new WeaponDryFire(this, NULL, WeaponActions.FIRE, GetWeaponSpecificCommand(WeaponActions.FIRE, WeaponActionFireTypes.FIRE_DRY));
173
174 //Fire and jammed
175 WeaponStateBase Trigger_C10J = new WeaponFire(this, NULL, WeaponActions.FIRE, GetWeaponSpecificCommand(WeaponActions.FIRE, WeaponActionFireTypes.FIRE_JAM)); // cock with clip
176 WeaponStateBase Trigger_C11J = new WeaponFire(this, NULL, WeaponActions.FIRE, GetWeaponSpecificCommand(WeaponActions.FIRE, WeaponActionFireTypes.FIRE_JAM));
177 // Unjam
178 WeaponStateBase Unjam_JF0 = new WeaponUnjamming(this, NULL, WeaponActions.UNJAMMING, GetWeaponSpecificCommand(WeaponActions.UNJAMMING, WeaponActionUnjammingTypes.UNJAMMING_START));
179 WeaponStateBase Unjam_JF1 = new WeaponUnjamming(this, NULL, WeaponActions.UNJAMMING, GetWeaponSpecificCommand(WeaponActions.UNJAMMING, WeaponActionUnjammingTypes.UNJAMMING_START));
180
181
182 WeaponChambering Chamber_C00 = new WeaponChambering(this, NULL, WeaponActions.CHAMBERING, GetWeaponSpecificCommand(WeaponActions.CHAMBERING, WeaponActionChamberingTypes.CHAMBERING_ONEBULLET_CLOSED));
183 WeaponChambering Chamber_C01 = new WeaponChambering(this, NULL, WeaponActions.CHAMBERING, GetWeaponSpecificCommand(WeaponActions.CHAMBERING, WeaponActionChamberingTypes.CHAMBERING_ONEBULLET_CLOSED));
184 WeaponChambering Chamber_CF0 = new WeaponChambering(this, NULL, WeaponActions.CHAMBERING, GetWeaponSpecificCommand(WeaponActions.CHAMBERING, WeaponActionChamberingTypes.CHAMBERING_ONEBULLET_CLOSED));
185 WeaponChambering Chamber_CF1 = new WeaponChambering(this, NULL, WeaponActions.CHAMBERING, GetWeaponSpecificCommand(WeaponActions.CHAMBERING, WeaponActionChamberingTypes.CHAMBERING_ONEBULLET_CLOSED));
186
187 WeaponAttachMagazine Attach_C00 = new WeaponAttachMagazine(this, NULL, WeaponActions.RELOAD, GetWeaponSpecificCommand(WeaponActions.RELOAD, WeaponActionReloadTypes.RELOADSRIFLE_NOMAGAZINE_NOBULLET));
188 WeaponAttachMagazine Attach_CF0 = new WeaponAttachMagazine(this, NULL, WeaponActions.RELOAD, GetWeaponSpecificCommand(WeaponActions.RELOAD, WeaponActionReloadTypes.RELOADSRIFLE_NOMAGAZINE_NOBULLET));
189 WeaponAttachMagazine Attach_C10 = new WeaponAttachMagazine(this, NULL, WeaponActions.RELOAD, GetWeaponSpecificCommand(WeaponActions.RELOAD, WeaponActionReloadTypes.RELOADSRIFLE_NOMAGAZINE_BULLET));
190 WeaponAttachMagazine Attach_JF0 = new WeaponAttachMagazine(this, NULL, WeaponActions.RELOAD, GetWeaponSpecificCommand(WeaponActions.RELOAD, WeaponActionReloadTypes.RELOADSRIFLE_NOMAGAZINE_BULLET));
191
192 WeaponReplacingMagAndChamberNext Reload_C11 = new WeaponReplacingMagAndChamberNext(this, NULL, WeaponActions.RELOAD, GetWeaponSpecificCommand(WeaponActions.RELOAD, WeaponActionReloadTypes.RELOADSRIFLE_MAGAZINE_BULLET));
193 WeaponReplacingMagAndChamberNext Reload_C01 = new WeaponReplacingMagAndChamberNext(this, NULL, WeaponActions.RELOAD, GetWeaponSpecificCommand(WeaponActions.RELOAD, WeaponActionReloadTypes.RELOADSRIFLE_MAGAZINE_NOBULLET));
194 WeaponReplacingMagAndChamberNext Reload_CF1 = new WeaponReplacingMagAndChamberNext(this, NULL, WeaponActions.RELOAD, GetWeaponSpecificCommand(WeaponActions.RELOAD, WeaponActionReloadTypes.RELOADSRIFLE_MAGAZINE_NOBULLET));
195 WeaponReplacingMagAndChamberNext Reload_JF1 = new WeaponReplacingMagAndChamberNext(this, NULL, WeaponActions.RELOAD, GetWeaponSpecificCommand(WeaponActions.RELOAD, WeaponActionReloadTypes.RELOADSRIFLE_MAGAZINE_BULLET));
196
197 WeaponDetachingMag Detach_C11 = new WeaponDetachingMag(this, NULL, WeaponActions.RELOAD, GetWeaponSpecificCommand(WeaponActions.RELOAD, WeaponActionReloadTypes.RELOADRIFLE_MAGAZINE_DETACH));
198 WeaponDetachingMag Detach_C01 = new WeaponDetachingMag(this, NULL, WeaponActions.RELOAD, GetWeaponSpecificCommand(WeaponActions.RELOAD, WeaponActionReloadTypes.RELOADRIFLE_MAGAZINE_DETACH));
199 WeaponDetachingMag Detach_CF1 = new WeaponDetachingMag(this, NULL, WeaponActions.RELOAD, GetWeaponSpecificCommand(WeaponActions.RELOAD, WeaponActionReloadTypes.RELOADRIFLE_MAGAZINE_DETACH));
200 WeaponDetachingMag Detach_JF1 = new WeaponDetachingMag(this, NULL, WeaponActions.RELOAD, GetWeaponSpecificCommand(WeaponActions.RELOAD, WeaponActionReloadTypes.RELOADRIFLE_MAGAZINE_DETACH));
201
202 //WeaponStateBase chmMag = new WeaponChamberFromAttMag(this, NULL, WeaponActions.MECHANISM, WeaponActionMechanismTypes.MECHANISM_CLOSED);
203
204 // events
205 WeaponEventBase __M__ = new WeaponEventMechanism;
206 WeaponEventBase __T__ = new WeaponEventTrigger;
207 WeaponEventBase __TJ_ = new WeaponEventTriggerToJam;
208 WeaponEventBase __U__ = new WeaponEventUnjam;
209 WeaponEventBase __L__ = new WeaponEventLoad1Bullet;
210 WeaponEventBase __A__ = new WeaponEventAttachMagazine;
211 WeaponEventBase __D__ = new WeaponEventDetachMagazine;
212 WeaponEventBase __S__ = new WeaponEventSwapMagazine;
213 WeaponEventBase _fin_ = new WeaponEventHumanCommandActionFinished;
214 WeaponEventBase _abt_ = new WeaponEventHumanCommandActionAborted;
215 WeaponEventBase _rto_ = new WeaponEventReloadTimeout;
216 WeaponEventBase _dto_ = new WeaponEventDryFireTimeout;
217
218 m_fsm = new WeaponFSM();
219
220 // order: Discharged-Charged | nobullet-bullet | nomag-mag
221 // charging
222 m_fsm.AddTransition(new WeaponTransition(C00, __M__, Mech_C00)); // charge from dischg nobullet nomag
223 m_fsm.AddTransition(new WeaponTransition(Mech_C00, _fin_, C00));
224 m_fsm.AddTransition(new WeaponTransition(Mech_C00, _abt_, C00));
225
226 m_fsm.AddTransition(new WeaponTransition(C10, __M__, Mech_C10)); // charge from bullet nomag
227 m_fsm.AddTransition(new WeaponTransition(Mech_C10, _fin_, C00, NULL, new WeaponGuardCurrentChamberEmpty(this)));
228 m_fsm.AddTransition(new WeaponTransition(Mech_C10, _fin_, C10));
229 m_fsm.AddTransition(new WeaponTransition(Mech_C10, _abt_, C00, NULL, new WeaponGuardCurrentChamberEmpty(this)));
230 m_fsm.AddTransition(new WeaponTransition(Mech_C10, _abt_, C10));
231
232 m_fsm.AddTransition(new WeaponTransition(CF0, __M__, Mech_CF0)); // charge from bullet nomag
233 m_fsm.AddTransition(new WeaponTransition(Mech_CF0, _fin_, CF0, NULL, new WeaponGuardCurrentChamberFiredOut(this)));
234 m_fsm.AddTransition(new WeaponTransition(Mech_CF0, _fin_, C00));
235 m_fsm.AddTransition(new WeaponTransition(Mech_CF0, _abt_, CF0, NULL, new WeaponGuardCurrentChamberFiredOut(this)));
236 m_fsm.AddTransition(new WeaponTransition(Mech_CF0, _abt_, C00));
237
238 m_fsm.AddTransition(new WeaponTransition(C11, __M__, Mech_C11)); // charge from dischg nobullet nomag
239 m_fsm.AddTransition(new WeaponTransition(Mech_C11, _fin_, C01, NULL, new WeaponGuardCurrentChamberEmpty(this)));
240 m_fsm.AddTransition(new WeaponTransition(Mech_C11, _fin_, C11));
241 m_fsm.AddTransition(new WeaponTransition(Mech_C11, _abt_, C01, NULL, new WeaponGuardCurrentChamberEmpty(this)));
242 m_fsm.AddTransition(new WeaponTransition(Mech_C11, _abt_, C11));
243
244 m_fsm.AddTransition(new WeaponTransition(C01, __M__, Mech_C01)); // charge from dischg nobullet nomag
245 m_fsm.AddTransition(new WeaponTransition(Mech_C01, _fin_, C01, NULL, new WeaponGuardCurrentChamberEmpty(this)));
246 m_fsm.AddTransition(new WeaponTransition(Mech_C01, _fin_, C11));
247 m_fsm.AddTransition(new WeaponTransition(Mech_C01, _abt_, C01, NULL, new WeaponGuardCurrentChamberEmpty(this)));
248 m_fsm.AddTransition(new WeaponTransition(Mech_C01, _abt_, C11));
249
250 m_fsm.AddTransition(new WeaponTransition(CF1, __M__, Mech_CF1)); // charge from dischg nobullet nomag
251 m_fsm.AddTransition(new WeaponTransition(Mech_CF1, _fin_, CF1, NULL, new WeaponGuardCurrentChamberFiredOut(this)));
252 m_fsm.AddTransition(new WeaponTransition(Mech_CF1, _fin_, C01, NULL, new WeaponGuardCurrentChamberEmpty(this)));
253 m_fsm.AddTransition(new WeaponTransition(Mech_CF1, _fin_, C11));
254 m_fsm.AddTransition(new WeaponTransition(Mech_CF1, _abt_, CF1, NULL, new WeaponGuardCurrentChamberFiredOut(this)));
255 m_fsm.AddTransition(new WeaponTransition(Mech_CF1, _abt_, C01, NULL, new WeaponGuardCurrentChamberEmpty(this)));
256 m_fsm.AddTransition(new WeaponTransition(Mech_CF1, _abt_, C11));
257
258 // fire
259 m_fsm.AddTransition(new WeaponTransition(C00, __T__, Trigger_C00));
260 m_fsm.AddTransition(new WeaponTransition(Trigger_C00, _fin_, C00));
261 m_fsm.AddTransition(new WeaponTransition(Trigger_C00, _dto_, C00));
262 m_fsm.AddTransition(new WeaponTransition(Trigger_C00, _abt_, C00));
263
264 m_fsm.AddTransition(new WeaponTransition(C01, __T__, Trigger_C01));
265 m_fsm.AddTransition(new WeaponTransition(Trigger_C01, _fin_, C01));
266 m_fsm.AddTransition(new WeaponTransition(Trigger_C01, _dto_, C01));
267 m_fsm.AddTransition(new WeaponTransition(Trigger_C01, _abt_, C01));
268
269 m_fsm.AddTransition(new WeaponTransition(CF0, __T__, Trigger_CF0));
270 m_fsm.AddTransition(new WeaponTransition(Trigger_CF0, _fin_, CF0));
271 m_fsm.AddTransition(new WeaponTransition(Trigger_CF0, _dto_, CF0));
272 m_fsm.AddTransition(new WeaponTransition(Trigger_CF0, _abt_, CF0));
273
274 m_fsm.AddTransition(new WeaponTransition(CF1, __T__, Trigger_CF1));
275 m_fsm.AddTransition(new WeaponTransition(Trigger_CF1, _fin_, CF1));
276 m_fsm.AddTransition(new WeaponTransition(Trigger_CF1, _dto_, CF1));
277 m_fsm.AddTransition(new WeaponTransition(Trigger_CF1, _abt_, CF1));
278
279 m_fsm.AddTransition(new WeaponTransition(JF0, __T__, Trigger_JF0));
280 m_fsm.AddTransition(new WeaponTransition(Trigger_JF0, _fin_, JF0));
281 m_fsm.AddTransition(new WeaponTransition(Trigger_JF0, _dto_, JF0));
282 m_fsm.AddTransition(new WeaponTransition(Trigger_JF0, _abt_, JF0));
283
284 m_fsm.AddTransition(new WeaponTransition(JF1, __T__, Trigger_JF1));
285 m_fsm.AddTransition(new WeaponTransition(Trigger_JF1, _fin_, JF1));
286 m_fsm.AddTransition(new WeaponTransition(Trigger_JF1, _dto_, JF1));
287 m_fsm.AddTransition(new WeaponTransition(Trigger_JF1, _abt_, JF1));
288
289 m_fsm.AddTransition(new WeaponTransition(C10, __T__, Trigger_C10));
290 m_fsm.AddTransition(new WeaponTransition(Trigger_C10, _fin_, CF0));
291 m_fsm.AddTransition(new WeaponTransition(Trigger_C10, _rto_, CF0));
292 m_fsm.AddTransition(new WeaponTransition(Trigger_C10, _abt_, CF0));
293
294 m_fsm.AddTransition(new WeaponTransition(C11, __T__, Trigger_C11));
295 m_fsm.AddTransition(new WeaponTransition(Trigger_C11, _fin_, CF1));
296 m_fsm.AddTransition(new WeaponTransition(Trigger_C11, _rto_, CF1));
297 m_fsm.AddTransition(new WeaponTransition(Trigger_C11, _abt_, CF1));
298
299 m_fsm.AddTransition(new WeaponTransition(C11, __TJ_, Trigger_C11J));
300 m_fsm.AddTransition(new WeaponTransition(Trigger_C11J, _fin_, JF1));
301 m_fsm.AddTransition(new WeaponTransition(Trigger_C11J, _rto_, JF1));
302 m_fsm.AddTransition(new WeaponTransition(Trigger_C11J, _abt_, JF1));
303
304 m_fsm.AddTransition(new WeaponTransition(C10, __TJ_, Trigger_C10J));
305 m_fsm.AddTransition(new WeaponTransition(Trigger_C10J, _fin_, JF0));
306 m_fsm.AddTransition(new WeaponTransition(Trigger_C10J, _rto_, JF0));
307 m_fsm.AddTransition(new WeaponTransition(Trigger_C10J, _abt_, JF0));
308
309
310 // load cartridge
311 m_fsm.AddTransition(new WeaponTransition(C00, __L__, Chamber_C00)); // chamber from closed=1
312 m_fsm.AddTransition(new WeaponTransition(Chamber_C00, _fin_, C00, NULL, new WeaponGuardCurrentChamberEmpty(this)));
313 m_fsm.AddTransition(new WeaponTransition(Chamber_C00, _fin_, C10));
314 m_fsm.AddTransition(new WeaponTransition(Chamber_C00, _abt_, C00, NULL, new WeaponGuardCurrentChamberEmpty(this)));
315 m_fsm.AddTransition(new WeaponTransition(Chamber_C00, _abt_, C10));
316
317 m_fsm.AddTransition(new WeaponTransition(C01, __L__, Chamber_C01)); // chamber from closed charged
318 m_fsm.AddTransition(new WeaponTransition(Chamber_C01, _fin_, C01, NULL, new WeaponGuardCurrentChamberEmpty(this)));
319 m_fsm.AddTransition(new WeaponTransition(Chamber_C01, _fin_, C11));
320 m_fsm.AddTransition(new WeaponTransition(Chamber_C01, _abt_, C01, NULL, new WeaponGuardCurrentChamberEmpty(this)));
321 m_fsm.AddTransition(new WeaponTransition(Chamber_C01, _abt_, C11));
322
323 m_fsm.AddTransition(new WeaponTransition(CF0, __L__, Chamber_CF0)); // chamber from closed=1
324 m_fsm.AddTransition(new WeaponTransition(Chamber_CF0, _fin_, CF0, NULL, new WeaponGuardCurrentChamberFiredOut(this)));
325 m_fsm.AddTransition(new WeaponTransition(Chamber_CF0, _fin_, C00, NULL, new WeaponGuardCurrentChamberEmpty(this)));
326 m_fsm.AddTransition(new WeaponTransition(Chamber_CF0, _fin_, C10));
327 m_fsm.AddTransition(new WeaponTransition(Chamber_CF0, _abt_, CF0, NULL, new WeaponGuardCurrentChamberFiredOut(this)));
328 m_fsm.AddTransition(new WeaponTransition(Chamber_CF0, _abt_, C00, NULL, new WeaponGuardCurrentChamberEmpty(this)));
329 m_fsm.AddTransition(new WeaponTransition(Chamber_CF0, _abt_, C10));
330
331 m_fsm.AddTransition(new WeaponTransition(CF1, __L__, Chamber_CF1)); // chamber from closed charged
332 m_fsm.AddTransition(new WeaponTransition(Chamber_CF1, _fin_, CF1, NULL, new WeaponGuardCurrentChamberFiredOut(this)));
333 m_fsm.AddTransition(new WeaponTransition(Chamber_CF1, _fin_, C01, NULL, new WeaponGuardCurrentChamberEmpty(this)));
334 m_fsm.AddTransition(new WeaponTransition(Chamber_CF1, _fin_, C11));
335 m_fsm.AddTransition(new WeaponTransition(Chamber_CF1, _abt_, CF1, NULL, new WeaponGuardCurrentChamberFiredOut(this)));
336 m_fsm.AddTransition(new WeaponTransition(Chamber_CF1, _abt_, C01, NULL, new WeaponGuardCurrentChamberEmpty(this)));
337 m_fsm.AddTransition(new WeaponTransition(Chamber_CF1, _abt_, C11));
338
339 // attach magazine (no mag in weapon)
340 m_fsm.AddTransition(new WeaponTransition(C00, __A__, Attach_C00, NULL, new WeaponGuardCanAttachMag(this))); // attach from CLO/b0/m0
341 m_fsm.AddTransition(new WeaponTransition(Attach_C00, _fin_, C11, NULL, new WeaponGuardCurrentChamberFull(this)));
342 m_fsm.AddTransition(new WeaponTransition(Attach_C00, _fin_, C01, NULL, new WeaponGuardHasMag(this)));
343 m_fsm.AddTransition(new WeaponTransition(Attach_C00, _fin_, C00));
344 m_fsm.AddTransition(new WeaponTransition(Attach_C00, _abt_, C11, NULL, new WeaponGuardCurrentChamberFull(this)));
345 m_fsm.AddTransition(new WeaponTransition(Attach_C00, _abt_, C01, NULL, new WeaponGuardHasMag(this)));
346 m_fsm.AddTransition(new WeaponTransition(Attach_C00, _abt_, C00));
347
348 m_fsm.AddTransition(new WeaponTransition(C10, __A__, Attach_C10, NULL, new WeaponGuardCanAttachMag(this))); // attach from CLO/b1/m0
349 m_fsm.AddTransition(new WeaponTransition(Attach_C10, _fin_, C11, NULL, new WeaponGuardHasMag(this)));
350 m_fsm.AddTransition(new WeaponTransition(Attach_C10, _fin_, C10));
351 m_fsm.AddTransition(new WeaponTransition(Attach_C10, _abt_, C11, NULL, new WeaponGuardHasMag(this)));
352 m_fsm.AddTransition(new WeaponTransition(Attach_C10, _abt_, C10));
353
354
355 m_fsm.AddTransition(new WeaponTransition(CF0, __A__, Attach_CF0, NULL, new WeaponGuardCanAttachMag(this))); // attach from CLO/b1/m0
356 m_fsm.AddTransition(new WeaponTransition(Attach_CF0, _fin_, CF1, NULL, new WeaponGuardCurrentChamberFiredOut(this)));
357 m_fsm.AddTransition(new WeaponTransition(Attach_CF0, _fin_, C11, NULL, new WeaponGuardCurrentChamberFull(this)));
358 m_fsm.AddTransition(new WeaponTransition(Attach_CF0, _fin_, C01, NULL, new WeaponGuardHasMag(this)));
359 m_fsm.AddTransition(new WeaponTransition(Attach_CF0, _fin_, C00));
360 m_fsm.AddTransition(new WeaponTransition(Attach_CF0, _abt_, CF1, NULL, new WeaponGuardCurrentChamberFiredOut(this)));
361 m_fsm.AddTransition(new WeaponTransition(Attach_CF0, _abt_, C11, NULL, new WeaponGuardCurrentChamberFull(this)));
362 m_fsm.AddTransition(new WeaponTransition(Attach_CF0, _abt_, C01, NULL, new WeaponGuardHasMag(this)));
363 m_fsm.AddTransition(new WeaponTransition(Attach_CF0, _abt_, C00));
364
365
366 m_fsm.AddTransition(new WeaponTransition(JF0, __A__, Attach_JF0, NULL, new WeaponGuardCanAttachMag(this))); // attach from JAM/b1/m0
367 m_fsm.AddTransition(new WeaponTransition(Attach_JF0, _fin_, JF1, NULL, new WeaponGuardHasMag(this)));
368 m_fsm.AddTransition(new WeaponTransition(Attach_JF0, _fin_, JF0));
369 m_fsm.AddTransition(new WeaponTransition(Attach_JF0, _abt_, JF1, NULL, new WeaponGuardHasMag(this)));
370 m_fsm.AddTransition(new WeaponTransition(Attach_JF0, _abt_, JF0));
371
372 // replace magazine
373 m_fsm.AddTransition(new WeaponTransition(C11, __S__, Reload_C11, NULL, new WeaponGuardCanSwapMag(this))); // swap in Chg/b1/m1
374 m_fsm.AddTransition(new WeaponTransition(Reload_C11, _fin_, C11, NULL, new WeaponGuardHasMag(this)));
375 m_fsm.AddTransition(new WeaponTransition(Reload_C11, _fin_, C10));
376 m_fsm.AddTransition(new WeaponTransition(Reload_C11, _abt_, C11, NULL, new WeaponGuardHasMag(this)));
377 m_fsm.AddTransition(new WeaponTransition(Reload_C11, _abt_, C10));
378
379 m_fsm.AddTransition(new WeaponTransition(C01, __S__, Reload_C01, NULL, new WeaponGuardCanSwapMag(this))); // swap in CLO/b0/m1
380 m_fsm.AddTransition(new WeaponTransition(Reload_C01, _fin_, C11, NULL, new WeaponGuardCurrentChamberFull(this)));
381 m_fsm.AddTransition(new WeaponTransition(Reload_C01, _fin_, C01, NULL, new WeaponGuardHasMag(this)));
382 m_fsm.AddTransition(new WeaponTransition(Reload_C01, _fin_, C00));
383 m_fsm.AddTransition(new WeaponTransition(Reload_C01, _abt_, C11, NULL, new WeaponGuardCurrentChamberFull(this)));
384 m_fsm.AddTransition(new WeaponTransition(Reload_C01, _abt_, C01, NULL, new WeaponGuardHasMag(this)));
385 m_fsm.AddTransition(new WeaponTransition(Reload_C01, _abt_, C00));
386
387 m_fsm.AddTransition(new WeaponTransition(CF1, __S__, Reload_CF1, NULL, new WeaponGuardCanSwapMag(this))); // swap in CLO/b0/m1
388 m_fsm.AddTransition(new WeaponTransition(Reload_CF1, _fin_, CF1, NULL, new WeaponGuardCurrentChamberFiredOut(this)));
389 m_fsm.AddTransition(new WeaponTransition(Reload_CF1, _fin_, C11, NULL, new WeaponGuardCurrentChamberFull(this)));
390 m_fsm.AddTransition(new WeaponTransition(Reload_CF1, _fin_, C01, NULL, new WeaponGuardHasMag(this)));
391 m_fsm.AddTransition(new WeaponTransition(Reload_CF1, _fin_, C00));
392 m_fsm.AddTransition(new WeaponTransition(Reload_CF1, _abt_, CF1, NULL, new WeaponGuardCurrentChamberFiredOut(this)));
393 m_fsm.AddTransition(new WeaponTransition(Reload_CF1, _abt_, C11, NULL, new WeaponGuardCurrentChamberFull(this)));
394 m_fsm.AddTransition(new WeaponTransition(Reload_CF1, _abt_, C01, NULL, new WeaponGuardHasMag(this)));
395 m_fsm.AddTransition(new WeaponTransition(Reload_CF1, _abt_, C00));
396
397 m_fsm.AddTransition(new WeaponTransition(JF1, __S__, Reload_JF1, NULL, new WeaponGuardCanSwapMag(this))); // swap in Chg/b1/m1
398 m_fsm.AddTransition(new WeaponTransition(Reload_JF1, _fin_, JF1, NULL, new WeaponGuardHasMag(this)));
399 m_fsm.AddTransition(new WeaponTransition(Reload_JF1, _fin_, JF0));
400 m_fsm.AddTransition(new WeaponTransition(Reload_JF1, _abt_, JF1, NULL, new WeaponGuardHasMag(this)));
401 m_fsm.AddTransition(new WeaponTransition(Reload_JF1, _abt_, JF0));
402
403
404 // detach magazine
405 m_fsm.AddTransition(new WeaponTransition(C11, __D__, Detach_C11, NULL, new WeaponGuardCanDetachMag(this))); // detach from Chg/b1/m1
406 m_fsm.AddTransition(new WeaponTransition(Detach_C11, _fin_, C10));
407 m_fsm.AddTransition(new WeaponTransition(Detach_C11, _abt_, C11, NULL, new WeaponGuardHasMag(this)));
408 m_fsm.AddTransition(new WeaponTransition(Detach_C11, _abt_, C10));
409
410
411 m_fsm.AddTransition(new WeaponTransition(C01, __D__, Detach_C01, NULL, new WeaponGuardCanDetachMag(this))); // detach from Chg/b0/m1
412 m_fsm.AddTransition(new WeaponTransition(Detach_C01, _fin_, C01, NULL, new WeaponGuardHasMag(this)));
413 m_fsm.AddTransition(new WeaponTransition(Detach_C01, _fin_, C00));
414 m_fsm.AddTransition(new WeaponTransition(Detach_C01, _abt_, C01, NULL, new WeaponGuardHasMag(this)));
415 m_fsm.AddTransition(new WeaponTransition(Detach_C01, _abt_, C00));
416
417 m_fsm.AddTransition(new WeaponTransition(CF1, __D__, Detach_CF1, NULL, new WeaponGuardCanDetachMag(this))); // detach from Chg/b0/m1
418 m_fsm.AddTransition(new WeaponTransition(Detach_CF1, _fin_, CF1, NULL, new WeaponGuardHasMag(this)));
419 m_fsm.AddTransition(new WeaponTransition(Detach_CF1, _fin_, CF0));
420 m_fsm.AddTransition(new WeaponTransition(Detach_CF1, _abt_, CF1, NULL, new WeaponGuardHasMag(this)));
421 m_fsm.AddTransition(new WeaponTransition(Detach_CF1, _abt_, CF0));
422
423 m_fsm.AddTransition(new WeaponTransition(JF1, __D__, Detach_JF1, NULL, new WeaponGuardCanDetachMag(this))); // detach from CLO/b1/m1 jammed
424 m_fsm.AddTransition(new WeaponTransition(Detach_JF1, _fin_, JF1, NULL, new WeaponGuardHasMag(this)));
425 m_fsm.AddTransition(new WeaponTransition(Detach_JF1, _fin_, JF0));
426 m_fsm.AddTransition(new WeaponTransition(Detach_JF1, _abt_, JF1, NULL, new WeaponGuardHasMag(this)));
427 m_fsm.AddTransition(new WeaponTransition(Detach_JF1, _abt_, JF0));
428
429 // unjam
430 m_fsm.AddTransition(new WeaponTransition(JF0, __U__, Unjam_JF0)); // unjam nomag
431 m_fsm.AddTransition(new WeaponTransition(Unjam_JF0, _fin_, JF0, NULL, new WeaponGuardJammed(this)));
432 m_fsm.AddTransition(new WeaponTransition(Unjam_JF0, _fin_, C00));
433 m_fsm.AddTransition(new WeaponTransition(Unjam_JF0, _abt_, JF0, NULL, new WeaponGuardJammed(this)));
434 m_fsm.AddTransition(new WeaponTransition(Unjam_JF0, _abt_, C00));
435
436 m_fsm.AddTransition(new WeaponTransition(JF1, __U__, Unjam_JF1)); // unjam with mag with ammo
437 m_fsm.AddTransition(new WeaponTransition(Unjam_JF1, _fin_, JF1, NULL, new WeaponGuardJammed(this)));
438 m_fsm.AddTransition(new WeaponTransition(Unjam_JF1, _fin_, C01, NULL, new WeaponGuardCurrentChamberEmpty(this)));
439 m_fsm.AddTransition(new WeaponTransition(Unjam_JF1, _fin_, C11));
440 m_fsm.AddTransition(new WeaponTransition(Unjam_JF1, _abt_, JF1, NULL, new WeaponGuardJammed(this)));
441 m_fsm.AddTransition(new WeaponTransition(Unjam_JF1, _abt_, C01, NULL, new WeaponGuardCurrentChamberEmpty(this)));
442 m_fsm.AddTransition(new WeaponTransition(Unjam_JF1, _abt_, C11));
443
444 SetInitialState(C00);
445
446 SelectionBulletHide();
447 HideMagazine();
448
449 m_fsm.Start();
450
451 }
452
453 override void SetActions()
454 {
455 super.SetActions();
457 //AddAction(ActionAdvancedDetachMagazine);
458 }
459}
void wpnPrint(string s)
Definition Debug.c:1
void AddAction(typename actionName)
@ DEFAULT
default weapon state, closed and discharged
class WeaponGuardIsDestroyed extends WeaponGuardBase m_weapon
Definition Guards.c:602
RBLAnimState
class SSPFireout extends WeaponStableState OnEntry
enum FSMTransition WeaponTransition
MuzzleState
ref array< MuzzleState > m_muzzleHasBullet
pair ( action, actionType )
Definition Weapon_Base.c:5
static bool IsWeaponLogEnable()
Definition Debug.c:799
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 IsJammed()
Definition Crossbow.c:33
override void OnExit(WeaponEventBase e)
Definition Crossbow.c:29
override void InitMuzzleArray()
Definition Crossbow.c:35
override void OnEntry(WeaponEventBase e)
override bool HasBullet()
Definition Crossbow.c:31
override int GetCurrentStateID()
Definition Crossbow.c:30
override bool IsRepairEnabled()
Definition Crossbow.c:34
override bool HasMagazine()
Definition Crossbow.c:32
represent weapon state base
Definition BulletHide.c:2
handle jamming state set jam/unjam state for weapon
Definition SKS.c:53
override void OnEntry(WeaponEventBase e)
override void OnExit(WeaponEventBase e)
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