DayZ 1.26
DayZ Explorer by KGB
Загрузка...
Поиск...
Не найдено
Класс FirearmActionAttachMagazineQuick
+ Граф наследования:FirearmActionAttachMagazineQuick:

Закрытые члены

void FirearmActionAttachMagazineQuick ()
 
override bool ActionCondition (PlayerBase player, ActionTarget target, ItemBase item)
 
override ActionData CreateActionData ()
 
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 bool Post_SetupAction (ActionData action_data)
 
override bool InventoryReservation (ActionData action_data)
 
override void Start (ActionData action_data)
 
override bool HasTarget ()
 
override bool HasProgress ()
 
override GetInputType ()
 
override void CreateConditionComponents ()
 

Подробное описание

Конструктор(ы)

◆ FirearmActionAttachMagazineQuick()

228 {
229 }

Методы

◆ ActionCondition()

override bool ActionCondition ( PlayerBase player,
ActionTarget target,
ItemBase item )
inlineprivate
232 {
233 if (!super.ActionCondition( player, target, item ))
234 return false;
235
236 HumanCommandWeapons hcw = player.GetCommandModifier_Weapons();
237 if (hcw && hcw.GetRunningAction() == WeaponActions.RELOAD)
238 return false;
239
240 MagazineStorage mag = MagazineStorage.Cast(player.GetWeaponManager().GetPreparedMagazine());
241
242 if (!mag)
243 return false;
244
245 Weapon weapon = Weapon.Cast(item);
246 bool isLoadedMag = false;
247
248 for (int i = 0, count = weapon.GetMuzzleCount(); i < count; ++i)
249 isLoadedMag |= ( mag == weapon.GetMagazine( i ) );
250
251 return !isLoadedMag;
252 }
Definition human.c:994
Definition EntityAI.c:95
script counterpart to engine's class Weapon
Definition InventoryItem.c:49
WeaponActions
actions
Definition human.c:816

◆ CreateActionData()

override ActionData CreateActionData ( )
inlineprivate

◆ CreateConditionComponents()

override void CreateConditionComponents ( )
inlineprivate
444 {
447 }
ref CCIBase m_ConditionItem
Definition ActionBase.c:64
ref CCTBase m_ConditionTarget
Definition ActionBase.c:65
Definition CCINonRuined.c:2
Definition CCTSelf.c:2

Перекрестные ссылки ActionBase::m_ConditionItem и ActionBase::m_ConditionTarget.

◆ GetInputType()

override GetInputType ( )
inlineprivate
439 {
441 }
Definition ActionInput.c:908

◆ HandleReciveData()

override void HandleReciveData ( ActionReciveData action_recive_data,
ActionData action_data )
inlineprivate
290 {
293
294 action_data.m_MainItem = action_recive_data.m_MainItem;
295 if (!action_recive_data.m_Target)
296 {
297 action_data.m_Target = new ActionTarget(NULL, NULL, -1, vector.Zero, 0);
298 }
299 else
300 {
301 action_data.m_Target = action_recive_data.m_Target;
302 }
303 action_data_am.m_ilOldMagazine = recive_data_am.m_ilOldMagazine;
304 }
class ActionTargets ActionTarget
Definition FirearmActionAttachMagazine.c:2
Definition EnConvert.c:106
static const vector Zero
Definition EnConvert.c:110

Перекрестные ссылки ActionTarget и vector::Zero.

◆ HasProgress()

override bool HasProgress ( )
inlineprivate
434 {
435 return false;
436 }

◆ HasTarget()

override bool HasTarget ( )
inlineprivate
429 {
430 return true;
431 }

◆ InventoryReservation()

override bool InventoryReservation ( ActionData action_data)
inlineprivate
331 {
332 if( (IsLocal() || !UseAcknowledgment()) && IsInstant() )
333 return true;
334
335 bool success = true;
339
340 PlayerBase player = action_data.m_Player;
342
343 Weapon_Base wpn = Weapon_Base.Cast(action_data.m_MainItem);
344 int muzzle_index = wpn.GetCurrentMuzzle();
345
346 Magazine new_mag = Magazine.Cast(action_data.m_Target.GetObject());
347
348 if (am_action_data.m_oldMagazine)
349 {
351 if ( action_data.m_Player.GetInventory().HasInventoryReservation( am_action_data.m_oldMagazine, am_action_data.m_ilOldMagazine) )
352 {
353 success = false;
354 }
355 else
356 {
357 player.GetInventory().AddInventoryReservationEx(am_action_data.m_oldMagazine,am_action_data.m_ilOldMagazine,GameInventory.c_InventoryReservationTimeoutMS);
358 }
359 }
360
361 if (success)
362 {
364 targetInventoryLocation.SetAttachment( wpn, new_mag, InventorySlots.MAGAZINE);
365 if ( action_data.m_Player.GetInventory().HasInventoryReservation( new_mag, targetInventoryLocation) )
366 {
367 success = false;
368 if (am_action_data.m_oldMagazine)
369 {
370 player.GetInventory().ClearInventoryReservation(am_action_data.m_oldMagazine,am_action_data.m_ilOldMagazine);
371 }
372 }
373 else
374 {
375 action_data.m_Player.GetInventory().AddInventoryReservationEx( new_mag, targetInventoryLocation, GameInventory.c_InventoryReservationTimeoutMS);
376 }
377 }
378
379 if (success)
380 {
382 handInventoryLocation.SetHands(action_data.m_Player, wpn);
383
384 if ( action_data.m_Player.GetInventory().HasInventoryReservation( wpn, handInventoryLocation) )
385 {
386 if (am_action_data.m_oldMagazine)
387 {
388 player.GetInventory().ClearInventoryReservation(am_action_data.m_oldMagazine,am_action_data.m_ilOldMagazine);
389 }
390 player.GetInventory().ClearInventoryReservation(new_mag, targetInventoryLocation);
391 success = false;
392 }
393 else
394 {
395 action_data.m_Player.GetInventory().AddInventoryReservationEx( wpn, handInventoryLocation, GameInventory.c_InventoryReservationTimeoutMS);
396 }
397 }
398
399 if ( success )
400 {
401 if (am_action_data.m_ilOldMagazine)
402 action_data.m_ReservedInventoryLocations.Insert(am_action_data.m_ilOldMagazine);
403
405 action_data.m_ReservedInventoryLocations.Insert(targetInventoryLocation);
406
408 action_data.m_ReservedInventoryLocations.Insert(handInventoryLocation);
409 }
410
411 return success;
412 }
bool UseAcknowledgment()
Definition ActionBase.c:1019
bool IsLocal()
Definition ActionBase.c:256
bool IsInstant()
Definition ActionBase.c:262
script counterpart to engine's class Inventory
Definition Inventory.c:79
const int c_InventoryReservationTimeoutMS
reservations
Definition Inventory.c:712
InventoryLocation.
Definition InventoryLocation.c:29
provides access to slot configuration
Definition InventorySlots.c:6
Definition PlayerBaseClient.c:2
shorthand
Definition BoltActionRifle_Base.c:6

Перекрестные ссылки GameInventory::c_InventoryReservationTimeoutMS, ActionBase::IsInstant(), ActionBase::IsLocal() и ActionBase::UseAcknowledgment().

Используется в Start().

◆ Post_SetupAction()

override bool Post_SetupAction ( ActionData action_data)
inlineprivate
307 {
308 if ( !GetGame().IsDedicatedServer() )
309 {
310 Weapon_Base wpn = Weapon_Base.Cast(action_data.m_MainItem);
311 int muzzle_index = wpn.GetCurrentMuzzle();
312
314 am_action_data.m_oldMagazine = wpn.GetMagazine(muzzle_index);
315
316 ActionTarget newTarget = new ActionTarget(action_data.m_Player.GetWeaponManager().GetPreparedMagazine(), null, -1, vector.Zero, -1);
317 action_data.m_Target = newTarget;
318
320
321 if (!action_data.m_Player.GetWeaponManager().PrepareInventoryLocationForMagazineSwap(wpn, Magazine.Cast(action_data.m_Target.GetObject()), new_il))
322 {
323 return false;
324 }
325 am_action_data.m_ilOldMagazine = new_il;
326 }
327 return true;
328 }
proto native CGame GetGame()

Перекрестные ссылки ActionTarget, GetGame() и vector::Zero.

◆ ReadFromContext()

override bool ReadFromContext ( ParamsReadContext ctx,
out ActionReciveData action_recive_data )
inlineprivate
271 {
273 {
275 }
276
277 super.ReadFromContext(ctx, action_recive_data);
278
280 if (!il.ReadFromContext(ctx))
281 return false;
282
284 recive_data_am.m_ilOldMagazine = il;
285
286 return true;
287 }

◆ Start()

override void Start ( ActionData action_data)
inlineprivate
415 {
416 super.Start( action_data );
418 Weapon_Base wpn = Weapon_Base.Cast(action_data.m_MainItem);
419 Magazine mag = Magazine.Cast(action_data.m_Target.GetObject());
421 if ( action_data.m_Player.GetWeaponManager().CanAttachMagazine(wpn,mag,false) )
422 action_data.m_Player.GetWeaponManager().AttachMagazine(mag, this);
423 else
424 action_data.m_Player.GetWeaponManager().SwapMagazineEx(mag, action_data_am.m_ilOldMagazine, this);
426 }
void ClearInventoryReservationEx(ActionData action_data)
Definition ActionBase.c:921
override bool InventoryReservation(ActionData action_data)
Definition FirearmActionAttachMagazine.c:330

Перекрестные ссылки ActionBase::ClearInventoryReservationEx() и InventoryReservation().

◆ WriteToContext()

override void WriteToContext ( ParamsWriteContext ctx,
ActionData action_data )
inlineprivate
262 {
263 super.WriteToContext(ctx, action_data);
264
266
267 action_data_am.m_ilOldMagazine.WriteToContext(ctx);
268 }

Объявления и описания членов класса находятся в файле: