30 protected int m_BurstOption;
81 if(
m_player.GetHumanInventory().GetEntityInHands() != wpn )
97 if (
m_player.GetHumanInventory().GetEntityInHands() != wpn )
100 if ( wpn.IsDamageDestroyed())
109 if ( reservationCheck && (
m_player.GetInventory().HasInventoryReservation(wpn, null) ||
m_player.GetInventory().HasInventoryReservation(mag, null)))
115 mag.GetInventory().GetCurrentInventoryLocation(invLoc);
123 int muzzleIndex = wpn.GetCurrentMuzzle();
125 if (wpn.CanAttachMagazine(muzzleIndex, mag))
138 if (
m_player.GetHumanInventory().GetEntityInHands() != wpn )
141 if ( mag.IsDamageDestroyed() || wpn.IsDamageDestroyed())
150 if ( reservationCheck && (
m_player.GetInventory().HasInventoryReservation(wpn, null) ||
m_player.GetInventory().HasInventoryReservation(mag, null)))
157 mag.GetInventory().GetCurrentInventoryLocation(invLoc);
164 int muzzleIndex = wpn.GetCurrentMuzzle();
167 if( !
Class.
CastTo(mag2, wpn.GetMagazine(muzzleIndex)) )
186 if (
m_player.GetHumanInventory().GetEntityInHands() != wpn )
189 if ( mag.GetHierarchyParent() != wpn )
195 if ( reservationCheck && (
m_player.GetInventory().HasInventoryReservation(wpn, null) ||
m_player.GetInventory().HasInventoryReservation(mag, null)))
206 if (
m_player.GetHumanInventory().GetEntityInHands() != wpn)
209 if (mag.IsDamageDestroyed() || wpn.IsDamageDestroyed())
218 if (reservationCheck && (
m_player.GetInventory().HasInventoryReservation(wpn, null) ||
m_player.GetInventory().HasInventoryReservation(mag, null)))
221 for (
int i = 0; i < wpn.GetMuzzleCount(); i++)
235 if(
m_player.GetHumanInventory().GetEntityInHands() != wpn)
238 if( wpn.IsDamageDestroyed())
244 if ( reservationCheck &&
m_player.GetInventory().HasInventoryReservation(wpn, null))
248 if( !wpn.IsJammed() )
259 if(
m_player.GetHumanInventory().GetEntityInHands() != wpn)
265 if( reservationCheck &&
m_player.GetInventory().HasInventoryReservation(wpn, null))
288 weapon.GetInventory().GetCurrentInventoryLocation(ilWeapon);
289 if (
m_player.GetInventory().HasInventoryReservation(weapon, ilWeapon) )
301 if (
m_player.GetInventory().HasInventoryReservation(invLoc.
GetItem(),invLoc) )
303 m_player.GetInventory().ClearInventoryReservationEx(weapon, ilWeapon);
320 m_player.GetInventory().ClearInventoryReservationEx(weapon, ilWeapon);
323 m_player.GetInventory().ClearInventoryReservationEx(invLoc.
GetItem(), invLoc);
430 int mi = wpn.GetCurrentMuzzle();
431 if ( wpn.IsChamberFiredOut(mi) || wpn.IsJammed() || wpn.IsChamberEmpty(mi) )
433 wpn.ProcessWeaponEvent(
new WeaponEventTrigger(
m_player));
439 wpn.ProcessWeaponEvent(
new WeaponEventTriggerToJam(
m_player));
443 wpn.ProcessWeaponEvent(
new WeaponEventTrigger(
m_player));
450 return m_BurstOption;
453 void SetBurstOption(
int value)
455 m_BurstOption = value;
530 int AcknowledgmentID;
531 pCtx.
Read(AcknowledgmentID);
546 weapon.GetInventory().GetCurrentInventoryLocation(ilWeapon);
547 m_player.GetInventory().ClearInventoryReservationEx(
m_player.GetItemInHands(),ilWeapon);
578 bool accepted =
false;
598 mi = wpn.GetCurrentMuzzle();
604 if ( !ctx.
Read(mag) )
610 slotID = wpn.GetSlotFromMuzzleIndex(mi);
613 if(
GetGame().AddInventoryJunctureEx(
m_player, mag, il,
false, 10000) )
621 if ( !ctx.
Read(mag) )
631 if ( !wpn.GetMagazine(mi) )
653 Magazine det_mag = wpn.GetMagazine(mi);
654 mag = Magazine.Cast(il.
GetItem());
655 if ( !det_mag || ( mag != det_mag) )
743 if ( !
GetGame().IsMultiplayer() )
790 m_player.GetDayZPlayerInventory().PostWeaponEvent(
new WeaponEventContinuousLoadBulletEnd(
m_player) );
795 m_player.GetDayZPlayerInventory().PostWeaponEvent(
new WeaponEventUnjam(
m_player, NULL) );
800 m_player.GetDayZPlayerInventory().PostWeaponEvent(
new WeaponEventMechanism(
m_player, NULL) );
805 m_player.GetDayZPlayerInventory().PostWeaponEvent(
new WeaponEventSetNextMuzzleMode(
m_player, NULL) );
863 if (!
GetGame().IsMultiplayer())
877 float actual_chance_to_jam;
957 m_player.GetInventory().ClearInventoryReservationEx(
m_player.GetItemInHands(),il);
1059 MagazineStorage sMag = MagazineStorage.Cast(mag);
1110 MagazineStorage sMag = MagazineStorage.Cast(mag);
1135 return mag1.GetAmmoCount() - mag2.GetAmmoCount();
1142 int low_mag1, high_mag1;
1143 int low_mag2, high_mag2;
1149 mag.GetNetworkID(low_mag1,high_mag1);
1150 for( j = 0; j < magazines.Count(); j++)
1152 magazines.Get(j).GetNetworkID(low_mag2,high_mag2);
1153 if(low_mag1 > low_mag2)
1157 else if (low_mag1 == low_mag2)
1159 if( high_mag1 > high_mag2 )
1165 magazines.InsertAt(mag,j);
1174 pile.GetNetworkID(low_mag1,high_mag1);
1175 for( j = 0; j < magazines_piles.Count(); j++)
1177 magazines_piles.Get(j).GetNetworkID(low_mag2,high_mag2);
1178 if(low_mag1 > low_mag2)
1182 else if (low_mag1 == low_mag2)
1184 if( high_mag1 > high_mag2 )
1190 magazines_piles.InsertAt(pile,j);
1278 int muzzleIndex = wpn.GetCurrentMuzzle();
1279 Magazine old_mag = Magazine.Cast(wpn.GetMagazine(muzzleIndex));
1287 new_mag.GetInventory().GetCurrentInventoryLocation(new_il);
1288 new_il.SetItem(old_mag);
1296 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 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)
const int c_InventoryReservationTimeoutMS
reservations
static bool CanSwapEntitiesEx(notnull EntityAI item1, notnull EntityAI item2)
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
bool ReadFromContext(ParamsReadContext ctx)
proto native void SetAttachment(notnull EntityAI parent, EntityAI e, int slotId)
sets current inventory location type to Attachment with slot id set to <slotId>
proto native EntityAI GetItem()
returns item of current inventory location
bool WriteToContext(ParamsWriteContext ctx)
provides access to slot configuration
Serialization general interface. Serializer API works with:
proto bool Write(void value_out)
proto bool Read(void value_in)
override float GetChanceToJam()
override bool CanChamberBullet(int muzzleIndex, Magazine mag)
override bool CanEjectBullet()
bool DetachMagazine(InventoryLocation invLoc, ActionBase control_action=NULL)
protected int m_PendingWeaponActionAcknowledgmentID
void Update(float deltaT)
protected int m_PendingWeaponAction
bool PrepareInventoryLocationForMagazineSwap(notnull Weapon_Base wpn, notnull Magazine new_mag, out InventoryLocation new_il)
protected ActionBase m_ControlAction
bool CanUnjam(Weapon_Base wpn, bool reservationCheck=true)
bool CanAttachMagazine(Weapon_Base wpn, Magazine mag, bool reservationCheck=true)
protected Magazine m_PendingTargetMagazine
protected ref array< Magazine > m_MagazinePilesInInventory
protected float m_NewJamChance
protected int m_LastAcknowledgmentID
protected ref InventoryLocation m_TargetInventoryLocation
bool Unjam(ActionBase control_action=NULL)
string GetCurrentModeName()
Magazine GetPreparedMagazine()
protected bool m_readyToStart
protected bool m_justStart
protected const int FORCE_EJECT_BULLET_TIMEOUT
bool StartAction(int action, Magazine mag, InventoryLocation il, ActionBase control_action=NULL)
bool CanEjectBulletVerified()
protected bool m_InProgress
protected ref array< MagazineStorage > m_MagazineStorageInInventory
void OnMagazineDetach(Magazine mag)
void SortMagazineAfterLoad()
protected bool m_WantContinue
protected bool m_WaitToSyncJamChance
bool CanDetachMagazine(Weapon_Base wpn, Magazine mag, bool reservationCheck=true)
protected MagazineStorage m_MagazineInHand
void RefreshAnimationState()
protected Magazine m_PreparedMagazine
protected Weapon_Base m_WeaponInHand
bool CanFire(Weapon_Base wpn)
protected ref array< Magazine > m_SuitableMagazines
protected PlayerBase m_player
bool AttachMagazine(Magazine mag, ActionBase control_action=NULL)
bool OnInputUserDataProcess(int userDataType, ParamsReadContext ctx)
void OnMagazineInventoryExit(Magazine mag)
protected ref InventoryLocation m_PendingInventoryLocation
bool EjectBullet(ActionBase control_action=NULL)
void OnMagazineAttach(Magazine mag)
void SetSutableMagazines()
void WeaponManager(PlayerBase player)
protected bool m_InIronSight
bool CanSwapMagazine(Weapon_Base wpn, Magazine mag, bool reservationCheck=true)
Magazine GetNextPreparedMagazine(out int startIdx)
void SetEjectBulletTryTimestamp()
void OnMagazineInventoryEnter(Magazine mag)
void Fire(Weapon_Base wpn)
void LoadMultiBulletStop()
protected int m_ForceEjectBulletTimestamp
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)
protected int m_AnimationRefreshCooldown
bool SwapMagazine(Magazine mag, ActionBase control_action=NULL)
protected bool m_IsEventSended
private void Synchronize()
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)
bool LoadMultiBullet(Magazine mag, ActionBase control_action=NULL)
bool SwapMagazineEx(Magazine mag, InventoryLocation invLoc, ActionBase control_action=NULL)
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.
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.