DayZ
1.24
Loading...
Searching...
No Matches
RifleBoltLock_Base.c
Go to the documentation of this file.
1
enum
RBLAnimState
2
{
3
DEFAULT
= 0,
4
OPENED
= 1,
5
JAMMED
= 2,
6
};
7
8
enum
RBLStableStateID
9
{
10
UNKNOWN
= 0,
11
RBL_CLO_BU0_MA0
= 1,
12
RBL_CLO_BU1_MA0
= 2,
13
RBL_CLO_BU1_MA1
= 3,
14
RBL_CLO_BU0_MA1
= 4,
15
RBL_OPN_BU0_MA1
= 5,
16
RBL_OPN_BU0_MA0
= 6,
17
RBL_JAM_BU1_MA0
= 7,
18
RBL_JAM_BU1_MA1
= 8
19
}
20
21
class
RBL_CLO_BU0_MA0
extends
WeaponStableState
22
{
23
override
void
OnEntry
(
WeaponEventBase
e
) {
if
(
LogManager
.
IsWeaponLogEnable
())
wpnPrint
(
"[wpnfsm] "
+
Object
.GetDebugName(
m_weapon
) +
" { close nobull nomag"
);
super
.OnEntry(
e
); }
24
override
void
OnExit
(
WeaponEventBase
e
) {
super
.OnExit(
e
);
if
(
LogManager
.
IsWeaponLogEnable
())
wpnPrint
(
"[wpnfsm] "
+
Object
.GetDebugName(
m_weapon
) +
" } close nobull nomag"
); }
25
override
int
GetCurrentStateID
() {
return
RBLStableStateID
.RBL_CLO_BU0_MA0; }
26
override
bool
HasBullet
() {
return
false
; }
27
override
bool
HasMagazine
() {
return
false
; }
28
override
bool
IsJammed
() {
return
false
; }
29
override
bool
IsRepairEnabled
() {
return
true
; }
30
override
void
InitMuzzleArray
() {
m_muzzleHasBullet
= {
MuzzleState
.E}; }
31
};
32
class
RBL_CLO_BU1_MA0
extends
WeaponStableState
33
{
34
override
void
OnEntry
(
WeaponEventBase
e
) {
if
(
LogManager
.
IsWeaponLogEnable
())
wpnPrint
(
"[wpnfsm] "
+
Object
.GetDebugName(
m_weapon
) +
" { close bullet nomag"
);
super
.OnEntry(
e
); }
35
override
void
OnExit
(
WeaponEventBase
e
) {
super
.OnExit(
e
);
if
(
LogManager
.
IsWeaponLogEnable
())
wpnPrint
(
"[wpnfsm] "
+
Object
.GetDebugName(
m_weapon
) +
" } close bullet nomag"
); }
36
override
int
GetCurrentStateID
() {
return
RBLStableStateID
.RBL_CLO_BU1_MA0; }
37
override
bool
HasBullet
() {
return
true
; }
38
override
bool
HasMagazine
() {
return
false
; }
39
override
bool
IsJammed
() {
return
false
; }
40
override
bool
IsRepairEnabled
() {
return
true
; }
41
override
void
InitMuzzleArray
() {
m_muzzleHasBullet
= {
MuzzleState
.L}; }
42
};
43
class
RBL_CLO_BU1_MA1
extends
WeaponStableState
44
{
45
override
void
OnEntry
(
WeaponEventBase
e
) {
if
(
LogManager
.
IsWeaponLogEnable
())
wpnPrint
(
"[wpnfsm] "
+
Object
.GetDebugName(
m_weapon
) +
" { close bullet mag"
);
super
.OnEntry(
e
); }
46
override
void
OnExit
(
WeaponEventBase
e
) {
super
.OnExit(
e
);
if
(
LogManager
.
IsWeaponLogEnable
())
wpnPrint
(
"[wpnfsm] "
+
Object
.GetDebugName(
m_weapon
) +
" } close bullet mag"
); }
47
override
int
GetCurrentStateID
() {
return
RBLStableStateID
.RBL_CLO_BU1_MA1; }
48
override
bool
HasBullet
() {
return
true
; }
49
override
bool
HasMagazine
() {
return
true
; }
50
override
bool
IsJammed
() {
return
false
; }
51
override
bool
IsRepairEnabled
() {
return
true
; }
52
override
void
InitMuzzleArray
() {
m_muzzleHasBullet
= {
MuzzleState
.L}; }
53
};
54
class
RBL_CLO_BU0_MA1
extends
WeaponStableState
55
{
56
override
void
OnEntry
(
WeaponEventBase
e
) {
if
(
LogManager
.
IsWeaponLogEnable
())
wpnPrint
(
"[wpnfsm] "
+
Object
.GetDebugName(
m_weapon
) +
" { close nobull mag"
);
super
.OnEntry(
e
); }
57
override
void
OnExit
(
WeaponEventBase
e
) {
super
.OnExit(
e
);
if
(
LogManager
.
IsWeaponLogEnable
())
wpnPrint
(
"[wpnfsm] "
+
Object
.GetDebugName(
m_weapon
) +
" } close nobull mag"
); }
58
override
int
GetCurrentStateID
() {
return
RBLStableStateID
.RBL_CLO_BU0_MA1; }
59
override
bool
HasBullet
() {
return
false
; }
60
override
bool
HasMagazine
() {
return
true
; }
61
override
bool
IsJammed
() {
return
false
; }
62
override
bool
IsRepairEnabled
() {
return
true
; }
63
override
void
InitMuzzleArray
() {
m_muzzleHasBullet
= {
MuzzleState
.E}; }
64
};
65
class
RBL_OPN_BU0_MA1
extends
WeaponStableState
66
{
67
override
void
OnEntry
(
WeaponEventBase
e
) {
if
(
LogManager
.
IsWeaponLogEnable
())
wpnPrint
(
"[wpnfsm] "
+
Object
.GetDebugName(
m_weapon
) +
" { lock nobull mag"
);
m_weapon
.SetWeaponOpen(
true
);
super
.OnEntry(
e
); }
68
override
void
OnExit
(
WeaponEventBase
e
) {
super
.OnExit(
e
);
if
(
LogManager
.
IsWeaponLogEnable
())
wpnPrint
(
"[wpnfsm] "
+
Object
.GetDebugName(
m_weapon
) +
" } open nobull mag"
); }
69
override
int
GetCurrentStateID
() {
return
RBLStableStateID
.RBL_OPN_BU0_MA1; }
70
override
bool
HasBullet
() {
return
false
; }
71
override
bool
HasMagazine
() {
return
true
; }
72
override
bool
IsJammed
() {
return
false
; }
73
override
bool
IsBoltOpen
() {
return
true
; }
74
override
bool
IsRepairEnabled
() {
return
true
; }
75
override
void
InitMuzzleArray
() {
m_muzzleHasBullet
= {
MuzzleState
.E}; }
76
};
77
class
RBL_OPN_BU0_MA0
extends
WeaponStableState
78
{
79
override
void
OnEntry
(
WeaponEventBase
e
) {
if
(
LogManager
.
IsWeaponLogEnable
())
wpnPrint
(
"[wpnfsm] "
+
Object
.GetDebugName(
m_weapon
) +
" { lock nobull nomag"
);
m_weapon
.SetWeaponOpen(
true
);
super
.OnEntry(
e
); }
80
override
void
OnExit
(
WeaponEventBase
e
) {
super
.OnExit(
e
);
if
(
LogManager
.
IsWeaponLogEnable
())
wpnPrint
(
"[wpnfsm] "
+
Object
.GetDebugName(
m_weapon
) +
" } open nobull nomag"
); }
81
override
int
GetCurrentStateID
() {
return
RBLStableStateID
.RBL_OPN_BU0_MA0; }
82
override
bool
HasBullet
() {
return
false
; }
83
override
bool
HasMagazine
() {
return
false
; }
84
override
bool
IsJammed
() {
return
false
; }
85
override
bool
IsBoltOpen
() {
return
true
; }
86
override
bool
IsRepairEnabled
() {
return
true
; }
87
override
void
InitMuzzleArray
() {
m_muzzleHasBullet
= {
MuzzleState
.E}; }
88
};
89
class
RBL_JAM_BU1_MA0
extends
WeaponStateJammed
90
{
91
override
void
OnEntry
(
WeaponEventBase
e
) {
if
(
LogManager
.
IsWeaponLogEnable
())
wpnPrint
(
"[wpnfsm] "
+
Object
.GetDebugName(
m_weapon
) +
" { jammed bullet nomag"
);
super
.OnEntry(
e
); }
92
override
void
OnExit
(
WeaponEventBase
e
) {
super
.OnExit(
e
);
if
(
LogManager
.
IsWeaponLogEnable
())
wpnPrint
(
"[wpnfsm] "
+
Object
.GetDebugName(
m_weapon
) +
" } jammed bullet nomag"
); }
93
override
int
GetCurrentStateID
() {
return
RBLStableStateID
.RBL_JAM_BU1_MA0; }
94
override
bool
HasBullet
() {
return
true
; }
95
override
bool
HasMagazine
() {
return
false
; }
96
override
bool
IsJammed
() {
return
true
; }
97
override
bool
IsBoltOpen
() {
return
true
; }
98
override
bool
IsRepairEnabled
() {
return
true
; }
99
override
void
InitMuzzleArray
() {
m_muzzleHasBullet
= {
MuzzleState
.F}; }
100
};
101
class
RBL_JAM_BU1_MA1
extends
WeaponStateJammed
102
{
103
override
void
OnEntry
(
WeaponEventBase
e
) {
if
(
LogManager
.
IsWeaponLogEnable
())
wpnPrint
(
"[wpnfsm] "
+
Object
.GetDebugName(
m_weapon
) +
" { jammed bullet mag"
);
super
.OnEntry(
e
); }
104
override
void
OnExit
(
WeaponEventBase
e
) {
super
.OnExit(
e
);
if
(
LogManager
.
IsWeaponLogEnable
())
wpnPrint
(
"[wpnfsm] "
+
Object
.GetDebugName(
m_weapon
) +
" } jammed bullet mag"
); }
105
override
int
GetCurrentStateID
() {
return
RBLStableStateID
.RBL_JAM_BU1_MA1; }
106
override
bool
HasBullet
() {
return
true
; }
107
override
bool
HasMagazine
() {
return
true
; }
108
override
bool
IsJammed
() {
return
true
; }
109
override
bool
IsBoltOpen
() {
return
true
; }
110
override
bool
IsRepairEnabled
() {
return
true
; }
111
override
void
InitMuzzleArray
() {
m_muzzleHasBullet
= {
MuzzleState
.F}; }
112
};
113
114
119
class
RifleBoltLock_Base
extends
Rifle_Base
120
{
121
ref
WeaponStableState
C00;
122
ref
WeaponStableState
C10;
123
ref
WeaponStableState
C11;
124
ref
WeaponStableState
C01;
125
ref
WeaponStableState
O00
;
126
ref
WeaponStableState
O01
;
127
ref
WeaponStableState
JF0;
128
ref
WeaponStableState
JF1;
129
130
void
RifleBoltLock_Base
()
131
{
132
}
133
134
override
void
InitStateMachine
()
135
{
136
m_abilities.Insert(
new
AbilityRecord
(
WeaponActions
.RELOAD, GetWeaponSpecificCommand(
WeaponActions
.RELOAD,
WeaponActionReloadTypes
.RELOADRIFLE_MAGAZINE_BULLET)));
137
m_abilities.Insert(
new
AbilityRecord
(
WeaponActions
.RELOAD, GetWeaponSpecificCommand(
WeaponActions
.RELOAD,
WeaponActionReloadTypes
.RELOADRIFLE_NOMAGAZINE_BULLET)));
138
m_abilities.Insert(
new
AbilityRecord
(
WeaponActions
.RELOAD, GetWeaponSpecificCommand(
WeaponActions
.RELOAD,
WeaponActionReloadTypes
.RELOADRIFLE_MAGAZINE_NOBULLET)));
139
m_abilities.Insert(
new
AbilityRecord
(
WeaponActions
.RELOAD, GetWeaponSpecificCommand(
WeaponActions
.RELOAD,
WeaponActionReloadTypes
.RELOADRIFLE_NOMAGAZINE_NOBULLET)));
140
m_abilities.Insert(
new
AbilityRecord
(
WeaponActions
.RELOAD, GetWeaponSpecificCommand(
WeaponActions
.RELOAD,
WeaponActionReloadTypes
.RELOADRIFLE_NOMAGAZINE_NOBULLET_OPEN)));
141
m_abilities.Insert(
new
AbilityRecord
(
WeaponActions
.RELOAD, GetWeaponSpecificCommand(
WeaponActions
.RELOAD,
WeaponActionReloadTypes
.RELOADRIFLE_MAGAZINE_NOBULLET_OPEN)));
142
m_abilities.Insert(
new
AbilityRecord
(
WeaponActions
.RELOAD, GetWeaponSpecificCommand(
WeaponActions
.RELOAD,
WeaponActionReloadTypes
.RELOADRIFLE_MAGAZINE_DETACH)));
143
144
m_abilities.Insert(
new
AbilityRecord
(
WeaponActions
.CHAMBERING, GetWeaponSpecificCommand(
WeaponActions
.CHAMBERING,
WeaponActionChamberingTypes
.CHAMBERING_ONEBULLET_CLOSED)));
145
m_abilities.Insert(
new
AbilityRecord
(
WeaponActions
.CHAMBERING, GetWeaponSpecificCommand(
WeaponActions
.CHAMBERING,
WeaponActionChamberingTypes
.CHAMBERING_ONEBULLET_UNIQUE_CLOSED)));
146
147
m_abilities.Insert(
new
AbilityRecord
(
WeaponActions
.MECHANISM, GetWeaponSpecificCommand(
WeaponActions
.MECHANISM,
WeaponActionMechanismTypes
.MECHANISM_CLOSED)));
148
m_abilities.Insert(
new
AbilityRecord
(
WeaponActions
.MECHANISM, GetWeaponSpecificCommand(
WeaponActions
.MECHANISM,
WeaponActionMechanismTypes
.MECHANISM_OPENED)));
//????
149
150
m_abilities.Insert(
new
AbilityRecord
(
WeaponActions
.UNJAMMING, GetWeaponSpecificCommand(
WeaponActions
.UNJAMMING,
WeaponActionUnjammingTypes
.UNJAMMING_START)));
151
m_abilities.Insert(
new
AbilityRecord
(
WeaponActions
.UNJAMMING, GetWeaponSpecificCommand(
WeaponActions
.UNJAMMING,
WeaponActionUnjammingTypes
.UNJAMMING_END)));
152
153
m_abilities.Insert(
new
AbilityRecord
(
WeaponActions
.FIRE, GetWeaponSpecificCommand(
WeaponActions
.FIRE,
WeaponActionFireTypes
.FIRE_NORMAL)));
154
m_abilities.Insert(
new
AbilityRecord
(
WeaponActions
.FIRE, GetWeaponSpecificCommand(
WeaponActions
.FIRE,
WeaponActionFireTypes
.FIRE_LAST)));
155
m_abilities.Insert(
new
AbilityRecord
(
WeaponActions
.FIRE, GetWeaponSpecificCommand(
WeaponActions
.FIRE,
WeaponActionFireTypes
.FIRE_JAM)));
156
m_abilities.Insert(
new
AbilityRecord
(
WeaponActions
.FIRE, GetWeaponSpecificCommand(
WeaponActions
.FIRE,
WeaponActionFireTypes
.FIRE_DRY)));
157
158
//m_abilities.Insert(new AbilityRecord(WeaponActions.FIRE, WeaponActionFireTypes.FIRE_UNCOCKED));
159
160
// setup state machine
161
// basic weapon states
162
// close-locked-jammed | nobullet-bullet | nomag-mag
163
// regexp: [CLJ][01][01]
164
C00 =
new
RBL_CLO_BU0_MA0
(
this
,
NULL
,
RBLAnimState
.DEFAULT);
165
C10 =
new
RBL_CLO_BU1_MA0
(
this
,
NULL
,
RBLAnimState
.DEFAULT);
166
C11 =
new
RBL_CLO_BU1_MA1
(
this
,
NULL
,
RBLAnimState
.DEFAULT);
167
C01 =
new
RBL_CLO_BU0_MA1
(
this
,
NULL
,
RBLAnimState
.DEFAULT);
168
O00 =
new
RBL_OPN_BU0_MA0
(
this
,
NULL
,
RBLAnimState
.OPENED);
169
O01 =
new
RBL_OPN_BU0_MA1
(
this
,
NULL
,
RBLAnimState
.OPENED);
170
JF0 =
new
RBL_JAM_BU1_MA0
(
this
,
NULL
,
RBLAnimState
.JAMMED);
171
JF1 =
new
RBL_JAM_BU1_MA1
(
this
,
NULL
,
RBLAnimState
.JAMMED);
172
173
// unstable (intermediate) states
174
WeaponCharging
Mech_C00
=
new
WeaponCharging
(
this
,
NULL
,
WeaponActions
.MECHANISM, GetWeaponSpecificCommand(
WeaponActions
.MECHANISM,
WeaponActionMechanismTypes
.MECHANISM_CLOSED));
175
WeaponCharging
Mech_C01
=
new
WeaponCharging
(
this
,
NULL
,
WeaponActions
.MECHANISM, GetWeaponSpecificCommand(
WeaponActions
.MECHANISM,
WeaponActionMechanismTypes
.MECHANISM_CLOSED));
176
WeaponCharging
Mech_O00
=
new
WeaponCharging
(
this
,
NULL
,
WeaponActions
.MECHANISM, GetWeaponSpecificCommand(
WeaponActions
.MECHANISM,
WeaponActionMechanismTypes
.MECHANISM_OPENED));
177
WeaponCharging
Mech_O01
=
new
WeaponCharging
(
this
,
NULL
,
WeaponActions
.MECHANISM, GetWeaponSpecificCommand(
WeaponActions
.MECHANISM,
WeaponActionMechanismTypes
.MECHANISM_OPENED));
178
179
WeaponCharging
Mech_C10
=
new
WeaponCharging
(
this
,
NULL
,
WeaponActions
.MECHANISM, GetWeaponSpecificCommand(
WeaponActions
.MECHANISM,
WeaponActionMechanismTypes
.MECHANISM_CLOSED));
180
WeaponCharging
Mech_C11
=
new
WeaponCharging
(
this
,
NULL
,
WeaponActions
.MECHANISM, GetWeaponSpecificCommand(
WeaponActions
.MECHANISM,
WeaponActionMechanismTypes
.MECHANISM_CLOSED));
181
182
WeaponStateBase
Trigger_C00
=
new
WeaponDryFire
(
this
,
NULL
,
WeaponActions
.FIRE, GetWeaponSpecificCommand(
WeaponActions
.FIRE,
WeaponActionFireTypes
.FIRE_DRY));
// cock without clip
183
WeaponStateBase
Trigger_C10
=
new
WeaponFireLast(
this
,
NULL
,
WeaponActions
.FIRE, GetWeaponSpecificCommand(
WeaponActions
.FIRE,
WeaponActionFireTypes
.FIRE_NORMAL));
// cock with clip
184
WeaponFireAndChamberNext
Trigger_C11
=
new
WeaponFireAndChamberNext(
this
,
NULL
,
WeaponActions
.FIRE, GetWeaponSpecificCommand(
WeaponActions
.FIRE,
WeaponActionFireTypes
.FIRE_NORMAL));
185
WeaponStateBase
Trigger_C11L
=
new
WeaponFireLast(
this
,
NULL
,
WeaponActions
.FIRE, GetWeaponSpecificCommand(
WeaponActions
.FIRE,
WeaponActionFireTypes
.FIRE_LAST));
186
WeaponStateBase
Trigger_C01
=
new
WeaponDryFire
(
this
,
NULL
,
WeaponActions
.FIRE, GetWeaponSpecificCommand(
WeaponActions
.FIRE,
WeaponActionFireTypes
.FIRE_DRY));
187
WeaponStateBase
Trigger_O00
=
new
WeaponDryFire
(
this
,
NULL
,
WeaponActions
.FIRE, GetWeaponSpecificCommand(
WeaponActions
.FIRE,
WeaponActionFireTypes
.FIRE_DRY));
188
WeaponStateBase
Trigger_O01
=
new
WeaponDryFire
(
this
,
NULL
,
WeaponActions
.FIRE, GetWeaponSpecificCommand(
WeaponActions
.FIRE,
WeaponActionFireTypes
.FIRE_DRY));
189
WeaponStateBase
Trigger_JF0
=
new
WeaponDryFire
(
this
,
NULL
,
WeaponActions
.FIRE, GetWeaponSpecificCommand(
WeaponActions
.FIRE,
WeaponActionFireTypes
.FIRE_DRY));
190
WeaponStateBase
Trigger_JF1
=
new
WeaponDryFire
(
this
,
NULL
,
WeaponActions
.FIRE, GetWeaponSpecificCommand(
WeaponActions
.FIRE,
WeaponActionFireTypes
.FIRE_DRY));
191
192
//Fire and jam
193
WeaponStateBase
Trigger_C10J
=
new
WeaponFireToJam
(
this
,
NULL
,
WeaponActions
.FIRE, GetWeaponSpecificCommand(
WeaponActions
.FIRE,
WeaponActionFireTypes
.FIRE_JAM));
// cock with clip
194
WeaponStateBase
Trigger_C11J
=
new
WeaponFireToJam
(
this
,
NULL
,
WeaponActions
.FIRE, GetWeaponSpecificCommand(
WeaponActions
.FIRE,
WeaponActionFireTypes
.FIRE_JAM));
195
196
// WeaponStateBase Trigger_C11J = new WeaponFire(this, NULL, WeaponActions.FIRE, GetWeaponSpecificCommand(WeaponActions.FIRE, WeaponActionFireTypes.FIRE_JAM));
197
198
WeaponStateBase
Unjam_JF0
=
new
WeaponUnjamming
(
this
,
NULL
,
WeaponActions
.UNJAMMING, GetWeaponSpecificCommand(
WeaponActions
.UNJAMMING,
WeaponActionUnjammingTypes
.UNJAMMING_START));
199
WeaponStateBase
Unjam_JF1
=
new
WeaponUnjamming
(
this
,
NULL
,
WeaponActions
.UNJAMMING, GetWeaponSpecificCommand(
WeaponActions
.UNJAMMING,
WeaponActionUnjammingTypes
.UNJAMMING_START));
200
201
WeaponChambering
Chamber_C00
=
new
WeaponChambering(
this
,
NULL
,
WeaponActions
.CHAMBERING, GetWeaponSpecificCommand(
WeaponActions
.CHAMBERING,
WeaponActionChamberingTypes
.CHAMBERING_ONEBULLET_CLOSED));
202
WeaponChambering
Chamber_C01
=
new
WeaponChambering(
this
,
NULL
,
WeaponActions
.CHAMBERING, GetWeaponSpecificCommand(
WeaponActions
.CHAMBERING,
WeaponActionChamberingTypes
.CHAMBERING_ONEBULLET_CLOSED));
203
WeaponChambering
Chamber_O00
=
new
WeaponChambering(
this
,
NULL
,
WeaponActions
.CHAMBERING, GetWeaponSpecificCommand(
WeaponActions
.CHAMBERING,
WeaponActionChamberingTypes
.CHAMBERING_ONEBULLET_UNIQUE_CLOSED));
204
WeaponChambering
Chamber_O01
=
new
WeaponChambering(
this
,
NULL
,
WeaponActions
.CHAMBERING, GetWeaponSpecificCommand(
WeaponActions
.CHAMBERING,
WeaponActionChamberingTypes
.CHAMBERING_ONEBULLET_UNIQUE_CLOSED));
205
206
WeaponAttachMagazine
Attach_C00
=
new
WeaponAttachMagazine(
this
,
NULL
,
WeaponActions
.RELOAD, GetWeaponSpecificCommand(
WeaponActions
.RELOAD,
WeaponActionReloadTypes
.RELOADRIFLE_NOMAGAZINE_NOBULLET));
207
WeaponAttachMagazine
Attach_C10
=
new
WeaponAttachMagazine(
this
,
NULL
,
WeaponActions
.RELOAD, GetWeaponSpecificCommand(
WeaponActions
.RELOAD,
WeaponActionReloadTypes
.RELOADRIFLE_NOMAGAZINE_BULLET));
208
WeaponAttachMagazine
Attach_O00
=
new
WeaponAttachMagazine(
this
,
NULL
,
WeaponActions
.RELOAD, GetWeaponSpecificCommand(
WeaponActions
.RELOAD,
WeaponActionReloadTypes
.RELOADRIFLE_NOMAGAZINE_NOBULLET_OPEN));
//TODO Need add open animation
209
WeaponAttachMagazine
Attach_JF0
=
new
WeaponAttachMagazine(
this
,
NULL
,
WeaponActions
.RELOAD, GetWeaponSpecificCommand(
WeaponActions
.RELOAD,
WeaponActionReloadTypes
.RELOADRIFLE_NOMAGAZINE_BULLET));
210
211
WeaponReplacingMagAndChamberNext
Reload_C11
=
new
WeaponReplacingMagAndChamberNext
(
this
,
NULL
,
WeaponActions
.RELOAD, GetWeaponSpecificCommand(
WeaponActions
.RELOAD,
WeaponActionReloadTypes
.RELOADRIFLE_MAGAZINE_BULLET));
212
WeaponReplacingMagAndChamberNext
Reload_C01
=
new
WeaponReplacingMagAndChamberNext
(
this
,
NULL
,
WeaponActions
.RELOAD, GetWeaponSpecificCommand(
WeaponActions
.RELOAD,
WeaponActionReloadTypes
.RELOADRIFLE_MAGAZINE_NOBULLET));
213
WeaponReplacingMagAndChamberNext
Reload_O01
=
new
WeaponReplacingMagAndChamberNext
(
this
,
NULL
,
WeaponActions
.RELOAD, GetWeaponSpecificCommand(
WeaponActions
.RELOAD,
WeaponActionReloadTypes
.RELOADRIFLE_MAGAZINE_NOBULLET_OPEN));
//TODO Need add open animation
214
WeaponReplacingMagAndChamberNext
Reload_JF1
=
new
WeaponReplacingMagAndChamberNext
(
this
,
NULL
,
WeaponActions
.RELOAD, GetWeaponSpecificCommand(
WeaponActions
.RELOAD,
WeaponActionReloadTypes
.RELOADRIFLE_MAGAZINE_BULLET));
215
216
WeaponDetachingMag
Detach_C11
=
new
WeaponDetachingMag(
this
,
NULL
,
WeaponActions
.RELOAD, GetWeaponSpecificCommand(
WeaponActions
.RELOAD,
WeaponActionReloadTypes
.RELOADRIFLE_MAGAZINE_DETACH));
217
WeaponDetachingMag
Detach_C01
=
new
WeaponDetachingMag(
this
,
NULL
,
WeaponActions
.RELOAD, GetWeaponSpecificCommand(
WeaponActions
.RELOAD,
WeaponActionReloadTypes
.RELOADRIFLE_MAGAZINE_DETACH));
218
WeaponDetachingMag
Detach_O01
=
new
WeaponDetachingMag(
this
,
NULL
,
WeaponActions
.RELOAD, GetWeaponSpecificCommand(
WeaponActions
.RELOAD,
WeaponActionReloadTypes
.RELOADRIFLE_MAGAZINE_DETACH));
219
WeaponDetachingMag
Detach_JF1
=
new
WeaponDetachingMag(
this
,
NULL
,
WeaponActions
.RELOAD, GetWeaponSpecificCommand(
WeaponActions
.RELOAD,
WeaponActionReloadTypes
.RELOADRIFLE_MAGAZINE_DETACH));
220
221
//WeaponStateBase chmMag = new WeaponChamberFromAttMag(this, NULL, WeaponActions.MECHANISM, WeaponActionMechanismTypes.MECHANISM_CLOSED);
222
223
// events
224
WeaponEventBase
__M__
=
new
WeaponEventMechanism;
225
WeaponEventBase
__T__
=
new
WeaponEventTrigger;
226
WeaponEventBase
__TJ_
=
new
WeaponEventTriggerToJam;
227
WeaponEventBase
__U__
=
new
WeaponEventUnjam;
228
WeaponEventBase
__L__
=
new
WeaponEventLoad1Bullet;
229
WeaponEventBase
__A__
=
new
WeaponEventAttachMagazine;
230
WeaponEventBase
__D__
=
new
WeaponEventDetachMagazine;
231
WeaponEventBase
__S__
=
new
WeaponEventSwapMagazine;
232
WeaponEventBase
_fin_
=
new
WeaponEventHumanCommandActionFinished;
233
WeaponEventBase
_abt_
=
new
WeaponEventHumanCommandActionAborted;
234
WeaponEventBase
_rto_
=
new
WeaponEventReloadTimeout;
235
WeaponEventBase
_dto_
=
new
WeaponEventDryFireTimeout;
236
237
m_fsm =
new
WeaponFSM
();
238
239
// order: Discharged-Charged | nobullet-bullet | nomag-mag
240
// charging
241
m_fsm.AddTransition(
new
WeaponTransition
(C00,
__M__
,
Mech_C00
));
// charge from dischg nobullet nomag
242
m_fsm.AddTransition(
new
WeaponTransition
(
Mech_C00
,
_fin_
, C00));
243
m_fsm.AddTransition(
new
WeaponTransition
(
Mech_C00
,
_abt_
, C00));
244
245
m_fsm.AddTransition(
new
WeaponTransition
(C10,
__M__
,
Mech_C10
));
// charge from bullet nomag
246
m_fsm.AddTransition(
new
WeaponTransition
(
Mech_C10
,
_fin_
, C00,
NULL
,
new
WeaponGuardCurrentChamberEmpty(
this
)));
247
m_fsm.AddTransition(
new
WeaponTransition
(
Mech_C10
,
_fin_
, C10));
248
m_fsm.AddTransition(
new
WeaponTransition
(
Mech_C10
,
_abt_
, C00,
NULL
,
new
WeaponGuardCurrentChamberEmpty(
this
)));
249
m_fsm.AddTransition(
new
WeaponTransition
(
Mech_C10
,
_abt_
, C10));
250
251
m_fsm.AddTransition(
new
WeaponTransition
(C11,
__M__
,
Mech_C11
));
// charge from dischg nobullet nomag
252
m_fsm.AddTransition(
new
WeaponTransition
(
Mech_C11
,
_fin_
, C01,
NULL
,
new
WeaponGuardCurrentChamberEmpty(
this
)));
253
m_fsm.AddTransition(
new
WeaponTransition
(
Mech_C11
,
_fin_
, C11));
254
m_fsm.AddTransition(
new
WeaponTransition
(
Mech_C11
,
_abt_
, C01,
NULL
,
new
WeaponGuardCurrentChamberEmpty(
this
)));
255
m_fsm.AddTransition(
new
WeaponTransition
(
Mech_C11
,
_abt_
, C11));
256
257
258
m_fsm.AddTransition(
new
WeaponTransition
(C01,
__M__
,
Mech_C01
));
// charge from dischg nobullet nomag
259
m_fsm.AddTransition(
new
WeaponTransition
(
Mech_C01
,
_fin_
, C01,
NULL
,
new
WeaponGuardCurrentChamberEmpty(
this
)));
260
m_fsm.AddTransition(
new
WeaponTransition
(
Mech_C01
,
_fin_
, C11));
261
m_fsm.AddTransition(
new
WeaponTransition
(
Mech_C01
,
_abt_
, C01,
NULL
,
new
WeaponGuardCurrentChamberEmpty(
this
)));
262
m_fsm.AddTransition(
new
WeaponTransition
(
Mech_C01
,
_abt_
, C11));
263
264
m_fsm.AddTransition(
new
WeaponTransition
(O00,
__M__
,
Mech_O00
));
// charge from dischg nobullet nomag
265
m_fsm.AddTransition(
new
WeaponTransition
(
Mech_O00
,
_fin_
, O00,
NULL
,
new
WeaponGuardWeaponOpen
(
this
)));
266
m_fsm.AddTransition(
new
WeaponTransition
(
Mech_O00
,
_fin_
, C00));
267
m_fsm.AddTransition(
new
WeaponTransition
(
Mech_O00
,
_abt_
, O00,
NULL
,
new
WeaponGuardWeaponOpen
(
this
)));
268
m_fsm.AddTransition(
new
WeaponTransition
(
Mech_O00
,
_abt_
, C00));
269
270
m_fsm.AddTransition(
new
WeaponTransition
(O01,
__M__
,
Mech_O01
));
// charge from dischg nobullet nomag
271
m_fsm.AddTransition(
new
WeaponTransition
(
Mech_O01
,
_fin_
, O01,
NULL
,
new
WeaponGuardWeaponOpen
(
this
)));
272
m_fsm.AddTransition(
new
WeaponTransition
(
Mech_O01
,
_fin_
, C01,
NULL
,
new
WeaponGuardCurrentChamberEmpty(
this
)));
273
m_fsm.AddTransition(
new
WeaponTransition
(
Mech_O01
,
_fin_
, C11));
274
m_fsm.AddTransition(
new
WeaponTransition
(
Mech_O01
,
_abt_
, O01,
NULL
,
new
WeaponGuardWeaponOpen
(
this
)));
275
m_fsm.AddTransition(
new
WeaponTransition
(
Mech_O01
,
_abt_
, C01,
NULL
,
new
WeaponGuardCurrentChamberEmpty(
this
)));
276
m_fsm.AddTransition(
new
WeaponTransition
(
Mech_O01
,
_abt_
, C11));
277
278
// fire
279
m_fsm.AddTransition(
new
WeaponTransition
(C00,
__T__
,
Trigger_C00
));
280
m_fsm.AddTransition(
new
WeaponTransition
(
Trigger_C00
,
_fin_
, C00));
281
m_fsm.AddTransition(
new
WeaponTransition
(
Trigger_C00
,
_dto_
, C00));
282
m_fsm.AddTransition(
new
WeaponTransition
(
Trigger_C00
,
_abt_
, C00));
283
284
m_fsm.AddTransition(
new
WeaponTransition
(C01,
__T__
,
Trigger_C01
));
285
m_fsm.AddTransition(
new
WeaponTransition
(
Trigger_C01
,
_fin_
, C01));
286
m_fsm.AddTransition(
new
WeaponTransition
(
Trigger_C01
,
_dto_
, C01));
287
m_fsm.AddTransition(
new
WeaponTransition
(
Trigger_C01
,
_abt_
, C01));
288
289
m_fsm.AddTransition(
new
WeaponTransition
(C10,
__T__
,
Trigger_C10
));
290
m_fsm.AddTransition(
new
WeaponTransition
(
Trigger_C10
,
_fin_
, C00));
291
m_fsm.AddTransition(
new
WeaponTransition
(
Trigger_C10
,
_rto_
, C00));
292
m_fsm.AddTransition(
new
WeaponTransition
(
Trigger_C10
,
_abt_
, C00));
293
294
m_fsm.AddTransition(
new
WeaponTransition
(C11,
__T__
,
Trigger_C11
,
NULL
,
new
WeaponGuardHasAmmo
(
this
)));
295
m_fsm.AddTransition(
new
WeaponTransition
(
Trigger_C11
,
_fin_
, C11));
296
m_fsm.AddTransition(
new
WeaponTransition
(
Trigger_C11
,
_rto_
, C11));
297
m_fsm.AddTransition(
new
WeaponTransition
(
Trigger_C11
,
_abt_
, C11));
298
299
m_fsm.AddTransition(
new
WeaponTransition
(C11,
__T__
,
Trigger_C11L
));
300
m_fsm.AddTransition(
new
WeaponTransition
(
Trigger_C11L
,
_fin_
, O01));
301
m_fsm.AddTransition(
new
WeaponTransition
(
Trigger_C11L
,
_rto_
, O01));
302
m_fsm.AddTransition(
new
WeaponTransition
(
Trigger_C11L
,
_abt_
, O01));
303
304
m_fsm.AddTransition(
new
WeaponTransition
(O00,
__T__
,
Trigger_O00
));
305
m_fsm.AddTransition(
new
WeaponTransition
(
Trigger_O00
,
_fin_
, O00));
306
m_fsm.AddTransition(
new
WeaponTransition
(
Trigger_O00
,
_dto_
, O00));
307
m_fsm.AddTransition(
new
WeaponTransition
(
Trigger_O00
,
_abt_
, O00));
308
309
m_fsm.AddTransition(
new
WeaponTransition
(O01,
__T__
,
Trigger_O01
));
310
m_fsm.AddTransition(
new
WeaponTransition
(
Trigger_O01
,
_fin_
, O01));
311
m_fsm.AddTransition(
new
WeaponTransition
(
Trigger_O01
,
_dto_
, O01));
312
m_fsm.AddTransition(
new
WeaponTransition
(
Trigger_O01
,
_abt_
, O01));
313
314
m_fsm.AddTransition(
new
WeaponTransition
(JF0,
__T__
,
Trigger_JF0
));
// opened fire.uncocked w mag
315
m_fsm.AddTransition(
new
WeaponTransition
(
Trigger_JF0
,
_fin_
, JF0));
316
m_fsm.AddTransition(
new
WeaponTransition
(
Trigger_JF0
,
_dto_
, JF0));
317
m_fsm.AddTransition(
new
WeaponTransition
(
Trigger_JF0
,
_abt_
, JF0));
318
319
m_fsm.AddTransition(
new
WeaponTransition
(JF1,
__T__
,
Trigger_JF1
));
// opened fire.uncocked w mag
320
m_fsm.AddTransition(
new
WeaponTransition
(
Trigger_JF1
,
_fin_
, JF1));
321
m_fsm.AddTransition(
new
WeaponTransition
(
Trigger_JF1
,
_dto_
, JF1));
322
m_fsm.AddTransition(
new
WeaponTransition
(
Trigger_JF1
,
_abt_
, JF1));
323
324
325
m_fsm.AddTransition(
new
WeaponTransition
(C10,
__TJ_
,
Trigger_C10J
));
326
m_fsm.AddTransition(
new
WeaponTransition
(
Trigger_C10J
,
_fin_
, JF0));
327
m_fsm.AddTransition(
new
WeaponTransition
(
Trigger_C10J
,
_rto_
, JF0));
328
m_fsm.AddTransition(
new
WeaponTransition
(
Trigger_C10J
,
_abt_
, JF0));
329
330
m_fsm.AddTransition(
new
WeaponTransition
(C11,
__TJ_
,
Trigger_C11J
));
331
m_fsm.AddTransition(
new
WeaponTransition
(
Trigger_C11J
,
_fin_
, JF1));
332
m_fsm.AddTransition(
new
WeaponTransition
(
Trigger_C11J
,
_rto_
, JF1));
333
m_fsm.AddTransition(
new
WeaponTransition
(
Trigger_C11J
,
_abt_
, JF1));
334
335
336
// load cartridge
337
m_fsm.AddTransition(
new
WeaponTransition
(C00,
__L__
,
Chamber_C00
));
// chamber from closed=1
338
m_fsm.AddTransition(
new
WeaponTransition
(
Chamber_C00
,
_fin_
, O00,
NULL
,
new
WeaponGuardWeaponOpen
(
this
)));
339
m_fsm.AddTransition(
new
WeaponTransition
(
Chamber_C00
,
_fin_
, C00,
NULL
,
new
WeaponGuardChamberEmpty(
this
)));
340
m_fsm.AddTransition(
new
WeaponTransition
(
Chamber_C00
,
_fin_
, C10));
341
m_fsm.AddTransition(
new
WeaponTransition
(
Chamber_C00
,
_abt_
, O00,
NULL
,
new
WeaponGuardWeaponOpen
(
this
)));
342
m_fsm.AddTransition(
new
WeaponTransition
(
Chamber_C00
,
_abt_
, C00,
NULL
,
new
WeaponGuardChamberEmpty(
this
)));
343
m_fsm.AddTransition(
new
WeaponTransition
(
Chamber_C00
,
_abt_
, C10));
344
345
m_fsm.AddTransition(
new
WeaponTransition
(C01,
__L__
,
Chamber_C01
));
// chamber from closed charged
346
m_fsm.AddTransition(
new
WeaponTransition
(
Chamber_C01
,
_fin_
, O01,
NULL
,
new
WeaponGuardWeaponOpen
(
this
)));
347
m_fsm.AddTransition(
new
WeaponTransition
(
Chamber_C01
,
_fin_
, C01,
NULL
,
new
WeaponGuardChamberEmpty(
this
)));
348
m_fsm.AddTransition(
new
WeaponTransition
(
Chamber_C01
,
_fin_
, C11));
349
m_fsm.AddTransition(
new
WeaponTransition
(
Chamber_C01
,
_abt_
, O01,
NULL
,
new
WeaponGuardWeaponOpen
(
this
)));
350
m_fsm.AddTransition(
new
WeaponTransition
(
Chamber_C01
,
_abt_
, C01,
NULL
,
new
WeaponGuardChamberEmpty(
this
)));
351
m_fsm.AddTransition(
new
WeaponTransition
(
Chamber_C01
,
_abt_
, C11));
352
353
m_fsm.AddTransition(
new
WeaponTransition
(O00,
__L__
,
Chamber_O00
));
// chamber from closed charged
354
m_fsm.AddTransition(
new
WeaponTransition
(
Chamber_O00
,
_fin_
, O00,
NULL
,
new
WeaponGuardCurrentChamberEmpty(
this
)));
355
m_fsm.AddTransition(
new
WeaponTransition
(
Chamber_O00
,
_fin_
, C10));
356
m_fsm.AddTransition(
new
WeaponTransition
(
Chamber_O00
,
_abt_
, O00,
NULL
,
new
WeaponGuardCurrentChamberEmpty(
this
)));
357
m_fsm.AddTransition(
new
WeaponTransition
(
Chamber_O00
,
_abt_
, C10));
358
359
m_fsm.AddTransition(
new
WeaponTransition
(O01,
__L__
,
Chamber_O01
));
// chamber from closed charged
360
m_fsm.AddTransition(
new
WeaponTransition
(
Chamber_O01
,
_fin_
, O01,
NULL
,
new
WeaponGuardCurrentChamberEmpty(
this
)));
361
m_fsm.AddTransition(
new
WeaponTransition
(
Chamber_O01
,
_fin_
, C11));
362
m_fsm.AddTransition(
new
WeaponTransition
(
Chamber_O01
,
_abt_
, O01,
NULL
,
new
WeaponGuardCurrentChamberEmpty(
this
)));
363
m_fsm.AddTransition(
new
WeaponTransition
(
Chamber_O01
,
_abt_
, C11));
364
365
// attach magazine (no mag in weapon)
366
m_fsm.AddTransition(
new
WeaponTransition
(C00,
__A__
,
Attach_C00
,
NULL
,
new
WeaponGuardCanAttachMag(
this
)));
// attach from CLO/b0/m0
367
m_fsm.AddTransition(
new
WeaponTransition
(
Attach_C00
,
_fin_
, C00,
NULL
,
new
GuardNot(
new
WeaponGuardHasMag(
this
))));
368
m_fsm.AddTransition(
new
WeaponTransition
(
Attach_C00
,
_fin_
, C01,
NULL
,
new
WeaponGuardCurrentChamberEmpty(
this
)));
369
m_fsm.AddTransition(
new
WeaponTransition
(
Attach_C00
,
_fin_
, C11));
370
m_fsm.AddTransition(
new
WeaponTransition
(
Attach_C00
,
_abt_
, C00,
NULL
,
new
GuardNot(
new
WeaponGuardHasMag(
this
))));
371
m_fsm.AddTransition(
new
WeaponTransition
(
Attach_C00
,
_abt_
, C01,
NULL
,
new
WeaponGuardCurrentChamberEmpty(
this
)));
372
m_fsm.AddTransition(
new
WeaponTransition
(
Attach_C00
,
_abt_
, C11));
373
374
m_fsm.AddTransition(
new
WeaponTransition
(C10,
__A__
,
Attach_C10
,
NULL
,
new
WeaponGuardCanAttachMag(
this
)));
// attach from CLO/b1/m0
375
m_fsm.AddTransition(
new
WeaponTransition
(
Attach_C10
,
_fin_
, C11,
NULL
,
new
WeaponGuardHasMag(
this
)));
376
m_fsm.AddTransition(
new
WeaponTransition
(
Attach_C10
,
_fin_
, C10));
377
m_fsm.AddTransition(
new
WeaponTransition
(
Attach_C10
,
_abt_
, C11,
NULL
,
new
WeaponGuardHasMag(
this
)));
378
m_fsm.AddTransition(
new
WeaponTransition
(
Attach_C10
,
_abt_
, C10));
379
380
m_fsm.AddTransition(
new
WeaponTransition
(O00,
__A__
,
Attach_O00
,
NULL
,
new
WeaponGuardCanAttachMag(
this
)));
// attach from CLO/b0/m0
381
m_fsm.AddTransition(
new
WeaponTransition
(
Attach_O00
,
_fin_
, O00,
NULL
,
new
GuardNot(
new
WeaponGuardHasMag(
this
))));
382
m_fsm.AddTransition(
new
WeaponTransition
(
Attach_O00
,
_fin_
, O01,
NULL
,
new
WeaponGuardWeaponOpen
(
this
)));
383
m_fsm.AddTransition(
new
WeaponTransition
(
Attach_O00
,
_fin_
, C01,
NULL
,
new
WeaponGuardCurrentChamberEmpty(
this
)));
384
m_fsm.AddTransition(
new
WeaponTransition
(
Attach_O00
,
_fin_
, C11));
385
m_fsm.AddTransition(
new
WeaponTransition
(
Attach_O00
,
_abt_
, O00,
NULL
,
new
GuardNot(
new
WeaponGuardHasMag(
this
))));
386
m_fsm.AddTransition(
new
WeaponTransition
(
Attach_O00
,
_abt_
, O01,
NULL
,
new
WeaponGuardWeaponOpen
(
this
)));
387
m_fsm.AddTransition(
new
WeaponTransition
(
Attach_O00
,
_abt_
, C01,
NULL
,
new
WeaponGuardCurrentChamberEmpty(
this
)));
388
m_fsm.AddTransition(
new
WeaponTransition
(
Attach_O00
,
_abt_
, C11));
389
390
m_fsm.AddTransition(
new
WeaponTransition
(JF0,
__A__
,
Attach_JF0
,
NULL
,
new
WeaponGuardCanAttachMag(
this
)));
// attach from JAM/b1/m0
391
m_fsm.AddTransition(
new
WeaponTransition
(
Attach_JF0
,
_fin_
, JF1,
NULL
,
new
WeaponGuardHasMag(
this
)));
392
m_fsm.AddTransition(
new
WeaponTransition
(
Attach_JF0
,
_fin_
, JF0));
393
m_fsm.AddTransition(
new
WeaponTransition
(
Attach_JF0
,
_abt_
, JF1,
NULL
,
new
WeaponGuardHasMag(
this
)));
394
m_fsm.AddTransition(
new
WeaponTransition
(
Attach_JF0
,
_abt_
, JF0));
395
396
397
// replace magazine
398
m_fsm.AddTransition(
new
WeaponTransition
(C11,
__S__
,
Reload_C11
,
NULL
,
new
WeaponGuardCanSwapMag(
this
)));
// swap in Chg/b1/m1
399
m_fsm.AddTransition(
new
WeaponTransition
(
Reload_C11
,
_fin_
, C11,
NULL
,
new
WeaponGuardHasMag(
this
)));
400
m_fsm.AddTransition(
new
WeaponTransition
(
Reload_C11
,
_fin_
, C10));
401
m_fsm.AddTransition(
new
WeaponTransition
(
Reload_C11
,
_abt_
, C11,
NULL
,
new
WeaponGuardHasMag(
this
)));
402
m_fsm.AddTransition(
new
WeaponTransition
(
Reload_C11
,
_abt_
, C10));
403
404
405
m_fsm.AddTransition(
new
WeaponTransition
(C01,
__S__
,
Reload_C01
,
NULL
,
new
WeaponGuardCanSwapMag(
this
)));
// swap in CLO/b0/m1
406
m_fsm.AddTransition(
new
WeaponTransition
(
Reload_C01
,
_fin_
, C11,
NULL
,
new
WeaponGuardCurrentChamberFull(
this
)));
407
m_fsm.AddTransition(
new
WeaponTransition
(
Reload_C01
,
_fin_
, C01,
NULL
,
new
WeaponGuardHasMag(
this
)));
408
m_fsm.AddTransition(
new
WeaponTransition
(
Reload_C01
,
_fin_
, C00));
409
m_fsm.AddTransition(
new
WeaponTransition
(
Reload_C01
,
_abt_
, C11,
NULL
,
new
WeaponGuardCurrentChamberFull(
this
)));
410
m_fsm.AddTransition(
new
WeaponTransition
(
Reload_C01
,
_abt_
, C01,
NULL
,
new
WeaponGuardHasMag(
this
)));
411
m_fsm.AddTransition(
new
WeaponTransition
(
Reload_C01
,
_abt_
, C00));
412
413
414
m_fsm.AddTransition(
new
WeaponTransition
(O01,
__S__
,
Reload_O01
,
NULL
,
new
WeaponGuardCanSwapMag(
this
)));
// swap in CLO/b0/m1
415
m_fsm.AddTransition(
new
WeaponTransition
(
Reload_O01
,
_fin_
, O00,
NULL
,
new
GuardNot(
new
WeaponGuardHasMag(
this
))));
416
m_fsm.AddTransition(
new
WeaponTransition
(
Reload_O01
,
_fin_
, O01,
NULL
,
new
WeaponGuardWeaponOpen
(
this
)));
417
m_fsm.AddTransition(
new
WeaponTransition
(
Reload_O01
,
_fin_
, C01,
NULL
,
new
WeaponGuardCurrentChamberEmpty(
this
)));
418
m_fsm.AddTransition(
new
WeaponTransition
(
Reload_O01
,
_fin_
, C11));
419
m_fsm.AddTransition(
new
WeaponTransition
(
Reload_O01
,
_abt_
, O00,
NULL
,
new
GuardNot(
new
WeaponGuardHasMag(
this
))));
420
m_fsm.AddTransition(
new
WeaponTransition
(
Reload_O01
,
_abt_
, O01,
NULL
,
new
WeaponGuardWeaponOpen
(
this
)));
421
m_fsm.AddTransition(
new
WeaponTransition
(
Reload_O01
,
_abt_
, C01,
NULL
,
new
WeaponGuardCurrentChamberEmpty(
this
)));
422
m_fsm.AddTransition(
new
WeaponTransition
(
Reload_O01
,
_abt_
, C11));
423
424
m_fsm.AddTransition(
new
WeaponTransition
(JF1,
__S__
,
Reload_JF1
,
NULL
,
new
WeaponGuardCanSwapMag(
this
)));
// swap in JAM/b1/m1
425
m_fsm.AddTransition(
new
WeaponTransition
(
Reload_JF1
,
_fin_
, JF1,
NULL
,
new
WeaponGuardHasMag(
this
)));
426
m_fsm.AddTransition(
new
WeaponTransition
(
Reload_JF1
,
_fin_
, JF0));
427
m_fsm.AddTransition(
new
WeaponTransition
(
Reload_JF1
,
_abt_
, JF1,
NULL
,
new
WeaponGuardHasMag(
this
)));
428
m_fsm.AddTransition(
new
WeaponTransition
(
Reload_JF1
,
_abt_
, JF0));
429
430
// @TODO: abort in jam
431
432
// detach magazine
433
m_fsm.AddTransition(
new
WeaponTransition
(C11,
__D__
,
Detach_C11
,
NULL
,
new
WeaponGuardCanDetachMag(
this
)));
// detach from Chg/b1/m1
434
m_fsm.AddTransition(
new
WeaponTransition
(
Detach_C11
,
_fin_
, C11,
NULL
,
new
WeaponGuardHasMag(
this
)));
435
m_fsm.AddTransition(
new
WeaponTransition
(
Detach_C11
,
_fin_
, C10));
436
m_fsm.AddTransition(
new
WeaponTransition
(
Detach_C11
,
_abt_
, C11,
NULL
,
new
WeaponGuardHasMag(
this
)));
437
m_fsm.AddTransition(
new
WeaponTransition
(
Detach_C11
,
_abt_
, C10));
438
439
m_fsm.AddTransition(
new
WeaponTransition
(C01,
__D__
,
Detach_C01
,
NULL
,
new
WeaponGuardCanDetachMag(
this
)));
// detach from Chg/b0/m1
440
m_fsm.AddTransition(
new
WeaponTransition
(
Detach_C01
,
_fin_
, C01,
NULL
,
new
WeaponGuardHasMag(
this
)));
441
m_fsm.AddTransition(
new
WeaponTransition
(
Detach_C01
,
_fin_
, C00));
442
m_fsm.AddTransition(
new
WeaponTransition
(
Detach_C01
,
_abt_
, C01,
NULL
,
new
WeaponGuardHasMag(
this
)));
443
m_fsm.AddTransition(
new
WeaponTransition
(
Detach_C01
,
_abt_
, C00));
444
445
m_fsm.AddTransition(
new
WeaponTransition
(O01,
__D__
,
Detach_O01
,
NULL
,
new
WeaponGuardCanDetachMag(
this
)));
// detach from Dic/b0/m1
446
m_fsm.AddTransition(
new
WeaponTransition
(
Detach_O01
,
_fin_
, O01,
NULL
,
new
WeaponGuardHasMag(
this
)));
447
m_fsm.AddTransition(
new
WeaponTransition
(
Detach_O01
,
_fin_
, O00));
448
m_fsm.AddTransition(
new
WeaponTransition
(
Detach_O01
,
_abt_
, O01,
NULL
,
new
WeaponGuardHasMag(
this
)));
449
m_fsm.AddTransition(
new
WeaponTransition
(
Detach_O01
,
_abt_
, O00));
450
451
m_fsm.AddTransition(
new
WeaponTransition
(JF1,
__D__
,
Detach_JF1
,
NULL
,
new
WeaponGuardCanDetachMag(
this
)));
// detach from CLO/b1/m1 jammed
452
m_fsm.AddTransition(
new
WeaponTransition
(
Detach_JF1
,
_fin_
, JF1,
NULL
,
new
WeaponGuardHasMag(
this
)));
453
m_fsm.AddTransition(
new
WeaponTransition
(
Detach_JF1
,
_fin_
, JF0));
454
m_fsm.AddTransition(
new
WeaponTransition
(
Detach_JF1
,
_abt_
, JF1,
NULL
,
new
WeaponGuardHasMag(
this
)));
455
m_fsm.AddTransition(
new
WeaponTransition
(
Detach_JF1
,
_abt_
, JF0));
456
457
458
// unjam
459
m_fsm.AddTransition(
new
WeaponTransition
(JF0,
__U__
,
Unjam_JF0
));
// unjam nomag
460
m_fsm.AddTransition(
new
WeaponTransition
(
Unjam_JF0
,
_fin_
, JF0,
NULL
,
new
WeaponGuardJammed(
this
)));
461
m_fsm.AddTransition(
new
WeaponTransition
(
Unjam_JF0
,
_fin_
, C00));
462
m_fsm.AddTransition(
new
WeaponTransition
(
Unjam_JF0
,
_abt_
, JF0,
NULL
,
new
WeaponGuardJammed(
this
)));
463
m_fsm.AddTransition(
new
WeaponTransition
(
Unjam_JF0
,
_abt_
, C00));
464
465
m_fsm.AddTransition(
new
WeaponTransition
(JF1,
__U__
,
Unjam_JF1
));
// unjam with mag with ammo
466
m_fsm.AddTransition(
new
WeaponTransition
(
Unjam_JF1
,
_fin_
, JF1,
NULL
,
new
WeaponGuardJammed(
this
)));
467
m_fsm.AddTransition(
new
WeaponTransition
(
Unjam_JF1
,
_fin_
, C01,
NULL
,
new
WeaponGuardCurrentChamberEmpty(
this
)));
468
m_fsm.AddTransition(
new
WeaponTransition
(
Unjam_JF1
,
_fin_
, C11));
469
m_fsm.AddTransition(
new
WeaponTransition
(
Unjam_JF1
,
_abt_
, JF1,
NULL
,
new
WeaponGuardJammed(
this
)));
470
m_fsm.AddTransition(
new
WeaponTransition
(
Unjam_JF1
,
_abt_
, C01,
NULL
,
new
WeaponGuardCurrentChamberEmpty(
this
)));
471
m_fsm.AddTransition(
new
WeaponTransition
(
Unjam_JF1
,
_abt_
, C11));
472
473
SetInitialState(C00);
474
475
SelectionBulletHide();
476
HideMagazine();
477
478
m_fsm.Start();
479
}
480
481
override
float
GetChanceToJam
()
482
{
483
float
chanceToJam
=
super
.GetChanceToJam();
484
Magazine
mag
= GetMagazine(GetCurrentMuzzle());
485
486
if
(
mag
)
487
chanceToJam
=
chanceToJam
+ ((1.0 -
chanceToJam
) *
mag
.GetChanceToJam());
488
else
489
chanceToJam
=
chanceToJam
+ ((1.0 -
chanceToJam
) * 0.06);
490
491
return
chanceToJam
;
492
}
493
494
override
void
SetActions
()
495
{
496
super
.SetActions();
497
AddAction
(
FirearmActionDetachMagazine
);
498
//AddAction(ActionAdvancedDetachMagazine);
499
}
500
};
501
wpnPrint
void wpnPrint(string s)
Definition
Debug.c:1
AddAction
void AddAction(typename actionName)
Definition
AdvancedCommunication.c:212
m_weapon
class WeaponGuardIsDestroyed extends WeaponGuardBase m_weapon
Definition
Guards.c:602
WeaponGuardHasAmmo
void WeaponGuardHasAmmo(Weapon_Base w=NULL)
Definition
Guards.c:99
WeaponGuardWeaponOpen
void WeaponGuardWeaponOpen(Weapon_Base w=NULL)
Definition
Guards.c:604
RBL_CLO_BU0_MA0
RBL_CLO_BU0_MA0
Definition
RifleBoltLock_Base.c:25
RBL_OPN_BU0_MA1
RBL_OPN_BU0_MA1
Definition
RifleBoltLock_Base.c:29
RBLAnimState
RBLAnimState
Definition
RifleBoltLock_Base.c:2
OPENED
@ OPENED
Definition
RifleBoltLock_Base.c:4
DEFAULT
@ DEFAULT
default weapon state, closed and discharged
Definition
RifleBoltLock_Base.c:3
JAMMED
@ JAMMED
Definition
RifleBoltLock_Base.c:5
RBL_CLO_BU0_MA1
RBL_CLO_BU0_MA1
Definition
RifleBoltLock_Base.c:28
RBLStableStateID
RBLStableStateID
Definition
RifleBoltLock_Base.c:9
UNKNOWN
UNKNOWN
Definition
RifleBoltLock_Base.c:24
RBL_JAM_BU1_MA0
RBL_JAM_BU1_MA0
Definition
RifleBoltLock_Base.c:31
RBL_CLO_BU1_MA0
RBL_CLO_BU1_MA0
Definition
RifleBoltLock_Base.c:26
RBL_CLO_BU1_MA1
RBL_CLO_BU1_MA1
Definition
RifleBoltLock_Base.c:27
RBL_OPN_BU0_MA0
RBL_OPN_BU0_MA0
Definition
RifleBoltLock_Base.c:30
RBL_JAM_BU1_MA1
RBL_JAM_BU1_MA1
Definition
RifleBoltLock_Base.c:32
OnEntry
class SSPFireout extends WeaponStableState OnEntry
WeaponTransition
enum FSMTransition WeaponTransition
MuzzleState
MuzzleState
Definition
WeaponStableState.c:15
m_muzzleHasBullet
ref array< MuzzleState > m_muzzleHasBullet
Definition
WeaponStableState.c:30
AbilityRecord
pair ( action, actionType )
Definition
Weapon_Base.c:5
FirearmActionDetachMagazine
Definition
FirearmActionDetachMagazine.c:146
LogManager
Definition
Debug.c:675
LogManager::IsWeaponLogEnable
static bool IsWeaponLogEnable()
Definition
Debug.c:799
Object
Definition
ObjectTyped.c:2
Param3
Definition
EntityAI.c:95
Rifle_Base
base for rifles @NOTE name copies config base class
Definition
SKS.c:70
Rifle_Base::RifleBoltLock_Base
void RifleBoltLock_Base()
Definition
RifleBoltLock_Base.c:130
Rifle_Base::GetChanceToJam
override float GetChanceToJam()
Definition
RifleBoltLock_Base.c:481
Rifle_Base::O01
ref WeaponStableState O01
Definition
RifleBoltLock_Base.c:126
Rifle_Base::O00
ref WeaponStableState O00
Definition
RifleBoltLock_Base.c:125
Rifle_Base::SetActions
override void SetActions()
Definition
RifleBoltLock_Base.c:494
Rifle_Base::InitStateMachine
override void InitStateMachine()
Definition
RifleBoltLock_Base.c:134
WeaponCharging
charging of weapon without ammo to be chambered
WeaponEventBase
signalize mechanism manipulation
Definition
Events.c:35
WeaponFSM
weapon finite state machine
WeaponReplacingMagAndChamberNext
replace current magazine with new one
WeaponStableState
represents weapon's stable state (i.e. the basic states that the weapon will spend the most time in)
Definition
Crossbow.c:27
WeaponStableState::IsBoltOpen
override bool IsBoltOpen()
Definition
RifleBoltLock_Base.c:73
WeaponStableState::IsJammed
override bool IsJammed()
Definition
Crossbow.c:33
WeaponStableState::OnExit
override void OnExit(WeaponEventBase e)
Definition
Crossbow.c:29
WeaponStableState::InitMuzzleArray
override void InitMuzzleArray()
Definition
Crossbow.c:35
WeaponStableState::OnEntry
override void OnEntry(WeaponEventBase e)
Definition
RifleBoltLock_Base.c:34
WeaponStableState::HasBullet
override bool HasBullet()
Definition
Crossbow.c:31
WeaponStableState::GetCurrentStateID
override int GetCurrentStateID()
Definition
Crossbow.c:30
WeaponStableState::IsRepairEnabled
override bool IsRepairEnabled()
Definition
Crossbow.c:34
WeaponStableState::HasMagazine
override bool HasMagazine()
Definition
Crossbow.c:32
WeaponStateBase
represent weapon state base
Definition
BulletHide.c:2
WeaponStateJammed
handle jamming state set jam/unjam state for weapon
Definition
SKS.c:53
WeaponStateJammed::IsBoltOpen
override bool IsBoltOpen()
Definition
RifleBoltLock_Base.c:97
WeaponStateJammed::InitMuzzleArray
override void InitMuzzleArray()
Definition
RifleBoltLock_Base.c:99
WeaponStateJammed::HasMagazine
override bool HasMagazine()
Definition
RifleBoltLock_Base.c:95
WeaponStateJammed::IsRepairEnabled
override bool IsRepairEnabled()
Definition
RifleBoltLock_Base.c:98
WeaponStateJammed::OnEntry
override void OnEntry(WeaponEventBase e)
Definition
RifleBoltLock_Base.c:91
WeaponStateJammed::GetCurrentStateID
override int GetCurrentStateID()
Definition
RifleBoltLock_Base.c:93
WeaponStateJammed::IsJammed
override bool IsJammed()
Definition
RifleBoltLock_Base.c:96
WeaponStateJammed::HasBullet
override bool HasBullet()
Definition
RifleBoltLock_Base.c:94
WeaponStateJammed::OnExit
override void OnExit(WeaponEventBase e)
Definition
RifleBoltLock_Base.c:92
WeaponUnjamming
unjam submachine
WeaponActionChamberingTypes
WeaponActionChamberingTypes
Definition
human.c:856
WeaponActions
WeaponActions
actions
Definition
human.c:796
WeaponActionReloadTypes
WeaponActionReloadTypes
Definition
human.c:812
WeaponActionUnjammingTypes
WeaponActionUnjammingTypes
Definition
human.c:892
WeaponActionFireTypes
WeaponActionFireTypes
Definition
human.c:900
scripts
4_World
Entities
Firearms
RifleBoltLock_Base.c
Generated by
1.10.0