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

◆ IsHologram()

override bool SpawnItemOnLocation::IsHologram ( )
private

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

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

Используется в ItemBase::AssembleKit(), IEntity::CanBeActionTarget(), Entity::CanPutAsAttachment(), Entity::CanPutInCargo(), Entity::CanPutIntoHands(), KitBase::DisassembleKit(), ItemBase::EOnInit(), ItemBase::Pack(), RefreshFireplaceVisuals() и ItemBase::UpdateAllSelections().