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

◆ IsLiquidContainer()

bool SpawnItemOnLocation::IsLiquidContainer ( )
private

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

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

Используется в InventoryItem::GetDebugActions(), InventoryItem::GetItemOverheatThreshold(), InventoryItem::GetTemperatureFreezeThreshold(), InventoryItem::GetTemperatureThawThreshold(), InventoryItem::GetUnitWeight(), InventoryItem::InitItemVariables() и InventoryItem::OnQuantityChanged().