Dayz Explorer
1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
weaponejectcasingandchamberfromattmag.c
Go to the documentation of this file.
1
2
class
WeaponEjectCasing
extends
WeaponStateBase
3
{
4
void
WeaponEjectCasing
(
Weapon_Base
w = NULL,
WeaponStateBase
parent = NULL) { }
5
6
override
void
OnEntry (
WeaponEventBase
e)
7
{
8
super.OnEntry(e);
9
if
(e)
10
{
11
if
(
LogManager
.IsWeaponLogEnable()) {
wpnDebugPrint
(
"[wpnfsm] "
+
Object
.GetDebugName(
m_weapon
) +
" ejected fired out casing"
); }
12
int
mi =
m_weapon
.GetCurrentMuzzle();
13
if
(
m_weapon
.IsChamberFiredOut(mi))
14
{
15
m_weapon
.EjectCasing(mi);
16
}
17
m_weapon
.EffectBulletHide(mi);
18
m_weapon
.SelectionBulletHide();
19
}
20
}
21
};
22
23
class
WeaponEjectCasingMultiMuzzle
extends
WeaponStateBase
24
{
25
void
WeaponEjectCasingMultiMuzzle
(
Weapon_Base
w = NULL,
WeaponStateBase
parent = NULL) { }
26
27
override
void
OnEntry
(
WeaponEventBase
e)
28
{
29
super.OnEntry(e);
30
if
(e)
31
{
32
if
(
LogManager
.IsWeaponLogEnable()) {
wpnDebugPrint
(
"[wpnfsm] "
+
Object
.GetDebugName(
m_weapon
) +
" ejected fired out casing multi muzzle"
); }
33
for
(
int
i = 0; i <
m_weapon
.GetMuzzleCount(); i++ )
34
{
35
if
(
m_weapon
.IsChamberFiredOut(i))
36
{
37
m_weapon
.EjectCasing(i);
38
m_weapon
.EffectBulletHide(i);
39
m_weapon
.HideBullet(i);
40
}
41
}
42
}
43
}
44
45
override
bool
IsWaitingForActionFinish()
46
{
47
return
false
;
48
}
49
};
50
51
class
WeaponEjectCasing_W4T
extends
WeaponEjectCasingMultiMuzzle
52
{
53
override
bool
IsWaitingForActionFinish
() {
return
true
; }
54
};
55
56
class
WeaponEjectAllMuzzles
extends
WeaponStateBase
57
{
58
Magazine m_dstMagazine;
59
void
WeaponEjectAllMuzzles
(
Weapon_Base
w = NULL,
WeaponStateBase
parent = NULL) { }
60
61
override
void
OnEntry
(
WeaponEventBase
e)
62
{
63
super.OnEntry(e);
64
if
(e)
65
{
66
Magnum_Cylinder cylinder = Magnum_Cylinder.Cast(
m_weapon
.GetAttachmentByType(Magnum_Cylinder));
67
if
(cylinder)
68
{
69
cylinder.HideSelection(
"bullet"
);
70
cylinder.HideSelection(
"bullet_2"
);
71
cylinder.HideSelection(
"bullet_3"
);
72
cylinder.HideSelection(
"bullet_4"
);
73
cylinder.HideSelection(
"bullet_5"
);
74
cylinder.HideSelection(
"bullet_6"
);
75
76
cylinder.HideSelection(
"bullet_nose"
);
77
cylinder.HideSelection(
"bullet_nose_2"
);
78
cylinder.HideSelection(
"bullet_nose_3"
);
79
cylinder.HideSelection(
"bullet_nose_4"
);
80
cylinder.HideSelection(
"bullet_nose_5"
);
81
cylinder.HideSelection(
"bullet_nose_6"
);
82
}
83
84
85
if
(
LogManager
.IsWeaponLogEnable()) {
wpnDebugPrint
(
"[wpnfsm] "
+
Object
.GetDebugName(
m_weapon
) +
" ejected bullets from all muzzles"
); }
86
for
(
int
i = 0; i <
m_weapon
.GetMuzzleCount(); i++ )
87
{
88
if
(
m_weapon
.IsChamberFiredOut(i))
89
{
90
m_weapon
.EjectCasing(i);
91
m_weapon
.EffectBulletHide(i);
92
m_weapon
.HideBullet(i);
93
continue
;
94
}
95
96
if
(!
m_weapon
.IsChamberEmpty(i))
97
{
98
DayZPlayer
p = e.m_player;
99
if
(m_dstMagazine && m_dstMagazine.GetAmmoCount() < m_dstMagazine.GetAmmoMax() )
100
{
101
m_weapon
.CreateRound(i);
102
ejectBulletAndStoreInMagazine
(
m_weapon
,i,m_dstMagazine,p);
103
}
104
else
105
{
106
m_weapon
.CreateRound(i);
107
ejectBulletAndStoreInMagazine
(
m_weapon
,i,
null
,p);
108
}
109
m_weapon
.EffectBulletHide(i);
110
m_weapon
.HideBullet(i);
111
}
112
}
113
m_weapon
.SetWeaponOpen(
false
);
114
m_weapon
.SetCharged(
true
);
115
}
116
//m_weapon.SelectionBulletHide();
117
}
118
119
override
bool
IsWaitingForActionFinish
()
120
{
121
return
false
;
122
}
123
};
124
125
// eject casing and load bullet from att mag (no anim)
126
class
WeaponEjectCasingAndChamberFromAttMag
extends
WeaponEjectCasing
127
{
128
override
void
OnEntry
(
WeaponEventBase
e)
129
{
130
super.OnEntry(e);
131
if
(e)
132
{
133
int
mi =
m_weapon
.GetCurrentMuzzle();
134
pushToChamberFromAttachedMagazine
(
m_weapon
, mi);
135
}
136
}
137
override
void
OnExit
(
WeaponEventBase
e)
138
{
139
super.OnExit(e);
140
}
141
};
142
143
class
WeaponEjectCasingAndChamberFromAttMag_W4T
extends
WeaponEjectCasingAndChamberFromAttMag
144
{
145
override
bool
IsWaitingForActionFinish
() {
return
true
; }
146
};
147
LogManager
Definition:
debug.c:734
ejectBulletAndStoreInMagazine
void ejectBulletAndStoreInMagazine(Weapon_Base weapon, int muzzleIndex, Magazine mag, DayZPlayer p)
Definition:
weapon_utils.c:58
OnExit
override void OnExit(HandEventBase e)
Definition:
hand_states.c:28
wpnDebugPrint
void wpnDebugPrint(string s)
Definition:
debug.c:9
DayZPlayer
Definition:
dayzplayerimplement.c:72
IsWaitingForActionFinish
class WeaponChambering_Cartridge_InnerMag extends WeaponChambering_Base IsWaitingForActionFinish
Definition:
weaponchambering.c:190
WeaponEjectCasingAndChamberFromAttMag
Definition:
weaponejectcasingandchamberfromattmag.c:143
Object
Definition:
objecttyped.c:1
pushToChamberFromAttachedMagazine
bool pushToChamberFromAttachedMagazine(Weapon_Base weapon, int muzzleIndex)
Definition:
weapon_utils.c:1
WeaponEjectAllMuzzles
Definition:
weaponchamberfromattmag.c:62
WeaponEventBase
signalize mechanism manipulation
Definition:
events.c:34
WeaponStateBase
represent weapon state base
Definition:
bullethide.c:1
m_weapon
class WeaponGuardIsDestroyed extends WeaponGuardBase m_weapon
Definition:
guards.c:583
Weapon_Base
shorthand
Definition:
boltactionrifle_base.c:5
WeaponEjectCasingMultiMuzzle
Definition:
weaponejectcasingandchamberfromattmag.c:51
WeaponEjectCasing
Definition:
weaponejectcasingandchamberfromattmag.c:126
OnEntry
HandStateEquipped OnEntry
Definition:
weaponchambering.c:208
DAYZ
scripts_v1.24.157551
scripts
world
entities
firearms
fsm
states
weaponejectcasingandchamberfromattmag.c
Generated by
1.8.17