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

◆ GetLiquidContainerMask()

int SpawnItemOnLocation::GetLiquidContainerMask ( )
private

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

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