30 protected int m_BurstOption;
81 if(
m_player.GetEntityInHands() != wpn )
87 return !wpn.IsCoolDown();
96 if (
m_player.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.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.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.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.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)) < wpn.GetInternalMagazineMaxCartridgeCount(i))
273 if (wpn.IsChamberFiredOut(i))
291 if(
m_player.GetEntityInHands() != wpn)
294 if( wpn.IsDamageDestroyed())
300 if ( reservationCheck &&
m_player.GetInventory().HasInventoryReservation(wpn, null))
304 if( !wpn.IsJammed() )
315 if(
m_player.GetEntityInHands() != wpn)
321 if( reservationCheck &&
m_player.GetInventory().HasInventoryReservation(wpn, null))
345 weapon.GetInventory().GetCurrentInventoryLocation(ilWeapon);
453 int actual_time =
g_Game.GetTime();
487 int mi = wpn.GetCurrentMuzzle();
488 if ( wpn.IsChamberFiredOut(mi) || wpn.IsJammed() || wpn.IsChamberEmpty(mi) )
490 wpn.ProcessWeaponEvent(
new WeaponEventTrigger(
m_player));
496 wpn.ProcessWeaponEvent(
new WeaponEventTriggerToJam(
m_player));
500 wpn.ProcessWeaponEvent(
new WeaponEventTrigger(
m_player));
507 return m_BurstOption;
510 void SetBurstOption(
int value)
512 m_BurstOption = value;
587 int AcknowledgmentID;
588 pCtx.
Read(AcknowledgmentID);
604 weapon.GetInventory().GetCurrentInventoryLocation(ilWeapon);
636 bool accepted =
false;
656 mi = wpn.GetCurrentMuzzle();
662 if ( !ctx.
Read(mag) )
668 slotID = wpn.GetSlotFromMuzzleIndex(mi);
671 if(
g_Game.AddInventoryJunctureEx(
m_player, mag, il,
false, 10000) )
679 if ( !ctx.
Read(mag) )
689 if ( !wpn.GetMagazine(mi) )
711 Magazine det_mag = wpn.GetMagazine(mi);
712 mag = Magazine.Cast(il.
GetItem());
713 if ( !det_mag || ( mag != det_mag) )
801 if ( !
g_Game.IsMultiplayer() )
848 m_player.GetDayZPlayerInventory().PostWeaponEvent(
new WeaponEventContinuousLoadBulletEnd(
m_player) );
853 m_player.GetDayZPlayerInventory().PostWeaponEvent(
new WeaponEventUnjam(
m_player, NULL) );
858 m_player.GetDayZPlayerInventory().PostWeaponEvent(
new WeaponEventMechanism(
m_player, NULL) );
863 m_player.GetDayZPlayerInventory().PostWeaponEvent(
new WeaponEventSetNextMuzzleMode(
m_player, NULL) );
921 if (!
g_Game.IsMultiplayer())
935 float actual_chance_to_jam;
1084 if (!mag || mag.IsRuined() || (mag.GetHierarchyParent() && mag.GetHierarchyParent().IsWeapon()) )
1091 if(!mag.GetHierarchyParent() || mag.GetHierarchyParent().GetInventory().AreChildrenAccessible())
1093 if (mag.GetAmmoCount() > 0)
1105 for (
int i = startIdx; i < count; ++i)
1108 if (mag && mag.GetAmmoCount() > 0 && (!mag.GetHierarchyParent() || mag.GetHierarchyParent().GetInventory().AreChildrenAccessible()))
1128 MagazineStorage sMag = MagazineStorage.Cast(mag);
1179 MagazineStorage sMag = MagazineStorage.Cast(mag);
1204 return mag1.GetAmmoCount() - mag2.GetAmmoCount();
1211 int low_mag1, high_mag1;
1212 int low_mag2, high_mag2;
1218 mag.GetNetworkID(low_mag1,high_mag1);
1219 for( j = 0; j < magazines.Count(); j++)
1221 magazines.Get(j).GetNetworkID(low_mag2,high_mag2);
1222 if(low_mag1 > low_mag2)
1226 else if (low_mag1 == low_mag2)
1228 if( high_mag1 > high_mag2 )
1234 magazines.InsertAt(mag,j);
1243 pile.GetNetworkID(low_mag1,high_mag1);
1244 for( j = 0; j < magazines_piles.Count(); j++)
1246 magazines_piles.Get(j).GetNetworkID(low_mag2,high_mag2);
1247 if(low_mag1 > low_mag2)
1251 else if (low_mag1 == low_mag2)
1253 if( high_mag1 > high_mag2 )
1259 magazines_piles.InsertAt(pile,j);
1347 int muzzleIndex = wpn.GetCurrentMuzzle();
1348 Magazine old_mag = Magazine.Cast(wpn.GetMagazine(muzzleIndex));
1356 new_mag.GetInventory().GetCurrentInventoryLocation(new_il);
1357 new_il.SetItem(old_mag);
1365 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
Super root of all classes in Enforce script.
static const int SJ_WEAPON_ACTION_ACK_REJECT
static void SendWeaponActionAcknowledgment(DayZPlayer pPlayer, int AckID, bool accept)
static const int SJ_WEAPON_ACTION_ACK_ACCEPT
static void SendWeaponJamChance(DayZPlayer pPlayer, float jamChance)
static const int SJ_WEAPON_SET_JAMMING_CHANCE
script counterpart to engine's class Inventory
static bool CanForceSwapEntitiesEx(notnull EntityAI item1, InventoryLocation item1_dst, notnull EntityAI item2, out InventoryLocation item2_dst)
static proto native bool HasInventoryReservation(EntityAI item, InventoryLocation dst)
Internally: HasInventoryReservationEx(item, dst, FindInventoryReservationMode.LEGACY,...
const int c_InventoryReservationTimeoutMS
reservations
bool ClearInventoryReservationEx(EntityAI item, InventoryLocation dst)
bool AddInventoryReservationEx(EntityAI item, InventoryLocation dst, int timeout_ms)
static bool CanSwapEntitiesEx(notnull EntityAI item1, notnull EntityAI item2)
proto native void SetInitState(int pFrameIndex)
this sets to a weapon init state each weapon has a different weapon state those states are defined by...
proto native EntityAI GetParent()
returns parent of current inventory location
proto native bool IsValid()
verify current set inventory location
proto native void SetAttachment(notnull EntityAI parent, EntityAI e, int slotId)
proto native void SetHands(notnull EntityAI parent, EntityAI e)
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 CanChamberBullet(int muzzleIndex, Magazine mag)
override bool CanEjectBullet()
bool DetachMagazine(InventoryLocation invLoc, ActionBase control_action=NULL)
int m_ForceEjectBulletTimestamp
void Update(float deltaT)
bool PrepareInventoryLocationForMagazineSwap(notnull Weapon_Base wpn, notnull Magazine new_mag, out InventoryLocation new_il)
bool CanUnjam(Weapon_Base wpn, bool reservationCheck=true)
int m_PendingWeaponActionAcknowledgmentID
bool CanAttachMagazine(Weapon_Base wpn, Magazine mag, bool reservationCheck=true)
Weapon_Base m_WeaponInHand
bool Unjam(ActionBase control_action=NULL)
string GetCurrentModeName()
Magazine GetPreparedMagazine()
ref array< Magazine > m_SuitableMagazines
bool StartAction(int action, Magazine mag, InventoryLocation il, ActionBase control_action=NULL)
MagazineStorage m_MagazineInHand
bool CanEjectBulletVerified()
const int FORCE_EJECT_BULLET_TIMEOUT
void OnMagazineDetach(Magazine mag)
void SortMagazineAfterLoad()
bool CanDetachMagazine(Weapon_Base wpn, Magazine mag, bool reservationCheck=true)
void RefreshAnimationState()
bool CanFire(Weapon_Base wpn)
bool AttachMagazine(Magazine mag, ActionBase control_action=NULL)
bool OnInputUserDataProcess(int userDataType, ParamsReadContext ctx)
bool CanLoadMultipleBullet(Weapon_Base wpn, Magazine mag, bool reservationCheck=true)
void OnMagazineInventoryExit(Magazine mag)
ActionBase m_ControlAction
Magazine m_PreparedMagazine
int m_LastAcknowledgmentID
bool EjectBullet(ActionBase control_action=NULL)
void OnMagazineAttach(Magazine mag)
void SetSutableMagazines()
void WeaponManager(PlayerBase player)
bool CanSwapMagazine(Weapon_Base wpn, Magazine mag, bool reservationCheck=true)
ref array< Magazine > m_MagazinePilesInInventory
Magazine m_PendingTargetMagazine
Magazine GetNextPreparedMagazine(out int startIdx)
void SetEjectBulletTryTimestamp()
ref InventoryLocation m_PendingInventoryLocation
void OnMagazineInventoryEnter(Magazine mag)
int m_PendingWeaponAction
void Fire(Weapon_Base wpn)
void LoadMultiBulletStop()
void DelayedRefreshAnimationState(int delay)
void OnSyncJuncture(int pJunctureID, ParamsReadContext pCtx)
const float MAX_DROP_MAGAZINE_DISTANCE_SQ
void SetRunning(bool value)
bool InventoryReservation(Magazine mag, InventoryLocation invLoc)
bool LoadBullet(Magazine mag, ActionBase control_action=NULL)
bool m_WaitToSyncJamChance
bool SwapMagazine(Magazine mag, ActionBase control_action=NULL)
ref array< MagazineStorage > m_MagazineStorageInInventory
bool CanEjectBullet(Weapon_Base wpn, bool reservationCheck=true)
void StartPendingAction()
int CompareMagazinesSuitability(Magazine mag1, Magazine mag2)
bool EjectBulletVerified(ActionBase control_action=NULL)
bool CanLoadBullet(Weapon_Base wpn, Magazine mag, bool reservationCheck=true)
int m_AnimationRefreshCooldown
bool LoadMultiBullet(Magazine mag, ActionBase control_action=NULL)
ref InventoryLocation m_TargetInventoryLocation
bool SwapMagazineEx(Magazine mag, InventoryLocation invLoc, ActionBase control_action=NULL)
represents weapon's stable state (i.e.
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
Serializer ParamsReadContext
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.