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

◆ IsBeingPlaced()

override bool SpawnItemOnLocation::IsBeingPlaced ( )
private

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

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

Используется в OnInventoryExit(), ItemBase::OnItemLocationChanged() и FireplaceBase::OnVariablesSynchronized().