DayZ 1.24
Loading...
Searching...
No Matches
FirearmActionDetachMagazine Class Reference
Inheritance diagram for FirearmActionDetachMagazine:
[legend]
Collaboration diagram for FirearmActionDetachMagazine:
[legend]

Private Member Functions

void FirearmActionDetachMagazine ()
 
override ActionData CreateActionData ()
 
override bool InventoryReservation (ActionData action_data)
 
override void WriteToContext (ParamsWriteContext ctx, ActionData action_data)
 
override bool ReadFromContext (ParamsReadContext ctx, out ActionReciveData action_recive_data)
 
override void HandleReciveData (ActionReciveData action_recive_data, ActionData action_data)
 
override GetInputType ()
 
override void CreateConditionComponents ()
 
override bool CanBePerformedFromQuickbar ()
 
override bool ActionCondition (PlayerBase player, ActionTarget target, ItemBase item)
 
override bool ActionConditionContinue (ActionData action_data)
 
override void OnStageStart (SequentialActionData action_data)
 
override void OnUpdate (ActionData action_data)
 
override void OnStartServer (ActionData action_data)
 
override void OnEndServer (ActionData action_data)
 

Detailed Description

Definition at line 145 of file FirearmActionDetachMagazine.c.

Constructor & Destructor Documentation

◆ FirearmActionDetachMagazine()

void FirearmActionDetachMagazine::FirearmActionDetachMagazine ( )
inlineprivate

Definition at line 147 of file FirearmActionDetachMagazine.c.

148 {
149 }

Member Function Documentation

◆ ActionCondition()

override bool FirearmActionDetachMagazine::ActionCondition ( PlayerBase player,
ActionTarget target,
ItemBase item )
inlineprivate

Definition at line 262 of file FirearmActionDetachMagazine.c.

263 {
264 if (!super.ActionCondition(player, target, item))
265 return false;
266
268 int mi = wpn.GetCurrentMuzzle();
269 return wpn && wpn.GetMagazine(mi) == target.GetObject();
270 }

◆ ActionConditionContinue()

override bool FirearmActionDetachMagazine::ActionConditionContinue ( ActionData action_data)
inlineprivate

Definition at line 272 of file FirearmActionDetachMagazine.c.

273 {
274 return true;
275 }

◆ CanBePerformedFromQuickbar()

override bool FirearmActionDetachMagazine::CanBePerformedFromQuickbar ( )
inlineprivate

Definition at line 257 of file FirearmActionDetachMagazine.c.

258 {
259 return true;
260 }

◆ CreateActionData()

override ActionData FirearmActionDetachMagazine::CreateActionData ( )
inlineprivate

Definition at line 151 of file FirearmActionDetachMagazine.c.

◆ CreateConditionComponents()

override void FirearmActionDetachMagazine::CreateConditionComponents ( )
inlineprivate

Definition at line 251 of file FirearmActionDetachMagazine.c.

252 {
255 }
ref CCIBase m_ConditionItem
Definition ActionBase.c:55
ref CCTBase m_ConditionTarget
Definition ActionBase.c:56

References m_ConditionItem, and m_ConditionTarget.

◆ GetInputType()

override FirearmActionDetachMagazine::GetInputType ( )
inlineprivate

Definition at line 246 of file FirearmActionDetachMagazine.c.

247 {
249 }

◆ HandleReciveData()

override void FirearmActionDetachMagazine::HandleReciveData ( ActionReciveData action_recive_data,
ActionData action_data )
inlineprivate

◆ InventoryReservation()

override bool FirearmActionDetachMagazine::InventoryReservation ( ActionData action_data)
inlineprivate

Definition at line 158 of file FirearmActionDetachMagazine.c.

159 {
160 Weapon_Base wpn = Weapon_Base.Cast(action_data.m_MainItem);
161 Magazine mag = Magazine.Cast(action_data.m_Target.GetObject());
162
165
166
167 int ur_index = action_data.m_Player.GetHumanInventory().FindUserReservedLocationIndex(wpn);
168
169 if (ur_index > -1)
170 action_data.m_Player.GetHumanInventory().GetUserReservedLocation(ur_index, ilWpn);
171 else
172 {
173 action_data.m_Player.GetInventory().FindFreeLocationFor(wpn, FindInventoryLocationType.ANY_CARGO | FindInventoryLocationType.ATTACHMENT, ilWpn);
174
175
176 //return false;
177 }
178
179 if (!action_data.m_Player.GetInventory().FindFreeLocationFor(mag, FindInventoryLocationType.ANY_CARGO, ilMag))
180 return false;
181
182 if (!super.InventoryReservation(action_data))
183 return false;
184
186 if (!action_data.m_Player.GetInventory().AddInventoryReservationEx(wpn, ilWpn, 10000))
187 return false;
188
189 if (!action_data.m_Player.GetInventory().AddInventoryReservationEx(mag, ilMag, 10000))
190 return false;
191
192 action_data_dm.m_ReservedInventoryLocations.Insert(ilWpn);
193 action_data_dm.m_ReservedInventoryLocations.Insert(ilMag);
194 action_data_dm.m_ilWeapon = ilWpn;
195 action_data_dm.m_ilMagazine = ilMag;
196
197 return true;
198 }
FindInventoryLocationType
flags for searching locations in inventory
InventoryLocation.

◆ OnEndServer()

override void FirearmActionDetachMagazine::OnEndServer ( ActionData action_data)
inlineprivate

Definition at line 356 of file FirearmActionDetachMagazine.c.

357 {
358 GetGame().ClearJuncture(action_data.m_Player, EntityAI.Cast(action_data.m_Target.GetObject()));
359 }
proto native CGame GetGame()

References GetGame().

◆ OnStageStart()

override void FirearmActionDetachMagazine::OnStageStart ( SequentialActionData action_data)
inlineprivate

Definition at line 277 of file FirearmActionDetachMagazine.c.

278 {
279 if (action_data.m_ReciveEndInput)
280 {
282 return;
283 }
284 super.OnStageStart(action_data);
287 //InventoryLocation il = new InventoryLocation();
289
290 switch (action_data.m_Stage)
291 {
292 case 0:
293 action_data.m_Player.GetWeaponManager().DetachMagazine(action_data_dm.m_ilMagazine, this);
294 break;
295
296 case 1:
297 if (!action_data_dm.m_ilWeapon.IsValid())
298 {
300 break;
301 }
302
303 wpn = Weapon_Base.Cast(action_data.m_MainItem);
304 mag = Magazine.Cast(action_data.m_Target.GetObject());
305
306 action_data.m_Player.GetHumanInventory().ClearUserReservedLocation(wpn);
307 if ((!GetGame().IsDedicatedServer()) && !mag.GetHierarchyParent())
308 {
310
311 if (action_data.m_Player.NeedInventoryJunctureFromServer(mag, action_data.m_Player, action_data.m_Player) || action_data.m_Player.NeedInventoryJunctureFromServer(wpn, action_data.m_Player, action_data.m_Player))
312 invMode = InventoryMode.JUNCTURE;
313
314 action_data.m_Player.GetInventory().ForceSwapEntities(invMode, mag, wpn, action_data_dm.m_ilWeapon);
315 }
316
318 break;
319 default:
321 break;
322 }
323 }
InventoryMode
NOTE: PREDICTIVE is not to be used at all in multiplayer.
Definition Inventory.c:22
void End()
called on surrender end request end

References End(), and GetGame().

◆ OnStartServer()

override void FirearmActionDetachMagazine::OnStartServer ( ActionData action_data)
inlineprivate

Definition at line 350 of file FirearmActionDetachMagazine.c.

351 {
353 GetGame().AddInventoryJunctureEx(action_data.m_Player, EntityAI.Cast(action_data.m_Target.GetObject()), action_data_dm.m_ilMagazine, true, 10000);
354 }

References GetGame().

◆ OnUpdate()

override void FirearmActionDetachMagazine::OnUpdate ( ActionData action_data)
inlineprivate

Definition at line 325 of file FirearmActionDetachMagazine.c.

326 {
327 super.OnUpdate(action_data);
328
330 if (ad)
331 {
332 switch (ad.m_Stage)
333 {
334 case 0:
335 Weapon_Base wpn = Weapon_Base.Cast(action_data.m_MainItem);
336
337 if ((!wpn || ad.m_Player.GetItemInHands() != wpn || !ad.m_Player.GetWeaponManager().IsRunning()) && !ad.m_Player.IsJumpInProgress())
338 SetStage(1, ad);
339 break;
340 case 1:
341 //action_data.m_Player.GetHandFs
342
343 break;
344 default:
345 break;
346 }
347 }
348 }
void SetStage(int stage, SequentialActionData action_data)

References SetStage().

◆ ReadFromContext()

override bool FirearmActionDetachMagazine::ReadFromContext ( ParamsReadContext ctx,
out ActionReciveData action_recive_data )
inlineprivate

Definition at line 211 of file FirearmActionDetachMagazine.c.

212 {
215
216 if (!super.ReadFromContext(ctx, action_recive_data))
217 return false;
218
221
222 recive_data_dm.m_ilWeapon = new InventoryLocation;
223 recive_data_dm.m_ilMagazine = new InventoryLocation;
224
225 if (!recive_data_dm.m_ilWeapon.ReadFromContext(ctx))
226 return false;
227
228 if (!recive_data_dm.m_ilMagazine.ReadFromContext(ctx))
229 return false;
230
231 return true;
232 }

◆ WriteToContext()

override void FirearmActionDetachMagazine::WriteToContext ( ParamsWriteContext ctx,
ActionData action_data )
inlineprivate

Definition at line 200 of file FirearmActionDetachMagazine.c.

201 {
202 super.WriteToContext(ctx, action_data);
203
206
207 action_data_dm.m_ilWeapon.WriteToContext(ctx);
208 action_data_dm.m_ilMagazine.WriteToContext(ctx);
209 }

The documentation for this class was generated from the following file: