30 protected int m_BurstOption;
81 if(
m_player.GetHumanInventory().GetEntityInHands() != wpn )
87 return !wpn.IsCoolDown();
96 if (
m_player.GetHumanInventory().GetEntityInHands() != wpn )
99 if ( wpn.IsDamageDestroyed())
108 if ( reservationCheck && (
m_player.GetInventory().HasInventoryReservation(wpn, null) ||
m_player.GetInventory().HasInventoryReservation(mag, null)))
114 mag.GetInventory().GetCurrentInventoryLocation(invLoc);
122 int muzzleIndex = wpn.GetCurrentMuzzle();
124 if (wpn.CanAttachMagazine(muzzleIndex, mag))
137 if (
m_player.GetHumanInventory().GetEntityInHands() != wpn )
140 if ( mag.IsDamageDestroyed() || wpn.IsDamageDestroyed())
149 if ( reservationCheck && (
m_player.GetInventory().HasInventoryReservation(wpn, null) ||
m_player.GetInventory().HasInventoryReservation(mag, null)))
156 mag.GetInventory().GetCurrentInventoryLocation(invLoc);
163 int muzzleIndex = wpn.GetCurrentMuzzle();
166 if( !
Class.
CastTo(mag2, wpn.GetMagazine(muzzleIndex)) )
185 if (
m_player.GetHumanInventory().GetEntityInHands() != wpn )
188 if ( mag.GetHierarchyParent() != wpn )
194 if ( reservationCheck && (
m_player.GetInventory().HasInventoryReservation(wpn, null) ||
m_player.GetInventory().HasInventoryReservation(mag, null)))
205 if (
m_player.GetHumanInventory().GetEntityInHands() != wpn)
208 if (mag.IsDamageDestroyed() || wpn.IsDamageDestroyed())
217 if (reservationCheck && (
m_player.GetInventory().HasInventoryReservation(wpn, null) ||
m_player.GetInventory().HasInventoryReservation(mag, null)))
220 for (
int i = 0; i < wpn.GetMuzzleCount(); i++)
236 if (
m_player.GetHumanInventory().GetEntityInHands() != wpn)
239 if (mag.IsDamageDestroyed() || wpn.IsDamageDestroyed())
248 if (reservationCheck && (
m_player.GetInventory().HasInventoryReservation(wpn, null) ||
m_player.GetInventory().HasInventoryReservation(mag, null)))
252 bool fireout =
false;
253 for (
int i = 0; i < wpn.GetMuzzleCount(); i++)
265 if (wpn.HasInternalMagazine(i))
267 if ((wpn.GetInternalMagazineCartridgeCount(i) + 1) < wpn.GetInternalMagazineMaxCartridgeCount(i))
273 if (wpn.IsChamberFiredOut(i))
291 if(
m_player.GetHumanInventory().GetEntityInHands() != wpn)
294 if( wpn.IsDamageDestroyed())
300 if ( reservationCheck &&
m_player.GetInventory().HasInventoryReservation(wpn, null))
304 if( !wpn.IsJammed() )
315 if(
m_player.GetHumanInventory().GetEntityInHands() != wpn)
321 if( reservationCheck &&
m_player.GetInventory().HasInventoryReservation(wpn, null))
344 weapon.GetInventory().GetCurrentInventoryLocation(ilWeapon);
345 if (
m_player.GetInventory().HasInventoryReservation(weapon, ilWeapon) )
357 if (
m_player.GetInventory().HasInventoryReservation(invLoc.
GetItem(),invLoc) )
359 m_player.GetInventory().ClearInventoryReservationEx(weapon, ilWeapon);
376 m_player.GetInventory().ClearInventoryReservationEx(weapon, ilWeapon);
379 m_player.GetInventory().ClearInventoryReservationEx(invLoc.
GetItem(), invLoc);
486 int mi = wpn.GetCurrentMuzzle();
487 if ( wpn.IsChamberFiredOut(mi) || wpn.IsJammed() || wpn.IsChamberEmpty(mi) )
489 wpn.ProcessWeaponEvent(
new WeaponEventTrigger(
m_player));
495 wpn.ProcessWeaponEvent(
new WeaponEventTriggerToJam(
m_player));
499 wpn.ProcessWeaponEvent(
new WeaponEventTrigger(
m_player));
506 return m_BurstOption;
509 void SetBurstOption(
int value)
511 m_BurstOption = value;
586 int AcknowledgmentID;
587 pCtx.
Read(AcknowledgmentID);
602 weapon.GetInventory().GetCurrentInventoryLocation(ilWeapon);
603 m_player.GetInventory().ClearInventoryReservationEx(
m_player.GetItemInHands(),ilWeapon);
634 bool accepted =
false;
654 mi = wpn.GetCurrentMuzzle();
660 if ( !ctx.
Read(mag) )
666 slotID = wpn.GetSlotFromMuzzleIndex(mi);
669 if(
GetGame().AddInventoryJunctureEx(
m_player, mag, il,
false, 10000) )
677 if ( !ctx.
Read(mag) )
687 if ( !wpn.GetMagazine(mi) )
709 Magazine det_mag = wpn.GetMagazine(mi);
710 mag = Magazine.Cast(il.
GetItem());
711 if ( !det_mag || ( mag != det_mag) )
799 if ( !
GetGame().IsMultiplayer() )
846 m_player.GetDayZPlayerInventory().PostWeaponEvent(
new WeaponEventContinuousLoadBulletEnd(
m_player) );
851 m_player.GetDayZPlayerInventory().PostWeaponEvent(
new WeaponEventUnjam(
m_player, NULL) );
856 m_player.GetDayZPlayerInventory().PostWeaponEvent(
new WeaponEventMechanism(
m_player, NULL) );
861 m_player.GetDayZPlayerInventory().PostWeaponEvent(
new WeaponEventSetNextMuzzleMode(
m_player, NULL) );
919 if (!
GetGame().IsMultiplayer())
933 float actual_chance_to_jam;
1013 m_player.GetInventory().ClearInventoryReservationEx(
m_player.GetItemInHands(),il);
1080 if (!mag || mag.IsRuined() || (mag.GetHierarchyParent() && mag.GetHierarchyParent().IsWeapon()) )
1087 if(!mag.GetHierarchyParent() || mag.GetHierarchyParent().GetInventory().AreChildrenAccessible())
1089 if (mag.GetAmmoCount() > 0)
1101 for (
int i = startIdx; i < count; i++)
1104 if (mag && mag.GetAmmoCount() > 0 && (!mag.GetHierarchyParent() || mag.GetHierarchyParent().GetInventory().AreChildrenAccessible()))
1124 MagazineStorage sMag = MagazineStorage.Cast(mag);
1175 MagazineStorage sMag = MagazineStorage.Cast(mag);
1200 return mag1.GetAmmoCount() - mag2.GetAmmoCount();
1207 int low_mag1, high_mag1;
1208 int low_mag2, high_mag2;
1214 mag.GetNetworkID(low_mag1,high_mag1);
1215 for( j = 0; j < magazines.Count(); j++)
1217 magazines.Get(j).GetNetworkID(low_mag2,high_mag2);
1218 if(low_mag1 > low_mag2)
1222 else if (low_mag1 == low_mag2)
1224 if( high_mag1 > high_mag2 )
1230 magazines.InsertAt(mag,j);
1239 pile.GetNetworkID(low_mag1,high_mag1);
1240 for( j = 0; j < magazines_piles.Count(); j++)
1242 magazines_piles.Get(j).GetNetworkID(low_mag2,high_mag2);
1243 if(low_mag1 > low_mag2)
1247 else if (low_mag1 == low_mag2)
1249 if( high_mag1 > high_mag2 )
1255 magazines_piles.InsertAt(pile,j);
1343 int muzzleIndex = wpn.GetCurrentMuzzle();
1344 Magazine old_mag = Magazine.Cast(wpn.GetMagazine(muzzleIndex));
1352 new_mag.GetInventory().GetCurrentInventoryLocation(new_il);
1353 new_il.SetItem(old_mag);
1361 new_il.SetGroundEx( old_mag,
m_player.GetPosition(), dir);
const int AT_WPN_DETACH_MAGAZINE
const int AT_WPN_LOAD_MULTI_BULLETS_END
const int AT_WPN_ATTACH_MAGAZINE
const int AT_WPN_LOAD_BULLET
const int AT_WPN_SWAP_MAGAZINE
const int AT_WPN_LOAD_MULTI_BULLETS_START
const int AT_WPN_EJECT_BULLET
const int AT_WPN_SET_NEXT_MUZZLE_MODE
proto native bool ClearJuncture(Man player, notnull EntityAI item)
proto int GetTime()
returns mission time in milliseconds
Super root of all classes in Enforce script.
static void SendWeaponJamChance(DayZPlayer pPlayer, float jamChance)
static const int SJ_WEAPON_ACTION_ACK_REJECT
static const int SJ_WEAPON_ACTION_ACK_ACCEPT
static const int SJ_WEAPON_SET_JAMMING_CHANCE
static void SendWeaponActionAcknowledgment(DayZPlayer pPlayer, int AckID, bool accept)
static bool CanSwapEntitiesEx(notnull EntityAI item1, notnull EntityAI item2)
const int c_InventoryReservationTimeoutMS
reservations
static bool CanForceSwapEntitiesEx(notnull EntityAI item1, InventoryLocation item1_dst, notnull EntityAI item2, out InventoryLocation item2_dst)
script counterpart to engine's class Inventory
proto native void SetInitState(int pFrameIndex)
proto native bool IsValid()
verify current set inventory location
proto native void SetHands(notnull EntityAI parent, EntityAI e)
sets current inventory location type to Hands
proto native EntityAI GetParent()
returns parent of current inventory location
proto native void SetAttachment(notnull EntityAI parent, EntityAI e, int slotId)
sets current inventory location type to Attachment with slot id set to <slotId>
bool ReadFromContext(ParamsReadContext ctx)
proto native EntityAI GetItem()
returns item of current inventory location
provides access to slot configuration
proto bool Write(void value_out)
proto bool Read(void value_in)
override bool CanEjectBullet()
override bool CanChamberBullet(int muzzleIndex, Magazine mag)
bool EjectBulletVerified(ActionBase control_action=NULL)
string GetCurrentModeName()
void SetSutableMagazines()
bool CanUnjam(Weapon_Base wpn, bool reservationCheck=true)
void DelayedRefreshAnimationState(int delay)
bool CanEjectBulletVerified()
bool CanLoadBullet(Weapon_Base wpn, Magazine mag, bool reservationCheck=true)
bool CanAttachMagazine(Weapon_Base wpn, Magazine mag, bool reservationCheck=true)
ActionBase m_ControlAction
int m_PendingWeaponActionAcknowledgmentID
ref array< Magazine > m_MagazinePilesInInventory
bool AttachMagazine(Magazine mag, ActionBase control_action=NULL)
int m_ForceEjectBulletTimestamp
bool LoadBullet(Magazine mag, ActionBase control_action=NULL)
bool CanEjectBullet(Weapon_Base wpn, bool reservationCheck=true)
bool LoadMultiBullet(Magazine mag, ActionBase control_action=NULL)
bool PrepareInventoryLocationForMagazineSwap(notnull Weapon_Base wpn, notnull Magazine new_mag, out InventoryLocation new_il)
Magazine m_PendingTargetMagazine
bool DetachMagazine(InventoryLocation invLoc, ActionBase control_action=NULL)
void LoadMultiBulletStop()
bool CanLoadMultipleBullet(Weapon_Base wpn, Magazine mag, bool reservationCheck=true)
int m_LastAcknowledgmentID
void SortMagazineAfterLoad()
bool m_WaitToSyncJamChance
ref array< Magazine > m_SuitableMagazines
void RefreshAnimationState()
bool CanSwapMagazine(Weapon_Base wpn, Magazine mag, bool reservationCheck=true)
Magazine GetNextPreparedMagazine(out int startIdx)
Weapon_Base m_WeaponInHand
bool SwapMagazine(Magazine mag, ActionBase control_action=NULL)
const float MAX_DROP_MAGAZINE_DISTANCE_SQ
void Update(float deltaT)
const int FORCE_EJECT_BULLET_TIMEOUT
bool OnInputUserDataProcess(int userDataType, ParamsReadContext ctx)
ref array< MagazineStorage > m_MagazineStorageInInventory
bool CanFire(Weapon_Base wpn)
bool CanDetachMagazine(Weapon_Base wpn, Magazine mag, bool reservationCheck=true)
void OnSyncJuncture(int pJunctureID, ParamsReadContext pCtx)
void SetEjectBulletTryTimestamp()
Magazine m_PreparedMagazine
int CompareMagazinesSuitability(Magazine mag1, Magazine mag2)
bool Unjam(ActionBase control_action=NULL)
void SetRunning(bool value)
void WeaponManager(PlayerBase player)
ref InventoryLocation m_PendingInventoryLocation
bool SwapMagazineEx(Magazine mag, InventoryLocation invLoc, ActionBase control_action=NULL)
void Fire(Weapon_Base wpn)
ref InventoryLocation m_TargetInventoryLocation
bool EjectBullet(ActionBase control_action=NULL)
int m_PendingWeaponAction
bool StartAction(int action, Magazine mag, InventoryLocation il, ActionBase control_action=NULL)
MagazineStorage m_MagazineInHand
Magazine GetPreparedMagazine()
void OnMagazineDetach(Magazine mag)
int m_AnimationRefreshCooldown
void OnMagazineAttach(Magazine mag)
void OnMagazineInventoryExit(Magazine mag)
void OnMagazineInventoryEnter(Magazine mag)
void StartPendingAction()
bool InventoryReservation(Magazine mag, InventoryLocation invLoc)
represents weapon's stable state (i.e. the basic states that the weapon will spend the most time in)
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
Serializer ParamsReadContext
proto native CGame GetGame()
void Error(string err)
Messagebox with error message.
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
static proto float AbsFloat(float f)
Returns absolute value.