11enum WeaponWithAmmoFlags
41 const int SAMF_DEFAULT = WeaponWithAmmoFlags.CHAMBER | WeaponWithAmmoFlags.MAX_CAPACITY_MAG;
43 const int SAMF_RNG = WeaponWithAmmoFlags.CHAMBER_RNG | WeaponWithAmmoFlags.QUANTITY_RNG;
45 protected const float DEFAULT_DAMAGE_ON_SHOT = 0.05;
48 protected bool m_isJammed =
false;
49 protected bool m_LiftWeapon =
false;
55 protected int m_weaponAnimState = -1;
56 protected int m_magazineSimpleSelectionIndex = -1;
57 protected int m_weaponHideBarrelIdx = -1;
58 protected float m_DmgPerShot = 0;
63 protected float m_ChanceToJamSync = 0;
70 m_BayonetAttached =
false;
71 m_ButtstockAttached =
false;
72 m_BayonetAttachmentIdx = -1;
73 m_ButtstockAttachmentIdx = -1;
77 if ( ConfigIsExisting(
"simpleHiddenSelections") )
80 ConfigGetTextArray(
"simpleHiddenSelections",selectionNames);
81 m_weaponHideBarrelIdx = selectionNames.Find(
"hide_barrel");
82 m_magazineSimpleSelectionIndex = selectionNames.Find(
"magazine");
84 int bulletIndex = selectionNames.Find(
"bullet");
85 if ( bulletIndex != -1 )
87 m_bulletSelectionIndex.Insert(bulletIndex);
89 for (
int i = 2; i < 100; i++)
91 bulletIndex = selectionNames.Find(
string.Format(
"bullet%1",i));
92 if (bulletIndex != -1)
94 m_bulletSelectionIndex.Insert(bulletIndex);
105 InitDOFProperties(m_DOFProperties);
108 InitReliability(m_ChanceToJam);
124 m_fsm.SetInitialState(initState);
125 SetGroundAnimFrameIndex(initState.m_animState);
130 float baseWeight = GetInventoryAndCargoWeight(forceRecalc);
133 string bulletTypeName, ammoTypeName;
135 int muzzleCount = GetMuzzleCount();
137 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
140 data1.
SetCalcDetails(
"TWPN: " + m_ConfigWeight+
"(item weight) + " + baseWeight +
"(contents weight)" );
143 for (
int muzzleIndex = 0; muzzleIndex < muzzleCount; muzzleIndex++)
146 if (!IsChamberEmpty(muzzleIndex))
148 ammoTypeName = GetChamberAmmoTypeName(muzzleIndex);
149 ammoWeight +=
g_Game.ConfigGetFloat(
string.Format(
"CfgMagazines %1 weight", ammoTypeName));
152 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
155 data2.
AddCalcDetails(
g_Game.ConfigGetFloat(
"CfgMagazines " + ammoTypeName +
" weight").ToString() +
"(chamber weight)");
161 if (HasInternalMagazine(muzzleIndex))
164 float debugInternalMagWeight;
166 int cartridgeCount = GetInternalMagazineCartridgeCount(muzzleIndex);
167 for (
int cartridgeIndex = 0; cartridgeIndex < cartridgeCount; cartridgeIndex++)
169 GetInternalMagazineCartridgeInfo(muzzleIndex, cartridgeIndex, ammoDamage, bulletTypeName);
172 debugInternalMagWeight +=
g_Game.ConfigGetFloat(
"CfgMagazines " + ammoTypeName +
" weight");
177 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
186 return ammoWeight + baseWeight + GetConfigWeightModified();
203 int count = GetAbilityCount();
204 for (
int i = 0; i < count; ++i)
238 return CanProcessWeaponEvents() && GetCurrentState().IsWaitingForActionFinish();
243 return CanProcessWeaponEvents() && GetCurrentState().IsIdle();
252 SyncEventToRemote(e);
257 SetNextMuzzleMode(GetCurrentMuzzle());
272 SyncEventToRemote(e);
275 m_fsm.ProcessAbortEvent(e, aa);
281 return CanChamberFromMag(muzzleIndex, mag) && (!
IsChamberFull(muzzleIndex) ||
IsChamberFiredOut(muzzleIndex) || !IsInternalMagazineFull(muzzleIndex));
286 m_weaponAnimState = state;
287 SetGroundAnimFrameIndex(state);
292 m_weaponAnimState = -1;
296 void EEFired(
int muzzleType,
int mode,
string ammoType)
298 if ( !
GetGame().IsDedicatedServer() )
300 ItemBase suppressor = GetAttachedSuppressor();
303 ItemBase.PlayFireParticles(
this, muzzleType, ammoType,
this, suppressor,
"CfgWeapons" );
308 ItemBase.PlayFireParticles(
this, muzzleType, ammoType, suppressor, NULL,
"CfgVehicles" );
309 suppressor.IncreaseOverheating(
this, ammoType,
this, suppressor,
"CfgVehicles");
324 #ifdef DIAG_DEVELOPER
325 MiscGameplayFunctions.UnlimitedAmmoDebugCheck(
this);
336 if (rnd < GetSyncChanceToJam())
344 if ( m_bulletSelectionIndex.Count() > muzzleIndex )
346 SetSimpleHiddenSelectionState(m_bulletSelectionIndex[muzzleIndex],1);
349 SelectionBulletShow();
354 if ( m_bulletSelectionIndex.Count() > muzzleIndex )
356 SetSimpleHiddenSelectionState(m_bulletSelectionIndex[muzzleIndex],0);
359 SelectionBulletHide();
368 int level = GetHealthLevel();
370 if (level >= 0 && level < m_ChanceToJam.Count())
371 return m_ChanceToJam[level];
379 SelectionBulletShow();
381 SelectionBulletHide();
391 int nMuzzles = GetMuzzleCount();
392 for (
int i = 0; i < nMuzzles; ++i)
399 GetCartridgeInfo(i, damage, ammoTypeName);
400 EffectBulletShow(i, damage, ammoTypeName);
408 Magazine mag = GetMagazine(i);
418 if ( !super.OnStoreLoad(ctx, version) )
424 int current_muzzle = 0;
425 if (!ctx.
Read(current_muzzle))
427 Error(
"Weapon.OnStoreLoad " +
this +
" cannot read current muzzle!");
431 if (current_muzzle >= GetMuzzleCount() || current_muzzle < 0)
432 Error(
"Weapon.OnStoreLoad " +
this +
" trying to set muzzle index " + current_muzzle +
" while it only has " + GetMuzzleCount() +
" muzzles!");
434 SetCurrentMuzzle(current_muzzle);
440 if (!ctx.
Read(mode_count))
442 Error(
"Weapon.OnStoreLoad " +
this +
" cannot read mode count!");
446 for (
int m = 0; m < mode_count; ++m)
451 Error(
"Weapon.OnStoreLoad " +
this +
" cannot read mode[" + m +
"]");
456 SetCurrentMode(m, mode);
460 if ( version >= 106 )
462 if ( !ctx.
Read(m_isJammed) )
464 Error(
"Weapon.OnStoreLoad cannot load jamming state");
471 if (!m_fsm.OnStoreLoad(ctx, version))
477 SetGroundAnimFrameIndex(wss.m_animState);
484 if (!ctx.
Read(dummy))
493 if (m_fsm && m_fsm.IsRunning())
495 if (m_fsm.SaveCurrentFSMState(ctx))
500 Error(
"[wpnfsm] " +
Object.GetDebugName(
this) +
" Weapon=" +
this +
" state NOT saved.");
503 Error(
"[wpnfsm] " +
Object.GetDebugName(
this) +
" Weapon.SaveCurrentFSMState: trying to save weapon without FSM (or uninitialized weapon) this=" +
this +
" type=" +
GetType());
510 if (m_fsm.LoadCurrentFSMState(ctx, version))
516 state.SyncAnimState();
528 Error(
"[wpnfsm] " +
Object.GetDebugName(
this) +
" Weapon=" +
this +
" did not load.");
534 Error(
"[wpnfsm] " +
Object.GetDebugName(
this) +
" Weapon.LoadCurrentFSMState: trying to load weapon without FSM (or uninitialized weapon) this=" +
this +
" type=" +
GetType());
543 int mi = GetCurrentMuzzle();
544 Magazine mag = GetMagazine(mi);
545 bool has_mag = mag != null;
546 bool has_bullet = !IsChamberEmpty(mi);
547 SyncSelectionState(has_bullet, has_mag);
553 super.OnStoreSave(ctx);
556 int current_muzzle = GetCurrentMuzzle();
557 ctx.
Write(current_muzzle);
560 int mode_count = GetMuzzleCount();
561 ctx.
Write(mode_count);
562 for (
int m = 0; m < mode_count; ++m)
563 ctx.
Write(GetCurrentMode(m));
565 ctx.
Write(m_isJammed);
568 m_fsm.OnStoreSave(ctx);
582 return m_fsm.GetInternalStateID();
593 return m_fsm.GetCurrentStableStateID();
606 int mi = GetCurrentMuzzle();
607 Magazine mag = GetMagazine(mi);
608 bool has_mag = mag != null;
609 bool has_bullet = !IsChamberEmpty(mi);
612 m_fsm.RandomizeFSMStateEx(muzzleStates, has_mag, has_jam);
613 ForceSyncSelectionState();
622 int nMuzzles = GetMuzzleCount();
623 for (
int i = 0; i < nMuzzles; ++i)
630 else if (IsChamberEmpty(i))
633 ErrorEx(
string.Format(
"Unable to identify chamber state of muzzle %1", i));
635 muzzleStates.Insert(state);
661 ErrorEx(
string.Format(
"%1 does not exist or is not a weapon.", weaponType));
665 wpn.SpawnAmmo(magazineType, flags);
675 bool SpawnAmmo(
string magazineType =
"",
int flags = WeaponWithAmmoFlags.CHAMBER )
678 if ( HasInternalMagazine(-1) && FillInnerMagazine(magazineType, flags) )
682 if ( GetMagazineTypeCount(0) > 0 && SpawnAttachedMagazine(magazineType, flags) )
686 if ( FillChamber(magazineType, flags) )
701 if ( GetMagazineTypeCount(0) == 0 )
703 ErrorEx(
string.Format(
"No 'magazines' config entry for %1.",
this));
708 if ( magazineType ==
"" )
710 if ( flags & WeaponWithAmmoFlags.MAX_CAPACITY_MAG)
711 magazineType = GetMaxMagazineTypeName(0);
713 magazineType = GetRandomMagazineTypeName(0);
716 EntityAI magAI = GetInventory().CreateAttachment(magazineType);
724 if (!CastTo(mag, magAI))
731 if (flags & WeaponWithAmmoFlags.QUANTITY_RNG)
735 bool chamberRng = (flags & WeaponWithAmmoFlags.CHAMBER_RNG);
736 bool chamber = (flags & WeaponWithAmmoFlags.CHAMBER) || chamberRng;
737 if (chamber || chamberRng)
739 FillChamber(magazineType, flags);
759 if (!HasInternalMagazine(-1))
770 bool didSomething =
false;
771 int muzzCount = GetMuzzleCount();
773 bool ammoRng = ammoType ==
"";
774 bool ammoFullRng = ammoRng && (flags & WeaponWithAmmoFlags.AMMO_MAG_RNG);
777 if (ammoRng && !ammoFullRng)
778 ammoType = GetRandomChamberableAmmoTypeName(0);
781 for (
int i = 0; i < muzzCount; ++i)
783 int ammoCount = GetInternalMagazineMaxCartridgeCount(i);
786 if ( flags & WeaponWithAmmoFlags.QUANTITY_RNG )
793 for (
int j = 0; j < ammoCount; ++j)
797 ammoType = GetRandomChamberableAmmoTypeName(i);
799 PushCartridgeToInternalMagazine(i, 0, ammoType);
806 bool chamber = (flags & WeaponWithAmmoFlags.CHAMBER) || (flags & WeaponWithAmmoFlags.CHAMBER_RNG);
807 if (chamber && FillChamber(ammoType, flags))
824 bool FillChamber(
string ammoType =
"",
int flags = WeaponWithAmmoFlags.CHAMBER )
827 int muzzCount = GetMuzzleCount();
828 bool anyEmpty =
false;
830 for (
int m = 0; m < muzzCount; ++m)
832 if (IsChamberEmpty(m))
848 bool didSomething =
false;
849 bool chamberFullRng = (flags & WeaponWithAmmoFlags.CHAMBER_RNG_SPORADIC);
850 bool chamberRng = (flags & WeaponWithAmmoFlags.CHAMBER_RNG);
851 bool chamber = (flags & WeaponWithAmmoFlags.CHAMBER);
853 if (chamber || chamberRng || chamberFullRng)
855 int amountToChamber = muzzCount;
861 bool chamberAmmoRng = (ammoType ==
"");
862 bool chamberAmmoFullRng = chamberAmmoRng && (flags & WeaponWithAmmoFlags.AMMO_CHAMBER_RNG);
865 if (chamberAmmoRng && !chamberAmmoFullRng)
866 ammoType = GetRandomChamberableAmmoTypeName(0);
868 for (
int i = 0; i < muzzCount; ++i)
871 if (!IsChamberEmpty(i))
882 if ( chamberAmmoFullRng )
883 ammoType = GetRandomChamberableAmmoTypeName(i);
886 PushCartridgeToChamber(i, 0, ammoType);
891 if (amountToChamber <= 0)
917 int ac = GetInventory().AttachmentCount();
918 int sc = GetInventory().GetAttachmentSlotsCount() + GetMuzzleCount();
919 if (ac > sc) sc = ac;
925 if (!m_PropertyModifierObject)
929 return m_PropertyModifierObject;
962 if ( !
GetGame().IsDedicatedServer() )
980 m_fsm.ValidateAndRepair();
985 m_PropertyModifierObject = null;
989 super.OnInventoryEnter(player);
994 m_PropertyModifierObject = null;
995 super.OnInventoryExit(player);
1000 super.EEItemAttached(item, slot_name);
1002 GetPropertyModifierObject().UpdateModifiers();
1007 super.EEItemDetached(item, slot_name);
1009 GetPropertyModifierObject().UpdateModifiers();
1014 super.EEItemLocationChanged(oldLoc, newLoc);
1019 if (newLoc.GetParent() &&
PlayerBase.CastTo(player, newLoc.GetParent()))
1032 super.OnItemLocationChanged(old_owner,new_owner);
1038 player.SetReturnToOptics(
false);
1041 HideWeaponBarrel(
false);
1046 if ( !super.CanReleaseAttachment( attachment ) )
1048 Magazine mag = Magazine.Cast(attachment);
1054 if ( player.GetItemInHands() ==
this )
1076 if (GetInventory().GetCurrentInventoryLocation(il))
1102 p.StoreInputForRemotes(ctx);
1130 return optic.HasWeaponIronsightsOverride();
1136 if (
GetGame().ConfigIsExisting(
"cfgWeapons " +
GetType() +
" PPDOFProperties"))
1146 if (
GetGame().ConfigIsExisting(
"cfgWeapons " +
GetType() +
" Reliability ChanceToJam"))
1157 if (ConfigIsExisting(
"WeaponLength"))
1159 m_WeaponLength = ConfigGetFloat(
"WeaponLength");
1162 m_WeaponLength = 0.8;
1168 return m_DOFProperties;
1179 vector usti_hlavne_position;
1180 vector trigger_axis_position;
1181 vector hit_pos, hit_normal;
1186 m_LiftWeapon =
false;
1188 if ( HasSelection(
"Usti hlavne") )
1193 Print(
"Error: No weapon owner, returning");
1198 player.GetMovementState(movementState);
1202 usti_hlavne_position = GetSelectionPositionLS(
"Usti hlavne" );
1203 trigger_axis_position = GetSelectionPositionLS(
"trigger_axis");
1206 if (player.GetInputController().CameraIsFreeLook())
1208 if (player.m_DirectionToCursor !=
vector.
Zero)
1210 direction = player.m_DirectionToCursor;
1215 direction = MiscGameplayFunctions.GetHeadingVector(player);
1223 idx = player.GetBoneIndexByName(
"Neck");
1225 { start = player.GetPosition()[1] + 1.5; }
1227 { start = player.GetBonePositionWS(idx); }
1232 distance = m_WeaponLength;
1235 if (
ItemBase.CastTo(attachment,FindAttachmentBySlotName(
"weaponBayonet")) ||
ItemBase.CastTo(attachment,FindAttachmentBySlotName(
"weaponBayonetAK")) ||
ItemBase.CastTo(attachment,FindAttachmentBySlotName(
"weaponBayonetMosin")) ||
ItemBase.CastTo(attachment,FindAttachmentBySlotName(
"weaponBayonetSKS")) ||
ItemBase.CastTo(attachment,GetAttachedSuppressor()))
1237 distance += attachment.m_ItemModelLength;
1239 end = start + (direction * distance);
1246 m_LiftWeapon =
true;
1254 m_ChanceToJamSync = jamming_chance;
1269 if (IsChamberEjectable(muzzleIndex))
1271 if (PopCartridgeFromChamber(muzzleIndex, ammoDamage, ammoTypeName))
1274 else if (GetInternalMagazineCartridgeCount(muzzleIndex) > 0)
1276 if (PopCartridgeFromInternalMagazine(muzzleIndex, ammoDamage, ammoTypeName))
1287 for (
int mi = 0; mi < src.GetMuzzleCount(); ++mi)
1289 if (!src.IsChamberEmpty(mi))
1291 if (src.GetCartridgeInfo(mi, damage, type))
1293 PushCartridgeToChamber(mi, damage, type);
1297 for (
int ci = 0; ci < src.GetInternalMagazineCartridgeCount(mi); ++ci)
1299 if (src.GetInternalMagazineCartridgeInfo(mi, ci, damage, type))
1301 PushCartridgeToInternalMagazine(mi, damage, type);
1306 int dummy_version =
int.MAX;
1319 m_BayonetAttached = pState;
1320 m_BayonetAttachmentIdx = slot_idx;
1325 return m_BayonetAttached;
1330 return m_BayonetAttachmentIdx;
1335 m_ButtstockAttached = pState;
1336 m_ButtstockAttachmentIdx = slot_idx;
1341 return m_ButtstockAttached;
1346 return m_ButtstockAttachmentIdx;
1351 if ( !
GetGame().IsDedicatedServer() )
1354 if ( optics && !optics.AllowsDOF() && m_weaponHideBarrelIdx != -1 )
1356 SetSimpleHiddenSelectionState(m_weaponHideBarrelIdx,!state);
1363 if (m_magazineSimpleSelectionIndex > -1)
1364 SetSimpleHiddenSelectionState(m_magazineSimpleSelectionIndex,1);
1366 SelectionMagazineShow();
1371 if (m_magazineSimpleSelectionIndex > -1)
1372 SetSimpleHiddenSelectionState(m_magazineSimpleSelectionIndex,0);
1374 SelectionMagazineHide();
1384 super.ProcessMeleeItemDamage();
1388 attachment = GetInventory().FindAttachment(m_ButtstockAttachmentIdx);
1392 attachment = GetInventory().FindAttachment(m_BayonetAttachmentIdx);
1396 super.ProcessMeleeItemDamage();
1402 attachment.ProcessMeleeItemDamage();
1416 return m_BurstCount;
1441 SpawnAmmo(
"", SAMF_DEFAULT);
eBleedingSourceType GetType()
void wpnDebugPrint(string s)
protected bool IsDamageDestroyed(ActionTarget target)
void AddAction(typename actionName)
const int ECE_PLACE_ON_SURFACE
WeaponEventID
identifier for events. mainly for rpc purposes
FirearmActionLoadBullet FirearmActionBase FirearmActionLoadBulletQuick()
void fsmDebugSpam(string s)
InventoryLocationType
types of Inventory Location
void IncreaseOverheating(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
bool OnStoreLoad(ParamsReadContext ctx, int version)
override string GetDebugName()
Gets the debug name for the ParticleManager.
class JsonUndergroundAreaTriggerData GetPosition
@ AMMO_CHAMBER_RNG
Fully randomizes the ammo type instead of picking one random for all chambers (needs to have type as ...
@ CHAMBER
Chambers bullets.
@ CHAMBER_RNG_SPORADIC
Maybe chambers bullets (full random) example: 0 1 0 0 1 1.
@ MAX_CAPACITY_MAG
Instead of randomizing when type is empty, it looks for the one which has the highest capacity.
@ QUANTITY_RNG
Randomizes the quantity of the bullets in the spawned magazine.
@ CHAMBER_RNG
Maybe chambers bullets (sequential rng) example: 1 1 1 0 0 0.
@ NONE
Attached magazine will be full and no round will be chambered.
@ AMMO_MAG_RNG
Fully randomizes the ammo type instead of picking one random for the entire mag (needs to have type a...
enum FSMTransition WeaponTransition
bool IsChamberFiredOut(int idx)
bool IsChamberFull(int idx)
pair ( action, actionType )
int m_actionType
corresponds to Human::actions == RELOAD, MECHANISM, ...
void AbilityRecord(int a, int at)
corresponds to Human::actionTypes == CHAMBERING_ONEBULLET_CLOSED, MECHANISM_CLOSED....
static bool MagazineTypeToAmmoType(string magazineType, out string ammoType)
Helper method.
static float GetAmmoWeightByBulletType(string bulletType)
proto native vector GetCurrentCameraDirection()
proto native void ConfigGetFloatArray(string path, out TFloatArray values)
Get array of floats from config on path.
override ScriptCallQueue GetCallQueue(int call_category)
static proto bool RayCastBullet(vector begPos, vector endPos, PhxInteractionLayers layerMask, Object ignoreObj, out Object hitObject, out vector hitPosition, out vector hitNormal, out float hitFraction)
Wrapper class for managing sound through SEffectManager.
override void SetAutodestroy(bool auto_destroy)
Sets whether Effect automatically cleans up when it stops.
represents transition src -— event[guard]/action -—|> dst
proto native void SetMeleeBlock(bool pBlock)
this enables/disables block
proto native int GetType()
returns type of InventoryLocation
proto native EntityAI GetParent()
returns parent of current inventory location
static bool IsWeaponLogEnable()
Manager class for managing Effect (EffectParticle, EffectSound)
static EffectSound PlaySound(string sound_set, vector position, float play_fade_in=0, float stop_fade_out=0, bool loop=false)
Create and play an EffectSound.
proto void Call(func fn, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL)
adds call into the queue with given parameters and arguments (arguments are held in memory until the ...
proto native ParamsReadContext GetReadContext()
proto native ParamsWriteContext GetWriteContext()
Serialization general interface. Serializer API works with:
proto bool Write(void value_out)
proto bool Read(void value_in)
override void AssembleGun()
override void InitStateMachine()
override void ShowBullet(int muzzleIndex)
override void HideBullet(int muzzleIndex)
signalize mechanism manipulation
WeaponEventID GetEventID()
returns id from enum WeaponEventID
void WriteToContext(ParamsWriteContext ctx)
weapon finite state machine
script counterpart to engine's class Weapon
bool ProcessWeaponEvent(WeaponEventBase e)
weapon's fsm handling of events @NOTE: warning: ProcessWeaponEvent can be called only within DayZPlay...
protected ref PropertyModifiers m_PropertyModifierObject
protected int m_BayonetAttachmentIdx
override void OnDebugSpawn()
void ResetWeaponAnimState()
protected bool m_BayonetAttached
bool InitDOFProperties(out array< float > temp_array)
Initializes DOF properties for weapon's ironsight/optics cameras.
override void OnItemLocationChanged(EntityAI old_owner, EntityAI new_owner)
protected float m_WeaponLength
override void OnInventoryExit(Man player)
void SetWeaponAnimState(int state)
bool CanEnterIronsights()
protected int m_ButtstockAttachmentIdx
Magazine SpawnAttachedMagazine(string magazineType="", int flags=WeaponWithAmmoFlags.CHAMBER)
Try to spawn and attach a magazine.
static Weapon_Base CreateWeaponWithAmmo(string weaponType, string magazineType="", int flags=WeaponWithAmmoFlags.CHAMBER)
Create weapon with ammo.
bool JamCheck(int muzzleIndex)
override int GetBayonetAttachmentIdx()
void SaveCurrentFSMState(ParamsWriteContext ctx)
void ShowBullet(int muzzleIndex)
bool ProcessWeaponAbortEvent(WeaponEventBase e)
bool InitReliability(out array< float > reliability_array)
override void OnStoreSave(ParamsWriteContext ctx)
int GetCurrentStableStateID()
tries to return identifier of current stable state (or nearest stable state if unstable state is curr...
override protected float GetWeightSpecialized(bool forceRecalc=false)
RecoilBase SpawnRecoilObject()
override bool HasButtstockAttached()
WeaponStateBase GetCurrentState()
returns currently active state
bool IsShowingChamberedBullet()
bool LiftWeaponCheck(PlayerBase player)
void EEFired(int muzzleType, int mode, string ammoType)
bool EjectCartridge(int muzzleIndex, out float ammoDamage, out string ammoTypeName)
unload bullet from chamber or internal magazine
bool InitWeaponLength()
gets weapon length from config for weaponlift raycast
bool IsWaitingForActionFinish()
returns true if state machine started playing action/actionType and waits for finish
void SyncEventToRemote(WeaponEventBase e)
ref array< float > GetWeaponDOF()
protected ref WeaponFSM m_fsm
weapon abilities
void HideBullet(int muzzleIndex)
protected bool m_ButtstockAttached
void SetSyncJammingChance(float jamming_chance)
void OnFireModeChange(int fireMode)
bool LoadCurrentFSMState(ParamsReadContext ctx, int version)
bool CanChamberBullet(int muzzleIndex, Magazine mag)
override bool CanReleaseAttachment(EntityAI attachment)
void HideWeaponBarrel(bool state)
void SyncSelectionState(bool has_bullet, bool has_mag)
void RandomizeFSMState()
With the parameters given, selects a random suitable state for the FSM of the weapon @WARNING: Weapon...
protected array< MuzzleState > GetMuzzleStates()
Helper method for RandomizeFSMState.
bool FillInnerMagazine(string ammoType="", int flags=WeaponWithAmmoFlags.CHAMBER)
Try to fill the inner magazine.
override void EEItemDetached(EntityAI item, string slot_name)
override int GetSlotsCountCorrect()
Returns number of slots for attachments corrected for weapons.
ref array< float > m_DOFProperties
override void AfterStoreLoad()
float GetSyncChanceToJam()
override void SetButtstockAttached(bool pState, int slot_idx=-1)
override void SetBayonetAttached(bool pState, int slot_idx=-1)
attachment helpers (firearm melee)
override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
void OnFire(int muzzle_index)
bool CopyWeaponStateFrom(notnull Weapon_Base src)
override bool OnStoreLoad(ParamsReadContext ctx, int version)
PropertyModifiers GetPropertyModifierObject()
bool HasActionAbility(int action, int actionType)
query if weapon supports action and actionType
override EntityAI ProcessMeleeItemDamage(int mode=0)
override void EEItemAttached(EntityAI item, string slot_name)
bool CanProcessAction(int action, int actionType)
override bool HasBayonetAttached()
AbilityRecord GetAbility(int index)
override void OnInventoryEnter(Man player)
void AssembleGun()
override on weapons with some assembly required
bool SpawnAmmo(string magazineType="", int flags=WeaponWithAmmoFlags.CHAMBER)
General method trying to attch magazine, fill inner magazine and fill chamber.
void SetInitialState(WeaponStableState initState)
protected int m_BurstCount
bool CanProcessWeaponEvents()
void ForceSyncSelectionState()
bool FillChamber(string ammoType="", int flags=WeaponWithAmmoFlags.CHAMBER)
Try to fill the chamber.
override int GetButtstockAttachmentIdx()
void SetJammed(bool value)
override bool CanRemoveFromHands(EntityAI parent)
int GetWeaponSpecificCommand(int weaponAction, int subCommand)
override void SetActions()
represents weapon's stable state (i.e. the basic states that the weapon will spend the most time in)
override bool HasBullet()
override bool HasMagazine()
represent weapon state base
void SetCalcDetails(string details)
void AddCalcDetails(string details)
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
DayZPlayerInstanceType
defined in C++
proto native CGame GetGame()
void Error(string err)
Messagebox with error message.
proto void Print(void var)
Prints content of variable to console/log.
array< string > TStringArray
static int RandomIntInclusive(int min, int max)
Returns a random int number between and min [inclusive] and max [inclusive].