DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
FirearmActionLoadMultiBullet.c
См. документацию.
2{
3 //-----------------------------------------------------
4 // Action events and methods
5 //-----------------------------------------------------
7 {
8 m_Text = "#load_bullets";
9 }
10
11 override int GetActionCategory()
12 {
13 return AC_CONTINUOUS;
14 }
15
16 /*string GetTargetDescription()
17 {
18 return "default target description";
19 }*/
20
21 /*protected bool ActionConditionContinue( ActionData action_data ) //condition for action
22 {
23 return true;
24 }*/
25
26 override bool ActionCondition( PlayerBase player, ActionTarget target, ItemBase item ) //condition for action
27 {
28 if (!super.ActionCondition( player, target, item ))
29 return false;
30
31 Weapon_Base wpn = Weapon_Base.Cast(item);
32 Magazine mag = Magazine.Cast(target.GetObject());
33 return mag && player.GetWeaponManager().CanLoadMultipleBullet(wpn,mag);
34 }
35
36 override void Start( ActionData action_data )
37 {
38 super.Start( action_data );
39 Magazine mag = Magazine.Cast(action_data.m_Target.GetObject());
40
41 action_data.m_Player.GetWeaponManager().LoadMultiBullet(mag, this);
42
43 }
44
46 {
47 return false;
48 }
49
50 override bool CanBeSetFromInventory()
51 {
52 return false;
53 }
54
55 override void OnEndInput( ActionData action_data )
56 {
57 action_data.m_Player.GetWeaponManager().LoadMultiBulletStop();
58 }
59
61 {
62 return true;
63 }
64
65 override bool HasProgress()
66 {
67 return false;
68 }
69
70 // action need first have permission from server before can start
71 /*bool UseAcknowledgment()
72 {
73 return true;
74 }*/
75
76
77 /*override int GetState( ActionData action_data )
78 {
79 return UA_PROCESSING;
80 }*/
81
82 /*override float GetProgress( ActionData action_data )
83 {
84 return -1;
85 }*/
86
87 override typename GetInputType()
88 {
90 }
91};
92
93
95{
96 //-----------------------------------------------------
97 // Action events and methods
98 //-----------------------------------------------------
102
103 override bool HasTarget()
104 {
105 return false;
106 }
107
108 override bool HasProgress()
109 {
110 return false;
111 }
112
113 override typename GetInputType()
114 {
116 }
117
119 {
122 }
123
124
125 override bool ActionCondition( PlayerBase player, ActionTarget target, ItemBase item ) //condition for action
126 {
127 if (!super.ActionCondition( player, target, item ))
128 return false;
129
130 Weapon_Base weapon = Weapon_Base.Cast( item );
131 return player.GetWeaponManager().CanLoadMultipleBullet(weapon ,player.GetWeaponManager().GetPreparedMagazine());
132 }
133
134 override void Start( ActionData action_data )
135 {
136 super.Start( action_data );
137
138 WeaponManager weaponManager = action_data.m_Player.GetWeaponManager();
139 int idx = 0;
140 Magazine mag = weaponManager.GetNextPreparedMagazine(idx);
141 Weapon weapon = Weapon.Cast(action_data.m_Player.GetItemInHands());
142
143 int internalCount = weapon.GetInternalMagazineCartridgeCount(0);
144 int maxCount = weapon.GetInternalMagazineMaxCartridgeCount(0) + 1;
145 int total = mag.GetAmmoCount() + internalCount;
146
147 if (total < maxCount)
148 {
149 //Increment index for the first additional mag find, since GetNextPreparedMagazine does not do that
150 //Normally the mag at found index is combined right after, removing it from the suitable magazine array
151 ++idx;
152 Magazine additionalMag = weaponManager.GetNextPreparedMagazine(idx);
153
154 while ((additionalMag != null) && (total < maxCount))
155 {
156 total += additionalMag.GetAmmoCount();
157 mag.CombineItems(additionalMag);
158 additionalMag = weaponManager.GetNextPreparedMagazine(idx);
159 }
160 }
161
162 action_data.m_Player.GetWeaponManager().LoadMultiBullet(mag, this);
163 }
164
165 override void OnEndInput( ActionData action_data )
166 {
167 action_data.m_Player.GetWeaponManager().LoadMultiBulletStop();
168 }
169};
170
172{
173 //-----------------------------------------------------
174 // Action events and methods
175 //-----------------------------------------------------
179
180 override bool HasProgress()
181 {
182 return false;
183 }
184
186 {
189 }
190
191 override bool CanContinue( ActionData action_data )
192 {
193 if (!super.CanContinue( action_data ))
194 return false;
195
196 return ActionCondition(action_data.m_Player, action_data.m_Target, action_data.m_MainItem);
197 }
198
199 override bool ActionCondition( PlayerBase player, ActionTarget target, ItemBase item ) //condition for action
200 {
201 if (!super.ActionCondition( player, target, item ))
202 return false;
203
204 Weapon_Base wpn = Weapon_Base.Cast(item);
205 Magazine mag = Magazine.Cast(target.GetObject());
206 return mag && player.GetWeaponManager().CanLoadBullet(wpn,mag);
207 }
208
209 override void OnStart( ActionData action_data )
210 {
211 super.OnStart(action_data);
212
213 Magazine mag = Magazine.Cast(action_data.m_Target.GetObject());
214 action_data.m_Player.GetWeaponManager().LoadMultiBullet(mag, this);
215 }
216
217 override void OnEnd( ActionData action_data )
218 {
219 action_data.m_Player.GetWeaponManager().LoadMultiBulletStop();
220 }
221};
222
const int AC_CONTINUOUS
Определения _constants.c:3
ActionBase ActionData
Определения ActionBase.c:30
void ContinuousDefaultActionInput(PlayerBase player)
Определения ActionInput.c:607
class ActionTargets ActionTarget
string m_Text
Определения ActionBase.c:58
ref CCIBase m_ConditionItem
Определения ActionBase.c:64
ref CCTBase m_ConditionTarget
Определения ActionBase.c:65
Определения CCINonRuined.c:2
Определения CCTSelf.c:2
void FirearmActionBase()
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
Определения FirearmActionLoadMultiBullet.c:26
override bool CanBeSetFromInventory()
Определения FirearmActionLoadMultiBullet.c:50
override bool HasProgress()
Определения FirearmActionLoadMultiBullet.c:65
override bool CanBePerformedFromQuickbar()
Определения FirearmActionLoadMultiBullet.c:60
override int GetActionCategory()
Определения FirearmActionLoadMultiBullet.c:11
override void OnEndInput(ActionData action_data)
Определения FirearmActionLoadMultiBullet.c:55
override void Start(ActionData action_data)
Определения FirearmActionLoadMultiBullet.c:36
override bool CanBePerformedFromInventory()
Определения FirearmActionLoadMultiBullet.c:45
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
Определения FirearmActionLoadMultiBullet.c:125
override void OnEndInput(ActionData action_data)
Определения FirearmActionLoadMultiBullet.c:165
override void Start(ActionData action_data)
Определения FirearmActionLoadMultiBullet.c:134
override void CreateConditionComponents()
Определения FirearmActionLoadMultiBullet.c:118
override bool CanContinue(ActionData action_data)
Определения FirearmActionLoadMultiBullet.c:191
override void CreateConditionComponents()
Определения FirearmActionLoadMultiBullet.c:185
override void OnEnd(ActionData action_data)
Определения FirearmActionLoadMultiBullet.c:217
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
Определения FirearmActionLoadMultiBullet.c:199
override void OnStart(ActionData action_data)
Определения FirearmActionLoadMultiBullet.c:209
Определения InventoryItem.c:731
Определения PlayerBaseClient.c:2
shorthand
Определения BoltActionRifle_Base.c:6
script counterpart to engine's class Weapon
Определения InventoryItem.c:49
Magazine GetNextPreparedMagazine(out int startIdx)
Определения WeaponManager.c:1097
Определения WeaponManager.c:2