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

◆ GetDebugActionsMask()

static int SpawnItemOnLocation::GetDebugActionsMask ( )
staticprivate

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

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