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

◆ KillAllOverheatingParticles()

void SpawnItemOnLocation::KillAllOverheatingParticles ( )
private

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

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

Используется в InventoryItem::UpdateOverheating().