DayZ Scripts
v1.21.156300 ยท Jun 20, 2023
 
Loading...
Searching...
No Matches
WeaponEjectCasingAndChamberFromAttMag.c
Go to the documentation of this file.
1
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
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
46 {
47 return false;
48 }
49};
50
51class WeaponEjectCasing_W4T extends WeaponEjectCasingMultiMuzzle
52{
53 override bool IsWaitingForActionFinish () { return true; }
54};
55
56class 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);
108 }
109 m_weapon.EffectBulletHide(i);
110 m_weapon.HideBullet(i);
111 }
112 }
113 }
114 //m_weapon.SelectionBulletHide();
115 }
116
117 override bool IsWaitingForActionFinish ()
118 {
119 return false;
120 }
121};
122
123// eject casing and load bullet from att mag (no anim)
125{
126 override void OnEntry (WeaponEventBase e)
127 {
128 super.OnEntry(e);
129 if (e)
130 {
131 int mi = m_weapon.GetCurrentMuzzle();
133 }
134 }
135 override void OnExit (WeaponEventBase e)
136 {
137 super.OnExit(e);
138 }
139};
140
141class WeaponEjectCasingAndChamberFromAttMag_W4T extends WeaponEjectCasingAndChamberFromAttMag
142{
143 override bool IsWaitingForActionFinish () { return true; }
144};
145
void wpnDebugPrint(string s)
Definition Debug.c:9
class WeaponGuardIsDestroyed extends WeaponGuardBase m_weapon
static bool IsWeaponLogEnable()
Definition Debug.c:640
override void OnEntry(WeaponEventBase e)
override void OnExit(WeaponEventBase e)
signalize mechanism manipulation
Definition Events.c:35
DayZPlayer m_player
Definition Events.c:37
represent weapon state base
Definition BulletHide.c:2
void WeaponEjectAllMuzzles(Weapon_Base w=NULL, WeaponStateBase parent=NULL)
override void OnEntry(WeaponEventBase e)
void WeaponEjectCasing(Weapon_Base w=NULL, WeaponStateBase parent=NULL)
void WeaponEjectCasingMultiMuzzle(Weapon_Base w=NULL, WeaponStateBase parent=NULL)
void ejectBulletAndStoreInMagazine(Weapon_Base weapon, int muzzleIndex, Magazine mag, DayZPlayer p)
bool pushToChamberFromAttachedMagazine(Weapon_Base weapon, int muzzleIndex)
Definition weapon_utils.c:1