DayZ 1.28
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено

◆ GetDisinfectQuantity()

float SpawnItemOnLocation::GetDisinfectQuantity ( int system = 0,
Param param1 = null )
private

См. определение в файле ItemBase.c строка 5529

5533{
5534 override bool CanPutAsAttachment(EntityAI parent)
5535 {
5536 return true;
5537 }
5538};
5539
5540//const bool QUANTITY_DEBUG_REMOVE_ME = false;
5541
5542class ItemBase extends InventoryItem
5543{
5547
5549
5550 static int m_DebugActionsMask;
5552 // ============================================
5553 // Variable Manipulation System
5554 // ============================================
5555 // Quantity
5556
5557 float m_VarQuantity;
5558 float m_VarQuantityPrev;//for client to know quantity changed during synchronization
5560 int m_VarQuantityMin;
5561 int m_VarQuantityMax;
5562 int m_Count;
5563 float m_VarStackMax;
5564 float m_StoreLoadedQuantity = float.LOWEST;
5565 // Wet
5566 float m_VarWet;
5567 float m_VarWetPrev;//for client to know wetness changed during synchronization
5568 float m_VarWetInit;
5569 float m_VarWetMin;
5570 float m_VarWetMax;
5571 // Cleanness
5572 int m_Cleanness;
5573 int m_CleannessInit;
5574 int m_CleannessMin;
5575 int m_CleannessMax;
5576 // impact sounds
5578 bool m_CanPlayImpactSound = true;
5579 float m_ImpactSpeed;
5581 //
5582 float m_HeatIsolation;
5583 float m_ItemModelLength;
5584 float m_ItemAttachOffset; // Offset length for when the item is attached e.g. to weapon
5586 int m_VarLiquidType;
5587 int m_ItemBehaviour; // -1 = not specified; 0 = heavy item; 1= onehanded item; 2 = twohanded item
5588 int m_QuickBarBonus;
5589 bool m_IsBeingPlaced;
5590 bool m_IsHologram;
5591 bool m_IsTakeable;
5592 bool m_ThrowItemOnDrop;
5595 bool m_FixDamageSystemInit = false; //can be changed on storage version check
5596 bool can_this_be_combined; //Check if item can be combined
5597 bool m_CanThisBeSplit; //Check if item can be split
5598 bool m_IsStoreLoad = false;
5599 bool m_CanShowQuantity;
5600 bool m_HasQuantityBar;
5601 protected bool m_CanBeDigged;
5602 protected bool m_IsResultOfSplit
5603
5604 string m_SoundAttType;
5605 // items color variables
5610 //-------------------------------------------------------
5611
5612 // light source managing
5614
5618
5619 //==============================================
5620 // agent system
5621 private int m_AttachedAgents;
5622
5624 void TransferModifiers(PlayerBase reciever);
5625
5626
5627 // Weapons & suppressors particle effects
5632 static int m_LastRegisteredWeaponID = 0;
5633
5634 // Overheating effects
5636 float m_OverheatingShots;
5637 ref Timer m_CheckOverheating;
5638 int m_ShotsToStartOverheating = 0; // After these many shots, the overheating effect begins
5639 int m_MaxOverheatingValue = 0; // Limits the number of shots that will be tracked
5640 float m_OverheatingDecayInterval = 1; // Timer's interval for decrementing overheat effect's lifespan
5641 ref array <ref OverheatingParticle> m_OverheatingParticles;
5642
5644 protected bool m_HideSelectionsBySlot;
5645
5646 // Admin Log
5647 PluginAdminLog m_AdminLog;
5648
5649 // misc
5650 ref Timer m_PhysDropTimer;
5651
5652 // Attachment Locking variables
5653 ref array<int> m_CompatibleLocks;
5654 protected int m_LockType;
5655 protected ref EffectSound m_LockingSound;
5656 protected string m_LockSoundSet;
5657
5658 // ItemSoundHandler
5659 protected const int ITEM_SOUNDS_MAX = 63; // optimize network synch
5660 protected int m_SoundSyncPlay; // id for sound to play
5661 protected int m_SoundSyncStop; // id for sound to stop
5663
5664 //temperature
5665 private float m_TemperaturePerQuantityWeight;
5666
5667 // -------------------------------------------------------------------------
5668 void ItemBase()
5669 {
5670 SetEventMask(EntityEvent.INIT); // Enable EOnInit event
5674
5675 if (!GetGame().IsDedicatedServer())
5676 {
5677 if (HasMuzzle())
5678 {
5680
5682 {
5684 }
5685 }
5686
5688 m_ActionsInitialize = false;
5689 }
5690
5691 m_OldLocation = null;
5692
5693 if (GetGame().IsServer())
5694 {
5695 m_AdminLog = PluginAdminLog.Cast(GetPlugin(PluginAdminLog));
5696 }
5697
5698 if (ConfigIsExisting("headSelectionsToHide"))
5699 {
5701 ConfigGetTextArray("headSelectionsToHide",m_HeadHidingSelections);
5702 }
5703
5704 m_HideSelectionsBySlot = false;
5705 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
5706 {
5707 m_HideSelectionsBySlot = ConfigGetBool("hideSelectionsByinventorySlot");
5708 }
5709
5710 m_QuickBarBonus = Math.Max(0, ConfigGetInt("quickBarBonus"));
5711
5712 m_IsResultOfSplit = false;
5713
5715 }
5716
5717 override void InitItemVariables()
5718 {
5719 super.InitItemVariables();
5720
5721 m_VarQuantityInit = ConfigGetInt("varQuantityInit");
5722 m_VarQuantity = m_VarQuantityInit;//should be by the CE, this is just a precaution
5723 m_VarQuantityMin = ConfigGetInt("varQuantityMin");
5724 m_VarQuantityMax = ConfigGetInt("varQuantityMax");
5725 m_VarStackMax = ConfigGetFloat("varStackMax");
5726 m_Count = ConfigGetInt("count");
5727
5728 m_CanShowQuantity = ConfigGetBool("quantityShow");
5729 m_HasQuantityBar = ConfigGetBool("quantityBar");
5730
5731 m_CleannessInit = ConfigGetInt("varCleannessInit");
5733 m_CleannessMin = ConfigGetInt("varCleannessMin");
5734 m_CleannessMax = ConfigGetInt("varCleannessMax");
5735
5736 m_WantPlayImpactSound = false;
5737 m_ImpactSpeed = 0.0;
5738
5739 m_VarWetInit = ConfigGetFloat("varWetInit");
5741 m_VarWetMin = ConfigGetFloat("varWetMin");
5742 m_VarWetMax = ConfigGetFloat("varWetMax");
5743
5744 m_LiquidContainerMask = ConfigGetInt("liquidContainerType");
5745 if (IsLiquidContainer() && GetQuantity() != 0)
5747 m_IsBeingPlaced = false;
5748 m_IsHologram = false;
5749 m_IsTakeable = true;
5750 m_CanBeMovedOverride = false;
5754 m_CanBeDigged = ConfigGetBool("canBeDigged");
5755
5756 m_CompatibleLocks = new array<int>();
5757 ConfigGetIntArray("compatibleLocks", m_CompatibleLocks);
5758 m_LockType = ConfigGetInt("lockType");
5759
5760 //Define if item can be split and set ability to be combined accordingly
5761 m_CanThisBeSplit = false;
5762 can_this_be_combined = false;
5763 if (ConfigIsExisting("canBeSplit"))
5764 {
5765 can_this_be_combined = ConfigGetBool("canBeSplit");
5767 }
5768
5769 m_ItemBehaviour = -1;
5770 if (ConfigIsExisting("itemBehaviour"))
5771 m_ItemBehaviour = ConfigGetInt("itemBehaviour");
5772
5773 //RegisterNetSyncVariableInt("m_VariablesMask");
5774 if (HasQuantity()) RegisterNetSyncVariableFloat("m_VarQuantity", GetQuantityMin(), m_VarQuantityMax);
5775 RegisterNetSyncVariableFloat("m_VarWet", GetWetMin(), GetWetMax(), 2);
5776 RegisterNetSyncVariableInt("m_VarLiquidType");
5777 RegisterNetSyncVariableInt("m_Cleanness",0,1);
5778
5779 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
5780 RegisterNetSyncVariableFloat("m_ImpactSpeed");
5781 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
5782
5783 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
5784 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
5785 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
5786 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
5787
5788 RegisterNetSyncVariableBool("m_IsBeingPlaced");
5789 RegisterNetSyncVariableBool("m_IsTakeable");
5790 RegisterNetSyncVariableBool("m_IsHologram");
5791
5792 InitItemSounds();
5794 {
5795 RegisterNetSyncVariableInt("m_SoundSyncPlay", 0, ITEM_SOUNDS_MAX);
5796 RegisterNetSyncVariableInt("m_SoundSyncStop", 0, ITEM_SOUNDS_MAX);
5797 }
5798
5799 m_LockSoundSet = ConfigGetString("lockSoundSet");
5800
5802 if (ConfigIsExisting("temperaturePerQuantityWeight"))
5803 m_TemperaturePerQuantityWeight = ConfigGetFloat("temperaturePerQuantityWeight");
5804
5805 }
5806
5807 override int GetQuickBarBonus()
5808 {
5809 return m_QuickBarBonus;
5810 }
5811
5812 void InitializeActions()
5813 {
5815 if (!m_InputActionMap)
5816 {
5818 m_InputActionMap = iam;
5819 SetActions();
5821 }
5822 }
5823
5824 override void GetActions(typename action_input_type, out array<ActionBase_Basic> actions)
5825 {
5827 {
5828 m_ActionsInitialize = true;
5830 }
5831
5832 actions = m_InputActionMap.Get(action_input_type);
5833 }
5834
5835 void SetActions()
5836 {
5837 AddAction(ActionTakeItem);
5838 AddAction(ActionTakeItemToHands);
5839 AddAction(ActionWorldCraft);
5841 AddAction(ActionAttachWithSwitch);
5842 }
5843
5844 void SetActionAnimOverrides(); // Override action animation for specific item
5845
5846 void AddAction(typename actionName)
5847 {
5848 ActionBase action = ActionManagerBase.GetAction(actionName);
5849
5850 if (!action)
5851 {
5852 Debug.LogError("Action " + actionName + " dosn't exist!");
5853 return;
5854 }
5855
5856 typename ai = action.GetInputType();
5857 if (!ai)
5858 {
5859 m_ActionsInitialize = false;
5860 return;
5861 }
5862
5863 array<ActionBase_Basic> action_array = m_InputActionMap.Get(ai);
5864 if (!action_array)
5865 {
5866 action_array = new array<ActionBase_Basic>;
5867 m_InputActionMap.Insert(ai, action_array);
5868 }
5869 if (LogManager.IsActionLogEnable())
5870 {
5871 Debug.ActionLog(action.ToString() + " -> " + ai, this.ToString() , "n/a", "Add action");
5872 }
5873
5874 if (action_array.Find(action) != -1)
5875 {
5876 Debug.Log("Action " + action.Type() + " already added to " + this + ", skipping!");
5877 }
5878 else
5879 {
5880 action_array.Insert(action);
5881 }
5882 }
5883
5884 void RemoveAction(typename actionName)
5885 {
5886 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
5887 ActionBase action = player.GetActionManager().GetAction(actionName);
5888 typename ai = action.GetInputType();
5889 array<ActionBase_Basic> action_array = m_InputActionMap.Get(ai);
5890
5891 if (action_array)
5892 {
5893 action_array.RemoveItem(action);
5894 }
5895 }
5896
5897 // Allows override of default action command per item, defined in the SetActionAnimOverrides() of the item's class
5898 // Set -1 for params which should stay in default state
5899 void OverrideActionAnimation(typename action, int commandUID, int stanceMask = -1, int commandUIDProne = -1)
5900 {
5901 ActionOverrideData overrideData = new ActionOverrideData();
5902 overrideData.m_CommandUID = commandUID;
5903 overrideData.m_CommandUIDProne = commandUIDProne;
5904 overrideData.m_StanceMask = stanceMask;
5905
5906 TActionAnimOverrideMap actionMap = m_ItemActionOverrides.Get(action);
5907 if (!actionMap) // create new map of action > overidables map
5908 {
5909 actionMap = new TActionAnimOverrideMap();
5910 m_ItemActionOverrides.Insert(action, actionMap);
5911 }
5912
5913 actionMap.Insert(this.Type(), overrideData); // insert item -> overrides
5914
5915 }
5916
5917 void OnItemInHandsPlayerSwimStart(PlayerBase player);
5918
5919 ScriptedLightBase GetLight();
5920
5921 // Loads muzzle flash particle configuration from config and saves it to a map for faster access
5922 void LoadParticleConfigOnFire(int id)
5923 {
5924 if (!m_OnFireEffect)
5926
5929
5930 string config_to_search = "CfgVehicles";
5931 string muzzle_owner_config;
5932
5933 if (!m_OnFireEffect.Contains(id))
5934 {
5935 if (IsInherited(Weapon))
5936 config_to_search = "CfgWeapons";
5937
5938 muzzle_owner_config = config_to_search + " " + GetType() + " ";
5939
5940 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
5941
5942 int config_OnFire_subclass_count = GetGame().ConfigGetChildrenCount(config_OnFire_class);
5943
5944 if (config_OnFire_subclass_count > 0)
5945 {
5946 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
5947
5948 for (int i = 0; i < config_OnFire_subclass_count; i++)
5949 {
5950 string particle_class = "";
5951 GetGame().ConfigGetChildName(config_OnFire_class, i, particle_class);
5952 string config_OnFire_entry = config_OnFire_class + particle_class;
5953 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
5954 WPOF_array.Insert(WPOF);
5955 }
5956
5957
5958 m_OnFireEffect.Insert(id, WPOF_array);
5959 }
5960 }
5961
5962 if (!m_OnBulletCasingEjectEffect.Contains(id))
5963 {
5964 config_to_search = "CfgWeapons"; // Bullet Eject efect is supported on weapons only.
5965 muzzle_owner_config = config_to_search + " " + GetType() + " ";
5966
5967 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
5968
5969 int config_OnBulletCasingEject_count = GetGame().ConfigGetChildrenCount(config_OnBulletCasingEject_class);
5970
5971 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
5972 {
5973 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
5974
5975 for (i = 0; i < config_OnBulletCasingEject_count; i++)
5976 {
5977 string particle_class2 = "";
5978 GetGame().ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
5979 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
5980 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
5981 WPOBE_array.Insert(WPOBE);
5982 }
5983
5984
5985 m_OnBulletCasingEjectEffect.Insert(id, WPOBE_array);
5986 }
5987 }
5988 }
5989
5990 // Loads muzzle flash particle configuration from config and saves it to a map for faster access
5992 {
5995
5996 if (!m_OnOverheatingEffect.Contains(id))
5997 {
5998 string config_to_search = "CfgVehicles";
5999
6000 if (IsInherited(Weapon))
6001 config_to_search = "CfgWeapons";
6002
6003 string muzzle_owner_config = config_to_search + " " + GetType() + " ";
6004 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
6005
6006 if (GetGame().ConfigIsExisting(config_OnOverheating_class))
6007 {
6008
6009 m_ShotsToStartOverheating = GetGame().ConfigGetFloat(config_OnOverheating_class + "shotsToStartOverheating");
6010
6012 {
6013 m_ShotsToStartOverheating = -1; // This prevents futher readings from config for future creations of this item
6014 string error = "Error reading config " + GetType() + ">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
6015 Error(error);
6016 return;
6017 }
6018
6019 m_OverheatingDecayInterval = GetGame().ConfigGetFloat(config_OnOverheating_class + "overheatingDecayInterval");
6020 m_MaxOverheatingValue = GetGame().ConfigGetFloat(config_OnOverheating_class + "maxOverheatingValue");
6021
6022
6023
6024 int config_OnOverheating_subclass_count = GetGame().ConfigGetChildrenCount(config_OnOverheating_class);
6025 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
6026
6027 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
6028 {
6029 string particle_class = "";
6030 GetGame().ConfigGetChildName(config_OnOverheating_class, i, particle_class);
6031 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
6032 int entry_type = GetGame().ConfigGetType(config_OnOverheating_entry);
6033
6034 if (entry_type == CT_CLASS)
6035 {
6036 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
6037 WPOOH_array.Insert(WPOF);
6038 }
6039 }
6040
6041
6042 m_OnOverheatingEffect.Insert(id, WPOOH_array);
6043 }
6044 }
6045 }
6046
6047 float GetOverheatingValue()
6048 {
6049 return m_OverheatingShots;
6050 }
6051
6052 void IncreaseOverheating(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
6053 {
6054 if (m_MaxOverheatingValue > 0)
6055 {
6057
6058 if (!m_CheckOverheating)
6060
6062 m_CheckOverheating.Run(m_OverheatingDecayInterval, this, "OnOverheatingDecay");
6063
6064 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6065 }
6066 }
6067
6068 void CheckOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
6069 {
6071 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6072
6074 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6075
6077 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6078
6080 {
6082 }
6083 }
6084
6086 {
6088 }
6089
6090 void OnOverheatingDecay()
6091 {
6092 if (m_MaxOverheatingValue > 0)
6093 m_OverheatingShots -= 1 + m_OverheatingShots / m_MaxOverheatingValue; // The hotter a barrel is, the faster it needs to cool down.
6094 else
6096
6097 if (m_OverheatingShots <= 0)
6098 {
6101 }
6102 else
6103 {
6104 if (!m_CheckOverheating)
6106
6108 m_CheckOverheating.Run(m_OverheatingDecayInterval, this, "OnOverheatingDecay");
6109 }
6110
6111 CheckOverheating(this, "", this);
6112 }
6113
6114 void StartOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
6115 {
6117 ItemBase.PlayOverheatingParticles(this, ammoType, this, suppressor, "CfgWeapons");
6118 }
6119
6120 void UpdateOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
6121 {
6123 ItemBase.UpdateOverheatingParticles(this, ammoType, this, suppressor, "CfgWeapons");
6125 }
6126
6127 void StopOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
6128 {
6130 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6131 }
6132
6133 void RegisterOverheatingParticle(Particle p, float min_heat_coef, float max_heat_coef, int particle_id, Object parent, vector local_pos, vector local_ori)
6134 {
6136 m_OverheatingParticles = new array<ref OverheatingParticle>;
6137
6138 OverheatingParticle OP = new OverheatingParticle();
6139 OP.RegisterParticle(p);
6140 OP.SetOverheatingLimitMin(min_heat_coef);
6141 OP.SetOverheatingLimitMax(max_heat_coef);
6142 OP.SetParticleParams(particle_id, parent, local_pos, local_ori);
6143
6144 m_OverheatingParticles.Insert(OP);
6145 }
6146
6147 float GetOverheatingCoef()
6148 {
6149 if (m_MaxOverheatingValue > 0)
6151
6152 return -1;
6153 }
6154
6156 {
6158 {
6159 float overheat_coef = GetOverheatingCoef();
6160 int count = m_OverheatingParticles.Count();
6161
6162 for (int i = count; i > 0; --i)
6163 {
6164 int id = i - 1;
6165 OverheatingParticle OP = m_OverheatingParticles.Get(id);
6166 Particle p = OP.GetParticle();
6167
6168 float overheat_min = OP.GetOverheatingLimitMin();
6169 float overheat_max = OP.GetOverheatingLimitMax();
6170
6171 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
6172 {
6173 if (p)
6174 {
6175 p.Stop();
6176 OP.RegisterParticle(null);
6177 }
6178 }
6179 }
6180 }
6181 }
6182
6184 {
6186 {
6187 for (int i = m_OverheatingParticles.Count(); i > 0; i--)
6188 {
6189 int id = i - 1;
6190 OverheatingParticle OP = m_OverheatingParticles.Get(id);
6191
6192 if (OP)
6193 {
6194 Particle p = OP.GetParticle();
6195
6196 if (p)
6197 {
6198 p.Stop();
6199 }
6200
6201 delete OP;
6202 }
6203 }
6204
6205 m_OverheatingParticles.Clear();
6207 }
6208 }
6209
6211 float GetInfectionChance(int system = 0, Param param = null)
6212 {
6213 return 0.0;
6214 }
6215
6216
6217 float GetDisinfectQuantity(int system = 0, Param param1 = null)
6218 {
6219 return 250;//default value
6220 }
6221
6222 float GetFilterDamageRatio()
6223 {
6224 return 0;
6225 }
6226
6228 bool HasMuzzle()
6229 {
6230 if (IsInherited(Weapon) || IsInherited(SuppressorBase))
6231 return true;
6232
6233 return false;
6234 }
6235
6237 int GetMuzzleID()
6238 {
6239 if (!m_WeaponTypeToID)
6241
6242 if (m_WeaponTypeToID.Contains(GetType()))
6243 {
6244 return m_WeaponTypeToID.Get(GetType());
6245 }
6246 else
6247 {
6248 // Register new weapon ID
6250 }
6251
6253 }
6254
6261 {
6262 return -1;
6263 }
6264
6265
6266
6267 // -------------------------------------------------------------------------
6268 void ~ItemBase()
6269 {
6270 if (GetGame() && GetGame().GetPlayer() && (!GetGame().IsDedicatedServer()))
6271 {
6272 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
6273 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6274
6275 if (r_index >= 0)
6276 {
6277 InventoryLocation r_il = new InventoryLocation;
6278 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6279
6280 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6281 int r_type = r_il.GetType();
6282 if (r_type == InventoryLocationType.CARGO || r_type == InventoryLocationType.PROXYCARGO)
6283 {
6284 r_il.GetParent().GetOnReleaseLock().Invoke(this);
6285 }
6286 else if (r_type == InventoryLocationType.ATTACHMENT)
6287 {
6288 r_il.GetParent().GetOnAttachmentReleaseLock().Invoke(this, r_il.GetSlot());
6289 }
6290
6291 }
6292
6293 player.GetHumanInventory().ClearUserReservedLocation(this);
6294 }
6295
6296 if (m_LockingSound)
6297 SEffectManager.DestroyEffect(m_LockingSound);
6298 }
6299
6300
6301
6302 // -------------------------------------------------------------------------
6303 static int GetDebugActionsMask()
6304 {
6305 return ItemBase.m_DebugActionsMask;
6306 }
6307
6308 static bool HasDebugActionsMask(int mask)
6309 {
6310 return ItemBase.m_DebugActionsMask & mask;
6311 }
6312
6313 static void SetDebugActionsMask(int mask)
6314 {
6315 ItemBase.m_DebugActionsMask = mask;
6316 }
6317
6318 static void AddDebugActionsMask(int mask)
6319 {
6320 ItemBase.m_DebugActionsMask |= mask;
6321 }
6322
6323 static void RemoveDebugActionsMask(int mask)
6324 {
6325 ItemBase.m_DebugActionsMask &= ~mask;
6326 }
6327
6328 static void ToggleDebugActionsMask(int mask)
6329 {
6330 if (HasDebugActionsMask(mask))
6331 {
6333 }
6334 else
6335 {
6336 AddDebugActionsMask(mask);
6337 }
6338 }
6339
6340 // -------------------------------------------------------------------------
6341 void SetCEBasedQuantity()
6342 {
6343 if (GetEconomyProfile())
6344 {
6345 float q_max = GetEconomyProfile().GetQuantityMax();
6346 if (q_max > 0)
6347 {
6348 float q_min = GetEconomyProfile().GetQuantityMin();
6349 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
6350
6351 if (HasComponent(COMP_TYPE_ENERGY_MANAGER))//more direct access for speed
6352 {
6353 ComponentEnergyManager comp = GetCompEM();
6354 if (comp && (comp.GetEnergyMaxPristine() || comp.GetEnergyAtSpawn()))//checking for a potential for energy, we need to check both values, as both are optional, only when both are set to 0, we know the item can't have energy
6355 {
6356 comp.SetEnergy0To1(quantity_randomized);
6357 }
6358 }
6359 else if (HasQuantity())
6360 {
6361 SetQuantityNormalized(quantity_randomized, false);
6362 //PrintString("<==> Normalized quantity for item: "+ GetType()+", qmin:"+q_min.ToString()+"; qmax:"+q_max.ToString()+";quantity:" +quantity_randomized.ToString());
6363 }
6364
6365 }
6366 }
6367 }
6368
6370 void LockToParent()
6371 {
6372 EntityAI parent = GetHierarchyParent();
6373
6374 if (parent)
6375 {
6376 InventoryLocation inventory_location_to_lock = new InventoryLocation;
6377 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
6378 parent.GetInventory().SetSlotLock(inventory_location_to_lock.GetSlot(), true);
6379 }
6380 }
6381
6383 void UnlockFromParent()
6384 {
6385 EntityAI parent = GetHierarchyParent();
6386
6387 if (parent)
6388 {
6389 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
6390 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
6391 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.GetSlot(), false);
6392 }
6393 }
6394
6395 override void CombineItemsClient(EntityAI entity2, bool use_stack_max = true)
6396 {
6397 /*
6398 ref Param1<EntityAI> item = new Param1<EntityAI>(entity2);
6399 RPCSingleParam(ERPCs.RPC_ITEM_COMBINE, item, GetGame().GetPlayer());
6400 */
6401 ItemBase item2 = ItemBase.Cast(entity2);
6402
6403 if (GetGame().IsClient())
6404 {
6405 if (ScriptInputUserData.CanStoreInputUserData())
6406 {
6407 ScriptInputUserData ctx = new ScriptInputUserData;
6409 ctx.Write(-1);
6410 ItemBase i1 = this; // @NOTE: workaround for correct serialization
6411 ctx.Write(i1);
6412 ctx.Write(item2);
6413 ctx.Write(use_stack_max);
6414 ctx.Write(-1);
6415 ctx.Send();
6416
6417 if (IsCombineAll(item2, use_stack_max))
6418 {
6419 GetGame().GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
6420 }
6421 }
6422 }
6423 else if (!GetGame().IsMultiplayer())
6424 {
6425 CombineItems(item2, use_stack_max);
6426 }
6427 }
6428
6429 bool IsLiquidPresent()
6430 {
6431 return (GetLiquidType() != 0 && HasQuantity());
6432 }
6433
6434 bool IsLiquidContainer()
6435 {
6436 return m_LiquidContainerMask != 0;
6437 }
6438
6440 {
6441 return m_LiquidContainerMask;
6442 }
6443
6444 bool IsBloodContainer()
6445 {
6446 //m_LiquidContainerMask & GROUP_LIQUID_BLOOD ???
6447 return false;
6448 }
6449
6450 bool IsNVG()
6451 {
6452 return false;
6453 }
6454
6457 bool IsExplosive()
6458 {
6459 return false;
6460 }
6461
6463 {
6464 return "";
6465 }
6466
6468
6469 bool IsLightSource()
6470 {
6471 return false;
6472 }
6473
6475 {
6476 return true;
6477 }
6478
6479 //--- ACTION CONDITIONS
6480 //direction
6481 bool IsFacingPlayer(PlayerBase player, string selection)
6482 {
6483 return true;
6484 }
6485
6486 bool IsPlayerInside(PlayerBase player, string selection)
6487 {
6488 return true;
6489 }
6490
6491 override bool CanObstruct()
6492 {
6493 PlayerBase player = PlayerBase.Cast(g_Game.GetPlayer());
6494 return !player || !IsPlayerInside(player, "");
6495 }
6496
6497 override bool IsBeingPlaced()
6498 {
6499 return m_IsBeingPlaced;
6500 }
6501
6502 void SetIsBeingPlaced(bool is_being_placed)
6503 {
6504 m_IsBeingPlaced = is_being_placed;
6505 if (!is_being_placed)
6507 SetSynchDirty();
6508 }
6509
6510 //server-side
6511 void OnEndPlacement() {}
6512
6513 override bool IsHologram()
6514 {
6515 return m_IsHologram;
6516 }
6517
6518 bool CanBeDigged()
6519 {
6520 return m_CanBeDigged;
6521 }
6522
6524 {
6525 return 1;
6526 }
6527
6528 bool CanMakeGardenplot()
6529 {
6530 return false;
6531 }
6532
6533 void SetIsHologram(bool is_hologram)
6534 {
6535 m_IsHologram = is_hologram;
6536 SetSynchDirty();
6537 }
6538 /*
6539 protected float GetNutritionalEnergy()
6540 {
6541 Edible_Base edible = Edible_Base.Cast(this);
6542 return edible.GetFoodEnergy();
6543 }
6544
6545 protected float GetNutritionalWaterContent()
6546 {
6547 Edible_Base edible = Edible_Base.Cast(this);
6548 return edible.GetFoodWater();
6549 }
6550
6551 protected float GetNutritionalIndex()
6552 {
6553 Edible_Base edible = Edible_Base.Cast(this);
6554 return edible.GetFoodNutritionalIndex();
6555 }
6556
6557 protected float GetNutritionalFullnessIndex()
6558 {
6559 Edible_Base edible = Edible_Base.Cast(this);
6560 return edible.GetFoodTotalVolume();
6561 }
6562
6563 protected float GetNutritionalToxicity()
6564 {
6565 Edible_Base edible = Edible_Base.Cast(this);
6566 return edible.GetFoodToxicity();
6567
6568 }
6569 */
6570
6571
6572 // -------------------------------------------------------------------------
6573 override void OnMovedInsideCargo(EntityAI container)
6574 {
6575 super.OnMovedInsideCargo(container);
6576
6577 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6578 }
6579
6580 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
6581 {
6582 super.EEItemLocationChanged(oldLoc,newLoc);
6583
6584 PlayerBase new_player = null;
6585 PlayerBase old_player = null;
6586
6587 if (newLoc.GetParent())
6588 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
6589
6590 if (oldLoc.GetParent())
6591 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
6592
6593 if (old_player && oldLoc.GetType() == InventoryLocationType.HANDS)
6594 {
6595 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
6596
6597 if (r_index >= 0)
6598 {
6599 InventoryLocation r_il = new InventoryLocation;
6600 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6601
6602 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6603 int r_type = r_il.GetType();
6604 if (r_type == InventoryLocationType.CARGO || r_type == InventoryLocationType.PROXYCARGO)
6605 {
6606 r_il.GetParent().GetOnReleaseLock().Invoke(this);
6607 }
6608 else if (r_type == InventoryLocationType.ATTACHMENT)
6609 {
6610 r_il.GetParent().GetOnAttachmentReleaseLock().Invoke(this, r_il.GetSlot());
6611 }
6612
6613 }
6614 }
6615
6616 if (newLoc.GetType() == InventoryLocationType.HANDS)
6617 {
6618 if (new_player)
6619 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
6620
6621 if (new_player == old_player)
6622 {
6623
6624 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
6625 {
6626 if (oldLoc.GetType() == InventoryLocationType.CARGO)
6627 {
6628 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
6629 {
6630 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6631 }
6632 }
6633 else
6634 {
6635 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6636 }
6637 }
6638
6639 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
6640 {
6641 int type = oldLoc.GetType();
6642 if (type == InventoryLocationType.CARGO || type == InventoryLocationType.PROXYCARGO)
6643 {
6644 oldLoc.GetParent().GetOnSetLock().Invoke(this);
6645 }
6646 else if (type == InventoryLocationType.ATTACHMENT)
6647 {
6648 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
6649 }
6650 }
6651 if (!m_OldLocation)
6652 {
6653 m_OldLocation = new InventoryLocation;
6654 }
6655 m_OldLocation.Copy(oldLoc);
6656 }
6657 else
6658 {
6659 if (m_OldLocation)
6660 {
6661 m_OldLocation.Reset();
6662 }
6663 }
6664
6666 }
6667 else
6668 {
6669 if (new_player)
6670 {
6671 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
6672 if (res_index >= 0)
6673 {
6674 InventoryLocation il = new InventoryLocation;
6675 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
6676 ItemBase it = ItemBase.Cast(il.GetItem());
6677 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
6678 int rel_type = il.GetType();
6679 if (rel_type == InventoryLocationType.CARGO || rel_type == InventoryLocationType.PROXYCARGO)
6680 {
6681 il.GetParent().GetOnReleaseLock().Invoke(it);
6682 }
6683 else if (rel_type == InventoryLocationType.ATTACHMENT)
6684 {
6685 il.GetParent().GetOnAttachmentReleaseLock().Invoke(it, il.GetSlot());
6686 }
6687 //it.GetOnReleaseLock().Invoke(it);
6688 }
6689 }
6690 else if (old_player && newLoc.GetType() == InventoryLocationType.GROUND && m_ThrowItemOnDrop)
6691 {
6692 //ThrowPhysically(old_player, vector.Zero);
6693 m_ThrowItemOnDrop = false;
6694 }
6695
6696 if (m_OldLocation)
6697 {
6698 m_OldLocation.Reset();
6699 }
6700 }
6701 }
6702
6703 override void EOnContact(IEntity other, Contact extra)
6704 {
6706 {
6707 int liquidType = -1;
6708 float impactSpeed = ProcessImpactSoundEx(other, extra, m_ConfigWeight, m_ImpactSoundSurfaceHash, liquidType);
6709 if (impactSpeed > 0.0)
6710 {
6711 m_ImpactSpeed = impactSpeed;
6712 #ifndef SERVER
6713 PlayImpactSound(m_ConfigWeight, m_ImpactSpeed, m_ImpactSoundSurfaceHash);
6714 #else
6715 m_WantPlayImpactSound = true;
6716 SetSynchDirty();
6717 #endif
6718 m_CanPlayImpactSound = (liquidType == -1);// prevents further playing of the sound when the surface is a liquid type
6719 }
6720 }
6721
6722 #ifdef SERVER
6723 if (GetCompEM() && GetCompEM().IsPlugged())
6724 {
6725 if (GetCompEM().GetCordLength() < vector.Distance(GetPosition(), GetCompEM().GetEnergySource().GetPosition()))
6726 GetCompEM().UnplugThis();
6727 }
6728 #endif
6729 }
6730
6731 void RefreshPhysics();
6732
6733 override void OnCreatePhysics()
6734 {
6736 }
6737
6738 override void OnItemAttachmentSlotChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
6739 {
6740
6741 }
6742 // -------------------------------------------------------------------------
6743 override void OnItemLocationChanged(EntityAI old_owner, EntityAI new_owner)
6744 {
6745 super.OnItemLocationChanged(old_owner, new_owner);
6746
6747 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
6748 PlayerBase playerNew = PlayerBase.Cast(new_owner);
6749
6750 if (!relatedPlayer && playerNew)
6751 relatedPlayer = playerNew;
6752
6753 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
6754 {
6755 ActionManagerBase actionMgr = relatedPlayer.GetActionManager();
6756 if (actionMgr)
6757 {
6758 ActionBase currentAction = actionMgr.GetRunningAction();
6759 if (currentAction)
6760 currentAction.OnItemLocationChanged(this);
6761 }
6762 }
6763
6764 Man ownerPlayerOld = null;
6765 Man ownerPlayerNew = null;
6766
6767 if (old_owner)
6768 {
6769 if (old_owner.IsMan())
6770 {
6771 ownerPlayerOld = Man.Cast(old_owner);
6772 }
6773 else
6774 {
6775 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
6776 }
6777 }
6778 else
6779 {
6780 if (new_owner && IsElectricAppliance() && GetCompEM() && GetCompEM().IsPlugged())
6781 {
6782 ActionBase action = ActionManagerBase.GetAction(ActionRepositionPluggedItem);
6783
6784 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.GetID())
6785 {
6786 GetCompEM().UnplugThis();
6787 }
6788 }
6789 }
6790
6791 if (new_owner)
6792 {
6793 if (new_owner.IsMan())
6794 {
6795 ownerPlayerNew = Man.Cast(new_owner);
6796 }
6797 else
6798 {
6799 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
6800 }
6801 }
6802
6803 if (ownerPlayerOld != ownerPlayerNew)
6804 {
6805 if (ownerPlayerOld)
6806 {
6807 array<EntityAI> subItemsExit = new array<EntityAI>;
6808 GetInventory().EnumerateInventory(InventoryTraversalType.PREORDER,subItemsExit);
6809 for (int i = 0; i < subItemsExit.Count(); i++)
6810 {
6811 ItemBase itemExit = ItemBase.Cast(subItemsExit.Get(i));
6812 itemExit.OnInventoryExit(ownerPlayerOld);
6813 }
6814 }
6815
6816 if (ownerPlayerNew)
6817 {
6818 array<EntityAI> subItemsEnter = new array<EntityAI>;
6819 GetInventory().EnumerateInventory(InventoryTraversalType.PREORDER,subItemsEnter);
6820 for (int j = 0; j < subItemsEnter.Count(); j++)
6821 {
6822 ItemBase itemEnter = ItemBase.Cast(subItemsEnter.Get(j));
6823 itemEnter.OnInventoryEnter(ownerPlayerNew);
6824 }
6825 }
6826 }
6827 else if (ownerPlayerNew != null)
6828 {
6829 PlayerBase nplayer;
6830 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
6831 {
6832 array<EntityAI> subItemsUpdate = new array<EntityAI>;
6833 GetInventory().EnumerateInventory(InventoryTraversalType.PREORDER,subItemsUpdate);
6834 for (int k = 0; k < subItemsUpdate.Count(); k++)
6835 {
6836 ItemBase itemUpdate = ItemBase.Cast(subItemsUpdate.Get(k));
6837 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
6838 }
6839 }
6840 }
6841
6842 if (old_owner)
6843 old_owner.OnChildItemRemoved(this);
6844 if (new_owner)
6845 new_owner.OnChildItemReceived(this);
6846 }
6847
6848 // -------------------------------------------------------------------------------
6849 override void EEDelete(EntityAI parent)
6850 {
6851 super.EEDelete(parent);
6852 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
6853 if (player)
6854 {
6855 OnInventoryExit(player);
6856
6857 if (player.IsAlive())
6858 {
6859 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6860 if (r_index >= 0)
6861 {
6862 InventoryLocation r_il = new InventoryLocation;
6863 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6864
6865 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6866 int r_type = r_il.GetType();
6867 if (r_type == InventoryLocationType.CARGO || r_type == InventoryLocationType.PROXYCARGO)
6868 {
6869 r_il.GetParent().GetOnReleaseLock().Invoke(this);
6870 }
6871 else if (r_type == InventoryLocationType.ATTACHMENT)
6872 {
6873 r_il.GetParent().GetOnAttachmentReleaseLock().Invoke(this, r_il.GetSlot());
6874 }
6875
6876 }
6877
6878 player.RemoveQuickBarEntityShortcut(this);
6879 }
6880 }
6881 }
6882 // -------------------------------------------------------------------------------
6883 override void EEKilled(Object killer)
6884 {
6885 super.EEKilled(killer);
6886
6888 if (killer && killer.IsFireplace() && CanExplodeInFire())
6889 {
6890 if (GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
6891 {
6892 if (IsMagazine())
6893 {
6894 if (Magazine.Cast(this).GetAmmoCount() > 0)
6895 {
6896 ExplodeAmmo();
6897 }
6898 }
6899 else
6900 {
6901 Explode(DamageType.EXPLOSION);
6902 }
6903 }
6904 }
6905 }
6906
6907 override void OnWasAttached(EntityAI parent, int slot_id)
6908 {
6909 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6910
6911 super.OnWasAttached(parent, slot_id);
6912
6913 if (HasQuantity())
6914 UpdateNetSyncVariableFloat("m_VarQuantity", GetQuantityMin(), m_VarQuantityMax);
6915
6916 PlayAttachSound(InventorySlots.GetSlotName(slot_id));
6917 }
6918
6919 override void OnWasDetached(EntityAI parent, int slot_id)
6920 {
6921 super.OnWasDetached(parent, slot_id);
6922
6923 if (HasQuantity())
6924 UpdateNetSyncVariableFloat("m_VarQuantity", GetQuantityMin(), m_VarQuantityMax);
6925 }
6926
6927 override string ChangeIntoOnAttach(string slot)
6928 {
6929 int idx;
6930 TStringArray inventory_slots = new TStringArray;
6931 TStringArray attach_types = new TStringArray;
6932
6933 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
6934 if (inventory_slots.Count() < 1) //is string
6935 {
6936 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
6937 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
6938 }
6939 else //is array
6940 {
6941 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
6942 }
6943
6944 idx = inventory_slots.Find(slot);
6945 if (idx < 0)
6946 return "";
6947
6948 return attach_types.Get(idx);
6949 }
6950
6951 override string ChangeIntoOnDetach()
6952 {
6953 int idx = -1;
6954 string slot;
6955
6956 TStringArray inventory_slots = new TStringArray;
6957 TStringArray detach_types = new TStringArray;
6958
6959 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
6960 if (inventory_slots.Count() < 1) //is string
6961 {
6962 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
6963 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
6964 }
6965 else //is array
6966 {
6967 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
6968 if (detach_types.Count() < 1)
6969 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
6970 }
6971
6972 for (int i = 0; i < inventory_slots.Count(); i++)
6973 {
6974 slot = inventory_slots.Get(i);
6975 }
6976
6977 if (slot != "")
6978 {
6979 if (detach_types.Count() == 1)
6980 idx = 0;
6981 else
6982 idx = inventory_slots.Find(slot);
6983 }
6984 if (idx < 0)
6985 return "";
6986
6987 return detach_types.Get(idx);
6988 }
6989
6990 void ExplodeAmmo()
6991 {
6992 //timer
6993 ref Timer explode_timer = new Timer(CALL_CATEGORY_SYSTEM);
6994
6995 //min/max time
6996 float min_time = 1;
6997 float max_time = 3;
6998 float delay = Math.RandomFloat(min_time, max_time);
6999
7000 explode_timer.Run(delay, this, "DoAmmoExplosion");
7001 }
7002
7003 void DoAmmoExplosion()
7004 {
7005 Magazine magazine = Magazine.Cast(this);
7006 int pop_sounds_count = 6;
7007 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
7008
7009 //play sound
7010 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
7011 string sound_name = pop_sounds[ sound_idx ];
7012 GetGame().CreateSoundOnObject(this, sound_name, 20, false);
7013
7014 //remove ammo count
7015 magazine.ServerAddAmmoCount(-1);
7016
7017 //if condition then repeat -> ExplodeAmmo
7018 float min_temp_to_explode = 100; //min temperature for item to explode
7019
7020 if (magazine.GetAmmoCount() > 0 && GetTemperature() >= min_temp_to_explode) //TODO ? add check for parent -> fireplace
7021 {
7022 ExplodeAmmo();
7023 }
7024 }
7025
7026 // -------------------------------------------------------------------------------
7027 override void EEHitBy(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
7028 {
7029 super.EEHitBy(damageResult, damageType, source, component, dmgZone, ammo, modelPos, speedCoef);
7030
7031 const int CHANCE_DAMAGE_CARGO = 4;
7032 const int CHANCE_DAMAGE_ATTACHMENT = 1;
7033 const int CHANCE_DAMAGE_NOTHING = 2;
7034
7035 if (IsClothing() || IsContainer() || IsItemTent())
7036 {
7037 float dmg = damageResult.GetDamage("","Health") * -0.5;
7038 int chances;
7039 int rnd;
7040
7041 if (GetInventory().GetCargo())
7042 {
7043 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7044 rnd = Math.RandomInt(0,chances);
7045
7046 if (rnd < CHANCE_DAMAGE_CARGO)
7047 {
7048 DamageItemInCargo(dmg);
7049 }
7050 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
7051 {
7053 }
7054 }
7055 else
7056 {
7057 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7058 rnd = Math.RandomInt(0,chances);
7059
7060 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
7061 {
7063 }
7064 }
7065 }
7066 }
7067
7068 bool DamageItemInCargo(float damage)
7069 {
7070 if (GetInventory().GetCargo())
7071 {
7072 int item_count = GetInventory().GetCargo().GetItemCount();
7073 if (item_count > 0)
7074 {
7075 int random_pick = Math.RandomInt(0, item_count);
7076 ItemBase item = ItemBase.Cast(GetInventory().GetCargo().GetItem(random_pick));
7077 if (!item.IsExplosive())
7078 {
7079 item.AddHealth("","",damage);
7080 return true;
7081 }
7082 }
7083 }
7084 return false;
7085 }
7086
7087 bool DamageItemAttachments(float damage)
7088 {
7089 int attachment_count = GetInventory().AttachmentCount();
7090 if (attachment_count > 0)
7091 {
7092 int random_pick = Math.RandomInt(0, attachment_count);
7093 ItemBase attachment = ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
7094 if (!attachment.IsExplosive())
7095 {
7096 attachment.AddHealth("","",damage);
7097 return true;
7098 }
7099 }
7100 return false;
7101 }
7102
7103 override bool IsSplitable()
7104 {
7105 return m_CanThisBeSplit;
7106 }
7107 //----------------
7108 override bool CanBeSplit()
7109 {
7110 if (IsSplitable() && (GetQuantity() > 1))
7111 return GetInventory().CanRemoveEntity();
7112
7113 return false;
7114 }
7115
7116 protected bool ShouldSplitQuantity(float quantity)
7117 {
7118 // don't call 'CanBeSplit' here, too strict and will introduce a freeze-crash when dismantling fence with a fireplace nearby
7119 if (!IsSplitable())
7120 return false;
7121
7122 // nothing to split?
7123 if (GetQuantity() <= 1)
7124 return false;
7125
7126 // check if we should re-use the item instead of creating a new copy?
7127 // implicit cast to int, if 'IsSplitable' returns true, these values are assumed ints
7128 int delta = GetQuantity() - quantity;
7129 if (delta == 0)
7130 return false;
7131
7132 // valid to split
7133 return true;
7134 }
7135
7136 override void SplitIntoStackMaxClient(EntityAI destination_entity, int slot_id )
7137 {
7138 if (GetGame().IsClient())
7139 {
7140 if (ScriptInputUserData.CanStoreInputUserData())
7141 {
7142 ScriptInputUserData ctx = new ScriptInputUserData;
7144 ctx.Write(1);
7145 ItemBase i1 = this; // @NOTE: workaround for correct serialization
7146 ctx.Write(i1);
7147 ctx.Write(destination_entity);
7148 ctx.Write(true);
7149 ctx.Write(slot_id);
7150 ctx.Send();
7151 }
7152 }
7153 else if (!GetGame().IsMultiplayer())
7154 {
7155 SplitIntoStackMax(destination_entity, slot_id, PlayerBase.Cast(GetGame().GetPlayer()));
7156 }
7157 }
7158
7159 void SplitIntoStackMax(EntityAI destination_entity, int slot_id, PlayerBase player)
7160 {
7161 float split_quantity_new;
7162 ItemBase new_item;
7163 float quantity = GetQuantity();
7164 float stack_max = GetTargetQuantityMax(slot_id);
7165 InventoryLocation loc = new InventoryLocation;
7166
7167 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7168 {
7169 if (stack_max <= GetQuantity())
7170 split_quantity_new = stack_max;
7171 else
7172 split_quantity_new = GetQuantity();
7173
7174 if (ShouldSplitQuantity(split_quantity_new))
7175 {
7176 new_item = ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(this.GetType(), slot_id));
7177 if (new_item)
7178 {
7179 new_item.SetResultOfSplit(true);
7180 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7181 AddQuantity(-split_quantity_new, false, true);
7182 new_item.SetQuantity(split_quantity_new, false, true);
7183 }
7184 }
7185 }
7186 else if (destination_entity && slot_id == -1)
7187 {
7188 if (quantity > stack_max)
7189 split_quantity_new = stack_max;
7190 else
7191 split_quantity_new = quantity;
7192
7193 if (ShouldSplitQuantity(split_quantity_new))
7194 {
7195 if (destination_entity.GetInventory().FindFreeLocationFor(this, FindInventoryLocationType.ANY, loc))
7196 {
7197 Object o = destination_entity.GetInventory().LocationCreateEntity(loc, GetType(), ECE_IN_INVENTORY, RF_DEFAULT);
7198 new_item = ItemBase.Cast(o);
7199 }
7200
7201 if (new_item)
7202 {
7203 new_item.SetResultOfSplit(true);
7204 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7205 AddQuantity(-split_quantity_new, false, true);
7206 new_item.SetQuantity(split_quantity_new, false, true);
7207 }
7208 }
7209 }
7210 else
7211 {
7212 if (stack_max != 0)
7213 {
7214 if (stack_max < GetQuantity())
7215 {
7216 split_quantity_new = GetQuantity() - stack_max;
7217 }
7218
7219 if (split_quantity_new == 0)
7220 {
7221 if (!GetGame().IsMultiplayer())
7222 player.PhysicalPredictiveDropItem(this);
7223 else
7224 player.ServerDropEntity(this);
7225 return;
7226 }
7227
7228 if (ShouldSplitQuantity(split_quantity_new))
7229 {
7230 new_item = ItemBase.Cast(GetGame().CreateObjectEx(GetType(), player.GetWorldPosition(), ECE_PLACE_ON_SURFACE));
7231
7232 if (new_item)
7233 {
7234 new_item.SetResultOfSplit(true);
7235 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7236 SetQuantity(split_quantity_new, false, true);
7237 new_item.SetQuantity(stack_max, false, true);
7238 new_item.PlaceOnSurface();
7239 }
7240 }
7241 }
7242 }
7243 }
7244
7245 override void SplitIntoStackMaxEx(EntityAI destination_entity, int slot_id)
7246 {
7247 float split_quantity_new;
7248 ItemBase new_item;
7249 float quantity = GetQuantity();
7250 float stack_max = GetTargetQuantityMax(slot_id);
7251 InventoryLocation loc = new InventoryLocation;
7252
7253 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7254 {
7255 if (stack_max <= GetQuantity())
7256 split_quantity_new = stack_max;
7257 else
7258 split_quantity_new = GetQuantity();
7259
7260 if (ShouldSplitQuantity(split_quantity_new))
7261 {
7262 new_item = ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(this.GetType(), slot_id));
7263 if (new_item)
7264 {
7265 new_item.SetResultOfSplit(true);
7266 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7267 AddQuantity(-split_quantity_new, false, true);
7268 new_item.SetQuantity(split_quantity_new, false, true);
7269 }
7270 }
7271 }
7272 else if (destination_entity && slot_id == -1)
7273 {
7274 if (quantity > stack_max)
7275 split_quantity_new = stack_max;
7276 else
7277 split_quantity_new = quantity;
7278
7279 if (ShouldSplitQuantity(split_quantity_new))
7280 {
7281 if (destination_entity.GetInventory().FindFreeLocationFor(this, FindInventoryLocationType.ANY, loc))
7282 {
7283 Object o = destination_entity.GetInventory().LocationCreateEntity(loc, GetType(), ECE_IN_INVENTORY, RF_DEFAULT);
7284 new_item = ItemBase.Cast(o);
7285 }
7286
7287 if (new_item)
7288 {
7289 new_item.SetResultOfSplit(true);
7290 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7291 AddQuantity(-split_quantity_new, false, true);
7292 new_item.SetQuantity(split_quantity_new, false, true);
7293 }
7294 }
7295 }
7296 else
7297 {
7298 if (stack_max != 0)
7299 {
7300 if (stack_max < GetQuantity())
7301 {
7302 split_quantity_new = GetQuantity() - stack_max;
7303 }
7304
7305 if (ShouldSplitQuantity(split_quantity_new))
7306 {
7307 new_item = ItemBase.Cast(GetGame().CreateObjectEx(GetType(),GetWorldPosition(), ECE_PLACE_ON_SURFACE));
7308
7309 if (new_item)
7310 {
7311 new_item.SetResultOfSplit(true);
7312 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7313 SetQuantity(split_quantity_new, false, true);
7314 new_item.SetQuantity(stack_max, false, true);
7315 new_item.PlaceOnSurface();
7316 }
7317 }
7318 }
7319 }
7320 }
7321
7322 void SplitIntoStackMaxToInventoryLocationClient(notnull InventoryLocation dst)
7323 {
7324 if (GetGame().IsClient())
7325 {
7326 if (ScriptInputUserData.CanStoreInputUserData())
7327 {
7328 ScriptInputUserData ctx = new ScriptInputUserData;
7330 ctx.Write(4);
7331 ItemBase thiz = this; // @NOTE: workaround for correct serialization
7332 ctx.Write(thiz);
7333 dst.WriteToContext(ctx);
7334 ctx.Send();
7335 }
7336 }
7337 else if (!GetGame().IsMultiplayer())
7338 {
7340 }
7341 }
7342
7343 void SplitIntoStackMaxCargoClient(EntityAI destination_entity, int idx, int row, int col)
7344 {
7345 if (GetGame().IsClient())
7346 {
7347 if (ScriptInputUserData.CanStoreInputUserData())
7348 {
7349 ScriptInputUserData ctx = new ScriptInputUserData;
7351 ctx.Write(2);
7352 ItemBase dummy = this; // @NOTE: workaround for correct serialization
7353 ctx.Write(dummy);
7354 ctx.Write(destination_entity);
7355 ctx.Write(true);
7356 ctx.Write(idx);
7357 ctx.Write(row);
7358 ctx.Write(col);
7359 ctx.Send();
7360 }
7361 }
7362 else if (!GetGame().IsMultiplayer())
7363 {
7364 SplitIntoStackMaxCargo(destination_entity, idx, row, col);
7365 }
7366 }
7367
7368 void SplitIntoStackMaxToInventoryLocation(notnull InventoryLocation dst)
7369 {
7371 }
7372
7373 ItemBase SplitIntoStackMaxToInventoryLocationEx(notnull InventoryLocation dst)
7374 {
7375 float quantity = GetQuantity();
7376 float split_quantity_new;
7377 ItemBase new_item;
7378 if (dst.IsValid())
7379 {
7380 int slot_id = dst.GetSlot();
7381 float stack_max = GetTargetQuantityMax(slot_id);
7382
7383 if (quantity > stack_max)
7384 split_quantity_new = stack_max;
7385 else
7386 split_quantity_new = quantity;
7387
7388 if (ShouldSplitQuantity(split_quantity_new))
7389 {
7390 new_item = ItemBase.Cast(GameInventory.LocationCreateEntity(dst, this.GetType(), ECE_IN_INVENTORY, RF_DEFAULT));
7391
7392 if (new_item)
7393 {
7394 new_item.SetResultOfSplit(true);
7395 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7396 AddQuantity(-split_quantity_new, false, true);
7397 new_item.SetQuantity(split_quantity_new, false, true);
7398 }
7399
7400 return new_item;
7401 }
7402 }
7403
7404 return null;
7405 }
7406
7407 void SplitIntoStackMaxCargo(EntityAI destination_entity, int idx, int row, int col)
7408 {
7409 float quantity = GetQuantity();
7410 float split_quantity_new;
7411 ItemBase new_item;
7412 if (destination_entity)
7413 {
7414 float stackable = GetTargetQuantityMax();
7415 if (quantity > stackable)
7416 split_quantity_new = stackable;
7417 else
7418 split_quantity_new = quantity;
7419
7420 if (ShouldSplitQuantity(split_quantity_new))
7421 {
7422 new_item = ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(this.GetType(), idx, row, col, false));
7423 if (new_item)
7424 {
7425 new_item.SetResultOfSplit(true);
7426 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7427 AddQuantity(-split_quantity_new, false, true);
7428 new_item.SetQuantity(split_quantity_new, false, true);
7429 }
7430 }
7431 }
7432 }
7433
7434 void SplitIntoStackMaxHandsClient(PlayerBase player)
7435 {
7436 if (GetGame().IsClient())
7437 {
7438 if (ScriptInputUserData.CanStoreInputUserData())
7439 {
7440 ScriptInputUserData ctx = new ScriptInputUserData;
7442 ctx.Write(3);
7443 ItemBase i1 = this; // @NOTE: workaround for correct serialization
7444 ctx.Write(i1);
7445 ItemBase destination_entity = this;
7446 ctx.Write(destination_entity);
7447 ctx.Write(true);
7448 ctx.Write(0);
7449 ctx.Send();
7450 }
7451 }
7452 else if (!GetGame().IsMultiplayer())
7453 {
7454 SplitIntoStackMaxHands(player);
7455 }
7456 }
7457
7458 void SplitIntoStackMaxHands(PlayerBase player)
7459 {
7460 float quantity = GetQuantity();
7461 float split_quantity_new;
7462 ref ItemBase new_item;
7463 if (player)
7464 {
7465 float stackable = GetTargetQuantityMax();
7466 if (quantity > stackable)
7467 split_quantity_new = stackable;
7468 else
7469 split_quantity_new = quantity;
7470
7471 if (ShouldSplitQuantity(split_quantity_new))
7472 {
7473 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.GetType());
7474 new_item = ItemBase.Cast(in_hands);
7475 if (new_item)
7476 {
7477 new_item.SetResultOfSplit(true);
7478 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7479 AddQuantity(-split_quantity_new, false, true);
7480 new_item.SetQuantity(split_quantity_new, false, true);
7481 }
7482 }
7483 }
7484 }
7485
7486 void SplitItemToInventoryLocation(notnull InventoryLocation dst)
7487 {
7488 float quantity = GetQuantity();
7489 float split_quantity_new = Math.Floor(quantity * 0.5);
7490
7491 if (!ShouldSplitQuantity(split_quantity_new))
7492 return;
7493
7494 ItemBase new_item = ItemBase.Cast(GameInventory.LocationCreateEntity(dst, GetType(), ECE_IN_INVENTORY, RF_DEFAULT));
7495
7496 if (new_item)
7497 {
7498 if (new_item.GetQuantityMax() < split_quantity_new)
7499 {
7500 split_quantity_new = new_item.GetQuantityMax();
7501 }
7502
7503 new_item.SetResultOfSplit(true);
7504 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7505
7506 if (dst.IsValid() && dst.GetType() == InventoryLocationType.ATTACHMENT && split_quantity_new > 1)
7507 {
7508 AddQuantity(-1, false, true);
7509 new_item.SetQuantity(1, false, true);
7510 }
7511 else
7512 {
7513 AddQuantity(-split_quantity_new, false, true);
7514 new_item.SetQuantity(split_quantity_new, false, true);
7515 }
7516 }
7517 }
7518
7519 void SplitItem(PlayerBase player)
7520 {
7521 float quantity = GetQuantity();
7522 float split_quantity_new = Math.Floor(quantity / 2);
7523
7524 if (!ShouldSplitQuantity(split_quantity_new))
7525 return;
7526
7527 InventoryLocation invloc = new InventoryLocation;
7528 bool found = player.GetInventory().FindFirstFreeLocationForNewEntity(GetType(), FindInventoryLocationType.ATTACHMENT, invloc);
7529
7530 ItemBase new_item;
7531 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
7532
7533 if (new_item)
7534 {
7535 if (new_item.GetQuantityMax() < split_quantity_new)
7536 {
7537 split_quantity_new = new_item.GetQuantityMax();
7538 }
7539 if (found && invloc.IsValid() && invloc.GetType() == InventoryLocationType.ATTACHMENT && split_quantity_new > 1)
7540 {
7541 AddQuantity(-1, false, true);
7542 new_item.SetQuantity(1, false, true);
7543 }
7544 else if (split_quantity_new > 1)
7545 {
7546 AddQuantity(-split_quantity_new, false, true);
7547 new_item.SetQuantity(split_quantity_new, false, true);
7548 }
7549 }
7550 }
7551
7553 void OnQuantityChanged(float delta)
7554 {
7555 SetWeightDirty();
7556 ItemBase parent = ItemBase.Cast(GetHierarchyParent());
7557
7558 if (parent)
7559 parent.OnAttachmentQuantityChangedEx(this, delta);
7560
7561 if (IsLiquidContainer())
7562 {
7563 if (GetQuantityNormalized() <= 0.0)
7564 {
7566 }
7567 else if (GetLiquidType() == LIQUID_NONE)
7568 {
7569 ErrorEx("Undefined liquid type quantity changed, please define liquid type first! Using init value.",ErrorExSeverity.INFO);
7571 }
7572 }
7573
7574 }
7575
7578 {
7579 // insert code here
7580 }
7581
7583 void OnAttachmentQuantityChangedEx(ItemBase item , float delta)
7584 {
7586 }
7587
7588 override void EEHealthLevelChanged(int oldLevel, int newLevel, string zone)
7589 {
7590 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
7591
7592 if (GetGame().IsServer())
7593 {
7594 if (newLevel == GameConstants.STATE_RUINED)
7595 {
7597 EntityAI parent = GetHierarchyParent();
7598 if (parent && parent.IsFireplace())
7599 {
7600 CargoBase cargo = GetInventory().GetCargo();
7601 if (cargo)
7602 {
7603 for (int i = 0; i < cargo.GetItemCount(); ++i)
7604 {
7605 parent.GetInventory().TakeEntityToInventory(InventoryMode.SERVER, FindInventoryLocationType.CARGO, cargo.GetItem(i));
7606 }
7607 }
7608 }
7609 }
7610
7611 if (IsResultOfSplit())
7612 {
7613 // reset the splitting result flag, return to normal item behavior
7614 SetResultOfSplit(false);
7615 return;
7616 }
7617
7618 if (m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
7619 {
7620 SetCleanness(0);//unclean the item upon damage dealt
7621 }
7622 }
7623 }
7624
7625 // just the split? TODO: verify
7626 override void OnRightClick()
7627 {
7628 super.OnRightClick();
7629
7630 if (CanBeSplit() && !GetDayZGame().IsLeftCtrlDown() && !GetGame().GetPlayer().GetInventory().HasInventoryReservation(this,null))
7631 {
7632 if (GetGame().IsClient())
7633 {
7634 if (ScriptInputUserData.CanStoreInputUserData())
7635 {
7636 EntityAI root = GetHierarchyRoot();
7637 Man playerOwner = GetHierarchyRootPlayer();
7638 InventoryLocation dst = new InventoryLocation;
7639
7640 // If we have no hierarchy root player and the root is the same as this item the source item is in the vicinity so we want to create the new split item there also
7641 if (!playerOwner && root && root == this)
7642 {
7644 }
7645 else
7646 {
7647 // Check if we can place the new split item in the same parent where the source item is placed in or otherwise drop it in vicinity
7648 GetInventory().GetCurrentInventoryLocation(dst);
7649 if (!dst.GetParent() || dst.GetParent() && !dst.GetParent().GetInventory().FindFreeLocationFor(this, FindInventoryLocationType.CARGO, dst))
7650 {
7651 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
7652 if (!player.GetInventory().FindFreeLocationFor(this, FindInventoryLocationType.CARGO, dst) || !playerOwner)
7653 {
7655 }
7656 else
7657 {
7658 dst.SetCargo(dst.GetParent(), this, dst.GetIdx(), dst.GetRow(), dst.GetCol(), dst.GetFlip());
7659 /* hacky solution to check reservation of "this" item instead of null since the gamecode is checking null against null and returning reservation=true incorrectly
7660 this shouldnt cause issues within this scope*/
7661 if (GetGame().GetPlayer().GetInventory().HasInventoryReservation(this, dst))
7662 {
7664 }
7665 else
7666 {
7667 GetGame().GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
7668 }
7669 }
7670 }
7671 }
7672
7673 ScriptInputUserData ctx = new ScriptInputUserData;
7675 ctx.Write(4);
7676 ItemBase thiz = this; // @NOTE: workaround for correct serialization
7677 ctx.Write(thiz);
7678 dst.WriteToContext(ctx);
7679 ctx.Write(true); // dummy
7680 ctx.Send();
7681 }
7682 }
7683 else if (!GetGame().IsMultiplayer())
7684 {
7685 SplitItem(PlayerBase.Cast(GetGame().GetPlayer()));
7686 }
7687 }
7688 }
7689
7690 protected void SetInventoryLocationToVicinityOrCurrent(EntityAI root, inout InventoryLocation dst)
7691 {
7692 if (root)
7693 {
7694 vector m4[4];
7695 root.GetTransform(m4);
7696 dst.SetGround(this, m4);
7697 }
7698 else
7699 {
7700 GetInventory().GetCurrentInventoryLocation(dst);
7701 }
7702 }
7703
7704 override bool CanBeCombined(EntityAI other_item, bool reservation_check = true, bool stack_max_limit = false)
7705 {
7706 //TODO: delete check zero quantity check after fix double posts hands fsm events
7707 if (!other_item || GetType() != other_item.GetType() || (IsFullQuantity() && other_item.GetQuantity() > 0) || other_item == this)
7708 return false;
7709
7710 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
7711 return false;
7712
7713 //can_this_be_combined = ConfigGetBool("canBeSplit");
7715 return false;
7716
7717
7718 Magazine mag = Magazine.Cast(this);
7719 if (mag)
7720 {
7721 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
7722 return false;
7723
7724 if (stack_max_limit)
7725 {
7726 Magazine other_mag = Magazine.Cast(other_item);
7727 if (other_item)
7728 {
7729 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
7730 return false;
7731 }
7732
7733 }
7734 }
7735 else
7736 {
7737 //TODO: delete check zero quantity check after fix double posts hands fsm events
7738 if (GetQuantity() >= GetQuantityMax() && other_item.GetQuantity() > 0 )
7739 return false;
7740
7741 if (stack_max_limit && (GetQuantity() + other_item.GetQuantity() > GetQuantityMax()))
7742 return false;
7743 }
7744
7745 PlayerBase player = null;
7746 if (CastTo(player, GetHierarchyRootPlayer())) //false when attached to player's attachment slot
7747 {
7748 if (player.GetInventory().HasAttachment(this))
7749 return false;
7750
7751 if (player.IsItemsToDelete())
7752 return false;
7753 }
7754
7755 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
7756 return false;
7757
7758 int slotID;
7759 string slotName;
7760 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
7761 return false;
7762
7763 return true;
7764 }
7765
7766 bool IsCombineAll(ItemBase other_item, bool use_stack_max = false)
7767 {
7768 return ComputeQuantityUsed(other_item, use_stack_max) == other_item.GetQuantity();
7769 }
7770
7771 bool IsResultOfSplit()
7772 {
7773 return m_IsResultOfSplit;
7774 }
7775
7776 void SetResultOfSplit(bool value)
7777 {
7778 m_IsResultOfSplit = value;
7779 }
7780
7781 int ComputeQuantityUsed(ItemBase other_item, bool use_stack_max = true)
7782 {
7783 return ComputeQuantityUsedEx(other_item, use_stack_max);
7784 }
7785
7786 float ComputeQuantityUsedEx(ItemBase other_item, bool use_stack_max = true)
7787 {
7788 float other_item_quantity = other_item.GetQuantity();
7789 float this_free_space;
7790
7791 float stack_max = GetQuantityMax();
7792
7793 this_free_space = stack_max - GetQuantity();
7794
7795 if (other_item_quantity > this_free_space)
7796 {
7797 return this_free_space;
7798 }
7799 else
7800 {
7801 return other_item_quantity;
7802 }
7803 }
7804
7805 override void CombineItemsEx(EntityAI entity2, bool use_stack_max = true)
7806 {
7807 CombineItems(ItemBase.Cast(entity2),use_stack_max);
7808 }
7809
7810 void CombineItems(ItemBase other_item, bool use_stack_max = true)
7811 {
7812 if (!CanBeCombined(other_item, false))
7813 return;
7814
7815 if (!IsMagazine() && other_item)
7816 {
7817 float quantity_used = ComputeQuantityUsedEx(other_item,use_stack_max);
7818 if (quantity_used != 0)
7819 {
7820 float hp1 = GetHealth01("","");
7821 float hp2 = other_item.GetHealth01("","");
7822 float hpResult = ((hp1*GetQuantity()) + (hp2*quantity_used));
7823 hpResult = hpResult / (GetQuantity() + quantity_used);
7824
7825 hpResult *= GetMaxHealth();
7826 Math.Round(hpResult);
7827 SetHealth("", "Health", hpResult);
7828
7829 AddQuantity(quantity_used);
7830 other_item.AddQuantity(-quantity_used);
7831 }
7832 }
7833 OnCombine(other_item);
7834 }
7835
7836 void OnCombine(ItemBase other_item)
7837 {
7838 #ifdef SERVER
7839 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
7840 GetHierarchyParent().IncreaseLifetimeUp();
7841 #endif
7842 };
7843
7844 void GetRecipesActions(Man player, out TSelectableActionInfoArray outputList)
7845 {
7846 PlayerBase p = PlayerBase.Cast(player);
7847
7848 array<int> recipesIds = p.m_Recipes;
7849 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(GetPlugin(PluginRecipesManager));
7850 if (moduleRecipesManager)
7851 {
7852 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
7853 moduleRecipesManager.GetValidRecipes(ItemBase.Cast(this), ItemBase.Cast(itemInHands), recipesIds, p);
7854 }
7855
7856 for (int i = 0;i < recipesIds.Count(); i++)
7857 {
7858 int key = recipesIds.Get(i);
7859 string recipeName = moduleRecipesManager.GetRecipeName(key);
7860 outputList.Insert(new TSelectableActionInfo(SAT_CRAFTING, key, recipeName));
7861 }
7862 }
7863
7864 // -------------------------------------------------------------------------
7865 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
7866 {
7867 super.GetDebugActions(outputList);
7868
7869 //quantity
7870 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_QUANTITY, "Quantity +20%", FadeColors.LIGHT_GREY));
7871 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_QUANTITY, "Quantity -20%", FadeColors.LIGHT_GREY));
7872 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SET_QUANTITY_0, "Set Quantity 0", FadeColors.LIGHT_GREY));
7873 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SET_MAX_QUANTITY, "Set Quantity Max", FadeColors.LIGHT_GREY));
7874 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
7875
7876 //health
7877 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_HEALTH, "Health +20%", FadeColors.LIGHT_GREY));
7878 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_HEALTH, "Health -20%", FadeColors.LIGHT_GREY));
7879 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.DESTROY_HEALTH, "Health 0", FadeColors.LIGHT_GREY));
7880 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
7881 //temperature
7882 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_TEMPERATURE, "Temperature +20", FadeColors.LIGHT_GREY));
7883 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_TEMPERATURE, "Temperature -20", FadeColors.LIGHT_GREY));
7884 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.FLIP_FROZEN, "Toggle Frozen", FadeColors.LIGHT_GREY));
7885 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
7886
7887 //wet
7888 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_WETNESS, "Wetness +20", FadeColors.LIGHT_GREY));
7889 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_WETNESS, "Wetness -20", FadeColors.LIGHT_GREY));
7890 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
7891
7892 //liquidtype
7893 if (IsLiquidContainer())
7894 {
7895 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.LIQUIDTYPE_UP, "LiquidType Next", FadeColors.LIGHT_GREY));
7896 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.LIQUIDTYPE_DOWN, "LiquidType Previous", FadeColors.LIGHT_GREY));
7897 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
7898 }
7899
7900 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.MAKE_SPECIAL, "Make Special", FadeColors.LIGHT_GREY));
7901 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
7902
7903 // watch
7904 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.WATCH_ITEM, "Watch (CTRL-Z)", FadeColors.LIGHT_GREY));
7905 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.WATCH_PLAYER, "Watch Player", FadeColors.LIGHT_GREY));
7906 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
7907
7908 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.DELETE, "Delete", FadeColors.RED));
7909
7910 InventoryLocation loc = new InventoryLocation();
7911 GetInventory().GetCurrentInventoryLocation(loc);
7912 if (!loc || loc.GetType() == InventoryLocationType.GROUND)
7913 {
7914 if (Gizmo_IsSupported())
7915 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.GIZMO_OBJECT, "Gizmo Object", FadeColors.LIGHT_GREY));
7916 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.GIZMO_PHYSICS, "Gizmo Physics (SP Only)", FadeColors.LIGHT_GREY)); // intentionally allowed for testing physics desync
7917 }
7918
7919 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
7920 }
7921
7922 // -------------------------------------------------------------------------
7923 // -------------------------------------------------------------------------
7924 // -------------------------------------------------------------------------
7925 override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
7926 {
7927 super.OnAction(action_id, player, ctx);
7928
7929 if (GetGame().IsClient() || !GetGame().IsMultiplayer())
7930 {
7931 switch (action_id)
7932 {
7933 case EActions.GIZMO_OBJECT:
7934 GetGame().GizmoSelectObject(this);
7935 return true;
7936 case EActions.GIZMO_PHYSICS:
7937 GetGame().GizmoSelectPhysics(GetPhysics());
7938 return true;
7939 }
7940 }
7941
7942 if (GetGame().IsServer())
7943 {
7944 switch (action_id)
7945 {
7946 case EActions.DELETE:
7947 Delete();
7948 return true;
7949 }
7950 }
7951
7952 if (action_id >= EActions.RECIPES_RANGE_START && action_id < EActions.RECIPES_RANGE_END)
7953 {
7954 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(GetPlugin(PluginRecipesManager));
7955 int idWithoutOffset = action_id - EActions.RECIPES_RANGE_START;
7956 PlayerBase p = PlayerBase.Cast(player);
7957 if (EActions.RECIPES_RANGE_START < 1000)
7958 {
7959 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
7960 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
7961 }
7962 }
7963 #ifndef SERVER
7964 else if (action_id == EActions.WATCH_PLAYER)
7965 {
7966 PluginDeveloper.SetDeveloperItemClientEx(player);
7967 }
7968 #endif
7969 if (GetGame().IsServer())
7970 {
7971 if (action_id >= EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id < EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
7972 {
7973 int id = action_id - EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
7974 OnDebugButtonPressServer(id + 1);
7975 }
7976
7977 else if (action_id >= EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id < EActions.DEBUG_AGENTS_RANGE_INJECT_END)
7978 {
7979 int agent_id = action_id - EActions.DEBUG_AGENTS_RANGE_INJECT_START;
7980 InsertAgent(agent_id,100);
7981 }
7982
7983 else if (action_id >= EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id < EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
7984 {
7985 int agent_id2 = action_id - EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
7986 RemoveAgent(agent_id2);
7987 }
7988
7989 else if (action_id == EActions.ADD_QUANTITY)
7990 {
7991 if (IsMagazine())
7992 {
7993 Magazine mag = Magazine.Cast(this);
7994 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
7995 }
7996 else
7997 {
7998 AddQuantity(GetQuantityMax() * 0.2);
7999 }
8000
8001 if (m_EM)
8002 {
8003 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
8004 }
8005 //PrintVariables();
8006 }
8007
8008 else if (action_id == EActions.REMOVE_QUANTITY) //Quantity -20%
8009 {
8010 if (IsMagazine())
8011 {
8012 Magazine mag2 = Magazine.Cast(this);
8013 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
8014 }
8015 else
8016 {
8017 AddQuantity(- GetQuantityMax() * 0.2);
8018 }
8019 if (m_EM)
8020 {
8021 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
8022 }
8023 //PrintVariables();
8024 }
8025
8026 else if (action_id == EActions.SET_QUANTITY_0) //SetMaxQuantity
8027 {
8028 SetQuantity(0);
8029
8030 if (m_EM)
8031 {
8032 m_EM.SetEnergy(0);
8033 }
8034 }
8035
8036 else if (action_id == EActions.SET_MAX_QUANTITY) //SetMaxQuantity
8037 {
8039
8040 if (m_EM)
8041 {
8042 m_EM.SetEnergy(m_EM.GetEnergyMax());
8043 }
8044 }
8045
8046 else if (action_id == EActions.ADD_HEALTH)
8047 {
8048 AddHealth("","",GetMaxHealth("","Health")/5);
8049 }
8050 else if (action_id == EActions.REMOVE_HEALTH)
8051 {
8052 AddHealth("","",-GetMaxHealth("","Health")/5);
8053 }
8054 else if (action_id == EActions.DESTROY_HEALTH)
8055 {
8056 SetHealth01("","",0);
8057 }
8058 else if (action_id == EActions.WATCH_ITEM)
8059 {
8061 mid.RegisterDebugItem(ItemBase.Cast(this), PlayerBase.Cast(player));
8062 #ifdef DEVELOPER
8063 SetDebugDeveloper_item(this);
8064 #endif
8065 }
8066
8067 else if (action_id == EActions.ADD_TEMPERATURE)
8068 {
8069 AddTemperature(20);
8070 //PrintVariables();
8071 }
8072
8073 else if (action_id == EActions.REMOVE_TEMPERATURE)
8074 {
8075 AddTemperature(-20);
8076 //PrintVariables();
8077 }
8078
8079 else if (action_id == EActions.FLIP_FROZEN)
8080 {
8081 SetFrozen(!GetIsFrozen());
8082 //PrintVariables();
8083 }
8084
8085 else if (action_id == EActions.ADD_WETNESS)
8086 {
8087 AddWet(GetWetMax()/5);
8088 //PrintVariables();
8089 }
8090
8091 else if (action_id == EActions.REMOVE_WETNESS)
8092 {
8093 AddWet(-GetWetMax()/5);
8094 //PrintVariables();
8095 }
8096
8097 else if (action_id == EActions.LIQUIDTYPE_UP)
8098 {
8099 int curr_type = GetLiquidType();
8100 SetLiquidType(curr_type * 2);
8101 //AddWet(1);
8102 //PrintVariables();
8103 }
8104
8105 else if (action_id == EActions.LIQUIDTYPE_DOWN)
8106 {
8107 int curr_type2 = GetLiquidType();
8108 SetLiquidType(curr_type2 / 2);
8109 }
8110
8111 else if (action_id == EActions.MAKE_SPECIAL)
8112 {
8113 auto debugParams = DebugSpawnParams.WithPlayer(player);
8114 OnDebugSpawnEx(debugParams);
8115 }
8116
8117 }
8118
8119
8120 return false;
8121 }
8122
8123 // -------------------------------------------------------------------------
8124
8125
8128 void OnActivatedByTripWire();
8129
8131 void OnActivatedByItem(notnull ItemBase item);
8132
8133 //----------------------------------------------------------------
8134 //returns true if item is able to explode when put in fire
8135 bool CanExplodeInFire()
8136 {
8137 return false;
8138 }
8139
8140 //----------------------------------------------------------------
8141 bool CanEat()
8142 {
8143 return true;
8144 }
8145
8146 //----------------------------------------------------------------
8147 override bool IsIgnoredByConstruction()
8148 {
8149 return true;
8150 }
8151
8152 //----------------------------------------------------------------
8153 //has FoodStages in config?
8154 bool HasFoodStage()
8155 {
8156 string config_path = string.Format("CfgVehicles %1 Food FoodStages", GetType());
8157 return GetGame().ConfigIsExisting(config_path);
8158 }
8159
8161 FoodStage GetFoodStage()
8162 {
8163 return null;
8164 }
8165
8166 bool CanBeCooked()
8167 {
8168 return false;
8169 }
8170
8171 bool CanBeCookedOnStick()
8172 {
8173 return false;
8174 }
8175
8177 void RefreshAudioVisualsOnClient( CookingMethodType cooking_method, bool is_done, bool is_empty, bool is_burned );
8179
8180 //----------------------------------------------------------------
8181 bool CanRepair(ItemBase item_repair_kit)
8182 {
8183 PluginRepairing module_repairing = PluginRepairing.Cast(GetPlugin(PluginRepairing));
8184 return module_repairing.CanRepair(this, item_repair_kit);
8185 }
8186
8187 //----------------------------------------------------------------
8188 bool Repair(PlayerBase player, ItemBase item_repair_kit, float specialty_weight)
8189 {
8190 PluginRepairing module_repairing = PluginRepairing.Cast(GetPlugin(PluginRepairing));
8191 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
8192 }
8193
8194 //----------------------------------------------------------------
8195 int GetItemSize()
8196 {
8197 /*
8198 vector v_size = this.ConfigGetVector("itemSize");
8199 int v_size_x = v_size[0];
8200 int v_size_y = v_size[1];
8201 int size = v_size_x * v_size_y;
8202 return size;
8203 */
8204
8205 return 1;
8206 }
8207
8208 //----------------------------------------------------------------
8209 //Override for allowing seemingly unallowed moves when two clients send a conflicting message simultaneously
8210 bool CanBeMovedOverride()
8211 {
8212 return m_CanBeMovedOverride;
8213 }
8214
8215 //----------------------------------------------------------------
8216 //Override for allowing seemingly unallowed moves when two clients send a conflicting message simultaneously
8217 void SetCanBeMovedOverride(bool setting)
8218 {
8219 m_CanBeMovedOverride = setting;
8220 }
8221
8222 //----------------------------------------------------------------
8230 void MessageToOwnerStatus(string text)
8231 {
8232 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8233
8234 if (player)
8235 {
8236 player.MessageStatus(text);
8237 }
8238 }
8239
8240 //----------------------------------------------------------------
8248 void MessageToOwnerAction(string text)
8249 {
8250 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8251
8252 if (player)
8253 {
8254 player.MessageAction(text);
8255 }
8256 }
8257
8258 //----------------------------------------------------------------
8266 void MessageToOwnerFriendly(string text)
8267 {
8268 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8269
8270 if (player)
8271 {
8272 player.MessageFriendly(text);
8273 }
8274 }
8275
8276 //----------------------------------------------------------------
8284 void MessageToOwnerImportant(string text)
8285 {
8286 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8287
8288 if (player)
8289 {
8290 player.MessageImportant(text);
8291 }
8292 }
8293
8294 override bool IsItemBase()
8295 {
8296 return true;
8297 }
8298
8299 // Checks if item is of questioned kind
8300 override bool KindOf(string tag)
8301 {
8302 bool found = false;
8303 string item_name = this.GetType();
8304 ref TStringArray item_tag_array = new TStringArray;
8305 GetGame().ConfigGetTextArray("cfgVehicles " + item_name + " itemInfo", item_tag_array);
8306
8307 int array_size = item_tag_array.Count();
8308 for (int i = 0; i < array_size; i++)
8309 {
8310 if (item_tag_array.Get(i) == tag)
8311 {
8312 found = true;
8313 break;
8314 }
8315 }
8316 return found;
8317 }
8318
8319
8320 override void OnRPC(PlayerIdentity sender, int rpc_type,ParamsReadContext ctx)
8321 {
8322 //Debug.Log("OnRPC called");
8323 super.OnRPC(sender, rpc_type,ctx);
8324
8325 //Play soundset for attachment locking (ActionLockAttachment.c)
8326 switch (rpc_type)
8327 {
8328 #ifndef SERVER
8329 case ERPCs.RPC_SOUND_LOCK_ATTACH:
8330 Param2<bool, string> p = new Param2<bool, string>(false, "");
8331
8332 if (!ctx.Read(p))
8333 return;
8334
8335 bool play = p.param1;
8336 string soundSet = p.param2;
8337
8338 if (play)
8339 {
8340 if (m_LockingSound)
8341 {
8343 {
8344 m_LockingSound = SEffectManager.PlaySound(soundSet, GetPosition(), 0, 0, true);
8345 }
8346 }
8347 else
8348 {
8349 m_LockingSound = SEffectManager.PlaySound(soundSet, GetPosition(), 0, 0, true);
8350 }
8351 }
8352 else
8353 {
8354 SEffectManager.DestroyEffect(m_LockingSound);
8355 }
8356
8357 break;
8358 #endif
8359
8360 }
8361
8362 if (GetWrittenNoteData())
8363 {
8364 GetWrittenNoteData().OnRPC(sender, rpc_type,ctx);
8365 }
8366 }
8367
8368 //-----------------------------
8369 // VARIABLE MANIPULATION SYSTEM
8370 //-----------------------------
8371 int NameToID(string name)
8372 {
8373 PluginVariables plugin = PluginVariables.Cast(GetPlugin(PluginVariables));
8374 return plugin.GetID(name);
8375 }
8376
8377 string IDToName(int id)
8378 {
8379 PluginVariables plugin = PluginVariables.Cast(GetPlugin(PluginVariables));
8380 return plugin.GetName(id);
8381 }
8382
8384 void OnSyncVariables(ParamsReadContext ctx)//with ID optimization
8385 {
8386 //Debug.Log("OnSyncVariables called for item: "+ ToString(this.GetType()),"varSync");
8387 //read the flags
8388 int varFlags;
8389 if (!ctx.Read(varFlags))
8390 return;
8391
8392 if (varFlags & ItemVariableFlags.FLOAT)
8393 {
8394 ReadVarsFromCTX(ctx);
8395 }
8396 }
8397
8398 override void SerializeNumericalVars(array<float> floats_out)
8399 {
8400 //some variables handled on EntityAI level already!
8401 super.SerializeNumericalVars(floats_out);
8402
8403 // the order of serialization must be the same as the order of de-serialization
8404 //--------------------------------------------
8405 if (IsVariableSet(VARIABLE_QUANTITY))
8406 {
8407 floats_out.Insert(m_VarQuantity);
8408 }
8409 //--------------------------------------------
8410 if (IsVariableSet(VARIABLE_WET))
8411 {
8412 floats_out.Insert(m_VarWet);
8413 }
8414 //--------------------------------------------
8415 if (IsVariableSet(VARIABLE_LIQUIDTYPE))
8416 {
8417 floats_out.Insert(m_VarLiquidType);
8418 }
8419 //--------------------------------------------
8420 if (IsVariableSet(VARIABLE_COLOR))
8421 {
8422 floats_out.Insert(m_ColorComponentR);
8423 floats_out.Insert(m_ColorComponentG);
8424 floats_out.Insert(m_ColorComponentB);
8425 floats_out.Insert(m_ColorComponentA);
8426 }
8427 //--------------------------------------------
8428 if (IsVariableSet(VARIABLE_CLEANNESS))
8429 {
8430 floats_out.Insert(m_Cleanness);
8431 }
8432 }
8433
8434 override void DeSerializeNumericalVars(array<float> floats)
8435 {
8436 //some variables handled on EntityAI level already!
8437 super.DeSerializeNumericalVars(floats);
8438
8439 // the order of serialization must be the same as the order of de-serialization
8440 int index = 0;
8441 int mask = Math.Round(floats.Get(index));
8442
8443 index++;
8444 //--------------------------------------------
8445 if (mask & VARIABLE_QUANTITY)
8446 {
8447 if (m_IsStoreLoad)
8448 {
8449 SetStoreLoadedQuantity(floats.Get(index));
8450 }
8451 else
8452 {
8453 float quantity = floats.Get(index);
8454 SetQuantity(quantity, true, false, false, false);
8455 }
8456 index++;
8457 }
8458 //--------------------------------------------
8459 if (mask & VARIABLE_WET)
8460 {
8461 float wet = floats.Get(index);
8462 SetWet(wet);
8463 index++;
8464 }
8465 //--------------------------------------------
8466 if (mask & VARIABLE_LIQUIDTYPE)
8467 {
8468 int liquidtype = Math.Round(floats.Get(index));
8469 SetLiquidType(liquidtype);
8470 index++;
8471 }
8472 //--------------------------------------------
8473 if (mask & VARIABLE_COLOR)
8474 {
8475 m_ColorComponentR = Math.Round(floats.Get(index));
8476 index++;
8477 m_ColorComponentG = Math.Round(floats.Get(index));
8478 index++;
8479 m_ColorComponentB = Math.Round(floats.Get(index));
8480 index++;
8481 m_ColorComponentA = Math.Round(floats.Get(index));
8482 index++;
8483 }
8484 //--------------------------------------------
8485 if (mask & VARIABLE_CLEANNESS)
8486 {
8487 int cleanness = Math.Round(floats.Get(index));
8488 SetCleanness(cleanness);
8489 index++;
8490 }
8491 }
8492
8493 override void WriteVarsToCTX(ParamsWriteContext ctx)
8494 {
8495 super.WriteVarsToCTX(ctx);
8496
8497 //--------------------------------------------
8498 if (IsVariableSet(VARIABLE_QUANTITY))
8499 {
8500 ctx.Write(GetQuantity());
8501 }
8502 //--------------------------------------------
8503 if (IsVariableSet(VARIABLE_WET))
8504 {
8505 ctx.Write(GetWet());
8506 }
8507 //--------------------------------------------
8508 if (IsVariableSet(VARIABLE_LIQUIDTYPE))
8509 {
8510 ctx.Write(GetLiquidType());
8511 }
8512 //--------------------------------------------
8513 if (IsVariableSet(VARIABLE_COLOR))
8514 {
8515 int r,g,b,a;
8516 GetColor(r,g,b,a);
8517 ctx.Write(r);
8518 ctx.Write(g);
8519 ctx.Write(b);
8520 ctx.Write(a);
8521 }
8522 //--------------------------------------------
8523 if (IsVariableSet(VARIABLE_CLEANNESS))
8524 {
8525 ctx.Write(GetCleanness());
8526 }
8527 }
8528
8529 override bool ReadVarsFromCTX(ParamsReadContext ctx, int version = -1)//with ID optimization
8530 {
8531 if (!super.ReadVarsFromCTX(ctx,version))
8532 return false;
8533
8534 int intValue;
8535 float value;
8536
8537 if (version < 140)
8538 {
8539 if (!ctx.Read(intValue))
8540 return false;
8541
8542 m_VariablesMask = intValue;
8543 }
8544
8545 if (m_VariablesMask & VARIABLE_QUANTITY)
8546 {
8547 if (!ctx.Read(value))
8548 return false;
8549
8550 if (IsStoreLoad())
8551 {
8553 }
8554 else
8555 {
8556 SetQuantity(value, true, false, false, false);
8557 }
8558 }
8559 //--------------------------------------------
8560 if (version < 140)
8561 {
8562 if (m_VariablesMask & VARIABLE_TEMPERATURE)
8563 {
8564 if (!ctx.Read(value))
8565 return false;
8566 SetTemperatureDirect(value);
8567 }
8568 }
8569 //--------------------------------------------
8570 if (m_VariablesMask & VARIABLE_WET)
8571 {
8572 if (!ctx.Read(value))
8573 return false;
8574 SetWet(value);
8575 }
8576 //--------------------------------------------
8577 if (m_VariablesMask & VARIABLE_LIQUIDTYPE)
8578 {
8579 if (!ctx.Read(intValue))
8580 return false;
8581 SetLiquidType(intValue);
8582 }
8583 //--------------------------------------------
8584 if (m_VariablesMask & VARIABLE_COLOR)
8585 {
8586 int r,g,b,a;
8587 if (!ctx.Read(r))
8588 return false;
8589 if (!ctx.Read(g))
8590 return false;
8591 if (!ctx.Read(b))
8592 return false;
8593 if (!ctx.Read(a))
8594 return false;
8595
8596 SetColor(r,g,b,a);
8597 }
8598 //--------------------------------------------
8599 if (m_VariablesMask & VARIABLE_CLEANNESS)
8600 {
8601 if (!ctx.Read(intValue))
8602 return false;
8603 SetCleanness(intValue);
8604 }
8605 //--------------------------------------------
8606 if (version >= 138 && version < 140)
8607 {
8608 if (m_VariablesMask & VARIABLE_TEMPERATURE)
8609 {
8610 if (!ctx.Read(intValue))
8611 return false;
8612 SetFrozen(intValue);
8613 }
8614 }
8615
8616 return true;
8617 }
8618
8619 //----------------------------------------------------------------
8620 override bool OnStoreLoad(ParamsReadContext ctx, int version)
8621 {
8622 m_IsStoreLoad = true;
8624 {
8625 m_FixDamageSystemInit = true;
8626 }
8627
8628 if (!super.OnStoreLoad(ctx, version))
8629 {
8630 m_IsStoreLoad = false;
8631 return false;
8632 }
8633
8634 if (version >= 114)
8635 {
8636 bool hasQuickBarIndexSaved;
8637
8638 if (!ctx.Read(hasQuickBarIndexSaved))
8639 {
8640 m_IsStoreLoad = false;
8641 return false;
8642 }
8643
8644 if (hasQuickBarIndexSaved)
8645 {
8646 int itmQBIndex;
8647
8648 //Load quickbar item bind
8649 if (!ctx.Read(itmQBIndex))
8650 {
8651 m_IsStoreLoad = false;
8652 return false;
8653 }
8654
8655 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
8656 if (itmQBIndex != -1 && parentPlayer)
8657 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
8658 }
8659 }
8660 else
8661 {
8662 // Backup of how it used to be
8663 PlayerBase player;
8664 int itemQBIndex;
8665 if (version == int.MAX)
8666 {
8667 if (!ctx.Read(itemQBIndex))
8668 {
8669 m_IsStoreLoad = false;
8670 return false;
8671 }
8672 }
8673 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
8674 {
8675 //Load quickbar item bind
8676 if (!ctx.Read(itemQBIndex))
8677 {
8678 m_IsStoreLoad = false;
8679 return false;
8680 }
8681 if (itemQBIndex != -1 && player)
8682 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
8683 }
8684 }
8685
8686 if (version < 140)
8687 {
8688 // variable management system
8689 if (!LoadVariables(ctx, version))
8690 {
8691 m_IsStoreLoad = false;
8692 return false;
8693 }
8694 }
8695
8696 //agent trasmission system
8697 if (!LoadAgents(ctx, version))
8698 {
8699 m_IsStoreLoad = false;
8700 return false;
8701 }
8702 if (version >= 132)
8703 {
8704 RemotelyActivatedItemBehaviour raib = GetRemotelyActivatedItemBehaviour();
8705 if (raib)
8706 {
8707 if (!raib.OnStoreLoad(ctx,version))
8708 {
8709 m_IsStoreLoad = false;
8710 return false;
8711 }
8712 }
8713 }
8714
8715 m_IsStoreLoad = false;
8716 return true;
8717 }
8718
8719 //----------------------------------------------------------------
8720
8721 override void OnStoreSave(ParamsWriteContext ctx)
8722 {
8723 super.OnStoreSave(ctx);
8724
8725 PlayerBase player;
8726 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
8727 {
8728 ctx.Write(true); // Keep track of if we should actually read this in or not
8729 //Save quickbar item bind
8730 int itemQBIndex = -1;
8731 itemQBIndex = player.FindQuickBarEntityIndex(this);
8732 ctx.Write(itemQBIndex);
8733 }
8734 else
8735 {
8736 ctx.Write(false); // Keep track of if we should actually read this in or not
8737 }
8738
8739 SaveAgents(ctx);//agent trasmission system
8740
8741 RemotelyActivatedItemBehaviour raib = GetRemotelyActivatedItemBehaviour();
8742 if (raib)
8743 {
8744 raib.OnStoreSave(ctx);
8745 }
8746 }
8747 //----------------------------------------------------------------
8748
8749 override void AfterStoreLoad()
8750 {
8751 super.AfterStoreLoad();
8752
8754 {
8756 }
8757
8758 if (GetStoreLoadedQuantity() != float.LOWEST)
8759 {
8761 SetStoreLoadedQuantity(float.LOWEST);//IMPORTANT to do this !! we use 'm_StoreLoadedQuantity' inside SetQuantity to distinguish between initial quantity setting and the consequent(normal gameplay) calls
8762 }
8763 }
8764
8765 override void EEOnAfterLoad()
8766 {
8767 super.EEOnAfterLoad();
8768
8770 {
8771 m_FixDamageSystemInit = false;
8772 }
8773
8776 }
8777
8778 bool CanBeDisinfected()
8779 {
8780 return false;
8781 }
8782
8783
8784 //----------------------------------------------------------------
8785 override void OnVariablesSynchronized()
8786 {
8787 if (m_Initialized)
8788 {
8789 #ifdef PLATFORM_CONSOLE
8790 //bruteforce it is
8791 if (IsSplitable())
8792 {
8793 UIScriptedMenu menu = GetGame().GetUIManager().FindMenu(MENU_INVENTORY);
8794 if (menu)
8795 {
8796 menu.Refresh();
8797 }
8798 }
8799 #endif
8800 }
8801
8803 {
8804 PlayImpactSound(m_ConfigWeight, m_ImpactSpeed, m_ImpactSoundSurfaceHash);
8805 m_WantPlayImpactSound = false;
8806 }
8807
8809 {
8810 SetWeightDirty();
8812 }
8813 if (m_VarWet != m_VarWetPrev)
8814 {
8817 }
8818
8819 if (m_SoundSyncPlay != 0)
8820 {
8821 m_ItemSoundHandler.PlayItemSoundClient(m_SoundSyncPlay);
8822 m_SoundSyncPlay = 0;
8823 }
8824 if (m_SoundSyncStop != 0)
8825 {
8826 m_ItemSoundHandler.StopItemSoundClient(m_SoundSyncStop);
8827 m_SoundSyncStop = 0;
8828 }
8829
8830 super.OnVariablesSynchronized();
8831 }
8832
8833 //------------------------- Quantity
8834 //----------------------------------------------------------------
8836 override bool SetQuantity(float value, bool destroy_config = true, bool destroy_forced = false, bool allow_client = false, bool clamp_to_stack_max = true)
8837 {
8838 if (!IsServerCheck(allow_client))
8839 return false;
8840
8841 if (!HasQuantity())
8842 return false;
8843
8844 float min = GetQuantityMin();
8845 float max = GetQuantityMax();
8846
8847 if (value <= (min + 0.001))
8848 value = min;
8849
8850 if (value == min)
8851 {
8852 if (destroy_config)
8853 {
8854 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
8855 if (dstr)
8856 {
8857 m_VarQuantity = Math.Clamp(value, min, max);
8858 this.Delete();
8859 return true;
8860 }
8861 }
8862 else if (destroy_forced)
8863 {
8864 m_VarQuantity = Math.Clamp(value, min, max);
8865 this.Delete();
8866 return true;
8867 }
8868 // we get here if destroy_config IS true AND dstr(config destroy param) IS false;
8869 RemoveAllAgents();//we remove all agents when we got to the min value, but the item is not getting deleted
8870 }
8871
8872 float delta = m_VarQuantity;
8873 m_VarQuantity = Math.Clamp(value, min, max);
8874
8875 if (GetStoreLoadedQuantity() == float.LOWEST)//any other value means we are setting quantity from storage
8876 {
8877 delta = m_VarQuantity - delta;
8878
8879 if (delta)
8880 OnQuantityChanged(delta);
8881 }
8882
8883 SetVariableMask(VARIABLE_QUANTITY);
8884
8885 return false;
8886 }
8887
8888 //----------------------------------------------------------------
8890 bool AddQuantity(float value, bool destroy_config = true, bool destroy_forced = false)
8891 {
8892 return SetQuantity(GetQuantity() + value, destroy_config, destroy_forced);
8893 }
8894 //----------------------------------------------------------------
8895 void SetQuantityMax()
8896 {
8897 float max = GetQuantityMax();
8898 SetQuantity(max);
8899 }
8900
8901 override void SetQuantityToMinimum()
8902 {
8903 float min = GetQuantityMin();
8904 SetQuantity(min);
8905 }
8906 //----------------------------------------------------------------
8908 override void SetQuantityNormalized(float value, bool destroy_config = true, bool destroy_forced = false)
8909 {
8910 float value_clamped = Math.Clamp(value, 0, 1);//just to make sure
8911 int result = Math.Round(Math.Lerp(GetQuantityMin(), GetQuantityMax(), value_clamped));
8912 SetQuantity(result, destroy_config, destroy_forced);
8913 }
8914
8915 //----------------------------------------------------------------
8917 override float GetQuantityNormalized()
8918 {
8919 return Math.InverseLerp(GetQuantityMin(), GetQuantityMax(),m_VarQuantity);
8920 }
8921
8923 {
8924 return GetQuantityNormalized();
8925 }
8926
8927 /*void SetAmmoNormalized(float value)
8928 {
8929 float value_clamped = Math.Clamp(value, 0, 1);
8930 Magazine this_mag = Magazine.Cast(this);
8931 int max_rounds = this_mag.GetAmmoMax();
8932 int result = value * max_rounds;//can the rounded if higher precision is required
8933 this_mag.SetAmmoCount(result);
8934 }*/
8935 //----------------------------------------------------------------
8936 override int GetQuantityMax()
8937 {
8938 int slot = -1;
8939 if (GetInventory())
8940 {
8941 InventoryLocation il = new InventoryLocation;
8942 GetInventory().GetCurrentInventoryLocation(il);
8943 slot = il.GetSlot();
8944 }
8945
8946 return GetTargetQuantityMax(slot);
8947 }
8948
8949 override int GetTargetQuantityMax(int attSlotID = -1)
8950 {
8951 float quantity_max = 0;
8952
8953 if (IsSplitable()) //only stackable/splitable items can check for stack size
8954 {
8955 if (attSlotID != -1)
8956 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
8957
8958 if (quantity_max <= 0)
8959 quantity_max = m_VarStackMax;
8960 }
8961
8962 if (quantity_max <= 0)
8963 quantity_max = m_VarQuantityMax;
8964
8965 return quantity_max;
8966 }
8967 //----------------------------------------------------------------
8968 override int GetQuantityMin()
8969 {
8970 return m_VarQuantityMin;
8971 }
8972 //----------------------------------------------------------------
8973 int GetQuantityInit()
8974 {
8975 return m_VarQuantityInit;
8976 }
8977
8978 //----------------------------------------------------------------
8979 override bool HasQuantity()
8980 {
8981 return !(GetQuantityMax() - GetQuantityMin() == 0);
8982 }
8983
8984 override float GetQuantity()
8985 {
8986 return m_VarQuantity;
8987 }
8988
8989 bool IsFullQuantity()
8990 {
8991 return GetQuantity() >= GetQuantityMax();
8992 }
8993
8994 //Calculates weight of single item without attachments and cargo
8995 override float GetSingleInventoryItemWeightEx()
8996 {
8997 //this needs to be first stored inside local variables, when returned directly during inside return call, the result is completely different due to enforce script bug
8998 float weightEx = GetWeightEx();//overall weight of the item
8999 float special = GetInventoryAndCargoWeight();//cargo and attachment weight
9000 return weightEx - special;
9001 }
9002
9003 // Obsolete, use GetSingleInventoryItemWeightEx() instead
9005 {
9007 }
9008
9009 override protected float GetWeightSpecialized(bool forceRecalc = false)
9010 {
9011 if (IsSplitable()) //quantity determines size of the stack
9012 {
9013 #ifdef DEVELOPER
9014 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9015 {
9016 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
9017 data1.SetCalcDetails("TIB1: " + GetConfigWeightModifiedDebugText() +" * " + GetQuantity()+"(quantity)");
9018 }
9019 #endif
9020
9021 return GetQuantity() * GetConfigWeightModified();
9022 }
9023 else if (HasEnergyManager())// items with energy manager
9024 {
9025 #ifdef DEVELOPER
9026 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9027 {
9028 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
9029 data2.SetCalcDetails("TIB2: "+super.GetWeightSpecialized(forceRecalc)+"(contents weight) + " + GetConfigWeightModifiedDebugText() +" + " + GetCompEM().GetEnergy()+"(energy) * " + ConfigGetFloat("weightPerQuantityUnit") +"(weightPerQuantityUnit)");
9030 }
9031 #endif
9032 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
9033 }
9034 else//everything else
9035 {
9036 #ifdef DEVELOPER
9037 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9038 {
9039 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
9040 data3.SetCalcDetails("TIB3: "+super.GetWeightSpecialized(forceRecalc)+"(contents weight) + " + GetConfigWeightModifiedDebugText() +" + " + GetQuantity()+"(quantity) * " + ConfigGetFloat("weightPerQuantityUnit") +"(weightPerQuantityUnit))");
9041 }
9042 #endif
9043 return super.GetWeightSpecialized(forceRecalc) + (GetQuantity() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
9044 }
9045 }
9046
9048 int GetNumberOfItems()
9049 {
9050 int item_count = 0;
9051 ItemBase item;
9052
9053 if (GetInventory().GetCargo() != NULL)
9054 {
9055 item_count = GetInventory().GetCargo().GetItemCount();
9056 }
9057
9058 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
9059 {
9060 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
9061 if (item)
9062 item_count += item.GetNumberOfItems();
9063 }
9064 return item_count;
9065 }
9066
9068 float GetUnitWeight(bool include_wetness = true)
9069 {
9070 float weight = 0;
9071 float wetness = 1;
9072 if (include_wetness)
9073 wetness += GetWet();
9074 if (IsSplitable()) //quantity determines size of the stack
9075 {
9076 weight = wetness * m_ConfigWeight;
9077 }
9078 else if (IsLiquidContainer()) //is a liquid container, default liquid weight is set to 1. May revisit later?
9079 {
9080 weight = 1;
9081 }
9082 return weight;
9083 }
9084
9085 //-----------------------------------------------------------------
9086
9087 override void ClearInventory()
9088 {
9089 if ((GetGame().IsServer() || !GetGame().IsMultiplayer()) && GetInventory())
9090 {
9091 GameInventory inv = GetInventory();
9092 array<EntityAI> items = new array<EntityAI>;
9093 inv.EnumerateInventory(InventoryTraversalType.INORDER, items);
9094 for (int i = 0; i < items.Count(); i++)
9095 {
9096 ItemBase item = ItemBase.Cast(items.Get(i));
9097 if (item)
9098 {
9099 GetGame().ObjectDelete(item);
9100 }
9101 }
9102 }
9103 }
9104
9105 //------------------------- Energy
9106
9107 //----------------------------------------------------------------
9108 float GetEnergy()
9109 {
9110 float energy = 0;
9111 if (HasEnergyManager())
9112 {
9113 energy = GetCompEM().GetEnergy();
9114 }
9115 return energy;
9116 }
9117
9118
9119 override void OnEnergyConsumed()
9120 {
9121 super.OnEnergyConsumed();
9122
9124 }
9125
9126 override void OnEnergyAdded()
9127 {
9128 super.OnEnergyAdded();
9129
9131 }
9132
9133 // Converts energy (from Energy Manager) to quantity, if enabled.
9135 {
9136 if (GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
9137 {
9138 if (HasQuantity())
9139 {
9140 float energy_0to1 = GetCompEM().GetEnergy0To1();
9141 SetQuantityNormalized(energy_0to1);
9142 }
9143 }
9144 }
9145
9146 //----------------------------------------------------------------
9147 float GetHeatIsolationInit()
9148 {
9149 return ConfigGetFloat("heatIsolation");
9150 }
9151
9152 float GetHeatIsolation()
9153 {
9154 return m_HeatIsolation;
9155 }
9156
9157 float GetDryingIncrement(string pIncrementName)
9158 {
9159 string paramPath = string.Format("CfgVehicles %1 EnvironmentWetnessIncrements Drying %2", GetType(), pIncrementName);
9160 if (GetGame().ConfigIsExisting(paramPath))
9161 return GetGame().ConfigGetFloat(paramPath);
9162
9163 return 0.0;
9164 }
9165
9166 float GetSoakingIncrement(string pIncrementName)
9167 {
9168 string paramPath = string.Format("CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2", GetType(), pIncrementName);
9169 if (GetGame().ConfigIsExisting(paramPath))
9170 return GetGame().ConfigGetFloat(paramPath);
9171
9172 return 0.0;
9173 }
9174 //----------------------------------------------------------------
9175 override void SetWet(float value, bool allow_client = false)
9176 {
9177 if (!IsServerCheck(allow_client))
9178 return;
9179
9180 float min = GetWetMin();
9181 float max = GetWetMax();
9182
9183 float previousValue = m_VarWet;
9184
9185 m_VarWet = Math.Clamp(value, min, max);
9186
9187 if (previousValue != m_VarWet)
9188 {
9189 SetVariableMask(VARIABLE_WET);
9190 OnWetChanged(m_VarWet, previousValue);
9191 }
9192 }
9193 //----------------------------------------------------------------
9194 override void AddWet(float value)
9195 {
9196 SetWet(GetWet() + value);
9197 }
9198 //----------------------------------------------------------------
9199 override void SetWetMax()
9200 {
9202 }
9203 //----------------------------------------------------------------
9204 override float GetWet()
9205 {
9206 return m_VarWet;
9207 }
9208 //----------------------------------------------------------------
9209 override float GetWetMax()
9210 {
9211 return m_VarWetMax;
9212 }
9213 //----------------------------------------------------------------
9214 override float GetWetMin()
9215 {
9216 return m_VarWetMin;
9217 }
9218 //----------------------------------------------------------------
9219 override float GetWetInit()
9220 {
9221 return m_VarWetInit;
9222 }
9223 //----------------------------------------------------------------
9224 override void OnWetChanged(float newVal, float oldVal)
9225 {
9226 EWetnessLevel newLevel = GetWetLevelInternal(newVal);
9227 EWetnessLevel oldLevel = GetWetLevelInternal(oldVal);
9228 if (newLevel != oldLevel)
9229 {
9230 OnWetLevelChanged(newLevel,oldLevel);
9231 }
9232 }
9233
9234 override void OnWetLevelChanged(EWetnessLevel newLevel, EWetnessLevel oldLevel)
9235 {
9236 SetWeightDirty();
9237 }
9238
9239 override EWetnessLevel GetWetLevel()
9240 {
9241 return GetWetLevelInternal(m_VarWet);
9242 }
9243
9244 //----------------------------------------------------------------
9245
9246 override void SetStoreLoad(bool value)
9247 {
9248 m_IsStoreLoad = value;
9249 }
9250
9251 override bool IsStoreLoad()
9252 {
9253 return m_IsStoreLoad;
9254 }
9255
9256 override void SetStoreLoadedQuantity(float value)
9257 {
9258 m_StoreLoadedQuantity = value;
9259 }
9260
9261 override float GetStoreLoadedQuantity()
9262 {
9263 return m_StoreLoadedQuantity;
9264 }
9265
9266 //----------------------------------------------------------------
9267
9268 float GetItemModelLength()
9269 {
9270 if (ConfigIsExisting("itemModelLength"))
9271 {
9272 return ConfigGetFloat("itemModelLength");
9273 }
9274 return 0;
9275 }
9276
9277 float GetItemAttachOffset()
9278 {
9279 if (ConfigIsExisting("itemAttachOffset"))
9280 {
9281 return ConfigGetFloat("itemAttachOffset");
9282 }
9283 return 0;
9284 }
9285
9286 override void SetCleanness(int value, bool allow_client = false)
9287 {
9288 if (!IsServerCheck(allow_client))
9289 return;
9290
9291 int previousValue = m_Cleanness;
9292
9293 m_Cleanness = Math.Clamp(value, m_CleannessMin, m_CleannessMax);
9294
9295 if (previousValue != m_Cleanness)
9296 SetVariableMask(VARIABLE_CLEANNESS);
9297 }
9298
9299 override int GetCleanness()
9300 {
9301 return m_Cleanness;
9302 }
9303
9305 {
9306 return true;
9307 }
9308
9309 //----------------------------------------------------------------
9310 // ATTACHMENT LOCKING
9311 // Getters relevant to generic ActionLockAttachment
9312 int GetLockType()
9313 {
9314 return m_LockType;
9315 }
9316
9317 string GetLockSoundSet()
9318 {
9319 return m_LockSoundSet;
9320 }
9321
9322 //----------------------------------------------------------------
9323 //------------------------- Color
9324 // sets items color variable given color components
9325 override void SetColor(int r, int g, int b, int a)
9326 {
9331 SetVariableMask(VARIABLE_COLOR);
9332 }
9334 override void GetColor(out int r,out int g,out int b,out int a)
9335 {
9340 }
9341
9342 bool IsColorSet()
9343 {
9344 return IsVariableSet(VARIABLE_COLOR);
9345 }
9346
9348 string GetColorString()
9349 {
9350 int r,g,b,a;
9351 GetColor(r,g,b,a);
9352 r = r/255;
9353 g = g/255;
9354 b = b/255;
9355 a = a/255;
9356 return MiscGameplayFunctions.GetColorString(r, g, b, a);
9357 }
9358 //----------------------------------------------------------------
9359 //------------------------- LiquidType
9360
9361 override void SetLiquidType(int value, bool allow_client = false)
9362 {
9363 if (!IsServerCheck(allow_client))
9364 return;
9365
9366 int old = m_VarLiquidType;
9367 m_VarLiquidType = value;
9368 OnLiquidTypeChanged(old,value);
9369 SetVariableMask(VARIABLE_LIQUIDTYPE);
9370 }
9371
9372 int GetLiquidTypeInit()
9373 {
9374 return ConfigGetInt("varLiquidTypeInit");
9375 }
9376
9377 override int GetLiquidType()
9378 {
9379 return m_VarLiquidType;
9380 }
9381
9382 protected void OnLiquidTypeChanged(int oldType, int newType)
9383 {
9384 if (newType == LIQUID_NONE && GetIsFrozen())
9385 SetFrozen(false);
9386 }
9387
9389 void UpdateQuickbarShortcutVisibility(PlayerBase player)
9390 {
9391 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9392 }
9393
9394 // -------------------------------------------------------------------------
9396 void OnInventoryEnter(Man player)
9397 {
9398 PlayerBase nplayer;
9399 if (PlayerBase.CastTo(nplayer, player))
9400 {
9401 m_CanPlayImpactSound = true;
9402 //nplayer.OnItemInventoryEnter(this);
9403 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9404 }
9405 }
9406
9407 // -------------------------------------------------------------------------
9409 void OnInventoryExit(Man player)
9410 {
9411 PlayerBase nplayer;
9412 if (PlayerBase.CastTo(nplayer,player))
9413 {
9414 //nplayer.OnItemInventoryExit(this);
9415 nplayer.SetEnableQuickBarEntityShortcut(this,false);
9416
9417 }
9418
9419 //if (!GetGame().IsDedicatedServer())
9420 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
9421
9422
9423 if (HasEnergyManager())
9424 {
9425 GetCompEM().UpdatePlugState(); // Unplug the el. device if it's necesarry.
9426 }
9427 }
9428
9429 // ADVANCED PLACEMENT EVENTS
9430 override void OnPlacementStarted(Man player)
9431 {
9432 super.OnPlacementStarted(player);
9433
9434 SetTakeable(false);
9435 }
9436
9437 override void OnPlacementComplete(Man player, vector position = "0 0 0", vector orientation = "0 0 0")
9438 {
9439 if (m_AdminLog)
9440 {
9441 m_AdminLog.OnPlacementComplete(player, this);
9442 }
9443
9444 super.OnPlacementComplete(player, position, orientation);
9445 }
9446
9447 //-----------------------------
9448 // AGENT SYSTEM
9449 //-----------------------------
9450 //--------------------------------------------------------------------------
9451 bool ContainsAgent(int agent_id)
9452 {
9453 if (agent_id & m_AttachedAgents)
9454 {
9455 return true;
9456 }
9457 else
9458 {
9459 return false;
9460 }
9461 }
9462
9463 //--------------------------------------------------------------------------
9464 override void RemoveAgent(int agent_id)
9465 {
9466 if (ContainsAgent(agent_id))
9467 {
9468 m_AttachedAgents = ~agent_id & m_AttachedAgents;
9469 }
9470 }
9471
9472 //--------------------------------------------------------------------------
9473 override void RemoveAllAgents()
9474 {
9475 m_AttachedAgents = 0;
9476 }
9477 //--------------------------------------------------------------------------
9478 override void RemoveAllAgentsExcept(int agent_to_keep)
9479 {
9480 m_AttachedAgents = m_AttachedAgents & agent_to_keep;
9481 }
9482 // -------------------------------------------------------------------------
9483 override void InsertAgent(int agent, float count = 1)
9484 {
9485 if (count < 1)
9486 return;
9487 //Debug.Log("Inserting Agent on item: " + agent.ToString() +" count: " + count.ToString());
9489 }
9490
9492 void TransferAgents(int agents)
9493 {
9495 }
9496
9497 // -------------------------------------------------------------------------
9498 override int GetAgents()
9499 {
9500 return m_AttachedAgents;
9501 }
9502 //----------------------------------------------------------------------
9503
9504 /*int GetContaminationType()
9505 {
9506 int contamination_type;
9507
9508 const int CONTAMINATED_MASK = eAgents.CHOLERA | eAgents.INFLUENZA | eAgents.SALMONELLA | eAgents.BRAIN;
9509 const int POISONED_MASK = eAgents.FOOD_POISON | eAgents.CHEMICAL_POISON;
9510 const int NERVE_GAS_MASK = eAgents.CHEMICAL_POISON;
9511 const int DIRTY_MASK = eAgents.WOUND_AGENT;
9512
9513 Edible_Base edible = Edible_Base.Cast(this);
9514 int agents = GetAgents();
9515 if (edible)
9516 {
9517 NutritionalProfile profile = Edible_Base.GetNutritionalProfile(edible);
9518 if (profile)
9519 {
9520 agents = agents | profile.GetAgents();//merge item's agents with nutritional agents
9521 }
9522 }
9523 if (agents & CONTAMINATED_MASK)
9524 {
9525 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_CONTAMINATED;
9526 }
9527 if (agents & POISONED_MASK)
9528 {
9529 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_POISONED;
9530 }
9531 if (agents & NERVE_GAS_MASK)
9532 {
9533 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_NERVE_GAS;
9534 }
9535 if (agents & DIRTY_MASK)
9536 {
9537 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_DIRTY;
9538 }
9539
9540 return agents;
9541 }*/
9542
9543 // -------------------------------------------------------------------------
9544 bool LoadAgents(ParamsReadContext ctx, int version)
9545 {
9546 if (!ctx.Read(m_AttachedAgents))
9547 return false;
9548 return true;
9549 }
9550 // -------------------------------------------------------------------------
9552 {
9553
9555 }
9556 // -------------------------------------------------------------------------
9557
9559 override void CheckForRoofLimited(float timeTresholdMS = 3000)
9560 {
9561 super.CheckForRoofLimited(timeTresholdMS);
9562
9563 float time = GetGame().GetTime();
9564 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
9565 {
9566 m_PreviousRoofTestTime = time;
9567 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
9568 }
9569 }
9570
9571 // returns item's protection level against enviromental hazard, for masks with filters, returns the filters protection for valid filter, otherwise 0
9572 float GetProtectionLevel(int type, bool consider_filter = false, int system = 0)
9573 {
9574 if (IsDamageDestroyed() || (HasQuantity() && GetQuantity() <= 0))
9575 {
9576 return 0;
9577 }
9578
9579 if (GetInventory().GetAttachmentSlotsCount() != 0)//is it an item with attachable filter ?
9580 {
9581 ItemBase filter = ItemBase.Cast(FindAttachmentBySlotName("GasMaskFilter"));
9582 if (filter)
9583 return filter.GetProtectionLevel(type, false, system);//it's a valid filter, return the protection
9584 else
9585 return 0;//otherwise return 0 when no filter attached
9586 }
9587
9588 string subclassPath, entryName;
9589
9590 switch (type)
9591 {
9592 case DEF_BIOLOGICAL:
9593 entryName = "biological";
9594 break;
9595 case DEF_CHEMICAL:
9596 entryName = "chemical";
9597 break;
9598 default:
9599 entryName = "biological";
9600 break;
9601 }
9602
9603 subclassPath = "CfgVehicles " + this.GetType() + " Protection ";
9604
9605 return GetGame().ConfigGetFloat(subclassPath + entryName);
9606 }
9607
9608
9609
9611 override void EEOnCECreate()
9612 {
9613 if (!IsMagazine())
9615
9617 }
9618
9619
9620 //-------------------------
9621 // OPEN/CLOSE USER ACTIONS
9622 //-------------------------
9624 void Open();
9625 void Close();
9626 bool IsOpen()
9627 {
9628 return true;
9629 }
9630
9631 override bool CanDisplayCargo()
9632 {
9633 return IsOpen();
9634 }
9635
9636
9637 // ------------------------------------------------------------
9638 // CONDITIONS
9639 // ------------------------------------------------------------
9640 override bool CanPutInCargo(EntityAI parent)
9641 {
9642 if (parent)
9643 {
9644 if (parent.IsInherited(DayZInfected))
9645 return true;
9646
9647 if (!parent.IsRuined())
9648 return true;
9649 }
9650
9651 return true;
9652 }
9653
9654 override bool CanPutAsAttachment(EntityAI parent)
9655 {
9656 if (!super.CanPutAsAttachment(parent))
9657 {
9658 return false;
9659 }
9660
9661 if (!IsRuined() && !parent.IsRuined())
9662 {
9663 return true;
9664 }
9665
9666 return false;
9667 }
9668
9669 override bool CanReceiveItemIntoCargo(EntityAI item)
9670 {
9671 //removed 15.06. coz of loading from storage -> after load items in cargo was lost -> waiting for proper solution
9672 //if (GetHealthLevel() == GameConstants.STATE_RUINED)
9673 // return false;
9674
9675 return super.CanReceiveItemIntoCargo(item);
9676 }
9677
9678 override bool CanReceiveAttachment(EntityAI attachment, int slotId)
9679 {
9680 //removed 15.06. coz of loading from storage -> after load items in cargo was lost -> waiting for proper solution
9681 //if (GetHealthLevel() == GameConstants.STATE_RUINED)
9682 // return false;
9683
9684 GameInventory attachmentInv = attachment.GetInventory();
9685 if (attachmentInv && attachmentInv.GetCargo() && attachmentInv.GetCargo().GetItemCount() > 0)
9686 {
9687 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
9688 return false;
9689 }
9690
9691 InventoryLocation loc = new InventoryLocation();
9692 attachment.GetInventory().GetCurrentInventoryLocation(loc);
9693 if (loc && loc.IsValid() && !GetInventory().AreChildrenAccessible())
9694 return false;
9695
9696 return super.CanReceiveAttachment(attachment, slotId);
9697 }
9698
9699 override bool CanReleaseAttachment(EntityAI attachment)
9700 {
9701 if (!super.CanReleaseAttachment(attachment))
9702 return false;
9703
9704 return GetInventory().AreChildrenAccessible();
9705 }
9706
9707 /*override bool CanLoadAttachment(EntityAI attachment)
9708 {
9709 //removed 15.06. coz of loading from storage -> after load items in cargo was lost -> waiting for proper solution
9710 //if (GetHealthLevel() == GameConstants.STATE_RUINED)
9711 // return false;
9712
9713 GameInventory attachmentInv = attachment.GetInventory();
9714 if (attachmentInv && attachmentInv.GetCargo() && attachmentInv.GetCargo().GetItemCount() > 0)
9715 {
9716 bool boo = (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase));
9717 ErrorEx("CanLoadAttachment | this: " + this + " | attachment: " + attachment + " | boo: " + boo,ErrorExSeverity.INFO);
9718
9719 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
9720 return false;
9721 }
9722
9723 return super.CanLoadAttachment(attachment);
9724 }*/
9725
9726 // Plays muzzle flash particle effects
9727 static void PlayFireParticles(ItemBase weapon, int muzzle_index, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
9728 {
9729 int id = muzzle_owner.GetMuzzleID();
9730 array<ref WeaponParticlesOnFire> WPOF_array = m_OnFireEffect.Get(id);
9731
9732 if (WPOF_array)
9733 {
9734 for (int i = 0; i < WPOF_array.Count(); i++)
9735 {
9736 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
9737
9738 if (WPOF)
9739 {
9740 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
9741 }
9742 }
9743 }
9744 }
9745
9746 // Plays bullet eject particle effects (usually just smoke, the bullet itself is a 3D model and is not part of this function)
9747 static void PlayBulletCasingEjectParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
9748 {
9749 int id = muzzle_owner.GetMuzzleID();
9750 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = m_OnBulletCasingEjectEffect.Get(id);
9751
9752 if (WPOBE_array)
9753 {
9754 for (int i = 0; i < WPOBE_array.Count(); i++)
9755 {
9756 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
9757
9758 if (WPOBE)
9759 {
9760 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
9761 }
9762 }
9763 }
9764 }
9765
9766 // Plays all weapon overheating particles
9767 static void PlayOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
9768 {
9769 int id = muzzle_owner.GetMuzzleID();
9770 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9771
9772 if (WPOOH_array)
9773 {
9774 for (int i = 0; i < WPOOH_array.Count(); i++)
9775 {
9776 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9777
9778 if (WPOOH)
9779 {
9780 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
9781 }
9782 }
9783 }
9784 }
9785
9786 // Updates all weapon overheating particles
9787 static void UpdateOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
9788 {
9789 int id = muzzle_owner.GetMuzzleID();
9790 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9791
9792 if (WPOOH_array)
9793 {
9794 for (int i = 0; i < WPOOH_array.Count(); i++)
9795 {
9796 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9797
9798 if (WPOOH)
9799 {
9800 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9801 }
9802 }
9803 }
9804 }
9805
9806 // Stops overheating particles
9807 static void StopOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
9808 {
9809 int id = muzzle_owner.GetMuzzleID();
9810 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9811
9812 if (WPOOH_array)
9813 {
9814 for (int i = 0; i < WPOOH_array.Count(); i++)
9815 {
9816 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9817
9818 if (WPOOH)
9819 {
9820 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9821 }
9822 }
9823 }
9824 }
9825
9826 //----------------------------------------------------------------
9827 //Item Behaviour - unified approach
9828 override bool IsHeavyBehaviour()
9829 {
9830 if (m_ItemBehaviour == 0)
9831 {
9832 return true;
9833 }
9834
9835 return false;
9836 }
9837
9838 override bool IsOneHandedBehaviour()
9839 {
9840 if (m_ItemBehaviour == 1)
9841 {
9842 return true;
9843 }
9844
9845 return false;
9846 }
9847
9848 override bool IsTwoHandedBehaviour()
9849 {
9850 if (m_ItemBehaviour == 2)
9851 {
9852 return true;
9853 }
9854
9855 return false;
9856 }
9857
9858 bool IsDeployable()
9859 {
9860 return false;
9861 }
9862
9864 float GetDeployTime()
9865 {
9866 return UATimeSpent.DEFAULT_DEPLOY;
9867 }
9868
9869
9870 //----------------------------------------------------------------
9871 // Item Targeting (User Actions)
9872 override void SetTakeable(bool pState)
9873 {
9874 m_IsTakeable = pState;
9875 SetSynchDirty();
9876 }
9877
9878 override bool IsTakeable()
9879 {
9880 return m_IsTakeable;
9881 }
9882
9883 // For cases where we want to show object widget which cant be taken to hands
9885 {
9886 return false;
9887 }
9888
9890 protected void PreLoadSoundAttachmentType()
9891 {
9892 string att_type = "None";
9893
9894 if (ConfigIsExisting("soundAttType"))
9895 {
9896 att_type = ConfigGetString("soundAttType");
9897 }
9898
9899 m_SoundAttType = att_type;
9900 }
9901
9902 override string GetAttachmentSoundType()
9903 {
9904 return m_SoundAttType;
9905 }
9906
9907 //----------------------------------------------------------------
9908 //SOUNDS - ItemSoundHandler
9909 //----------------------------------------------------------------
9910
9911 string GetPlaceSoundset(); // played when deploy starts
9912 string GetLoopDeploySoundset(); // played when deploy starts and stopped when it finishes
9913 string GetDeploySoundset(); // played when deploy sucessfully finishes
9914 string GetLoopFoldSoundset(); // played when fold starts and stopped when it finishes
9915 string GetFoldSoundset(); // played when fold sucessfully finishes
9916
9918 {
9919 if (!m_ItemSoundHandler)
9921
9922 return m_ItemSoundHandler;
9923 }
9924
9925 // override to initialize sounds
9926 protected void InitItemSounds()
9927 {
9928 if (GetPlaceSoundset() == string.Empty && GetDeploySoundset() == string.Empty && GetLoopDeploySoundset() == string.Empty)
9929 return;
9930
9932
9933 if (GetPlaceSoundset() != string.Empty)
9934 handler.AddSound(SoundConstants.ITEM_PLACE, GetPlaceSoundset());
9935
9936 if (GetDeploySoundset() != string.Empty)
9937 handler.AddSound(SoundConstants.ITEM_DEPLOY, GetDeploySoundset());
9938
9939 SoundParameters params = new SoundParameters();
9940 params.m_Loop = true;
9941 if (GetLoopDeploySoundset() != string.Empty)
9942 handler.AddSound(SoundConstants.ITEM_DEPLOY_LOOP, GetLoopDeploySoundset(), params);
9943 }
9944
9945 // Start sound using ItemSoundHandler
9946 void StartItemSoundServer(int id)
9947 {
9948 if (!GetGame().IsServer())
9949 return;
9950
9951 m_SoundSyncPlay = id;
9952 SetSynchDirty();
9953
9954 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).Remove(ClearStartItemSoundServer); // in case one is queued already
9956 }
9957
9958 // Stop sound using ItemSoundHandler
9959 void StopItemSoundServer(int id)
9960 {
9961 if (!GetGame().IsServer())
9962 return;
9963
9964 m_SoundSyncStop = id;
9965 SetSynchDirty();
9966
9967 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).Remove(ClearStopItemSoundServer); // in case one is queued already
9969 }
9970
9971 protected void ClearStartItemSoundServer()
9972 {
9973 m_SoundSyncPlay = 0;
9974 }
9975
9976 protected void ClearStopItemSoundServer()
9977 {
9978 m_SoundSyncStop = 0;
9979 }
9980
9982 void PlayAttachSound(string slot_type)
9983 {
9984 if (!GetGame().IsDedicatedServer())
9985 {
9986 if (ConfigIsExisting("attachSoundSet"))
9987 {
9988 string cfg_path = "";
9989 string soundset = "";
9990 string type_name = GetType();
9991
9992 TStringArray cfg_soundset_array = new TStringArray;
9993 TStringArray cfg_slot_array = new TStringArray;
9994 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
9995 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
9996
9997 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
9998 {
9999 for (int i = 0; i < cfg_soundset_array.Count(); i++)
10000 {
10001 if (cfg_slot_array[i] == slot_type)
10002 {
10003 soundset = cfg_soundset_array[i];
10004 break;
10005 }
10006 }
10007 }
10008
10009 if (soundset != "")
10010 {
10011 EffectSound sound = SEffectManager.PlaySound(soundset, GetPosition());
10012 sound.SetAutodestroy(true);
10013 }
10014 }
10015 }
10016 }
10017
10018 void PlayDetachSound(string slot_type)
10019 {
10020 //TODO - evaluate if needed and devise universal config structure if so
10021 }
10022
10023 void OnApply(PlayerBase player);
10024
10026 {
10027 return 1.0;
10028 };
10029 //returns applicable selection
10030 array<string> GetHeadHidingSelection()
10031 {
10033 }
10034
10036 {
10038 }
10039
10040 WrittenNoteData GetWrittenNoteData() {};
10041
10043 {
10044 SetDynamicPhysicsLifeTime(0.01);
10045 m_ItemBeingDroppedPhys = false;
10046 }
10047
10049 {
10050 array<string> zone_names = new array<string>;
10051 GetDamageZones(zone_names);
10052 for (int i = 0; i < zone_names.Count(); i++)
10053 {
10054 SetHealthMax(zone_names.Get(i),"Health");
10055 }
10056 SetHealthMax("","Health");
10057 }
10058
10060 void SetZoneDamageCEInit()
10061 {
10062 float global_health = GetHealth01("","Health");
10063 array<string> zones = new array<string>;
10064 GetDamageZones(zones);
10065 //set damage of all zones to match global health level
10066 for (int i = 0; i < zones.Count(); i++)
10067 {
10068 SetHealth01(zones.Get(i),"Health",global_health);
10069 }
10070 }
10071
10073 bool IsCoverFaceForShave(string slot_name)
10074 {
10075 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
10076 }
10077
10078 void ProcessItemWetness(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
10079 {
10080 if (!hasRootAsPlayer)
10081 {
10082 if (refParentIB)
10083 {
10084 // parent is wet
10085 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (m_VarWet < m_VarWetMax))
10086 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
10087 // parent has liquid inside
10088 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (m_VarWet < m_VarWetMax))
10089 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
10090 // drying
10091 else if (m_VarWet > m_VarWetMin)
10092 AddWet(-1 * delta * GetDryingIncrement("ground") * 2);
10093 }
10094 else
10095 {
10096 // drying on ground or inside non-itembase (car, ...)
10097 if (m_VarWet > m_VarWetMin)
10098 AddWet(-1 * delta * GetDryingIncrement("ground"));
10099 }
10100 }
10101 }
10102
10103 void ProcessItemTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
10104 {
10106 {
10107 float target = g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(this);
10108 if (GetTemperature() != target || !IsFreezeThawProgressFinished())
10109 {
10110 float heatPermCoef = 1.0;
10111 EntityAI ent = this;
10112 while (ent)
10113 {
10114 heatPermCoef *= ent.GetHeatPermeabilityCoef();
10115 ent = ent.GetHierarchyParent();
10116 }
10117
10118 SetTemperatureEx(new TemperatureDataInterpolated(target,ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
10119 }
10120 }
10121 }
10122
10123 void HierarchyCheck(out bool hasParent, out bool hasRootAsPlayer, out ItemBase refParentIB)
10124 {
10125 // hierarchy check for an item to decide whether it has some parent and it is in some player inventory
10126 EntityAI parent = GetHierarchyParent();
10127 if (!parent)
10128 {
10129 hasParent = false;
10130 hasRootAsPlayer = false;
10131 }
10132 else
10133 {
10134 hasParent = true;
10135 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
10136 refParentIB = ItemBase.Cast(parent);
10137 }
10138 }
10139
10140 protected void ProcessDecay(float delta, bool hasRootAsPlayer)
10141 {
10142 // this is stub, implemented on Edible_Base
10143 }
10144
10145 bool CanDecay()
10146 {
10147 // return true used on selected food clases so they can decay
10148 return false;
10149 }
10150
10151 protected bool CanProcessDecay()
10152 {
10153 // this is stub, implemented on Edible_Base class
10154 // used to determine whether it is still necessary for the food to decay
10155 return false;
10156 }
10157
10158 protected bool CanHaveWetness()
10159 {
10160 // return true used on selected items that have a wetness effect
10161 return false;
10162 }
10163
10165 bool CanBeConsumed(ConsumeConditionData data = null)
10166 {
10167 return !GetIsFrozen() && IsOpen();
10168 }
10169
10170 override void ProcessVariables()
10171 {
10172 bool hasParent = false, hasRootAsPlayer = false;
10173 ItemBase refParentIB;
10174
10175 bool wwtu = g_Game.IsWorldWetTempUpdateEnabled();
10176 bool foodDecay = g_Game.IsFoodDecayEnabled();
10177
10178 if (wwtu || foodDecay)
10179 {
10180 bool processWetness = wwtu && CanHaveWetness();
10181 bool processTemperature = wwtu && CanHaveTemperature();
10182 bool processDecay = foodDecay && CanDecay() && CanProcessDecay();
10183
10184 if (processWetness || processTemperature || processDecay)
10185 {
10186 HierarchyCheck(hasParent, hasRootAsPlayer, refParentIB);
10187
10188 if (processWetness)
10189 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
10190
10191 if (processTemperature)
10192 ProcessItemTemperature(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
10193
10194 if (processDecay)
10195 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
10196 }
10197 }
10198 }
10199
10202 {
10203 return m_TemperaturePerQuantityWeight * GameConstants.ITEM_TEMPERATURE_QUANTITY_WEIGHT_MULTIPLIER;
10204 }
10205
10206 override float GetTemperatureFreezeThreshold()
10207 {
10209 return Liquid.GetFreezeThreshold(GetLiquidType());
10210
10211 return super.GetTemperatureFreezeThreshold();
10212 }
10213
10214 override float GetTemperatureThawThreshold()
10215 {
10217 return Liquid.GetThawThreshold(GetLiquidType());
10218
10219 return super.GetTemperatureThawThreshold();
10220 }
10221
10222 override float GetItemOverheatThreshold()
10223 {
10225 return Liquid.GetBoilThreshold(GetLiquidType());
10226
10227 return super.GetItemOverheatThreshold();
10228 }
10229
10230 override float GetTemperatureFreezeTime()
10231 {
10232 if (HasQuantity())
10233 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),GetQuantityNormalized());
10234
10235 return super.GetTemperatureFreezeTime();
10236 }
10237
10238 override float GetTemperatureThawTime()
10239 {
10240 if (HasQuantity())
10241 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),GetQuantityNormalized());
10242
10243 return super.GetTemperatureThawTime();
10244 }
10245
10247 void AffectLiquidContainerOnFill(int liquid_type, float amount);
10249 void AffectLiquidContainerOnTransfer(int liquidType, float amount, float sourceLiquidTemperature);
10250
10251 bool IsCargoException4x3(EntityAI item)
10252 {
10253 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
10254 }
10255
10257 {
10258 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
10259 }
10260
10262 void AddLightSourceItem(ItemBase lightsource)
10263 {
10264 m_LightSourceItem = lightsource;
10265 }
10266
10268 {
10269 m_LightSourceItem = null;
10270 }
10271
10273 {
10274 return m_LightSourceItem;
10275 }
10276
10278 array<int> GetValidFinishers()
10279 {
10280 return null;
10281 }
10282
10284 bool GetActionWidgetOverride(out typename name)
10285 {
10286 return false;
10287 }
10288
10289 bool PairWithDevice(notnull ItemBase otherDevice)
10290 {
10291 if (GetGame().IsServer())
10292 {
10293 ItemBase explosive = otherDevice;
10295 if (!trg)
10296 {
10297 trg = RemoteDetonatorTrigger.Cast(otherDevice);
10298 explosive = this;
10299 }
10300
10301 explosive.PairRemote(trg);
10302 trg.SetControlledDevice(explosive);
10303
10304 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
10305 trg.SetPersistentPairID(persistentID);
10306 explosive.SetPersistentPairID(persistentID);
10307
10308 return true;
10309 }
10310 return false;
10311 }
10312
10314 float GetBaitEffectivity()
10315 {
10316 float ret = 1.0;
10317 if (HasQuantity())
10318 ret *= GetQuantityNormalized();
10319 ret *= GetHealth01();
10320
10321 return ret;
10322 }
10323
10324 #ifdef DEVELOPER
10325 override void SetDebugItem()
10326 {
10327 super.SetDebugItem();
10328 _itemBase = this;
10329 }
10330
10331 override string GetDebugText()
10332 {
10333 string text = super.GetDebugText();
10334
10335 text += string.Format("Heat isolation(raw): %1\n", GetHeatIsolation());
10336 text += string.Format("Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(this));
10337
10338 return text;
10339 }
10340 #endif
10341
10342 bool CanBeUsedForSuicide()
10343 {
10344 return true;
10345 }
10346
10348 //DEPRECATED BELOW
10350 // Backwards compatibility
10351 void ProcessItemWetnessAndTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
10352 {
10353 ProcessItemWetness(delta, hasParent, hasRootAsPlayer, refParentIB);
10354 ProcessItemTemperature(delta, hasParent, hasRootAsPlayer, refParentIB);
10355 }
10356
10357 // replaced by ItemSoundHandler
10358 protected EffectSound m_SoundDeployFinish;
10359 protected EffectSound m_SoundPlace;
10360 protected EffectSound m_DeployLoopSoundEx;
10361 protected EffectSound m_SoundDeploy;
10362 bool m_IsPlaceSound;
10363 bool m_IsDeploySound;
10365
10366 string GetDeployFinishSoundset();
10367 void PlayDeploySound();
10368 void PlayDeployFinishSound();
10369 void PlayPlaceSound();
10370 void PlayDeployLoopSoundEx();
10371 void StopDeployLoopSoundEx();
10372 void SoundSynchRemoteReset();
10373 void SoundSynchRemote();
10374 bool UsesGlobalDeploy(){return false;}
10375 bool CanPlayDeployLoopSound(){return false;}
10377 bool IsPlaceSound(){return m_IsPlaceSound;}
10378 bool IsDeploySound(){return m_IsDeploySound;}
10379 void SetIsPlaceSound(bool is_place_sound);
10380 void SetIsDeploySound(bool is_deploy_sound);
10381}
10382
10383EntityAI SpawnItemOnLocation(string object_name, notnull InventoryLocation loc, bool full_quantity)
10384{
10385 EntityAI entity = SpawnEntity(object_name, loc, ECE_IN_INVENTORY, RF_DEFAULT);
10386 if (entity)
10387 {
10388 bool is_item = entity.IsInherited(ItemBase);
10389 if (is_item && full_quantity)
10390 {
10391 ItemBase item = ItemBase.Cast(entity);
10392 item.SetQuantity(item.GetQuantityInit());
10393 }
10394 }
10395 else
10396 {
10397 ErrorEx("Cannot spawn entity: " + object_name,ErrorExSeverity.INFO);
10398 return NULL;
10399 }
10400 return entity;
10401}
10402
10403void SetupSpawnedItem(ItemBase item, float health, float quantity)
10404{
10405 if (item)
10406 {
10407 if (health > 0)
10408 item.SetHealth("", "", health);
10409
10410 if (item.CanHaveTemperature())
10411 {
10412 item.SetTemperatureDirect(GameConstants.ITEM_TEMPERATURE_NEUTRAL_ZONE_MIDDLE);
10413 if (item.CanFreeze())
10414 item.SetFrozen(false);
10415 }
10416
10417 if (item.HasEnergyManager())
10418 {
10419 if (quantity >= 0)
10420 {
10421 item.GetCompEM().SetEnergy0To1(quantity);
10422 }
10423 else
10424 {
10425 item.GetCompEM().SetEnergy(Math.AbsFloat(quantity));
10426 }
10427 }
10428 else if (item.IsMagazine())
10429 {
10430 Magazine mag = Magazine.Cast(item);
10431 if (quantity >= 0)
10432 {
10433 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
10434 }
10435 else
10436 {
10437 mag.ServerSetAmmoCount(Math.AbsFloat(quantity));
10438 }
10439
10440 }
10441 else
10442 {
10443 if (quantity >= 0)
10444 {
10445 item.SetQuantityNormalized(quantity, false);
10446 }
10447 else
10448 {
10449 item.SetQuantity(Math.AbsFloat(quantity));
10450 }
10451
10452 }
10453 }
10454}
10455
10456#ifdef DEVELOPER
10457ItemBase _itemBase;//watched item goes here(LCTRL+RMB->Watch)
10458#endif
Param4< int, int, string, int > TSelectableActionInfoWithColor
Определения 3_Game/Entities/EntityAI.c:97
Param3 TSelectableActionInfo
EWetnessLevel
Определения 3_Game/Entities/EntityAI.c:2
InventoryMode
NOTE: PREDICTIVE is not to be used at all in multiplayer.
const int INPUT_UDT_ITEM_MANIPULATION
class LogManager EntityAI
eBleedingSourceType GetType()
ItemSuppressor SuppressorBase
void ActionDropItem()
Определения ActionDropItem.c:14
void ActionManagerBase(PlayerBase player)
Определения ActionManagerBase.c:63
map< typename, ref array< ActionBase_Basic > > TInputActionMap
Определения ActionManagerClient.c:1
void AddAction(typename actionName)
Определения AdvancedCommunication.c:220
void RemoveAction(typename actionName)
Определения AdvancedCommunication.c:252
TInputActionMap m_InputActionMap
Определения AdvancedCommunication.c:137
bool m_ActionsInitialize
Определения AdvancedCommunication.c:138
override void GetActions(typename action_input_type, out array< ActionBase_Basic > actions)
Определения AdvancedCommunication.c:202
void InitializeActions()
Определения AdvancedCommunication.c:190
int GetLiquidType()
Определения CCTWaterSurface.c:129
const int ECE_PLACE_ON_SURFACE
Определения CentralEconomy.c:37
proto native void SpawnEntity(string sClassName, vector vPos, float fRange, int iCount)
Spawn an entity through CE.
const int ECE_IN_INVENTORY
Определения CentralEconomy.c:36
const int RF_DEFAULT
Определения CentralEconomy.c:65
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
PlayerSpawnPreset slotName
Open
Implementations only.
override void EEOnCECreate()
Определения ContaminatedArea_Dynamic.c:42
map
Определения ControlsXboxNew.c:4
CookingMethodType
Определения Cooking.c:2
DamageType
exposed from C++ (do not change)
Определения DamageSystem.c:11
DayZGame g_Game
Определения DayZGame.c:3868
DayZGame GetDayZGame()
Определения DayZGame.c:3870
EActions
Определения EActions.c:2
ERPCs
Определения ERPCs.c:2
PluginAdminLog m_AdminLog
Определения EmoteManager.c:142
const int MAX
Определения EnConvert.c:27
float GetTemperature()
Определения Environment.c:497
override bool IsExplosive()
Определения ExplosivesBase.c:59
override bool CanHaveTemperature()
Определения FireplaceBase.c:559
class GP5GasMask extends MaskBase ItemBase
Empty
Определения Hand_States.c:14
FindInventoryLocationType
flags for searching locations in inventory
Определения InventoryLocation.c:17
InventoryLocationType
types of Inventory Location
Определения InventoryLocation.c:4
class BoxCollidingParams component
ComponentInfo for BoxCollidingResult.
bool DamageItemInCargo(float damage)
Определения ItemBase.c:6380
static bool HasDebugActionsMask(int mask)
Определения ItemBase.c:5620
bool HidesSelectionBySlot()
Определения ItemBase.c:9347
float m_VarWetMin
Определения ItemBase.c:4881
void SplitItem(PlayerBase player)
Определения ItemBase.c:6831
void CopyScriptPropertiesFrom(EntityAI oldItem)
Определения ItemBase.c:9568
override void InsertAgent(int agent, float count=1)
Определения ItemBase.c:8795
override float GetQuantityNormalized()
Gets quantity in normalized 0..1 form between the item's Min a Max values as defined by item's config...
Определения ItemBase.c:8229
static void SetDebugActionsMask(int mask)
Определения ItemBase.c:5625
void SetIsDeploySound(bool is_deploy_sound)
bool IsOpen()
Определения ItemBase.c:8938
void SplitItemToInventoryLocation(notnull InventoryLocation dst)
Определения ItemBase.c:6798
override bool IsHeavyBehaviour()
Определения ItemBase.c:9140
override void SetWetMax()
Определения ItemBase.c:8511
bool IsCoverFaceForShave(string slot_name)
DEPRECATED in use, but returns correct values nontheless. Check performed elsewhere.
Определения ItemBase.c:9385
void ClearStartItemSoundServer()
Определения ItemBase.c:9283
float m_VarWet
Определения ItemBase.c:4878
void ProcessItemTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
Определения ItemBase.c:9415
map< typename, ref ActionOverrideData > TActionAnimOverrideMap
Определения ItemBase.c:2
override void RemoveAllAgentsExcept(int agent_to_keep)
Определения ItemBase.c:8790
static ref map< int, ref array< ref WeaponParticlesOnBulletCasingEject > > m_OnBulletCasingEjectEffect
Определения ItemBase.c:4941
bool CanBeMovedOverride()
Определения ItemBase.c:7522
override void SetWet(float value, bool allow_client=false)
Определения ItemBase.c:8487
ref TIntArray m_SingleUseActions
Определения ItemBase.c:4927
override void ProcessVariables()
Определения ItemBase.c:9482
ref TStringArray m_HeadHidingSelections
Определения ItemBase.c:4955
float GetWeightSpecialized(bool forceRecalc=false)
Определения ItemBase.c:8321
bool LoadAgents(ParamsReadContext ctx, int version)
Определения ItemBase.c:8856
void UpdateQuickbarShortcutVisibility(PlayerBase player)
To be called on moving item within character's inventory; 'player' should never be null.
Определения ItemBase.c:8701
void OverrideActionAnimation(typename action, int commandUID, int stanceMask=-1, int commandUIDProne=-1)
Определения ItemBase.c:5211
ref array< ref OverheatingParticle > m_OverheatingParticles
Определения ItemBase.c:4953
override float GetTemperatureFreezeThreshold()
Определения ItemBase.c:9518
bool m_IsSoundSynchRemote
Определения ItemBase.c:9676
float m_OverheatingShots
Определения ItemBase.c:4948
void StopItemSoundServer(int id)
Определения ItemBase.c:9271
static void ToggleDebugActionsMask(int mask)
Определения ItemBase.c:5640
void IncreaseOverheating(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:5364
override float GetTemperatureFreezeTime()
Определения ItemBase.c:9542
ref array< int > m_CompatibleLocks
Определения ItemBase.c:4965
bool CanBeCooked()
Определения ItemBase.c:7478
override void CombineItemsClient(EntityAI entity2, bool use_stack_max=true)
Определения ItemBase.c:5707
float m_TemperaturePerQuantityWeight
Определения ItemBase.c:4977
bool m_RecipesInitialized
Определения ItemBase.c:4863
void SplitIntoStackMax(EntityAI destination_entity, int slot_id, PlayerBase player)
Определения ItemBase.c:6471
override float GetTemperatureThawThreshold()
Определения ItemBase.c:9526
override void OnEnergyConsumed()
Определения ItemBase.c:8431
void RefreshAudioVisualsOnClient(CookingMethodType cooking_method, bool is_done, bool is_empty, bool is_burned)
cooking-related effect methods
Определения Bottle_Base.c:158
int GetNumberOfItems()
Returns the number of items in cargo, otherwise returns 0(non-cargo objects). Recursive.
Определения ItemBase.c:8360
override EWetnessLevel GetWetLevel()
Определения ItemBase.c:8551
float GetSingleInventoryItemWeight()
Определения ItemBase.c:8316
ref TIntArray m_InteractActions
Определения ItemBase.c:4929
void MessageToOwnerStatus(string text)
Send message to owner player in grey color.
Определения ItemBase.c:7542
float m_VarQuantity
Определения ItemBase.c:4869
bool CanPlayDeployLoopSound()
Определения ItemBase.c:9687
override float GetWetMax()
Определения ItemBase.c:8521
bool CanBeUsedForSuicide()
Определения ItemBase.c:9654
override void CombineItemsEx(EntityAI entity2, bool use_stack_max=true)
Определения ItemBase.c:7117
void OnItemInHandsPlayerSwimStart(PlayerBase player)
void SetIsHologram(bool is_hologram)
Определения ItemBase.c:5845
void OnSyncVariables(ParamsReadContext ctx)
DEPRECATED (most likely)
Определения ItemBase.c:7696
void StartItemSoundServer(int id)
Определения ItemBase.c:9258
void DoAmmoExplosion()
Определения ItemBase.c:6315
static ref map< int, ref array< ref WeaponParticlesOnFire > > m_OnFireEffect
Определения ItemBase.c:4940
void SplitIntoStackMaxCargoClient(EntityAI destination_entity, int idx, int row, int col)
Определения ItemBase.c:6655
int GetItemSize()
Определения ItemBase.c:7507
bool m_CanBeMovedOverride
Определения ItemBase.c:4906
override string ChangeIntoOnAttach(string slot)
Определения ItemBase.c:6239
void UpdateOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
Определения ItemBase.c:5432
bool CanDecay()
Определения ItemBase.c:9457
ScriptedLightBase GetLight()
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...
Определения ItemBase.c:8202
void SetQuantityMax()
Определения ItemBase.c:8207
override float GetQuantity()
Определения ItemBase.c:8296
int m_ColorComponentR
Определения ItemBase.c:4918
int m_ShotsToStartOverheating
Определения ItemBase.c:4950
override void OnWetChanged(float newVal, float oldVal)
Определения ItemBase.c:8536
void StopOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
Определения ItemBase.c:5439
static void PlayFireParticles(ItemBase weapon, int muzzle_index, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:9039
void OnOverheatingDecay()
Определения ItemBase.c:5402
float GetDryingIncrement(string pIncrementName)
Определения ItemBase.c:8469
void SoundSynchRemoteReset()
int m_Cleanness
Определения ItemBase.c:4884
bool HasMuzzle()
Returns true if this item has a muzzle (weapons, suppressors)
Определения ItemBase.c:5540
bool UsesGlobalDeploy()
Определения ItemBase.c:9686
int m_ItemBehaviour
Определения ItemBase.c:4899
override bool CanReleaseAttachment(EntityAI attachment)
Определения ItemBase.c:9011
float m_HeatIsolation
Определения ItemBase.c:4894
float m_VarWetInit
Определения ItemBase.c:4880
override void OnMovedInsideCargo(EntityAI container)
Определения ItemBase.c:5885
void SetCEBasedQuantity()
Определения ItemBase.c:5653
bool m_CanPlayImpactSound
Определения ItemBase.c:4890
override string GetAttachmentSoundType()
Определения ItemBase.c:9214
float GetOverheatingCoef()
Определения ItemBase.c:5459
array< string > GetHeadHidingSelection()
Определения ItemBase.c:9342
void PlayAttachSound(string slot_type)
Plays sound on item attach. Be advised, the config structure may slightly change in 1....
Определения ItemBase.c:9294
override bool IsStoreLoad()
Определения ItemBase.c:8563
int ComputeQuantityUsed(ItemBase other_item, bool use_stack_max=true)
Определения ItemBase.c:7093
bool IsLightSource()
Определения ItemBase.c:5781
bool m_HasQuantityBar
Определения ItemBase.c:4912
void SetResultOfSplit(bool value)
Определения ItemBase.c:7088
void SplitIntoStackMaxCargo(EntityAI destination_entity, int idx, int row, int col)
Определения ItemBase.c:6719
void OnAttachmentQuantityChanged(ItemBase item)
Called on server side when some attachment's quantity is changed. Call super.OnAttachmentQuantityChan...
Определения ItemBase.c:6889
void UpdateAllOverheatingParticles()
Определения ItemBase.c:5467
float GetSoakingIncrement(string pIncrementName)
Определения ItemBase.c:8478
static void StopOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:9119
override float GetStoreLoadedQuantity()
Определения ItemBase.c:8573
int m_LockType
Определения ItemBase.c:4966
const int ITEM_SOUNDS_MAX
Определения ItemBase.c:4971
bool m_CanBeDigged
Определения ItemBase.c:4913
float m_ItemAttachOffset
Определения ItemBase.c:4896
float GetItemModelLength()
Определения ItemBase.c:8580
bool m_ThrowItemOnDrop
Определения ItemBase.c:4904
override bool ReadVarsFromCTX(ParamsReadContext ctx, int version=-1)
Определения ItemBase.c:7841
override void CheckForRoofLimited(float timeTresholdMS=3000)
Roof check for entity, limited by time (anti-spam solution)
Определения ItemBase.c:8871
void Close()
float GetHeatIsolation()
Определения ItemBase.c:8464
void CombineItems(ItemBase other_item, bool use_stack_max=true)
Определения ItemBase.c:7122
void TransferModifiers(PlayerBase reciever)
appears to be deprecated, legacy code
float GetTemperaturePerQuantityWeight()
Used in heat comfort calculations only!
Определения ItemBase.c:9513
bool CanHaveWetness()
Определения ItemBase.c:9470
int m_CleannessMin
Определения ItemBase.c:4886
void TransferAgents(int agents)
transfer agents from another item
Определения ItemBase.c:8804
string IDToName(int id)
Определения ItemBase.c:7689
bool CanBeConsumed(ConsumeConditionData data=null)
Items cannot be consumed if frozen by default. Override for exceptions.
Определения ItemBase.c:9477
float GetHeatIsolationInit()
Определения ItemBase.c:8459
void PlayPlaceSound()
void SetCanBeMovedOverride(bool setting)
Определения ItemBase.c:7529
override bool HasQuantity()
Определения ItemBase.c:8291
float m_VarWetPrev
Определения ItemBase.c:4879
int m_SoundSyncStop
Определения ItemBase.c:4973
bool IsCargoException4x3(EntityAI item)
Определения ItemBase.c:9563
ref TIntArray m_ContinuousActions
Определения ItemBase.c:4928
int GetMuzzleID()
Returns global muzzle ID. If not found, then it gets automatically registered.
Определения ItemBase.c:5549
void LoadParticleConfigOnFire(int id)
Определения ItemBase.c:5234
int m_VarLiquidType
Определения ItemBase.c:4898
int m_QuickBarBonus
Определения ItemBase.c:4900
void PreLoadSoundAttachmentType()
Attachment Sound Type getting from config file.
Определения ItemBase.c:9202
override float GetWetInit()
Определения ItemBase.c:8531
int m_ImpactSoundSurfaceHash
Определения ItemBase.c:4892
int m_SoundSyncPlay
Определения ItemBase.c:4972
int m_MaxOverheatingValue
Определения ItemBase.c:4951
void SetupSpawnedItem(ItemBase item, float health, float quantity)
Определения ItemBase.c:4875
bool m_IsTakeable
Определения ItemBase.c:4903
bool ShouldSplitQuantity(float quantity)
Определения ItemBase.c:6428
static ref map< string, int > m_WeaponTypeToID
Определения ItemBase.c:4943
string GetLockSoundSet()
Определения ItemBase.c:8629
string GetColorString()
Returns item's PROCEDURAL color as formated string, i.e. "#(argb,8,8,3)color(0.15,...
Определения ItemBase.c:8660
array< int > GetValidFinishers()
returns an array of possible finishers
Определения ItemBase.c:9590
void OnAttachmentQuantityChangedEx(ItemBase item, float delta)
Called on server side when some attachment's quantity is changed. Call super.OnAttachmentQuantityChan...
Определения ItemBase.c:6895
class ItemBase extends InventoryItem SpawnItemOnLocation(string object_name, notnull InventoryLocation loc, bool full_quantity)
Определения ItemBase.c:4855
ItemSoundHandler GetItemSoundHandler()
Определения ItemBase.c:9229
override int GetQuantityMin()
Определения ItemBase.c:8280
void SplitIntoStackMaxToInventoryLocationClient(notnull InventoryLocation dst)
Определения ItemBase.c:6634
override int GetQuickBarBonus()
Определения ItemBase.c:5119
override void SetTakeable(bool pState)
Определения ItemBase.c:9184
float m_OverheatingDecayInterval
Определения ItemBase.c:4952
void SetIsPlaceSound(bool is_place_sound)
override void SplitIntoStackMaxClient(EntityAI destination_entity, int slot_id)
Определения ItemBase.c:6448
void HierarchyCheck(out bool hasParent, out bool hasRootAsPlayer, out ItemBase refParentIB)
Определения ItemBase.c:9435
bool CanProcessDecay()
Определения ItemBase.c:9463
void RemoveAudioVisualsOnClient()
Определения Bottle_Base.c:151
void SoundSynchRemote()
static void AddDebugActionsMask(int mask)
Определения ItemBase.c:5630
void PlayDeployLoopSoundEx()
void RemoveLightSourceItem()
Определения ItemBase.c:9579
bool CanRepair(ItemBase item_repair_kit)
Определения ItemBase.c:7493
bool can_this_be_combined
Определения ItemBase.c:4908
EffectSound m_SoundDeploy
Определения ItemBase.c:9673
int m_Count
Определения ItemBase.c:4874
float GetBaitEffectivity()
generic effectivity as a bait for animal catching
Определения ItemBase.c:9626
float GetDeployTime()
how long it takes to deploy this item in seconds
Определения ItemBase.c:9176
override bool IsSplitable()
Определения ItemBase.c:6415
bool DamageItemAttachments(float damage)
Определения ItemBase.c:6399
override void WriteVarsToCTX(ParamsWriteContext ctx)
Определения ItemBase.c:7805
void ConvertEnergyToQuantity()
Определения ItemBase.c:8446
override void RemoveAllAgents()
Определения ItemBase.c:8785
override void SetQuantityToMinimum()
Определения ItemBase.c:8213
bool m_WantPlayImpactSound
Определения ItemBase.c:4889
override float GetTemperatureThawTime()
Определения ItemBase.c:9550
ref map< int, ref array< ref WeaponParticlesOnOverheating > > m_OnOverheatingEffect
Определения ItemBase.c:4942
int m_ColorComponentG
Определения ItemBase.c:4919
float m_StoreLoadedQuantity
Определения ItemBase.c:4876
void MessageToOwnerAction(string text)
Send message to owner player in yellow color.
Определения ItemBase.c:7560
int m_ColorComponentA
Определения ItemBase.c:4921
int m_VarQuantityInit
Определения ItemBase.c:4871
float GetFilterDamageRatio()
Определения ItemBase.c:5534
override void SetLiquidType(int value, bool allow_client=false)
Определения ItemBase.c:8673
void OnQuantityChanged(float delta)
Called on server side when this item's quantity is changed. Call super.OnQuantityChanged(); first whe...
Определения ItemBase.c:6865
void OnApply(PlayerBase player)
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...
Определения ItemBase.c:8220
bool m_HideSelectionsBySlot
Определения ItemBase.c:4956
bool IsOverheatingEffectActive()
Определения ItemBase.c:5397
void SetIsBeingPlaced(bool is_being_placed)
Определения ItemBase.c:5814
int GetLiquidContainerMask()
Определения ItemBase.c:5751
void SetInventoryLocationToVicinityOrCurrent(EntityAI root, inout InventoryLocation dst)
Определения ItemBase.c:7002
ref Timer m_CheckOverheating
Определения ItemBase.c:4949
void RegisterOverheatingParticle(Particle p, float min_heat_coef, float max_heat_coef, int particle_id, Object parent, vector local_pos, vector local_ori)
Определения ItemBase.c:5445
float GetEnergy()
Определения ItemBase.c:8420
bool CanBeDigged()
Определения ItemBase.c:5830
bool GetActionWidgetOverride(out typename name)
If we need a different (handheld)item action widget displayed, the logic goes in here.
Определения ItemBase.c:9596
bool IsNVG()
Определения ItemBase.c:5762
float GetUnitWeight(bool include_wetness=true)
Obsolete, use GetWeightEx instead.
Определения ItemBase.c:8380
void SetZoneDamageCEInit()
Sets zone damages to match randomized global health set by CE (CE spawn only)
Определения ItemBase.c:9372
bool m_IsDeploySound
Определения ItemBase.c:9675
bool CanEat()
Определения ItemBase.c:7453
static void PlayOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:9079
override bool IsOneHandedBehaviour()
Определения ItemBase.c:9150
void AddLightSourceItem(ItemBase lightsource)
Adds a light source child.
Определения ItemBase.c:9574
bool IsLiquidContainer()
Определения ItemBase.c:5746
FoodStage GetFoodStage()
overridden on Edible_Base; so we don't have to parse configs all the time
Определения ItemBase.c:7473
override float GetSingleInventoryItemWeightEx()
Определения ItemBase.c:8307
void SaveAgents(ParamsWriteContext ctx)
Определения ItemBase.c:8863
override int GetTargetQuantityMax(int attSlotID=-1)
Определения ItemBase.c:8261
int m_CleannessInit
Определения ItemBase.c:4885
float GetDisinfectQuantity(int system=0, Param param1=null)
Определения ItemBase.c:5529
override int GetAgents()
Определения ItemBase.c:8810
int m_VarQuantityMax
Определения ItemBase.c:4873
override bool IsHologram()
Определения ItemBase.c:5825
float GetItemAttachOffset()
Определения ItemBase.c:8589
bool IsPlaceSound()
Определения ItemBase.c:9689
static int GetDebugActionsMask()
Определения ItemBase.c:5615
void ProcessDecay(float delta, bool hasRootAsPlayer)
Определения ItemBase.c:9452
override bool IsItemBase()
Определения ItemBase.c:7606
void PlayDeploySound()
override bool IsTwoHandedBehaviour()
Определения ItemBase.c:9160
void ExplodeAmmo()
Определения ItemBase.c:6302
bool IsCombineAll(ItemBase other_item, bool use_stack_max=false)
Определения ItemBase.c:7078
float GetProtectionLevel(int type, bool consider_filter=false, int system=0)
Определения ItemBase.c:8884
static void PlayBulletCasingEjectParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:9059
override void OnEnergyAdded()
Определения ItemBase.c:8438
void AffectLiquidContainerOnFill(int liquid_type, float amount)
from enviro source
void AffectLiquidContainerOnTransfer(int liquidType, float amount, float sourceLiquidTemperature)
from other liquid container source
string GetExplosiveTriggerSlotName()
Определения ItemBase.c:5774
EffectSound m_DeployLoopSoundEx
Определения ItemBase.c:9672
override void DeSerializeNumericalVars(array< float > floats)
Определения ItemBase.c:7746
void StopItemDynamicPhysics()
Определения ItemBase.c:9354
bool HasFoodStage()
Определения ItemBase.c:7466
override void SetStoreLoad(bool value)
Определения ItemBase.c:8558
float GetOverheatingValue()
Определения ItemBase.c:5359
bool ContainsAgent(int agent_id)
Определения ItemBase.c:8763
override void AddWet(float value)
Определения ItemBase.c:8506
bool IsLiquidPresent()
Определения ItemBase.c:5741
bool IsFullQuantity()
Определения ItemBase.c:8301
override void EOnContact(IEntity other, Contact extra)
Определения ItemBase.c:6015
void SplitIntoStackMaxHands(PlayerBase player)
Определения ItemBase.c:6770
void SplitIntoStackMaxHandsClient(PlayerBase player)
Определения ItemBase.c:6746
int m_CleannessMax
Определения ItemBase.c:4887
float m_VarStackMax
Определения ItemBase.c:4875
ref Timer m_PhysDropTimer
Определения ItemBase.c:4962
void MessageToOwnerFriendly(string text)
Send message to owner player in green color.
Определения ItemBase.c:7578
override void SetStoreLoadedQuantity(float value)
Определения ItemBase.c:8568
bool m_IsResultOfSplit string m_SoundAttType
distinguish if item has been created as new or it came from splitting (server only flag)
Определения ItemBase.c:4916
void CheckOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
Определения ItemBase.c:5380
void UnlockFromParent()
Unlocks this item from its attachment slot of its parent.
Определения ItemBase.c:5695
bool Repair(PlayerBase player, ItemBase item_repair_kit, float specialty_weight)
Определения ItemBase.c:7500
void OnLiquidTypeChanged(int oldType, int newType)
Определения ItemBase.c:8694
void StartOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
Определения ItemBase.c:5426
void PlayDeployFinishSound()
bool AllowFoodConsumption()
Определения ItemBase.c:8616
bool m_IsOverheatingEffectActive
Определения ItemBase.c:4947
int m_LiquidContainerMask
Определения ItemBase.c:4897
void ProcessItemWetness(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
Определения ItemBase.c:9390
override int GetCleanness()
Определения ItemBase.c:8611
bool PairWithDevice(notnull ItemBase otherDevice)
Определения ItemBase.c:9601
bool IsDeploySound()
Определения ItemBase.c:9690
static void RemoveDebugActionsMask(int mask)
Определения ItemBase.c:5635
static void UpdateOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:9099
int m_VarQuantityMin
Определения ItemBase.c:4872
void PerformDamageSystemReinit()
Определения ItemBase.c:9360
override void ClearInventory()
Определения ItemBase.c:8399
static int m_LastRegisteredWeaponID
Определения ItemBase.c:4944
ItemBase GetLightSourceItem()
Определения ItemBase.c:9584
void MessageToOwnerImportant(string text)
Send message to owner player in red color.
Определения ItemBase.c:7596
override float GetItemOverheatThreshold()
Определения ItemBase.c:9534
void StopDeployLoopSoundEx()
bool m_CanThisBeSplit
Определения ItemBase.c:4909
override void SerializeNumericalVars(array< float > floats_out)
Определения ItemBase.c:7710
ItemBase SplitIntoStackMaxToInventoryLocationEx(notnull InventoryLocation dst)
Определения ItemBase.c:6685
float m_ItemModelLength
Определения ItemBase.c:4895
bool m_IsHologram
Определения ItemBase.c:4902
static int m_DebugActionsMask
Определения ItemBase.c:4862
void KillAllOverheatingParticles()
Определения ItemBase.c:5495
bool CanBeCookedOnStick()
Определения ItemBase.c:7483
override int GetQuantityMax()
Определения ItemBase.c:8248
void GetRecipesActions(Man player, out TSelectableActionInfoArray outputList)
Определения ItemBase.c:7156
void OnActivatedByTripWire()
bool IsColorSet()
Определения ItemBase.c:8654
override void RemoveAgent(int agent_id)
Определения ItemBase.c:8776
bool m_ItemBeingDroppedPhys
Определения ItemBase.c:4905
override bool CanPutAsAttachment(EntityAI parent)
Определения ItemBase.c:8966
void PlayDetachSound(string slot_type)
Определения ItemBase.c:9330
static ref map< typename, ref TInputActionMap > m_ItemTypeActionsMap
Определения ItemBase.c:4856
void ProcessItemWetnessAndTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
Определения ItemBase.c:9663
override bool IsBeingPlaced()
Определения ItemBase.c:5809
int GetQuantityInit()
Определения ItemBase.c:8285
float ComputeQuantityUsedEx(ItemBase other_item, bool use_stack_max=true)
Определения ItemBase.c:7098
bool IsResultOfSplit()
Определения ItemBase.c:7083
bool m_FixDamageSystemInit
Определения ItemBase.c:4907
float m_ImpactSpeed
Определения ItemBase.c:4891
bool m_IsStoreLoad
Определения ItemBase.c:4910
int GetLiquidTypeInit()
Определения ItemBase.c:8684
string GetDeployFinishSoundset()
ItemBase m_LightSourceItem
Определения ItemBase.c:4925
void LockToParent()
Locks this item in it's current attachment slot of its parent. This makes the "locked" icon visible i...
Определения ItemBase.c:5682
override void SplitIntoStackMaxEx(EntityAI destination_entity, int slot_id)
Определения ItemBase.c:6557
int m_AttachedAgents
Определения ItemBase.c:4933
string m_LockSoundSet
Определения ItemBase.c:4968
void LoadParticleConfigOnOverheating(int id)
Определения ItemBase.c:5303
float m_VarQuantityPrev
Определения ItemBase.c:4870
bool IsSoundSynchRemote()
Определения ItemBase.c:9688
bool m_CanShowQuantity
Определения ItemBase.c:4911
override void OnRightClick()
Определения ItemBase.c:6938
int m_ColorComponentB
Определения ItemBase.c:4920
static ref map< typename, ref TActionAnimOverrideMap > m_ItemActionOverrides
Определения ItemBase.c:4858
bool IsActionTargetVisible()
Определения ItemBase.c:9196
override void OnItemAttachmentSlotChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
Определения ItemBase.c:6050
override void EEHitBy(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
Определения ItemBase.c:6339
bool m_IsBeingPlaced
Определения ItemBase.c:4901
int NameToID(string name)
Определения ItemBase.c:7683
void ~ItemBase()
Определения ItemBase.c:5580
override void OnWetLevelChanged(EWetnessLevel newLevel, EWetnessLevel oldLevel)
Определения ItemBase.c:8546
void ClearStopItemSoundServer()
Определения ItemBase.c:9288
override string ChangeIntoOnDetach()
Определения ItemBase.c:6263
float m_VarWetMax
Определения ItemBase.c:4882
void SplitIntoStackMaxToInventoryLocation(notnull InventoryLocation dst)
Определения ItemBase.c:6680
int GetLockType()
Определения ItemBase.c:8624
EffectSound m_SoundDeployFinish
Определения ItemBase.c:9670
override float GetWet()
Определения ItemBase.c:8516
EffectSound m_SoundPlace
Определения ItemBase.c:9671
float GetQuantityNormalizedScripted()
Определения ItemBase.c:8234
override void SetCleanness(int value, bool allow_client=false)
Определения ItemBase.c:8598
bool m_IsPlaceSound
Определения ItemBase.c:9674
override float GetWetMin()
Определения ItemBase.c:8526
ref ItemSoundHandler m_ItemSoundHandler
Определения ItemBase.c:4974
override bool KindOf(string tag)
Определения ItemBase.c:7612
void ItemSoundHandler(ItemBase parent)
Определения ItemSoundHandler.c:31
string Type
Определения JsonDataContaminatedArea.c:11
EffectSound m_LockingSound
Определения Land_Underground_Entrance.c:321
string GetDebugText()
Определения ModifierBase.c:71
PlayerBase GetPlayer()
Определения ModifierBase.c:51
@ LOWEST
Определения PPEConstants.c:54
void PluginItemDiagnostic()
Определения PluginItemDiagnostic.c:74
PluginBase GetPlugin(typename plugin_type)
Определения PluginManager.c:316
EntityAI GetItem()
Определения RadialQuickbarMenu.c:37
override RemotelyActivatedItemBehaviour GetRemotelyActivatedItemBehaviour()
Определения RemoteDetonator.c:272
void RemoteDetonatorTrigger()
Определения RemoteDetonator.c:233
override void OnActivatedByItem(notnull ItemBase item)
Called when this item is activated by other.
Определения RemoteDetonator.c:305
int particle_id
Определения SmokeSimulation.c:28
ETemperatureAccessTypes
Определения TemperatureAccessConstants.c:2
override void Explode(int damageType, string ammoType="")
Определения Trap_LandMine.c:220
bool m_Initialized
Определения UiHintPanel.c:317
void Debug()
Определения UniversalTemperatureSource.c:349
int GetID()
Определения ActionBase.c:1360
void OnItemLocationChanged(ItemBase item)
Определения ActionBase.c:998
GetInputType()
Определения ActionBase.c:215
int m_StanceMask
Определения ActionBase.c:25
int m_CommandUIDProne
Определения ActionBase.c:24
int m_CommandUID
Определения ActionBase.c:23
void OnItemAttachedAtPlayer(EntityAI item, string slot_name)
Определения AnalyticsManagerClient.c:77
proto native UIManager GetUIManager()
proto bool ConfigGetChildName(string path, int index, out string name)
Get name of subclass in config class on path.
proto native float ConfigGetFloat(string path)
Get float value from config on path.
override ScriptCallQueue GetCallQueue(int call_category)
Определения DayZGame.c:1187
proto native void GizmoSelectObject(Object object)
proto native bool ConfigIsExisting(string path)
proto native void ConfigGetTextArray(string path, out TStringArray values)
Get array of strings from config on path.
proto native DayZPlayer GetPlayer()
proto native void GizmoSelectPhysics(Physics physics)
proto int GetTime()
returns mission time in milliseconds
proto native int ConfigGetType(string path)
Returns type of config value.
AnalyticsManagerClient GetAnalyticsClient()
Определения Global/game.c:1568
proto native int ConfigGetChildrenCount(string path)
Get count of subclasses in config class on path.
proto native SoundOnVehicle CreateSoundOnObject(Object source, string sound_name, float distance, bool looped, bool create_local=false)
proto native void ObjectDelete(Object obj)
proto native int GetItemCount()
proto native EntityAI GetItem(int index)
float GetEnergyAtSpawn()
Определения ComponentEnergyManager.c:1280
void SetEnergy0To1(float energy01)
Energy manager: Sets stored energy for this device between 0 and MAX based on relative input value be...
Определения ComponentEnergyManager.c:541
float GetEnergyMaxPristine()
Energy manager: Returns the maximum amount of energy this device can store. It's damage is NOT taken ...
Определения ComponentEnergyManager.c:1275
override void SetAutodestroy(bool auto_destroy)
Sets whether Effect automatically cleans up when it stops.
Определения EffectSound.c:603
bool IsSoundPlaying()
Get whether EffectSound is currently playing.
Определения EffectSound.c:274
override bool IsMan()
Определения 3_Game/Entities/Man.c:44
proto native bool EnumerateInventory(InventoryTraversalType tt, out array< EntityAI > items)
enumerate inventory using traversal type and filling items array
proto native CargoBase GetCargo()
cargo
Определения ItemBase.c:15
proto native bool IsValid()
verify current set inventory location
proto native EntityAI GetParent()
returns parent of current inventory location
proto native int GetSlot()
returns slot id if current type is Attachment
proto native int GetCol()
returns column of cargo if current type is Cargo / ProxyCargo
proto native int GetRow()
returns row of cargo if current type is Cargo / ProxyCargo
bool WriteToContext(ParamsWriteContext ctx)
Определения InventoryLocation.c:469
proto native int GetType()
returns type of InventoryLocation
proto native int GetIdx()
returns index of cargo if current type is Cargo / ProxyCargo
proto native void SetCargo(notnull EntityAI parent, EntityAI e, int idx, int row, int col, bool flip)
sets current inventory location type to Cargo with coordinates (idx, row, col)
proto native bool GetFlip()
returns flip status of cargo
proto native EntityAI GetItem()
returns item of current inventory location
InventoryLocation.
Определения InventoryLocation.c:29
override bool CanDisplayCargo()
Определения UndergroundStash.c:24
override void OnInventoryEnter(Man player)
Определения BarbedWire.c:203
override string GetFoldSoundset()
Определения BaseBuildingBase.c:108
override bool CanPutAsAttachment(EntityAI parent)
Определения ItemBase.c:6
override bool CanReceiveItemIntoCargo(EntityAI item)
Определения TentBase.c:913
override bool OnStoreLoad(ParamsReadContext ctx, int version)
Определения GardenBase.c:199
override void OnWasDetached(EntityAI parent, int slot_id)
override void EEOnAfterLoad()
Определения GardenBase.c:242
override void EEDelete(EntityAI parent)
Определения BaseBuildingBase.c:68
override bool CanBeRepairedByCrafting()
Определения TentBase.c:86
override void OnPlacementStarted(Man player)
Определения BatteryCharger.c:376
override void OnItemLocationChanged(EntityAI old_owner, EntityAI new_owner)
Определения BarbedWire.c:357
override bool IsElectricAppliance()
Определения BatteryCharger.c:43
override bool IsItemTent()
Определения TentBase.c:81
override void SetActions()
override string GetLoopFoldSoundset()
Определения BaseBuildingBase.c:113
override bool CanMakeGardenplot()
Определения FieldShovel.c:3
override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
Определения PowerGenerator.c:412
override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
Определения HandcuffsLocked.c:12
override WrittenNoteData GetWrittenNoteData()
Определения Paper.c:30
override int GetDamageSystemVersionChange()
Определения BaseBuildingBase.c:1238
override bool SetQuantity(float value, bool destroy_config=true, bool destroy_forced=false, bool allow_client=false, bool clamp_to_stack_max=true)
Определения PileOfWoodenPlanks.c:88
override void InitItemVariables()
Определения Matchbox.c:3
override void SetActionAnimOverrides()
Определения PickAxe.c:28
override void OnCreatePhysics()
Определения BaseBuildingBase.c:489
override string GetDeploySoundset()
Определения BarbedWire.c:392
override float GetBandagingEffectivity()
Определения BandageDressing.c:49
override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
Определения PowerGenerator.c:424
override void EEHealthLevelChanged(int oldLevel, int newLevel, string zone)
Определения BaseBuildingBase.c:496
override void OnStoreSave(ParamsWriteContext ctx)
Определения GardenBase.c:266
override void AfterStoreLoad()
Определения BarbedWire.c:155
override int GetOnDigWormsAmount()
Определения FieldShovel.c:27
override bool IsSelfAdjustingTemperature()
Определения PortableGasStove.c:287
override bool IsPlayerInside(PlayerBase player, string selection)
Определения BaseBuildingBase.c:1037
override void OnVariablesSynchronized()
Определения GardenBase.c:97
override void RefreshPhysics()
Определения BatteryCharger.c:359
override bool CanObstruct()
Определения BaseBuildingBase.c:84
override void OnWasAttached(EntityAI parent, int slot_id)
override bool CanReceiveAttachment(EntityAI attachment, int slotId)
Определения BaseBuildingBase.c:982
override bool CanPutInCargo(EntityAI parent)
Определения GardenBase.c:331
override string GetLoopDeploySoundset()
Определения BarbedWire.c:397
override void OnPlacementComplete(Man player, vector position="0 0 0", vector orientation="0 0 0")
Определения BarbedWire.c:372
override void OnInventoryExit(Man player)
Определения BatteryCharger.c:341
override bool IsTakeable()
Определения BaseBuildingBase.c:1008
override bool IsIgnoredByConstruction()
Определения BaseBuildingBase.c:1170
override void InitItemSounds()
Определения BaseBuildingBase.c:94
override void EEKilled(Object killer)
Определения HandcuffsLocked.c:70
override void OnCombine(ItemBase other_item)
Определения BandageDressing.c:71
override bool CanExplodeInFire()
Определения LargeGasCannister.c:3
override bool IsFacingPlayer(PlayerBase player, string selection)
Определения BaseBuildingBase.c:1032
override bool CanBeCombined(EntityAI other_item, bool reservation_check=true, bool stack_max_limit=false)
Определения Rag.c:61
override bool IsBloodContainer()
Определения BloodContainerBase.c:10
override bool IsClothing()
override bool CanBeSplit()
Определения Rag.c:34
override bool IsDeployable()
Определения BaseBuildingBase.c:365
override void OnRPC(PlayerIdentity sender, int rpc_type, ParamsReadContext ctx)
Определения ToolBase.c:24
override bool CanBeDisinfected()
Определения BandageDressing.c:54
override float GetInfectionChance(int system=0, Param param=null)
Определения BandageDressing.c:59
override void OnEndPlacement()
Определения KitBase.c:65
Определения EnMath.c:7
float GetOverheatingLimitMax()
Определения WeaponParticles.c:417
void SetOverheatingLimitMax(float max)
Определения WeaponParticles.c:407
void SetParticleParams(int particle_id, Object parent, vector local_pos, vector local_ori)
Определения WeaponParticles.c:422
float GetOverheatingLimitMin()
Определения WeaponParticles.c:412
Particle GetParticle()
Определения WeaponParticles.c:397
void SetOverheatingLimitMin(float min)
Определения WeaponParticles.c:402
void RegisterParticle(Particle p)
Определения WeaponParticles.c:392
void Stop()
Legacy function for backwards compatibility with 1.14 and below.
Определения Particle.c:266
void SetControlledDevice(EntityAI pDevice)
Определения RemoteDetonator.c:140
bool OnStoreLoad(ParamsReadContext ctx, int version)
void OnStoreSave(ParamsWriteContext ctx)
proto void Remove(func fn)
remove specific call from queue
proto void CallLater(func fn, int delay=0, bool repeat=false, 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 void Send()
proto bool Write(void value_out)
proto bool Read(void value_in)
bool m_Loop
Определения ItemSoundHandler.c:5
override void Stop()
Определения DayZPlayerImplement.c:64
proto native float GetDamage(string zoneName, string healthType)
UIScriptedMenu FindMenu(int id)
Returns menu with specific ID if it is open (see MenuID)
Определения UIManager.c:160
override void Refresh()
Определения ChatInputMenu.c:70
void SetCalcDetails(string details)
Определения 3_Game/tools/Debug.c:816
void OnRPC(PlayerIdentity sender, int rpc_type, ParamsReadContext ctx)
Определения WrittenNoteData.c:13
const float LOWEST
Определения EnConvert.c:100
Serializer ParamsReadContext
Определения gameplay.c:15
class LOD Object
InventoryTraversalType
tree traversal type, for more see http://en.wikipedia.org/wiki/Tree_traversal
Определения gameplay.c:6
proto native CGame GetGame()
Serializer ParamsWriteContext
Определения gameplay.c:16
const int DEF_BIOLOGICAL
Определения 3_Game/constants.c:512
const int DEF_CHEMICAL
Определения 3_Game/constants.c:513
const int COMP_TYPE_ENERGY_MANAGER
Определения Component.c:9
ErrorExSeverity
Определения EnDebug.c:62
void Error(string err)
Messagebox with error message.
Определения EnDebug.c:90
enum ShapeType ErrorEx
proto native void SetColor(int color)
array< string > TStringArray
Определения EnScript.c:709
array< int > TIntArray
Определения EnScript.c:711
EntityEvent
Entity events for event-mask, or throwing event from code.
Определения EnEntity.c:45
static const float ITEM_TEMPERATURE_NEUTRAL_ZONE_MIDDLE
Определения 3_Game/constants.c:808
const int VARIABLE_LIQUIDTYPE
Определения 3_Game/constants.c:632
const int VARIABLE_CLEANNESS
Определения 3_Game/constants.c:635
const int VARIABLE_COLOR
Определения 3_Game/constants.c:634
const int VARIABLE_TEMPERATURE
Определения 3_Game/constants.c:630
const int VARIABLE_QUANTITY
Определения 3_Game/constants.c:628
const int VARIABLE_WET
Определения 3_Game/constants.c:631
const int LIQUID_NONE
Определения 3_Game/constants.c:529
static proto float AbsFloat(float f)
Returns absolute value.
const int MENU_INVENTORY
Определения 3_Game/constants.c:180
proto native bool dBodyIsDynamic(notnull IEntity ent)
const int SAT_CRAFTING
Определения 3_Game/constants.c:453
const int SAT_DEBUG_ACTION
Определения 3_Game/constants.c:454
class JsonUndergroundAreaTriggerData GetPosition
Определения UndergroundAreaLoader.c:9
static proto string Format(string fmt, 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)
Gets n-th character from string.
const int CALL_CATEGORY_GAMEPLAY
Определения 3_Game/tools/tools.c:10
const int CALL_CATEGORY_SYSTEM
Определения 3_Game/tools/tools.c:8
proto native int GetColor()