26 bool m_ActionsInitialize;
28 static int m_DebugActionsMask;
29 bool m_RecipesInitialized;
36 float m_VarQuantityPrev;
37 int m_VarQuantityInit;
42 float m_StoreLoadedQuantity =
float.LOWEST;
55 bool m_WantPlayImpactSound;
56 bool m_CanPlayImpactSound =
true;
58 int m_ImpactSoundSurfaceHash;
60 float m_HeatIsolation;
61 float m_ItemModelLength;
62 float m_ItemAttachOffset;
63 int m_LiquidContainerMask;
70 bool m_ThrowItemOnDrop;
71 bool m_ItemBeingDroppedPhys;
72 bool m_CanBeMovedOverride;
73 bool m_FixDamageSystemInit =
false;
74 bool can_this_be_combined;
75 bool m_CanThisBeSplit;
76 bool m_IsStoreLoad =
false;
77 bool m_CanShowQuantity;
78 bool m_HasQuantityBar;
80 protected bool m_IsResultOfSplit
99 private int m_AttachedAgents;
110 static int m_LastRegisteredWeaponID = 0;
113 bool m_IsOverheatingEffectActive;
114 float m_OverheatingShots;
115 ref
Timer m_CheckOverheating;
116 int m_ShotsToStartOverheating = 0;
117 int m_MaxOverheatingValue = 0;
118 float m_OverheatingDecayInterval = 1;
119 ref array <ref OverheatingParticle> m_OverheatingParticles;
145 private float m_TemperaturePerQuantityWeight;
155 if (!
g_Game.IsDedicatedServer())
159 LoadParticleConfigOnFire(GetMuzzleID());
161 if (m_ShotsToStartOverheating == 0)
163 LoadParticleConfigOnOverheating(GetMuzzleID());
168 m_ActionsInitialize =
false;
171 m_OldLocation = null;
178 if (ConfigIsExisting(
"headSelectionsToHide"))
185 if (ConfigIsExisting(
"hideSelectionsByinventorySlot"))
190 m_QuickBarBonus =
Math.Max(0, ConfigGetInt(
"quickBarBonus"));
192 m_IsResultOfSplit =
false;
194 SetActionAnimOverrides();
197 override void InitItemVariables()
199 super.InitItemVariables();
206 m_Count = ConfigGetInt(
"count");
243 if (ConfigIsExisting(
"canBeSplit"))
250 if (ConfigIsExisting(
"itemBehaviour"))
256 RegisterNetSyncVariableInt(
"m_VarLiquidType");
257 RegisterNetSyncVariableInt(
"m_Cleanness",0,1);
259 RegisterNetSyncVariableBoolSignal(
"m_WantPlayImpactSound");
260 RegisterNetSyncVariableFloat(
"m_ImpactSpeed");
261 RegisterNetSyncVariableInt(
"m_ImpactSoundSurfaceHash");
263 RegisterNetSyncVariableInt(
"m_ColorComponentR", 0, 255);
264 RegisterNetSyncVariableInt(
"m_ColorComponentG", 0, 255);
265 RegisterNetSyncVariableInt(
"m_ColorComponentB", 0, 255);
266 RegisterNetSyncVariableInt(
"m_ColorComponentA", 0, 255);
268 RegisterNetSyncVariableBool(
"m_IsBeingPlaced");
269 RegisterNetSyncVariableBool(
"m_IsTakeable");
270 RegisterNetSyncVariableBool(
"m_IsHologram");
273 if (m_ItemSoundHandler)
277 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
282 m_TemperaturePerQuantityWeight = 1.0;;
283 if (ConfigIsExisting(
"temperaturePerQuantityWeight"))
284 m_TemperaturePerQuantityWeight = ConfigGetFloat(
"temperaturePerQuantityWeight");
289 override int GetQuickBarBonus()
306 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
326 void SetActionAnimOverrides();
334 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
348 action_array =
new array<ActionBase_Basic>;
351 if (LogManager.IsActionLogEnable())
353 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
356 if (action_array.Find(action) != -1)
358 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
362 action_array.Insert(action);
368 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
369 ActionBase action = player.GetActionManager().GetAction(actionName);
375 action_array.RemoveItem(action);
381 void OverrideActionAnimation(
typename action,
int commandUID,
int stanceMask = -1,
int commandUIDProne = -1)
383 ActionOverrideData overrideData =
new ActionOverrideData();
384 overrideData.m_CommandUID = commandUID;
385 overrideData.m_CommandUIDProne = commandUIDProne;
386 overrideData.m_StanceMask = stanceMask;
392 m_ItemActionOverrides.Insert(action, actionMap);
395 actionMap.Insert(this.
Type(), overrideData);
399 void OnItemInHandsPlayerSwimStart(PlayerBase player);
401 ScriptedLightBase GetLight();
404 void LoadParticleConfigOnFire(
int id)
409 if (!m_OnBulletCasingEjectEffect)
412 string config_to_search =
"CfgVehicles";
413 string muzzle_owner_config;
415 if (!m_OnFireEffect.Contains(
id))
417 if (IsInherited(Weapon))
418 config_to_search =
"CfgWeapons";
420 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
422 string config_OnFire_class = muzzle_owner_config +
"Particles " +
"OnFire ";
424 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
426 if (config_OnFire_subclass_count > 0)
428 array<ref WeaponParticlesOnFire> WPOF_array =
new array<ref WeaponParticlesOnFire>;
430 for (
int i = 0; i < config_OnFire_subclass_count; i++)
432 string particle_class =
"";
433 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
434 string config_OnFire_entry = config_OnFire_class + particle_class;
435 WeaponParticlesOnFire WPOF =
new WeaponParticlesOnFire(
this, config_OnFire_entry);
436 WPOF_array.Insert(WPOF);
440 m_OnFireEffect.Insert(
id, WPOF_array);
444 if (!m_OnBulletCasingEjectEffect.Contains(
id))
446 config_to_search =
"CfgWeapons";
447 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
449 string config_OnBulletCasingEject_class = muzzle_owner_config +
"Particles " +
"OnBulletCasingEject ";
451 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
453 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
455 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array =
new array<ref WeaponParticlesOnBulletCasingEject>;
457 for (i = 0; i < config_OnBulletCasingEject_count; i++)
459 string particle_class2 =
"";
460 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
461 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
462 WeaponParticlesOnBulletCasingEject WPOBE =
new WeaponParticlesOnBulletCasingEject(
this, config_OnBulletCasingEject_entry);
463 WPOBE_array.Insert(WPOBE);
467 m_OnBulletCasingEjectEffect.Insert(
id, WPOBE_array);
473 void LoadParticleConfigOnOverheating(
int id)
475 if (!m_OnOverheatingEffect)
478 if (!m_OnOverheatingEffect.Contains(
id))
480 string config_to_search =
"CfgVehicles";
482 if (IsInherited(Weapon))
483 config_to_search =
"CfgWeapons";
485 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
486 string config_OnOverheating_class = muzzle_owner_config +
"Particles " +
"OnOverheating ";
488 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
491 m_ShotsToStartOverheating =
g_Game.ConfigGetFloat(config_OnOverheating_class +
"shotsToStartOverheating");
493 if (m_ShotsToStartOverheating == 0)
495 m_ShotsToStartOverheating = -1;
496 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
501 m_OverheatingDecayInterval =
g_Game.ConfigGetFloat(config_OnOverheating_class +
"overheatingDecayInterval");
502 m_MaxOverheatingValue =
g_Game.ConfigGetFloat(config_OnOverheating_class +
"maxOverheatingValue");
506 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
507 array<ref WeaponParticlesOnOverheating> WPOOH_array =
new array<ref WeaponParticlesOnOverheating>;
509 for (
int i = 0; i < config_OnOverheating_subclass_count; i++)
511 string particle_class =
"";
512 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
513 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
514 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
516 if (entry_type == CT_CLASS)
518 WeaponParticlesOnOverheating WPOF =
new WeaponParticlesOnOverheating(
this, config_OnOverheating_entry);
519 WPOOH_array.Insert(WPOF);
524 m_OnOverheatingEffect.Insert(
id, WPOOH_array);
529 float GetOverheatingValue()
531 return m_OverheatingShots;
534 void IncreaseOverheating(
ItemBase weapon,
string ammoType,
ItemBase muzzle_owner,
ItemBase suppressor,
string config_to_search)
536 if (m_MaxOverheatingValue > 0)
538 m_OverheatingShots++;
540 if (!m_CheckOverheating)
543 m_CheckOverheating.Stop();
544 m_CheckOverheating.Run(m_OverheatingDecayInterval,
this,
"OnOverheatingDecay");
546 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
550 void CheckOverheating(
ItemBase weapon = null,
string ammoType =
"",
ItemBase muzzle_owner = null,
ItemBase suppressor = null,
string config_to_search =
"")
552 if (m_OverheatingShots >= m_ShotsToStartOverheating && IsOverheatingEffectActive())
553 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
555 if (m_OverheatingShots >= m_ShotsToStartOverheating && !IsOverheatingEffectActive())
556 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
558 if (m_OverheatingShots < m_ShotsToStartOverheating && IsOverheatingEffectActive())
559 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
561 if (m_OverheatingShots > m_MaxOverheatingValue)
563 m_OverheatingShots = m_MaxOverheatingValue;
567 bool IsOverheatingEffectActive()
569 return m_IsOverheatingEffectActive;
572 void OnOverheatingDecay()
574 if (m_MaxOverheatingValue > 0)
575 m_OverheatingShots -= 1 + m_OverheatingShots / m_MaxOverheatingValue;
577 m_OverheatingShots--;
579 if (m_OverheatingShots <= 0)
581 m_CheckOverheating.Stop();
582 m_OverheatingShots = 0;
586 if (!m_CheckOverheating)
589 m_CheckOverheating.Stop();
590 m_CheckOverheating.Run(m_OverheatingDecayInterval,
this,
"OnOverheatingDecay");
593 CheckOverheating(
this,
"",
this);
596 void StartOverheating(
ItemBase weapon = null,
string ammoType =
"",
ItemBase muzzle_owner = null,
ItemBase suppressor = null,
string config_to_search =
"")
598 m_IsOverheatingEffectActive =
true;
599 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
602 void UpdateOverheating(
ItemBase weapon = null,
string ammoType =
"",
ItemBase muzzle_owner = null,
ItemBase suppressor = null,
string config_to_search =
"")
604 KillAllOverheatingParticles();
605 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
606 UpdateAllOverheatingParticles();
609 void StopOverheating(
ItemBase weapon = null,
string ammoType =
"",
ItemBase muzzle_owner = null,
ItemBase suppressor = null,
string config_to_search =
"")
611 m_IsOverheatingEffectActive =
false;
612 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
615 void RegisterOverheatingParticle(Particle p,
float min_heat_coef,
float max_heat_coef,
int particle_id,
Object parent, vector local_pos, vector local_ori)
617 if (!m_OverheatingParticles)
618 m_OverheatingParticles =
new array<ref OverheatingParticle>;
620 OverheatingParticle OP =
new OverheatingParticle();
621 OP.RegisterParticle(p);
622 OP.SetOverheatingLimitMin(min_heat_coef);
623 OP.SetOverheatingLimitMax(max_heat_coef);
624 OP.SetParticleParams(
particle_id, parent, local_pos, local_ori);
626 m_OverheatingParticles.Insert(OP);
629 float GetOverheatingCoef()
631 if (m_MaxOverheatingValue > 0)
632 return (m_OverheatingShots - m_ShotsToStartOverheating) / m_MaxOverheatingValue;
637 void UpdateAllOverheatingParticles()
639 if (m_OverheatingParticles)
641 float overheat_coef = GetOverheatingCoef();
642 int count = m_OverheatingParticles.Count();
644 for (
int i = count; i > 0; --i)
647 OverheatingParticle OP = m_OverheatingParticles.Get(
id);
648 Particle p = OP.GetParticle();
650 float overheat_min = OP.GetOverheatingLimitMin();
651 float overheat_max = OP.GetOverheatingLimitMax();
653 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
658 OP.RegisterParticle(null);
665 void KillAllOverheatingParticles()
667 if (m_OverheatingParticles)
669 for (
int i = m_OverheatingParticles.Count(); i > 0; i--)
672 OverheatingParticle OP = m_OverheatingParticles.Get(
id);
676 Particle p = OP.GetParticle();
687 m_OverheatingParticles.Clear();
688 delete m_OverheatingParticles;
693 float GetInfectionChance(
int system = 0, Param param = null)
699 float GetDisinfectQuantity(
int system = 0, Param param1 = null)
721 if (!m_WeaponTypeToID)
722 m_WeaponTypeToID =
new map<string, int>;
724 if (m_WeaponTypeToID.Contains(
GetType()))
726 return m_WeaponTypeToID.Get(
GetType());
731 m_WeaponTypeToID.Insert(
GetType(), ++m_LastRegisteredWeaponID);
734 return m_LastRegisteredWeaponID;
754 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
755 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(
this);
759 InventoryLocation r_il =
new InventoryLocation;
760 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
762 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
763 int r_type = r_il.GetType();
766 r_il.GetParent().GetOnReleaseLock().Invoke(
this);
770 r_il.GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.GetSlot());
775 player.GetHumanInventory().ClearUserReservedLocation(
this);
785 static int GetDebugActionsMask()
790 static bool HasDebugActionsMask(
int mask)
792 return ItemBase.m_DebugActionsMask & mask;
795 static void SetDebugActionsMask(
int mask)
800 static void AddDebugActionsMask(
int mask)
802 ItemBase.m_DebugActionsMask |= mask;
805 static void RemoveDebugActionsMask(
int mask)
807 ItemBase.m_DebugActionsMask &= ~mask;
810 static void ToggleDebugActionsMask(
int mask)
812 if (HasDebugActionsMask(mask))
814 RemoveDebugActionsMask(mask);
818 AddDebugActionsMask(mask);
823 void SetCEBasedQuantity()
825 if (GetEconomyProfile())
827 float q_max = GetEconomyProfile().GetQuantityMax();
830 float q_min = GetEconomyProfile().GetQuantityMin();
831 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
835 ComponentEnergyManager comp = GetCompEM();
854 EntityAI parent = GetHierarchyParent();
858 InventoryLocation inventory_location_to_lock =
new InventoryLocation;
859 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
860 parent.GetInventory().SetSlotLock(inventory_location_to_lock.GetSlot(),
true);
865 void UnlockFromParent()
867 EntityAI parent = GetHierarchyParent();
871 InventoryLocation inventory_location_to_unlock =
new InventoryLocation;
872 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
873 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.GetSlot(),
false);
877 override void CombineItemsClient(
EntityAI entity2,
bool use_stack_max =
true)
887 if (ScriptInputUserData.CanStoreInputUserData())
889 ScriptInputUserData ctx =
new ScriptInputUserData;
895 ctx.Write(use_stack_max);
901 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
905 else if (!
g_Game.IsMultiplayer())
911 bool IsLiquidPresent()
916 bool IsLiquidContainer()
921 int GetLiquidContainerMask()
926 bool IsBloodContainer()
944 string GetExplosiveTriggerSlotName()
975 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
979 override bool IsBeingPlaced()
984 void SetIsBeingPlaced(
bool is_being_placed)
987 if (!is_being_placed)
995 override bool IsHologram()
1005 int GetOnDigWormsAmount()
1010 bool CanMakeGardenplot()
1015 void SetIsHologram(
bool is_hologram)
1055 override void OnMovedInsideCargo(
EntityAI container)
1057 super.OnMovedInsideCargo(container);
1059 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(
this, {Bolt_Base});
1062 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
1064 super.EEItemLocationChanged(oldLoc, newLoc);
1066 PlayerBase newPlayer = null;
1067 PlayerBase oldPlayer = null;
1069 if (newLoc.GetParent())
1070 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
1072 if (oldLoc.GetParent())
1073 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
1077 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(
this);
1081 InventoryLocation rIl =
new InventoryLocation;
1082 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
1084 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
1085 int rType = rIl.GetType();
1088 rIl.GetParent().GetOnReleaseLock().Invoke(
this);
1092 rIl.GetParent().GetOnAttachmentReleaseLock().Invoke(
this, rIl.GetSlot());
1101 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
1103 if (newPlayer == oldPlayer)
1105 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
1109 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc,
false,
false,
false,
true,
false,
false))
1111 newPlayer.GetHumanInventory().SetUserReservedLocation(
this,oldLoc);
1116 newPlayer.GetHumanInventory().SetUserReservedLocation(
this,oldLoc);
1120 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(
this) >= 0)
1122 int type = oldLoc.GetType();
1125 oldLoc.GetParent().GetOnSetLock().Invoke(
this);
1129 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(
this, oldLoc.GetSlot());
1134 m_OldLocation =
new InventoryLocation;
1136 m_OldLocation.Copy(oldLoc);
1142 m_OldLocation.Reset();
1146 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
1152 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(
this, newLoc);
1155 InventoryLocation il =
new InventoryLocation;
1156 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
1158 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
1159 int rel_type = il.GetType();
1162 il.GetParent().GetOnReleaseLock().Invoke(it);
1166 il.GetParent().GetOnAttachmentReleaseLock().Invoke(it, il.GetSlot());
1179 m_OldLocation.Reset();
1185 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
1190 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
1194 override void EOnContact(IEntity other, Contact extra)
1198 int liquidType = -1;
1200 if (impactSpeed > 0.0)
1214 if (GetCompEM() && GetCompEM().IsPlugged())
1216 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
1217 GetCompEM().UnplugThis();
1229 override void OnItemAttachmentSlotChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
1236 super.OnItemLocationChanged(old_owner, new_owner);
1238 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
1239 PlayerBase playerNew = PlayerBase.Cast(new_owner);
1241 if (!relatedPlayer && playerNew)
1242 relatedPlayer = playerNew;
1244 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
1249 ActionBase currentAction = actionMgr.GetRunningAction();
1255 Man ownerPlayerOld = null;
1256 Man ownerPlayerNew = null;
1260 if (old_owner.IsMan())
1262 ownerPlayerOld = Man.Cast(old_owner);
1266 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
1275 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
1277 GetCompEM().UnplugThis();
1284 if (new_owner.IsMan())
1286 ownerPlayerNew = Man.Cast(new_owner);
1290 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
1294 if (ownerPlayerOld != ownerPlayerNew)
1298 array<EntityAI> subItemsExit =
new array<EntityAI>;
1300 for (
int i = 0; i < subItemsExit.Count(); i++)
1309 array<EntityAI> subItemsEnter =
new array<EntityAI>;
1311 for (
int j = 0; j < subItemsEnter.Count(); j++)
1318 else if (ownerPlayerNew != null)
1321 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
1323 array<EntityAI> subItemsUpdate =
new array<EntityAI>;
1325 for (
int k = 0; k < subItemsUpdate.Count(); k++)
1328 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
1334 old_owner.OnChildItemRemoved(
this);
1336 new_owner.OnChildItemReceived(
this);
1342 super.EEDelete(parent);
1343 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
1348 if (player.IsAlive())
1350 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(
this);
1353 InventoryLocation r_il =
new InventoryLocation;
1354 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
1356 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
1357 int r_type = r_il.GetType();
1360 r_il.GetParent().GetOnReleaseLock().Invoke(
this);
1364 r_il.GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.GetSlot());
1369 player.RemoveQuickBarEntityShortcut(
this);
1374 override void EEKilled(
Object killer)
1376 super.EEKilled(killer);
1379 if (killer && killer.IsFireplace() && CanExplodeInFire())
1381 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
1385 if (Magazine.Cast(
this).GetAmmoCount() > 0)
1398 override void OnWasAttached(
EntityAI parent,
int slot_id)
1400 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(
this, {Bolt_Base});
1402 super.OnWasAttached(parent, slot_id);
1411 override void OnWasDetached(
EntityAI parent,
int slot_id)
1413 super.OnWasDetached(parent, slot_id);
1422 override string ChangeIntoOnAttach(
string slot)
1428 ConfigGetTextArray(
"ChangeInventorySlot",inventory_slots);
1429 if (inventory_slots.Count() < 1)
1431 inventory_slots.Insert(ConfigGetString(
"ChangeInventorySlot"));
1432 attach_types.Insert(ConfigGetString(
"ChangeIntoOnAttach"));
1436 ConfigGetTextArray(
"ChangeIntoOnAttach",attach_types);
1439 idx = inventory_slots.Find(slot);
1443 return attach_types.Get(idx);
1446 override string ChangeIntoOnDetach()
1454 this.ConfigGetTextArray(
"ChangeInventorySlot",inventory_slots);
1455 if (inventory_slots.Count() < 1)
1457 inventory_slots.Insert(this.ConfigGetString(
"ChangeInventorySlot"));
1458 detach_types.Insert(this.ConfigGetString(
"ChangeIntoOnDetach"));
1462 this.ConfigGetTextArray(
"ChangeIntoOnDetach",detach_types);
1463 if (detach_types.Count() < 1)
1464 detach_types.Insert(this.ConfigGetString(
"ChangeIntoOnDetach"));
1467 for (
int i = 0; i < inventory_slots.Count(); i++)
1469 slot = inventory_slots.Get(i);
1474 if (detach_types.Count() == 1)
1477 idx = inventory_slots.Find(slot);
1482 return detach_types.Get(idx);
1493 float delay = Math.RandomFloat(min_time, max_time);
1495 explode_timer.Run(delay,
this,
"DoAmmoExplosion");
1498 void DoAmmoExplosion()
1500 Magazine magazine = Magazine.Cast(
this);
1501 int pop_sounds_count = 6;
1502 string pop_sounds[ 6 ] = {
"ammopops_1",
"ammopops_2",
"ammopops_3",
"ammopops_4",
"ammopops_5",
"ammopops_6" };
1505 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
1506 string sound_name = pop_sounds[ sound_idx ];
1507 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
1510 magazine.ServerAddAmmoCount(-1);
1513 float min_temp_to_explode = 100;
1515 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
1522 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
1524 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
1526 const int CHANCE_DAMAGE_CARGO = 4;
1527 const int CHANCE_DAMAGE_ATTACHMENT = 1;
1528 const int CHANCE_DAMAGE_NOTHING = 2;
1530 if (IsClothing() || IsContainer() ||
IsItemTent())
1532 float dmg = damageResult.GetDamage(
"",
"Health") * -0.5;
1536 if (GetInventory().GetCargo())
1538 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
1539 rnd = Math.RandomInt(0,chances);
1541 if (rnd < CHANCE_DAMAGE_CARGO)
1543 DamageItemInCargo(dmg);
1545 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
1547 DamageItemAttachments(dmg);
1552 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
1553 rnd = Math.RandomInt(0,chances);
1555 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
1557 DamageItemAttachments(dmg);
1563 bool DamageItemInCargo(
float damage)
1565 CargoBase cargo = GetInventory().GetCargo();
1568 int item_count = cargo.GetItemCount();
1571 int random_pick = Math.RandomInt(0, item_count);
1573 if (!item.IsExplosive())
1575 item.AddHealth(
"",
"",damage);
1583 bool DamageItemAttachments(
float damage)
1585 GameInventory inventory = GetInventory();
1587 if (attachment_count > 0)
1589 int random_pick = Math.RandomInt(0, attachment_count);
1591 if (!attachment.IsExplosive())
1593 attachment.AddHealth(
"",
"",damage);
1600 override bool IsSplitable()
1605 override bool CanBeSplit()
1608 return GetInventory().CanRemoveEntity();
1644 ctx.Write(destination_entity);
1650 else if (!
g_Game.IsMultiplayer())
1658 float split_quantity_new;
1664 if (destination_entity && slot_id != -1 &&
InventorySlots.IsSlotIdValid(slot_id))
1667 split_quantity_new = stack_max;
1673 new_item = ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
1676 new_item.SetResultOfSplit(
true);
1677 MiscGameplayFunctions.TransferItemProperties(
this, new_item);
1679 new_item.SetQuantity(split_quantity_new,
false,
true);
1683 else if (destination_entity && slot_id == -1)
1685 if (quantity > stack_max)
1686 split_quantity_new = stack_max;
1688 split_quantity_new = quantity;
1692 GameInventory destinationInventory = destination_entity.GetInventory();
1696 new_item = ItemBase.Cast(o);
1701 new_item.SetResultOfSplit(
true);
1702 MiscGameplayFunctions.TransferItemProperties(
this, new_item);
1704 new_item.SetQuantity(split_quantity_new,
false,
true);
1717 if (split_quantity_new == 0)
1719 if (!
g_Game.IsMultiplayer())
1720 player.PhysicalPredictiveDropItem(
this);
1722 player.ServerDropEntity(
this);
1732 new_item.SetResultOfSplit(
true);
1733 MiscGameplayFunctions.TransferItemProperties(
this, new_item);
1735 new_item.SetQuantity(stack_max,
false,
true);
1736 new_item.PlaceOnSurface();
1745 float split_quantity_new;
1751 if (destination_entity && slot_id != -1 &&
InventorySlots.IsSlotIdValid(slot_id))
1754 split_quantity_new = stack_max;
1760 new_item = ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
1763 new_item.SetResultOfSplit(
true);
1764 MiscGameplayFunctions.TransferItemProperties(
this, new_item);
1766 new_item.SetQuantity(split_quantity_new,
false,
true);
1770 else if (destination_entity && slot_id == -1)
1772 if (quantity > stack_max)
1773 split_quantity_new = stack_max;
1775 split_quantity_new = quantity;
1779 GameInventory destinationInventory = destination_entity.GetInventory();
1783 new_item = ItemBase.Cast(o);
1788 new_item.SetResultOfSplit(
true);
1789 MiscGameplayFunctions.TransferItemProperties(
this, new_item);
1791 new_item.SetQuantity(split_quantity_new,
false,
true);
1810 new_item.SetResultOfSplit(
true);
1811 MiscGameplayFunctions.TransferItemProperties(
this, new_item);
1813 new_item.SetQuantity(stack_max,
false,
true);
1814 new_item.PlaceOnSurface();
1830 ItemBase thiz =
this;
1832 dst.WriteToContext(ctx);
1836 else if (!
g_Game.IsMultiplayer())
1851 ItemBase dummy =
this;
1853 ctx.Write(destination_entity);
1861 else if (!
g_Game.IsMultiplayer())
1875 float split_quantity_new;
1879 int slot_id = dst.GetSlot();
1882 if (quantity > stack_max)
1883 split_quantity_new = stack_max;
1885 split_quantity_new = quantity;
1893 new_item.SetResultOfSplit(
true);
1894 MiscGameplayFunctions.TransferItemProperties(
this,new_item);
1896 new_item.SetQuantity(split_quantity_new,
false,
true);
1909 float split_quantity_new;
1911 if (destination_entity)
1914 if (quantity > stackable)
1915 split_quantity_new = stackable;
1917 split_quantity_new = quantity;
1921 new_item = ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
1924 new_item.SetResultOfSplit(
true);
1925 MiscGameplayFunctions.TransferItemProperties(
this,new_item);
1927 new_item.SetQuantity(split_quantity_new,
false,
true);
1944 ItemBase destination_entity =
this;
1945 ctx.Write(destination_entity);
1951 else if (!
g_Game.IsMultiplayer())
1960 float split_quantity_new;
1961 ref ItemBase new_item;
1965 if (quantity > stackable)
1966 split_quantity_new = stackable;
1968 split_quantity_new = quantity;
1972 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
1973 new_item = ItemBase.Cast(in_hands);
1976 new_item.SetResultOfSplit(
true);
1977 MiscGameplayFunctions.TransferItemProperties(
this,new_item);
1979 new_item.SetQuantity(split_quantity_new,
false,
true);
1988 float split_quantity_new =
Math.Floor(quantity * 0.5);
1997 if (new_item.GetQuantityMax() < split_quantity_new)
1999 split_quantity_new = new_item.GetQuantityMax();
2002 new_item.SetResultOfSplit(
true);
2003 MiscGameplayFunctions.TransferItemProperties(
this, new_item);
2008 new_item.SetQuantity(1,
false,
true);
2013 new_item.SetQuantity(split_quantity_new,
false,
true);
2021 float split_quantity_new =
Math.Floor(quantity / 2);
2030 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(
this,
true);
2034 if (new_item.GetQuantityMax() < split_quantity_new)
2036 split_quantity_new = new_item.GetQuantityMax();
2038 if (found && invloc.IsValid() && invloc.GetType() ==
InventoryLocationType.ATTACHMENT && split_quantity_new > 1)
2041 new_item.SetQuantity(1,
false,
true);
2043 else if (split_quantity_new > 1)
2046 new_item.SetQuantity(split_quantity_new,
false,
true);
2055 ItemBase parent = ItemBase.Cast(GetHierarchyParent());
2058 parent.OnAttachmentQuantityChangedEx(
this, delta);
2060 if (IsLiquidContainer())
2068 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
2088 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2095 EntityAI parent = GetHierarchyParent();
2096 if (parent && parent.IsFireplace())
2098 CargoBase cargo = GetInventory().GetCargo();
2101 for (
int i = 0; i < cargo.GetItemCount(); ++i)
2116 if (m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
2126 super.OnRightClick();
2128 if (CanBeSplit() && !
GetDayZGame().IsLeftCtrlDown() && !
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this,null))
2134 EntityAI root = GetHierarchyRoot();
2135 Man playerOwner = GetHierarchyRootPlayer();
2139 if (!playerOwner && root && root ==
this)
2146 GetInventory().GetCurrentInventoryLocation(dst);
2147 if (!dst.GetParent() || dst.GetParent() && !dst.GetParent().GetInventory().FindFreeLocationFor(
this,
FindInventoryLocationType.CARGO, dst))
2156 dst.SetCargo(dst.GetParent(),
this, dst.GetIdx(), dst.GetRow(), dst.GetCol(), dst.GetFlip());
2159 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
2174 ItemBase thiz =
this;
2176 dst.WriteToContext(ctx);
2181 else if (!
g_Game.IsMultiplayer())
2193 root.GetTransform(m4);
2194 dst.SetGround(
this, m4);
2198 GetInventory().GetCurrentInventoryLocation(dst);
2205 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
2212 if (!can_this_be_combined)
2216 Magazine mag = Magazine.Cast(
this);
2219 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
2222 if (stack_max_limit)
2224 Magazine other_mag = Magazine.Cast(other_item);
2227 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
2244 if (CastTo(player, GetHierarchyRootPlayer()))
2246 if (player.GetInventory().HasAttachment(
this))
2249 if (player.IsItemsToDelete())
2253 if (reservation_check && (GetInventory().HasInventoryReservation(
this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
2258 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
2271 return m_IsResultOfSplit;
2276 m_IsResultOfSplit = value;
2286 float other_item_quantity = other_item.GetQuantity();
2287 float this_free_space;
2293 if (other_item_quantity > this_free_space)
2295 return this_free_space;
2299 return other_item_quantity;
2313 if (!IsMagazine() && other_item)
2316 if (quantity_used != 0)
2318 float hp1 = GetHealth01(
"",
"");
2319 float hp2 = other_item.GetHealth01(
"",
"");
2320 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
2321 hpResult = hpResult / (
GetQuantity() + quantity_used);
2323 hpResult *= GetMaxHealth();
2324 Math.Round(hpResult);
2325 SetHealth(
"",
"Health", hpResult);
2328 other_item.AddQuantity(-quantity_used);
2337 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
2338 GetHierarchyParent().IncreaseLifetimeUp();
2347 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
2348 if (moduleRecipesManager)
2350 EntityAI itemInHands = player.GetEntityInHands();
2351 moduleRecipesManager.GetValidRecipes(ItemBase.Cast(
this), ItemBase.Cast(itemInHands), recipesIds, p);
2354 for (
int i = 0;i < recipesIds.Count(); i++)
2356 int key = recipesIds.Get(i);
2357 string recipeName = moduleRecipesManager.GetRecipeName(key);
2365 super.GetDebugActions(outputList);
2391 if (IsLiquidContainer())
2409 GetInventory().GetCurrentInventoryLocation(loc);
2412 if (Gizmo_IsSupported())
2425 super.OnAction(action_id, player, ctx);
2452 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
2454 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
2455 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
2457 if (
EActions.RECIPES_RANGE_START < 1000)
2459 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
2460 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
2464 else if (action_id ==
EActions.WATCH_PLAYER)
2466 PluginDeveloper.SetDeveloperItemClientEx(player);
2471 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
2473 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
2474 OnDebugButtonPressServer(
id + 1);
2477 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
2479 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
2483 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
2485 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
2489 else if (action_id ==
EActions.ADD_QUANTITY)
2493 Magazine mag = Magazine.Cast(
this);
2494 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
2503 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
2508 else if (action_id ==
EActions.REMOVE_QUANTITY)
2512 Magazine mag2 = Magazine.Cast(
this);
2513 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
2521 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
2526 else if (action_id ==
EActions.SET_QUANTITY_0)
2536 else if (action_id ==
EActions.SET_MAX_QUANTITY)
2542 m_EM.SetEnergy(m_EM.GetEnergyMax());
2546 else if (action_id ==
EActions.ADD_HEALTH)
2548 AddHealth(
"",
"",GetMaxHealth(
"",
"Health")/5);
2550 else if (action_id ==
EActions.REMOVE_HEALTH)
2552 AddHealth(
"",
"",-GetMaxHealth(
"",
"Health")/5);
2554 else if (action_id ==
EActions.DESTROY_HEALTH)
2556 SetHealth01(
"",
"",0);
2558 else if (action_id ==
EActions.WATCH_ITEM)
2561 mid.RegisterDebugItem(ItemBase.Cast(
this),
PlayerBase.Cast(player));
2563 SetDebugDeveloper_item(
this);
2567 else if (action_id ==
EActions.ADD_TEMPERATURE)
2573 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
2575 AddTemperature(-20);
2579 else if (action_id ==
EActions.FLIP_FROZEN)
2581 SetFrozen(!GetIsFrozen());
2585 else if (action_id ==
EActions.ADD_WETNESS)
2591 else if (action_id ==
EActions.REMOVE_WETNESS)
2597 else if (action_id ==
EActions.LIQUIDTYPE_UP)
2605 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
2611 else if (action_id ==
EActions.MAKE_SPECIAL)
2613 auto debugParams = DebugSpawnParams.WithPlayer(player);
2614 OnDebugSpawnEx(debugParams);
2656 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
2657 return g_Game.ConfigIsExisting(config_path);
2683 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
2684 return module_repairing.CanRepair(
this, item_repair_kit);
2690 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
2691 return module_repairing.Repair(player,
this, item_repair_kit, specialty_weight);
2712 return m_CanBeMovedOverride;
2719 m_CanBeMovedOverride = setting;
2736 player.MessageStatus(text);
2754 player.MessageAction(text);
2772 player.MessageFriendly(text);
2790 player.MessageImportant(text);
2803 string item_name = this.
GetType();
2805 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
2807 int array_size = item_tag_array.Count();
2808 for (
int i = 0; i < array_size; i++)
2810 if (item_tag_array.Get(i) == tag)
2823 super.OnRPC(sender, rpc_type,ctx);
2829 case ERPCs.RPC_SOUND_LOCK_ATTACH:
2835 bool play = p.param1;
2836 string soundSet = p.param2;
2873 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
2874 return plugin.GetID(
name);
2879 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
2880 return plugin.GetName(
id);
2889 if (!ctx.Read(varFlags))
2901 super.SerializeNumericalVars(floats_out);
2907 floats_out.Insert(m_VarQuantity);
2912 floats_out.Insert(m_VarWet);
2917 floats_out.Insert(m_VarLiquidType);
2930 floats_out.Insert(m_Cleanness);
2937 super.DeSerializeNumericalVars(floats);
2941 int mask =
Math.Round(floats.Get(index));
2953 float quantity = floats.Get(index);
2961 float wet = floats.Get(index);
2968 int liquidtype =
Math.Round(floats.Get(index));
2987 int cleanness =
Math.Round(floats.Get(index));
2995 super.WriteVarsToCTX(ctx);
3031 if (!super.ReadVarsFromCTX(ctx,version))
3039 if (!ctx.Read(intValue))
3042 m_VariablesMask = intValue;
3047 if (!ctx.Read(value))
3064 if (!ctx.Read(value))
3066 SetTemperatureDirect(value);
3072 if (!ctx.Read(value))
3079 if (!ctx.Read(intValue))
3101 if (!ctx.Read(intValue))
3106 if (version >= 138 && version < 140)
3110 if (!ctx.Read(intValue))
3112 SetFrozen(intValue);
3122 m_IsStoreLoad =
true;
3125 m_FixDamageSystemInit =
true;
3128 if (!super.OnStoreLoad(ctx, version))
3130 m_IsStoreLoad =
false;
3136 bool hasQuickBarIndexSaved;
3138 if (!ctx.Read(hasQuickBarIndexSaved))
3140 m_IsStoreLoad =
false;
3144 if (hasQuickBarIndexSaved)
3149 if (!ctx.Read(itmQBIndex))
3151 m_IsStoreLoad =
false;
3156 if (itmQBIndex != -1 && parentPlayer)
3157 parentPlayer.SetLoadedQuickBarItemBind(
this, itmQBIndex);
3165 if (version ==
int.
MAX)
3167 if (!ctx.Read(itemQBIndex))
3169 m_IsStoreLoad =
false;
3173 else if (
Class.CastTo(player, GetHierarchyRootPlayer()))
3176 if (!ctx.Read(itemQBIndex))
3178 m_IsStoreLoad =
false;
3181 if (itemQBIndex != -1 && player)
3182 player.SetLoadedQuickBarItemBind(
this,itemQBIndex);
3189 if (!LoadVariables(ctx, version))
3191 m_IsStoreLoad =
false;
3199 m_IsStoreLoad =
false;
3209 m_IsStoreLoad =
false;
3215 m_IsStoreLoad =
false;
3223 super.OnStoreSave(ctx);
3226 if (
PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
3230 int itemQBIndex = -1;
3231 itemQBIndex = player.FindQuickBarEntityIndex(
this);
3232 ctx.Write(itemQBIndex);
3251 super.AfterStoreLoad();
3253 if (m_FixDamageSystemInit)
3267 super.EEOnAfterLoad();
3269 if (m_FixDamageSystemInit)
3271 m_FixDamageSystemInit =
false;
3289 #ifdef PLATFORM_CONSOLE
3304 PlayImpactSound(m_ConfigWeight, m_ImpactSpeed, m_ImpactSoundSurfaceHash);
3305 m_WantPlayImpactSound =
false;
3308 if (m_VarQuantity != m_VarQuantityPrev)
3311 m_VarQuantityPrev = m_VarQuantity;
3313 if (m_VarWet != m_VarWetPrev)
3316 m_VarWetPrev = m_VarWet;
3321 if (m_ItemSoundHandler)
3329 if (m_ItemSoundHandler)
3334 super.OnVariablesSynchronized();
3340 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
3342 if (!IsServerCheck(allow_client))
3351 if (value <= (min + 0.001))
3358 bool dstr = ConfigGetBool(
"varQuantityDestroyOnMin");
3361 m_VarQuantity =
Math.Clamp(value, min, max);
3366 else if (destroy_forced)
3368 m_VarQuantity =
Math.Clamp(value, min, max);
3376 float delta = m_VarQuantity;
3377 m_VarQuantity =
Math.Clamp(value, min, max);
3381 EntityAI parent = GetHierarchyRoot();
3383 GetInventory().GetCurrentInventoryLocation(iLoc);
3384 if (iLoc && iLoc.IsValid() && delta != m_VarQuantity)
3386 int iLocSlot = iLoc.GetSlot();
3400 delta = m_VarQuantity - delta;
3413 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
3433 float value_clamped =
Math.Clamp(value, 0, 1);
3435 SetQuantity(result, destroy_config, destroy_forced);
3467 slot = il.GetSlot();
3475 float quantity_max = 0;
3479 if (attSlotID != -1)
3482 if (quantity_max <= 0)
3483 quantity_max = m_VarStackMax;
3486 if (quantity_max <= 0)
3487 quantity_max = m_VarQuantityMax;
3489 return quantity_max;
3494 return m_VarQuantityMin;
3499 return m_VarQuantityInit;
3510 return m_VarQuantity;
3522 float weightEx = GetWeightEx();
3523 float special = GetInventoryAndCargoWeight();
3524 return weightEx - special;
3538 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
3541 data1.SetCalcDetails(
"TIB1: " + GetConfigWeightModifiedDebugText() +
" * " +
GetQuantity()+
"(quantity)");
3547 else if (HasEnergyManager())
3550 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
3553 data2.SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
3556 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
3561 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
3564 data3.SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
3567 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
3581 item_count = cargo.GetItemCount();
3585 for (
int i = 0; i < nAttachments; ++i)
3589 item_count += item.GetNumberOfItems();
3599 if (include_wetness)
3603 weight = wetness * m_ConfigWeight;
3605 else if (IsLiquidContainer())
3617 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
3621 for (
int i = 0; i < items.Count(); ++i)
3623 ItemBase item = ItemBase.Cast(items.Get(i));
3626 g_Game.ObjectDelete(item);
3638 if (HasEnergyManager())
3640 energy = GetCompEM().GetEnergy();
3648 super.OnEnergyConsumed();
3655 super.OnEnergyAdded();
3663 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
3667 float energy_0to1 = GetCompEM().GetEnergy0To1();
3676 return ConfigGetFloat(
"heatIsolation");
3681 return m_HeatIsolation;
3686 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
3687 if (
g_Game.ConfigIsExisting(paramPath))
3688 return g_Game.ConfigGetFloat(paramPath);
3695 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
3696 if (
g_Game.ConfigIsExisting(paramPath))
3697 return g_Game.ConfigGetFloat(paramPath);
3702 override void SetWet(
float value,
bool allow_client =
false)
3704 if (!IsServerCheck(allow_client))
3710 float previousValue = m_VarWet;
3712 m_VarWet =
Math.Clamp(value, min, max);
3714 if (previousValue != m_VarWet)
3748 return m_VarWetInit;
3755 if (newLevel != oldLevel)
3768 return GetWetLevelInternal(m_VarWet);
3775 m_IsStoreLoad = value;
3780 return m_IsStoreLoad;
3785 m_StoreLoadedQuantity = value;
3790 return m_StoreLoadedQuantity;
3797 if (ConfigIsExisting(
"itemModelLength"))
3799 return ConfigGetFloat(
"itemModelLength");
3806 if (ConfigIsExisting(
"itemAttachOffset"))
3808 return ConfigGetFloat(
"itemAttachOffset");
3815 if (!IsServerCheck(allow_client))
3818 int previousValue = m_Cleanness;
3820 m_Cleanness =
Math.Clamp(value, m_CleannessMin, m_CleannessMax);
3822 if (previousValue != m_Cleanness)
3861 override void GetColor(out
int r,out
int g,out
int b,out
int a)
3883 return MiscGameplayFunctions.GetColorString(r, g, b, a);
3890 if (!IsServerCheck(allow_client))
3893 int old = m_VarLiquidType;
3894 m_VarLiquidType = value;
3901 return ConfigGetInt(
"varLiquidTypeInit");
3906 return m_VarLiquidType;
3918 player.SetEnableQuickBarEntityShortcut(
this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
3928 m_CanPlayImpactSound =
true;
3929 nplayer.SetEnableQuickBarEntityShortcut(
this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
3940 nplayer.SetEnableQuickBarEntityShortcut(
this,
false);
3943 player.GetHumanInventory().ClearUserReservedLocationForContainer(
this);
3945 if (HasEnergyManager())
3947 GetCompEM().UpdatePlugState();
3954 super.OnPlacementStarted(player);
3963 m_AdminLog.OnPlacementComplete(player,
this);
3966 super.OnPlacementComplete(player, position, orientation);
3975 if (agent_id & m_AttachedAgents)
3990 m_AttachedAgents = ~agent_id & m_AttachedAgents;
3997 m_AttachedAgents = 0;
4002 m_AttachedAgents = m_AttachedAgents & agent_to_keep;
4010 m_AttachedAgents = (agent | m_AttachedAgents);
4016 m_AttachedAgents = (m_AttachedAgents | agents);
4022 return m_AttachedAgents;
4068 if (!ctx.Read(m_AttachedAgents))
4076 ctx.Write(m_AttachedAgents);
4083 super.CheckForRoofLimited(timeTresholdMS);
4085 float time =
g_Game.GetTime();
4086 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
4088 m_PreviousRoofTestTime = time;
4089 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(
this));
4101 if (GetInventory().GetAttachmentSlotsCount() != 0)
4103 ItemBase filter = ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
4105 return filter.GetProtectionLevel(type,
false, system);
4110 string subclassPath, entryName;
4115 entryName =
"biological";
4118 entryName =
"chemical";
4121 entryName =
"biological";
4125 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
4127 return g_Game.ConfigGetFloat(subclassPath + entryName);
4136 SetCEBasedQuantity();
4169 if (!parent.IsRuined())
4178 if (!super.CanPutAsAttachment(parent))
4183 if (!IsRuined() && !parent.IsRuined())
4197 return super.CanReceiveItemIntoCargo(item);
4207 if (attachmentInv && attachmentInv.
GetCargo() && attachmentInv.
GetCargo().GetItemCount() > 0)
4209 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(
PlayerBase))
4214 attachment.GetInventory().GetCurrentInventoryLocation(loc);
4215 if (loc && loc.IsValid() && !GetInventory().AreChildrenAccessible())
4218 return super.CanReceiveAttachment(attachment, slotId);
4223 if (!super.CanReleaseAttachment(attachment))
4226 return GetInventory().AreChildrenAccessible();
4249 static void PlayFireParticles(ItemBase weapon,
int muzzle_index,
string ammoType, ItemBase muzzle_owner, ItemBase suppressor,
string config_to_search)
4251 int id = muzzle_owner.GetMuzzleID();
4256 for (
int i = 0; i < WPOF_array.Count(); i++)
4258 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
4262 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
4271 int id = muzzle_owner.GetMuzzleID();
4276 for (
int i = 0; i < WPOBE_array.Count(); i++)
4278 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
4282 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
4289 static void PlayOverheatingParticles(ItemBase weapon,
string ammoType, ItemBase muzzle_owner, ItemBase suppressor,
string config_to_search)
4291 int id = muzzle_owner.GetMuzzleID();
4296 for (
int i = 0; i < WPOOH_array.Count(); i++)
4298 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
4302 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
4311 int id = muzzle_owner.GetMuzzleID();
4316 for (
int i = 0; i < WPOOH_array.Count(); i++)
4318 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
4322 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
4329 static void StopOverheatingParticles(ItemBase weapon,
string ammoType, ItemBase muzzle_owner, ItemBase suppressor,
string config_to_search)
4331 int id = muzzle_owner.GetMuzzleID();
4336 for (
int i = 0; i < WPOOH_array.Count(); i++)
4338 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
4342 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
4352 if (m_ItemBehaviour == 0)
4362 if (m_ItemBehaviour == 1)
4372 if (m_ItemBehaviour == 2)
4396 m_IsTakeable = pState;
4402 return m_IsTakeable;
4414 string att_type =
"None";
4416 if (ConfigIsExisting(
"soundAttType"))
4418 att_type = ConfigGetString(
"soundAttType");
4441 if (!m_ItemSoundHandler)
4444 return m_ItemSoundHandler;
4462 params.m_Loop =
true;
4532 SetDynamicPhysicsLifeTime(0.01);
4533 m_ItemBeingDroppedPhys =
false;
4539 GetDamageZones(zone_names);
4540 for (
int i = 0; i < zone_names.Count(); i++)
4542 SetHealthMax(zone_names.Get(i),
"Health");
4544 SetHealthMax(
"",
"Health");
4550 float global_health = GetHealth01(
"",
"Health");
4552 GetDamageZones(zones);
4554 for (
int i = 0; i < zones.Count(); i++)
4556 SetHealth01(zones.Get(i),
"Health",global_health);
4563 return IsExclusionFlagPresent(
PlayerBase.GetFaceCoverageShaveValues());
4568 if (!hasRootAsPlayer)
4573 if ((refParentIB.GetWet() >=
GameConstants.STATE_SOAKING_WET) && (m_VarWet < m_VarWetMax))
4576 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (m_VarWet < m_VarWetMax))
4579 else if (m_VarWet > m_VarWetMin)
4585 if (m_VarWet > m_VarWetMin)
4595 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
4596 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
4598 float heatPermCoef = 1.0;
4602 heatPermCoef *= ent.GetHeatPermeabilityCoef();
4603 ent = ent.GetHierarchyParent();
4611 void HierarchyCheck(out
bool hasParent, out
bool hasRootAsPlayer, out ItemBase refParentIB)
4614 EntityAI parent = GetHierarchyParent();
4618 hasRootAsPlayer =
false;
4623 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
4624 refParentIB = ItemBase.Cast(parent);
4655 return !GetIsFrozen() &&
IsOpen();
4660 bool hasParent =
false, hasRootAsPlayer =
false;
4661 ItemBase refParentIB;
4663 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
4664 bool foodDecay =
g_Game.IsFoodDecayEnabled();
4666 if (wwtu || foodDecay)
4672 if (processWetness || processTemperature || processDecay)
4677 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
4679 if (processTemperature)
4683 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
4691 return m_TemperaturePerQuantityWeight *
GameConstants.ITEM_TEMPERATURE_QUANTITY_WEIGHT_MULTIPLIER;
4699 return super.GetTemperatureFreezeThreshold();
4707 return super.GetTemperatureThawThreshold();
4715 return super.GetItemOverheatThreshold();
4723 return super.GetTemperatureFreezeTime();
4731 return super.GetTemperatureThawTime();
4741 return (item.IsKindOf(
"Cauldron") || item.IsKindOf(
"Pot") || item.IsKindOf(
"FryingPan") || item.IsKindOf(
"SmallProtectorCase") || (item.IsKindOf(
"PortableGasStove") && item.FindAttachmentBySlotName(
"CookingEquipment")));
4746 MiscGameplayFunctions.TransferItemProperties(oldItem,
this);
4781 ItemBase explosive = otherDevice;
4789 explosive.PairRemote(trg);
4793 trg.SetPersistentPairID(persistentID);
4794 explosive.SetPersistentPairID(persistentID);
4807 ret *= GetHealth01();
4813 override void SetDebugItem()
4815 super.SetDebugItem();
4821 string text = super.GetDebugText();
4824 text +=
string.Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
4870 [
Obsolete(
"Use ItemSoundHandler instead")]
4874 if (!
g_Game.IsDedicatedServer())
4876 if (ConfigIsExisting(
"attachSoundSet"))
4878 string cfg_path =
"";
4879 string soundset =
"";
4884 ConfigGetTextArray(
"attachSoundSet",cfg_soundset_array);
4885 ConfigGetTextArray(
"attachSoundSlot",cfg_slot_array);
4887 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
4889 for (
int i = 0; i < cfg_soundset_array.Count(); i++)
4891 if (cfg_slot_array[i] == slot_type)
4893 soundset = cfg_soundset_array[i];
4917 if (is_item && full_quantity)
4920 item.SetQuantity(item.GetQuantityInit());
4936 item.SetHealth(
"",
"", health);
4938 if (item.CanHaveTemperature())
4941 if (item.CanFreeze())
4942 item.SetFrozen(
false);
4945 if (item.HasEnergyManager())
4949 item.GetCompEM().SetEnergy0To1(quantity);
4953 item.GetCompEM().SetEnergy(
Math.AbsFloat(quantity));
4956 else if (item.IsMagazine())
4958 Magazine mag = Magazine.Cast(item);
4961 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
4965 mag.ServerSetAmmoCount(
Math.AbsFloat(quantity));
4973 item.SetQuantityNormalized(quantity,
false);
4977 item.SetQuantity(
Math.AbsFloat(quantity));
Param4< int, int, string, int > TSelectableActionInfoWithColor
Param3 TSelectableActionInfo
InventoryMode
NOTE: PREDICTIVE is not to be used at all in multiplayer.
eBleedingSourceType GetType()
ItemSuppressor SuppressorBase
void ActionManagerBase(PlayerBase player)
map< typename, ref array< ActionBase_Basic > > TInputActionMap
void AddAction(typename actionName)
void RemoveAction(typename actionName)
TInputActionMap m_InputActionMap
override void GetActions(typename action_input_type, out array< ActionBase_Basic > actions)
const int ECE_PLACE_ON_SURFACE
const int ECE_IN_INVENTORY
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
PlayerSpawnPreset slotName
void OnItemLocationChanged(ItemBase item)
represents base for cargo storage for entities
Super root of all classes in Enforce script.
void SetEnergy0To1(float energy01)
Energy manager: Sets stored energy for this device between 0 and MAX based on relative input value be...
float GetEnergyMaxPristine()
Energy manager: Returns the maximum amount of energy this device can store. It's damage is NOT taken ...
Wrapper class for managing sound through SEffectManager.
override void SetAutodestroy(bool auto_destroy)
Sets whether Effect automatically cleans up when it stops.
script counterpart to engine's class Inventory
proto native EntityAI GetAttachmentFromIndex(int index)
proto native bool GetCurrentInventoryLocation(out notnull InventoryLocation loc)
returns information about current item location
proto native bool EnumerateInventory(InventoryTraversalType tt, out array< EntityAI > items)
enumerate inventory using traversal type and filling items array
proto native CargoBase GetCargo()
cargo
const int c_InventoryReservationTimeoutShortMS
static proto native EntityAI LocationCreateEntity(notnull InventoryLocation inv_loc, string type, int iSetupFlags, int iRotation)
creates new item directly at location
proto native int AttachmentCount()
Returns count of attachments attached to this item.
proto native bool FindFreeLocationFor(notnull EntityAI item, FindInventoryLocationType flags, out notnull InventoryLocation loc)
FindFreeLocationFor.
override string GetAttachmentSoundType()
bool IsActionTargetVisible()
override float GetQuantity()
void SetZoneDamageCEInit()
Sets zone damages to match randomized global health set by CE (CE spawn only).
override void OnEnergyConsumed()
string GetLoopDeploySoundset()
override void ClearInventory()
void SoundSynchRemoteReset()
void PlayDeployLoopSoundEx()
override void EEOnCECreate()
Called when entity is being created as new by CE/ Debug.
void OnActivatedByItem(notnull ItemBase item)
Called when this item is activated by other.
EffectSound m_SoundDeployFinish
ItemBase GetLightSourceItem()
override bool IsOneHandedBehaviour()
override void SetColor(int r, int g, int b, int a)
override int GetCleanness()
float ComputeQuantityUsedEx(ItemBase other_item, bool use_stack_max=true)
override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
override float GetTemperatureThawThreshold()
FoodStage GetFoodStage()
overridden on Edible_Base; so we don't have to parse configs all the time
void SplitItemToInventoryLocation(notnull InventoryLocation dst)
override bool HasQuantity()
override float GetTemperatureThawTime()
void StopItemDynamicPhysics()
void UpdateQuickbarShortcutVisibility(PlayerBase player)
To be called on moving item within character's inventory; 'player' should never be null.
override bool IsStoreLoad()
override bool CanReceiveAttachment(EntityAI attachment, int slotId)
override float GetWetMin()
override bool CanDisplayCargo()
override void SetWetMax()
bool CanPlayDeployLoopSound()
array< string > GetHeadHidingSelection()
float GetHeatIsolationInit()
void OnAttachmentQuantityChanged(ItemBase item)
Called on server side when some attachment's quantity is changed. Call super.OnAttachmentQuantityChan...
void StartItemSoundServer(int id, int slotId)
override void ProcessVariables()
bool HidesSelectionBySlot()
override void OnPlacementComplete(Man player, vector position="0 0 0", vector orientation="0 0 0")
bool m_IsSoundSynchRemote
void RemoveAudioVisualsOnClient()
void MessageToOwnerAction(string text)
Send message to owner player in yellow color.
void SetIsPlaceSound(bool is_place_sound)
void ClearStopItemSoundServer()
override void RemoveAllAgents()
bool AddQuantity(float value, bool destroy_config=true, bool destroy_forced=false)
add item quantity[related to varQuantity... config entry], destroy_config = true > if the quantity re...
override void OnStoreSave(ParamsWriteContext ctx)
string GetLoopFoldSoundset()
override bool CanPutInCargo(EntityAI parent)
override void SetQuantityToMinimum()
WrittenNoteData GetWrittenNoteData()
float GetTemperaturePerQuantityWeight()
Used in heat comfort calculations only!
ref TIntArray m_SingleUseActions
override void SetTakeable(bool pState)
array< int > GetValidFinishers()
returns an array of possible finishers
bool CanBeCookedOnStick()
string GetColorString()
Returns item's PROCEDURAL color as formated string, i.e. "#(argb,8,8,3)color(0.15,...
float GetBaitEffectivity()
generic effectivity as a bait for animal catching
bool CanBeConsumed(ConsumeConditionData data=null)
Items cannot be consumed if frozen by default. Override for exceptions.
override void SetWet(float value, bool allow_client=false)
float GetSoakingIncrement(string pIncrementName)
override void CheckForRoofLimited(float timeTresholdMS=3000)
Roof check for entity, limited by time (anti-spam solution).
void SplitIntoStackMaxHandsClient(PlayerBase player)
void ProcessItemTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
void CombineItems(ItemBase other_item, bool use_stack_max=true)
void OnInventoryExit(Man player)
Event called on item when it is removed from the player(Man) inventory, passes the old owner as a par...
override float GetTemperatureFreezeTime()
void TransferAgents(int agents)
transfer agents from another item
float GetUnitWeight(bool include_wetness=true)
Obsolete, use GetWeightEx instead.
override bool CanPutAsAttachment(EntityAI parent)
ref EffectSound m_LockingSound
void HierarchyCheck(out bool hasParent, out bool hasRootAsPlayer, out ItemBase refParentIB)
int GetNumberOfItems()
Returns the number of items in cargo, otherwise returns 0(non-cargo objects). Recursive.
ItemSoundHandler GetItemSoundHandler()
bool Repair(PlayerBase player, ItemBase item_repair_kit, float specialty_weight)
void SaveAgents(ParamsWriteContext ctx)
void AffectLiquidContainerOnFill(int liquid_type, float amount)
from enviro source
override void SetQuantityNormalized(float value, bool destroy_config=true, bool destroy_forced=false)
Sets quantity in normalized 0..1 form between the item's Min a Max values as defined by item's config...
void SplitIntoStackMaxHands(PlayerBase player)
override void OnEnergyAdded()
void StopDeployLoopSoundEx()
void SplitIntoStackMaxCargo(EntityAI destination_entity, int idx, int row, int col)
override bool KindOf(string tag)
override void InsertAgent(int agent, float count=1)
override EWetnessLevel GetWetLevel()
override int GetQuantityMax()
void SplitIntoStackMaxToInventoryLocationClient(notnull InventoryLocation dst)
void ConvertEnergyToQuantity()
void PlayAttachSound(string slot_type)
Plays sound on item attach. Be advised, the config structure may slightly change in 1....
override float GetWetInit()
override void SetStoreLoadedQuantity(float value)
override void SplitIntoStackMaxEx(EntityAI destination_entity, int slot_id)
void SetIsDeploySound(bool is_deploy_sound)
override void RemoveAllAgentsExcept(int agent_to_keep)
override void OnPlacementStarted(Man player)
override int GetLiquidType()
void PerformDamageSystemReinit()
override bool SetQuantity(float value, bool destroy_config=true, bool destroy_forced=false, bool allow_client=false, bool clamp_to_stack_max=true)
Set item quantity[related to varQuantity... config entry], destroy_config = true > if the quantity re...
static void PlayBulletCasingEjectParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
void RefreshAudioVisualsOnClient(CookingMethodType cooking_method, bool is_done, bool is_empty, bool is_burned)
cooking-related effect methods
bool GetActionWidgetOverride(out typename name)
If we need a different (handheld)item action widget displayed, the logic goes in here.
override int GetTargetQuantityMax(int attSlotID=-1)
void StartItemSoundServer(int id)
override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
bool IsCargoException4x3(EntityAI item)
override void EEOnAfterLoad()
override void SetLiquidType(int value, bool allow_client=false)
override void OnVariablesSynchronized()
void OnInventoryEnter(Man player)
Event called on item when it is placed in the player(Man) inventory, passes the owner as a parameter.
override float GetSingleInventoryItemWeightEx()
override bool IsIgnoredByConstruction()
void OnActivatedByTripWire()
bool ContainsAgent(int agent_id)
bool CanBeMovedOverride()
void Open()
Implementations only.
bool m_HideSelectionsBySlot
bool m_IsResultOfSplit string m_SoundAttType
distinguish if item has been created as new or it came from splitting (server only flag)
override bool IsItemBase()
override bool IsTwoHandedBehaviour()
override float GetItemOverheatThreshold()
static void StopOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
float GetWeightSpecialized(bool forceRecalc=false)
float GetDeployTime()
how long it takes to deploy this item in seconds
override float GetStoreLoadedQuantity()
float GetBandagingEffectivity()
bool CanBeUsedForSuicide()
override void OnWetLevelChanged(EWetnessLevel newLevel, EWetnessLevel oldLevel)
override bool IsTakeable()
override void SetCleanness(int value, bool allow_client=false)
override void SetStoreLoad(bool value)
int ComputeQuantityUsed(ItemBase other_item, bool use_stack_max=true)
override bool ReadVarsFromCTX(ParamsReadContext ctx, int version=-1)
bool IsCombineAll(ItemBase other_item, bool use_stack_max=false)
override void DeSerializeNumericalVars(array< float > floats)
EffectSound m_SoundDeploy
bool ShouldSplitQuantity(float quantity)
override float GetTemperatureFreezeThreshold()
void ProcessItemWetness(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
override void AfterStoreLoad()
float GetSingleInventoryItemWeight()
void OnSyncVariables(ParamsReadContext ctx)
DEPRECATED (most likely).
override int GetQuantityMin()
void StopItemSoundServer(int id)
string GetPlaceSoundset()
void SplitIntoStackMaxToInventoryLocation(notnull InventoryLocation dst)
override void WriteVarsToCTX(ParamsWriteContext ctx)
void PlayDeployFinishSound()
float GetDryingIncrement(string pIncrementName)
override void RemoveAgent(int agent_id)
static void PlayFireParticles(ItemBase weapon, int muzzle_index, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
float GetProtectionLevel(int type, bool consider_filter=false, int system=0)
void SplitIntoStackMaxCargoClient(EntityAI destination_entity, int idx, int row, int col)
void ProcessItemWetnessAndTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
override void SerializeNumericalVars(array< float > floats_out)
override void SplitIntoStackMaxClient(EntityAI destination_entity, int slot_id)
void SetCanBeMovedOverride(bool setting)
static void PlayOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
override bool CanReceiveItemIntoCargo(EntityAI item)
void GetRecipesActions(Man player, out TSelectableActionInfoArray outputList)
bool IsSoundSynchRemote()
void CopyScriptPropertiesFrom(EntityAI oldItem)
PluginAdminLog m_AdminLog
override void OnRPC(PlayerIdentity sender, int rpc_type, ParamsReadContext ctx)
float GetItemModelLength()
override void EEHealthLevelChanged(int oldLevel, int newLevel, string zone)
void ClearStartItemSoundServer()
void OnCombine(ItemBase other_item)
void SetResultOfSplit(bool value)
void SplitItem(PlayerBase player)
override bool OnStoreLoad(ParamsReadContext ctx, int version)
static void UpdateOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
override void OnWetChanged(float newVal, float oldVal)
void OnLiquidTypeChanged(int oldType, int newType)
override bool CanBeCombined(EntityAI other_item, bool reservation_check=true, bool stack_max_limit=false)
void MessageToOwnerStatus(string text)
Send message to owner player in grey color.
bool IsCoverFaceForShave(string slot_name)
DEPRECATED in use, but returns correct values nontheless. Check performed elsewhere.
int NameToID(string name)
void MessageToOwnerFriendly(string text)
Send message to owner player in green color.
ref array< int > m_CompatibleLocks
ref TIntArray m_ContinuousActions
float GetItemAttachOffset()
bool CanRepair(ItemBase item_repair_kit)
void AffectLiquidContainerOnTransfer(int liquidType, float amount, float sourceLiquidTemperature)
from other liquid container source
bool PairWithDevice(notnull ItemBase otherDevice)
override void GetColor(out int r, out int g, out int b, out int a)
gets item's color variable as components
override void CombineItemsEx(EntityAI entity2, bool use_stack_max=true)
void SetInventoryLocationToVicinityOrCurrent(EntityAI root, inout InventoryLocation dst)
EffectSound m_DeployLoopSoundEx
void SplitIntoStackMax(EntityAI destination_entity, int slot_id, PlayerBase player)
bool AllowFoodConsumption()
string GetDeploySoundset()
void PlayDetachSound(string slot_type)
void OnAttachmentQuantityChangedEx(ItemBase item, float delta)
Called on server side when some attachment's quantity is changed. Call super.OnAttachmentQuantityChan...
ItemBase SplitIntoStackMaxToInventoryLocationEx(notnull InventoryLocation dst)
override void OnRightClick()
void ProcessDecay(float delta, bool hasRootAsPlayer)
override bool CanReleaseAttachment(EntityAI attachment)
void AddLightSourceItem(ItemBase lightsource)
Adds a light source child.
ItemBase m_LightSourceItem
void OnQuantityChanged(float delta)
Called on server side when this item's quantity is changed. Call super.OnQuantityChanged(); first whe...
override float GetQuantityNormalized()
Gets quantity in normalized 0..1 form between the item's Min a Max values as defined by item's config...
bool LoadAgents(ParamsReadContext ctx, int version)
const int ITEM_SOUNDS_MAX
void PreLoadSoundAttachmentType()
Attachment Sound Type getting from config file.
ref TIntArray m_InteractActions
override bool IsHeavyBehaviour()
void MessageToOwnerImportant(string text)
Send message to owner player in red color.
float GetQuantityNormalizedScripted()
ref Timer m_PhysDropTimer
void RemoveLightSourceItem()
string GetDeployFinishSoundset()
override float GetWetMax()
ref TStringArray m_HeadHidingSelections
void OnApply(PlayerBase player)
override void AddWet(float value)
provides access to slot configuration
override void OnInventoryEnter(Man player)
override void EEDelete(EntityAI parent)
override bool CanBeRepairedByCrafting()
override void OnItemLocationChanged(EntityAI old_owner, EntityAI new_owner)
override bool IsElectricAppliance()
override bool IsItemTent()
override void SetActions()
override WrittenNoteData GetWrittenNoteData()
override int GetDamageSystemVersionChange()
override void OnCreatePhysics()
override string GetDeploySoundset()
override bool IsSelfAdjustingTemperature()
override bool IsPlayerInside(PlayerBase player, string selection)
override void RefreshPhysics()
override bool CanObstruct()
override string GetLoopDeploySoundset()
override void OnInventoryExit(Man player)
override void InitItemSounds()
override bool IsFacingPlayer(PlayerBase player, string selection)
override void OnEndPlacement()
void Stop()
Legacy function for backwards compatibility with 1.14 and below.
The class that will be instanced (moddable).
void SetControlledDevice(EntityAI pDevice)
bool OnStoreLoad(ParamsReadContext ctx, int version)
void OnStoreSave(ParamsWriteContext ctx)
static int GeneratePersistentID()
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.
static void DestroyEffect(Effect effect)
Unregisters, stops and frees the Effect.
void OnRPC(PlayerIdentity sender, int rpc_type, ParamsReadContext ctx)
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
DamageType
exposed from C++ (do not change)
override bool IsExplosive()
override bool IsPrepareToDelete()
override bool CanHaveTemperature()
Serializer ParamsReadContext
InventoryTraversalType
tree traversal type, for more see http://en.wikipedia.org/wiki/Tree_traversal
Serializer ParamsWriteContext
GasMask_Filter ItemBase GetFilterDamageRatio()
proto GizmoApi GetGizmoApi()
class GP5GasMask extends MaskBase ItemBase
const int COMP_TYPE_ENERGY_MANAGER
void Error(string err)
Messagebox with error message.
proto native void SetColor(int color)
array< string > TStringArray
void Obsolete(string msg="")
EntityEvent
Entity events for event-mask, or throwing event from code.
const int VARIABLE_LIQUIDTYPE
const int VARIABLE_CLEANNESS
const int VARIABLE_TEMPERATURE
const int VARIABLE_QUANTITY
proto native bool dBodyIsDynamic(notnull IEntity ent)
const int SAT_DEBUG_ACTION
vector GetPosition()
Get the world position of the Effect.
FindInventoryLocationType
flags for searching locations in inventory
InventoryLocationType
types of Inventory Location
class BoxCollidingParams component
ComponentInfo for BoxCollidingResult.
void SplitItem(PlayerBase player)
override void InsertAgent(int agent, float count=1)
override float GetQuantityNormalized()
Gets quantity in normalized 0..1 form between the item's Min a Max values as defined by item's config...
void ProcessItemTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
map< typename, ref ActionOverrideData > TActionAnimOverrideMap
override void SetWet(float value, bool allow_client=false)
void StartItemSoundServer(int id, int slotId)
bool LoadAgents(ParamsReadContext ctx, int version)
ref array< int > m_CompatibleLocks
void SplitIntoStackMax(EntityAI destination_entity, int slot_id, PlayerBase player)
ItemBaseType Inventory_BaseType
override float GetWetMax()
bool m_CanBeMovedOverride
string GetPlaceSoundset()
bool AddQuantity(float value, bool destroy_config=true, bool destroy_forced=false)
add item quantity[related to varQuantity... config entry], destroy_config = true > if the quantity re...
override float GetQuantity()
override void OnWetChanged(float newVal, float oldVal)
float GetDryingIncrement(string pIncrementName)
bool m_CanPlayImpactSound
override bool IsStoreLoad()
int ComputeQuantityUsed(ItemBase other_item, bool use_stack_max=true)
void SetResultOfSplit(bool value)
void SplitIntoStackMaxCargo(EntityAI destination_entity, int idx, int row, int col)
void OnAttachmentQuantityChanged(ItemBase item)
Called on server side when some attachment's quantity is changed. Call super.OnAttachmentQuantityChan...
override float GetStoreLoadedQuantity()
const int ITEM_SOUNDS_MAX
float GetItemModelLength()
override bool ReadVarsFromCTX(ParamsReadContext ctx, int version=-1)
void CombineItems(ItemBase other_item, bool use_stack_max=true)
float GetHeatIsolationInit()
override bool HasQuantity()
void PreLoadSoundAttachmentType()
Attachment Sound Type getting from config file.
int m_ImpactSoundSurfaceHash
void SetupSpawnedItem(ItemBase item, float health, float quantity)
bool ShouldSplitQuantity(float quantity)
class ItemBase extends InventoryItem SpawnItemOnLocation(string object_name, notnull InventoryLocation loc, bool full_quantity)
ItemSoundHandler GetItemSoundHandler()
override int GetQuantityMin()
override void SetTakeable(bool pState)
void HierarchyCheck(out bool hasParent, out bool hasRootAsPlayer, out ItemBase refParentIB)
bool can_this_be_combined
void ConvertEnergyToQuantity()
override void RemoveAllAgents()
bool m_WantPlayImpactSound
override void SetLiquidType(int value, bool allow_client=false)
void OnQuantityChanged(float delta)
Called on server side when this item's quantity is changed. Call super.OnQuantityChanged(); first whe...
override void SetQuantityNormalized(float value, bool destroy_config=true, bool destroy_forced=false)
Sets quantity in normalized 0..1 form between the item's Min a Max values as defined by item's config...
void SetInventoryLocationToVicinityOrCurrent(EntityAI root, inout InventoryLocation dst)
void SetZoneDamageCEInit()
Sets zone damages to match randomized global health set by CE (CE spawn only).
override float GetSingleInventoryItemWeightEx()
void SaveAgents(ParamsWriteContext ctx)
override int GetTargetQuantityMax(int attSlotID=-1)
float GetItemAttachOffset()
override int GetLiquidType()
void ProcessDecay(float delta, bool hasRootAsPlayer)
bool IsCombineAll(ItemBase other_item, bool use_stack_max=false)
bool ContainsAgent(int agent_id)
override void AddWet(float value)
void SplitIntoStackMaxHands(PlayerBase player)
override void SetStoreLoadedQuantity(float value)
void OnLiquidTypeChanged(int oldType, int newType)
int m_LiquidContainerMask
void ProcessItemWetness(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
override int GetCleanness()
void PerformDamageSystemReinit()
ItemBase SplitIntoStackMaxToInventoryLocationEx(notnull InventoryLocation dst)
override int GetQuantityMax()
override void RemoveAgent(int agent_id)
override bool CanPutAsAttachment(EntityAI parent)
float ComputeQuantityUsedEx(ItemBase other_item, bool use_stack_max=true)
override void OnWetLevelChanged(EWetnessLevel newLevel, EWetnessLevel oldLevel)
void SplitIntoStackMaxToInventoryLocation(notnull InventoryLocation dst)
override void SetCleanness(int value, bool allow_client=false)
override float GetWetMin()
void ItemSoundHandler(ItemBase parent)
EffectSound m_LockingSound
void PluginItemDiagnostic()
PluginBase GetPlugin(typename plugin_type)
override RemotelyActivatedItemBehaviour GetRemotelyActivatedItemBehaviour()
override void Explode(int damageType, string ammoType="")