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

◆ GetQuantityMin()

override int SpawnItemOnLocation::GetQuantityMin ( )
protected

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

8284{
8285 override bool CanPutAsAttachment(EntityAI parent)
8286 {
8287 return true;
8288 }
8289};
8290
8291//const bool QUANTITY_DEBUG_REMOVE_ME = false;
8292
8293class ItemBase extends InventoryItem
8294{
8298
8300
8301 static int m_DebugActionsMask;
8303 // ============================================
8304 // Variable Manipulation System
8305 // ============================================
8306 // Quantity
8307
8308 float m_VarQuantity;
8309 float m_VarQuantityPrev;//for client to know quantity changed during synchronization
8311 int m_VarQuantityMin;
8312 int m_VarQuantityMax;
8313 int m_Count;
8314 float m_VarStackMax;
8315 float m_StoreLoadedQuantity = float.LOWEST;
8316 // Wet
8317 float m_VarWet;
8318 float m_VarWetPrev;//for client to know wetness changed during synchronization
8319 float m_VarWetInit;
8320 float m_VarWetMin;
8321 float m_VarWetMax;
8322 // Cleanness
8323 int m_Cleanness;
8324 int m_CleannessInit;
8325 int m_CleannessMin;
8326 int m_CleannessMax;
8327 // impact sounds
8329 bool m_CanPlayImpactSound = true;
8330 float m_ImpactSpeed;
8332 //
8333 float m_HeatIsolation;
8334 float m_ItemModelLength;
8335 float m_ItemAttachOffset; // Offset length for when the item is attached e.g. to weapon
8337 int m_VarLiquidType;
8338 int m_ItemBehaviour; // -1 = not specified; 0 = heavy item; 1= onehanded item; 2 = twohanded item
8339 int m_QuickBarBonus;
8340 bool m_IsBeingPlaced;
8341 bool m_IsHologram;
8342 bool m_IsTakeable;
8343 bool m_ThrowItemOnDrop;
8346 bool m_FixDamageSystemInit = false; //can be changed on storage version check
8347 bool can_this_be_combined; //Check if item can be combined
8348 bool m_CanThisBeSplit; //Check if item can be split
8349 bool m_IsStoreLoad = false;
8350 bool m_CanShowQuantity;
8351 bool m_HasQuantityBar;
8352 protected bool m_CanBeDigged;
8353 protected bool m_IsResultOfSplit
8354
8355 string m_SoundAttType;
8356 // items color variables
8361 //-------------------------------------------------------
8362
8363 // light source managing
8365
8369
8370 //==============================================
8371 // agent system
8372 private int m_AttachedAgents;
8373
8375 void TransferModifiers(PlayerBase reciever);
8376
8377
8378 // Weapons & suppressors particle effects
8383 static int m_LastRegisteredWeaponID = 0;
8384
8385 // Overheating effects
8387 float m_OverheatingShots;
8388 ref Timer m_CheckOverheating;
8389 int m_ShotsToStartOverheating = 0; // After these many shots, the overheating effect begins
8390 int m_MaxOverheatingValue = 0; // Limits the number of shots that will be tracked
8391 float m_OverheatingDecayInterval = 1; // Timer's interval for decrementing overheat effect's lifespan
8392 ref array <ref OverheatingParticle> m_OverheatingParticles;
8393
8395 protected bool m_HideSelectionsBySlot;
8396
8397 // Admin Log
8398 PluginAdminLog m_AdminLog;
8399
8400 // misc
8401 ref Timer m_PhysDropTimer;
8402
8403 // Attachment Locking variables
8404 ref array<int> m_CompatibleLocks;
8405 protected int m_LockType;
8406 protected ref EffectSound m_LockingSound;
8407 protected string m_LockSoundSet;
8408
8409 // ItemSoundHandler
8410 protected const int ITEM_SOUNDS_MAX = 63; // optimize network synch
8411 protected int m_SoundSyncPlay; // id for sound to play
8412 protected int m_SoundSyncStop; // id for sound to stop
8414
8415 //temperature
8416 private float m_TemperaturePerQuantityWeight;
8417
8418 // -------------------------------------------------------------------------
8419 void ItemBase()
8420 {
8421 SetEventMask(EntityEvent.INIT); // Enable EOnInit event
8425
8426 if (!GetGame().IsDedicatedServer())
8427 {
8428 if (HasMuzzle())
8429 {
8431
8433 {
8435 }
8436 }
8437
8439 m_ActionsInitialize = false;
8440 }
8441
8442 m_OldLocation = null;
8443
8444 if (GetGame().IsServer())
8445 {
8446 m_AdminLog = PluginAdminLog.Cast(GetPlugin(PluginAdminLog));
8447 }
8448
8449 if (ConfigIsExisting("headSelectionsToHide"))
8450 {
8452 ConfigGetTextArray("headSelectionsToHide",m_HeadHidingSelections);
8453 }
8454
8455 m_HideSelectionsBySlot = false;
8456 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
8457 {
8458 m_HideSelectionsBySlot = ConfigGetBool("hideSelectionsByinventorySlot");
8459 }
8460
8461 m_QuickBarBonus = Math.Max(0, ConfigGetInt("quickBarBonus"));
8462
8463 m_IsResultOfSplit = false;
8464
8466 }
8467
8468 override void InitItemVariables()
8469 {
8470 super.InitItemVariables();
8471
8472 m_VarQuantityInit = ConfigGetInt("varQuantityInit");
8473 m_VarQuantity = m_VarQuantityInit;//should be by the CE, this is just a precaution
8474 m_VarQuantityMin = ConfigGetInt("varQuantityMin");
8475 m_VarQuantityMax = ConfigGetInt("varQuantityMax");
8476 m_VarStackMax = ConfigGetFloat("varStackMax");
8477 m_Count = ConfigGetInt("count");
8478
8479 m_CanShowQuantity = ConfigGetBool("quantityShow");
8480 m_HasQuantityBar = ConfigGetBool("quantityBar");
8481
8482 m_CleannessInit = ConfigGetInt("varCleannessInit");
8484 m_CleannessMin = ConfigGetInt("varCleannessMin");
8485 m_CleannessMax = ConfigGetInt("varCleannessMax");
8486
8487 m_WantPlayImpactSound = false;
8488 m_ImpactSpeed = 0.0;
8489
8490 m_VarWetInit = ConfigGetFloat("varWetInit");
8492 m_VarWetMin = ConfigGetFloat("varWetMin");
8493 m_VarWetMax = ConfigGetFloat("varWetMax");
8494
8495 m_LiquidContainerMask = ConfigGetInt("liquidContainerType");
8496 if (IsLiquidContainer() && GetQuantity() != 0)
8498 m_IsBeingPlaced = false;
8499 m_IsHologram = false;
8500 m_IsTakeable = true;
8501 m_CanBeMovedOverride = false;
8505 m_CanBeDigged = ConfigGetBool("canBeDigged");
8506
8507 m_CompatibleLocks = new array<int>();
8508 ConfigGetIntArray("compatibleLocks", m_CompatibleLocks);
8509 m_LockType = ConfigGetInt("lockType");
8510
8511 //Define if item can be split and set ability to be combined accordingly
8512 m_CanThisBeSplit = false;
8513 can_this_be_combined = false;
8514 if (ConfigIsExisting("canBeSplit"))
8515 {
8516 can_this_be_combined = ConfigGetBool("canBeSplit");
8518 }
8519
8520 m_ItemBehaviour = -1;
8521 if (ConfigIsExisting("itemBehaviour"))
8522 m_ItemBehaviour = ConfigGetInt("itemBehaviour");
8523
8524 //RegisterNetSyncVariableInt("m_VariablesMask");
8525 if (HasQuantity()) RegisterNetSyncVariableFloat("m_VarQuantity", GetQuantityMin(), m_VarQuantityMax);
8526 RegisterNetSyncVariableFloat("m_VarWet", GetWetMin(), GetWetMax(), 2);
8527 RegisterNetSyncVariableInt("m_VarLiquidType");
8528 RegisterNetSyncVariableInt("m_Cleanness",0,1);
8529
8530 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
8531 RegisterNetSyncVariableFloat("m_ImpactSpeed");
8532 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
8533
8534 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
8535 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
8536 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
8537 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
8538
8539 RegisterNetSyncVariableBool("m_IsBeingPlaced");
8540 RegisterNetSyncVariableBool("m_IsTakeable");
8541 RegisterNetSyncVariableBool("m_IsHologram");
8542
8543 InitItemSounds();
8545 {
8546 RegisterNetSyncVariableInt("m_SoundSyncPlay", 0, ITEM_SOUNDS_MAX);
8547 RegisterNetSyncVariableInt("m_SoundSyncStop", 0, ITEM_SOUNDS_MAX);
8548 }
8549
8550 m_LockSoundSet = ConfigGetString("lockSoundSet");
8551
8553 if (ConfigIsExisting("temperaturePerQuantityWeight"))
8554 m_TemperaturePerQuantityWeight = ConfigGetFloat("temperaturePerQuantityWeight");
8555
8556 }
8557
8558 override int GetQuickBarBonus()
8559 {
8560 return m_QuickBarBonus;
8561 }
8562
8563 void InitializeActions()
8564 {
8566 if (!m_InputActionMap)
8567 {
8569 m_InputActionMap = iam;
8570 SetActions();
8572 }
8573 }
8574
8575 override void GetActions(typename action_input_type, out array<ActionBase_Basic> actions)
8576 {
8578 {
8579 m_ActionsInitialize = true;
8581 }
8582
8583 actions = m_InputActionMap.Get(action_input_type);
8584 }
8585
8586 void SetActions()
8587 {
8588 AddAction(ActionTakeItem);
8589 AddAction(ActionTakeItemToHands);
8590 AddAction(ActionWorldCraft);
8592 AddAction(ActionAttachWithSwitch);
8593 }
8594
8595 void SetActionAnimOverrides(); // Override action animation for specific item
8596
8597 void AddAction(typename actionName)
8598 {
8599 ActionBase action = ActionManagerBase.GetAction(actionName);
8600
8601 if (!action)
8602 {
8603 Debug.LogError("Action " + actionName + " dosn't exist!");
8604 return;
8605 }
8606
8607 typename ai = action.GetInputType();
8608 if (!ai)
8609 {
8610 m_ActionsInitialize = false;
8611 return;
8612 }
8613
8614 array<ActionBase_Basic> action_array = m_InputActionMap.Get(ai);
8615 if (!action_array)
8616 {
8617 action_array = new array<ActionBase_Basic>;
8618 m_InputActionMap.Insert(ai, action_array);
8619 }
8620 if (LogManager.IsActionLogEnable())
8621 {
8622 Debug.ActionLog(action.ToString() + " -> " + ai, this.ToString() , "n/a", "Add action");
8623 }
8624
8625 if (action_array.Find(action) != -1)
8626 {
8627 Debug.Log("Action " + action.Type() + " already added to " + this + ", skipping!");
8628 }
8629 else
8630 {
8631 action_array.Insert(action);
8632 }
8633 }
8634
8635 void RemoveAction(typename actionName)
8636 {
8637 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
8638 ActionBase action = player.GetActionManager().GetAction(actionName);
8639 typename ai = action.GetInputType();
8640 array<ActionBase_Basic> action_array = m_InputActionMap.Get(ai);
8641
8642 if (action_array)
8643 {
8644 action_array.RemoveItem(action);
8645 }
8646 }
8647
8648 // Allows override of default action command per item, defined in the SetActionAnimOverrides() of the item's class
8649 // Set -1 for params which should stay in default state
8650 void OverrideActionAnimation(typename action, int commandUID, int stanceMask = -1, int commandUIDProne = -1)
8651 {
8652 ActionOverrideData overrideData = new ActionOverrideData();
8653 overrideData.m_CommandUID = commandUID;
8654 overrideData.m_CommandUIDProne = commandUIDProne;
8655 overrideData.m_StanceMask = stanceMask;
8656
8657 TActionAnimOverrideMap actionMap = m_ItemActionOverrides.Get(action);
8658 if (!actionMap) // create new map of action > overidables map
8659 {
8660 actionMap = new TActionAnimOverrideMap();
8661 m_ItemActionOverrides.Insert(action, actionMap);
8662 }
8663
8664 actionMap.Insert(this.Type(), overrideData); // insert item -> overrides
8665
8666 }
8667
8668 void OnItemInHandsPlayerSwimStart(PlayerBase player);
8669
8670 ScriptedLightBase GetLight();
8671
8672 // Loads muzzle flash particle configuration from config and saves it to a map for faster access
8673 void LoadParticleConfigOnFire(int id)
8674 {
8675 if (!m_OnFireEffect)
8677
8680
8681 string config_to_search = "CfgVehicles";
8682 string muzzle_owner_config;
8683
8684 if (!m_OnFireEffect.Contains(id))
8685 {
8686 if (IsInherited(Weapon))
8687 config_to_search = "CfgWeapons";
8688
8689 muzzle_owner_config = config_to_search + " " + GetType() + " ";
8690
8691 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
8692
8693 int config_OnFire_subclass_count = GetGame().ConfigGetChildrenCount(config_OnFire_class);
8694
8695 if (config_OnFire_subclass_count > 0)
8696 {
8697 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
8698
8699 for (int i = 0; i < config_OnFire_subclass_count; i++)
8700 {
8701 string particle_class = "";
8702 GetGame().ConfigGetChildName(config_OnFire_class, i, particle_class);
8703 string config_OnFire_entry = config_OnFire_class + particle_class;
8704 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
8705 WPOF_array.Insert(WPOF);
8706 }
8707
8708
8709 m_OnFireEffect.Insert(id, WPOF_array);
8710 }
8711 }
8712
8713 if (!m_OnBulletCasingEjectEffect.Contains(id))
8714 {
8715 config_to_search = "CfgWeapons"; // Bullet Eject efect is supported on weapons only.
8716 muzzle_owner_config = config_to_search + " " + GetType() + " ";
8717
8718 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
8719
8720 int config_OnBulletCasingEject_count = GetGame().ConfigGetChildrenCount(config_OnBulletCasingEject_class);
8721
8722 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
8723 {
8724 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
8725
8726 for (i = 0; i < config_OnBulletCasingEject_count; i++)
8727 {
8728 string particle_class2 = "";
8729 GetGame().ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
8730 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
8731 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
8732 WPOBE_array.Insert(WPOBE);
8733 }
8734
8735
8736 m_OnBulletCasingEjectEffect.Insert(id, WPOBE_array);
8737 }
8738 }
8739 }
8740
8741 // Loads muzzle flash particle configuration from config and saves it to a map for faster access
8743 {
8746
8747 if (!m_OnOverheatingEffect.Contains(id))
8748 {
8749 string config_to_search = "CfgVehicles";
8750
8751 if (IsInherited(Weapon))
8752 config_to_search = "CfgWeapons";
8753
8754 string muzzle_owner_config = config_to_search + " " + GetType() + " ";
8755 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
8756
8757 if (GetGame().ConfigIsExisting(config_OnOverheating_class))
8758 {
8759
8760 m_ShotsToStartOverheating = GetGame().ConfigGetFloat(config_OnOverheating_class + "shotsToStartOverheating");
8761
8763 {
8764 m_ShotsToStartOverheating = -1; // This prevents futher readings from config for future creations of this item
8765 string error = "Error reading config " + GetType() + ">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
8766 Error(error);
8767 return;
8768 }
8769
8770 m_OverheatingDecayInterval = GetGame().ConfigGetFloat(config_OnOverheating_class + "overheatingDecayInterval");
8771 m_MaxOverheatingValue = GetGame().ConfigGetFloat(config_OnOverheating_class + "maxOverheatingValue");
8772
8773
8774
8775 int config_OnOverheating_subclass_count = GetGame().ConfigGetChildrenCount(config_OnOverheating_class);
8776 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
8777
8778 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
8779 {
8780 string particle_class = "";
8781 GetGame().ConfigGetChildName(config_OnOverheating_class, i, particle_class);
8782 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
8783 int entry_type = GetGame().ConfigGetType(config_OnOverheating_entry);
8784
8785 if (entry_type == CT_CLASS)
8786 {
8787 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
8788 WPOOH_array.Insert(WPOF);
8789 }
8790 }
8791
8792
8793 m_OnOverheatingEffect.Insert(id, WPOOH_array);
8794 }
8795 }
8796 }
8797
8798 float GetOverheatingValue()
8799 {
8800 return m_OverheatingShots;
8801 }
8802
8803 void IncreaseOverheating(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
8804 {
8805 if (m_MaxOverheatingValue > 0)
8806 {
8808
8809 if (!m_CheckOverheating)
8811
8813 m_CheckOverheating.Run(m_OverheatingDecayInterval, this, "OnOverheatingDecay");
8814
8815 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8816 }
8817 }
8818
8819 void CheckOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
8820 {
8822 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8823
8825 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8826
8828 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8829
8831 {
8833 }
8834 }
8835
8837 {
8839 }
8840
8841 void OnOverheatingDecay()
8842 {
8843 if (m_MaxOverheatingValue > 0)
8844 m_OverheatingShots -= 1 + m_OverheatingShots / m_MaxOverheatingValue; // The hotter a barrel is, the faster it needs to cool down.
8845 else
8847
8848 if (m_OverheatingShots <= 0)
8849 {
8852 }
8853 else
8854 {
8855 if (!m_CheckOverheating)
8857
8859 m_CheckOverheating.Run(m_OverheatingDecayInterval, this, "OnOverheatingDecay");
8860 }
8861
8862 CheckOverheating(this, "", this);
8863 }
8864
8865 void StartOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
8866 {
8868 ItemBase.PlayOverheatingParticles(this, ammoType, this, suppressor, "CfgWeapons");
8869 }
8870
8871 void UpdateOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
8872 {
8874 ItemBase.UpdateOverheatingParticles(this, ammoType, this, suppressor, "CfgWeapons");
8876 }
8877
8878 void StopOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
8879 {
8881 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8882 }
8883
8884 void RegisterOverheatingParticle(Particle p, float min_heat_coef, float max_heat_coef, int particle_id, Object parent, vector local_pos, vector local_ori)
8885 {
8887 m_OverheatingParticles = new array<ref OverheatingParticle>;
8888
8889 OverheatingParticle OP = new OverheatingParticle();
8890 OP.RegisterParticle(p);
8891 OP.SetOverheatingLimitMin(min_heat_coef);
8892 OP.SetOverheatingLimitMax(max_heat_coef);
8893 OP.SetParticleParams(particle_id, parent, local_pos, local_ori);
8894
8895 m_OverheatingParticles.Insert(OP);
8896 }
8897
8898 float GetOverheatingCoef()
8899 {
8900 if (m_MaxOverheatingValue > 0)
8902
8903 return -1;
8904 }
8905
8907 {
8909 {
8910 float overheat_coef = GetOverheatingCoef();
8911 int count = m_OverheatingParticles.Count();
8912
8913 for (int i = count; i > 0; --i)
8914 {
8915 int id = i - 1;
8916 OverheatingParticle OP = m_OverheatingParticles.Get(id);
8917 Particle p = OP.GetParticle();
8918
8919 float overheat_min = OP.GetOverheatingLimitMin();
8920 float overheat_max = OP.GetOverheatingLimitMax();
8921
8922 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
8923 {
8924 if (p)
8925 {
8926 p.Stop();
8927 OP.RegisterParticle(null);
8928 }
8929 }
8930 }
8931 }
8932 }
8933
8935 {
8937 {
8938 for (int i = m_OverheatingParticles.Count(); i > 0; i--)
8939 {
8940 int id = i - 1;
8941 OverheatingParticle OP = m_OverheatingParticles.Get(id);
8942
8943 if (OP)
8944 {
8945 Particle p = OP.GetParticle();
8946
8947 if (p)
8948 {
8949 p.Stop();
8950 }
8951
8952 delete OP;
8953 }
8954 }
8955
8956 m_OverheatingParticles.Clear();
8958 }
8959 }
8960
8962 float GetInfectionChance(int system = 0, Param param = null)
8963 {
8964 return 0.0;
8965 }
8966
8967
8968 float GetDisinfectQuantity(int system = 0, Param param1 = null)
8969 {
8970 return 250;//default value
8971 }
8972
8973 float GetFilterDamageRatio()
8974 {
8975 return 0;
8976 }
8977
8979 bool HasMuzzle()
8980 {
8981 if (IsInherited(Weapon) || IsInherited(SuppressorBase))
8982 return true;
8983
8984 return false;
8985 }
8986
8988 int GetMuzzleID()
8989 {
8990 if (!m_WeaponTypeToID)
8992
8993 if (m_WeaponTypeToID.Contains(GetType()))
8994 {
8995 return m_WeaponTypeToID.Get(GetType());
8996 }
8997 else
8998 {
8999 // Register new weapon ID
9001 }
9002
9004 }
9005
9012 {
9013 return -1;
9014 }
9015
9016
9017
9018 // -------------------------------------------------------------------------
9019 void ~ItemBase()
9020 {
9021 if (GetGame() && GetGame().GetPlayer() && (!GetGame().IsDedicatedServer()))
9022 {
9023 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
9024 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9025
9026 if (r_index >= 0)
9027 {
9028 InventoryLocation r_il = new InventoryLocation;
9029 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9030
9031 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9032 int r_type = r_il.GetType();
9033 if (r_type == InventoryLocationType.CARGO || r_type == InventoryLocationType.PROXYCARGO)
9034 {
9035 r_il.GetParent().GetOnReleaseLock().Invoke(this);
9036 }
9037 else if (r_type == InventoryLocationType.ATTACHMENT)
9038 {
9039 r_il.GetParent().GetOnAttachmentReleaseLock().Invoke(this, r_il.GetSlot());
9040 }
9041
9042 }
9043
9044 player.GetHumanInventory().ClearUserReservedLocation(this);
9045 }
9046
9047 if (m_LockingSound)
9048 SEffectManager.DestroyEffect(m_LockingSound);
9049 }
9050
9051
9052
9053 // -------------------------------------------------------------------------
9054 static int GetDebugActionsMask()
9055 {
9056 return ItemBase.m_DebugActionsMask;
9057 }
9058
9059 static bool HasDebugActionsMask(int mask)
9060 {
9061 return ItemBase.m_DebugActionsMask & mask;
9062 }
9063
9064 static void SetDebugActionsMask(int mask)
9065 {
9066 ItemBase.m_DebugActionsMask = mask;
9067 }
9068
9069 static void AddDebugActionsMask(int mask)
9070 {
9071 ItemBase.m_DebugActionsMask |= mask;
9072 }
9073
9074 static void RemoveDebugActionsMask(int mask)
9075 {
9076 ItemBase.m_DebugActionsMask &= ~mask;
9077 }
9078
9079 static void ToggleDebugActionsMask(int mask)
9080 {
9081 if (HasDebugActionsMask(mask))
9082 {
9084 }
9085 else
9086 {
9087 AddDebugActionsMask(mask);
9088 }
9089 }
9090
9091 // -------------------------------------------------------------------------
9092 void SetCEBasedQuantity()
9093 {
9094 if (GetEconomyProfile())
9095 {
9096 float q_max = GetEconomyProfile().GetQuantityMax();
9097 if (q_max > 0)
9098 {
9099 float q_min = GetEconomyProfile().GetQuantityMin();
9100 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
9101
9102 if (HasComponent(COMP_TYPE_ENERGY_MANAGER))//more direct access for speed
9103 {
9104 ComponentEnergyManager comp = GetCompEM();
9105 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
9106 {
9107 comp.SetEnergy0To1(quantity_randomized);
9108 }
9109 }
9110 else if (HasQuantity())
9111 {
9112 SetQuantityNormalized(quantity_randomized, false);
9113 //PrintString("<==> Normalized quantity for item: "+ GetType()+", qmin:"+q_min.ToString()+"; qmax:"+q_max.ToString()+";quantity:" +quantity_randomized.ToString());
9114 }
9115
9116 }
9117 }
9118 }
9119
9121 void LockToParent()
9122 {
9123 EntityAI parent = GetHierarchyParent();
9124
9125 if (parent)
9126 {
9127 InventoryLocation inventory_location_to_lock = new InventoryLocation;
9128 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
9129 parent.GetInventory().SetSlotLock(inventory_location_to_lock.GetSlot(), true);
9130 }
9131 }
9132
9134 void UnlockFromParent()
9135 {
9136 EntityAI parent = GetHierarchyParent();
9137
9138 if (parent)
9139 {
9140 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
9141 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
9142 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.GetSlot(), false);
9143 }
9144 }
9145
9146 override void CombineItemsClient(EntityAI entity2, bool use_stack_max = true)
9147 {
9148 /*
9149 ref Param1<EntityAI> item = new Param1<EntityAI>(entity2);
9150 RPCSingleParam(ERPCs.RPC_ITEM_COMBINE, item, GetGame().GetPlayer());
9151 */
9152 ItemBase item2 = ItemBase.Cast(entity2);
9153
9154 if (GetGame().IsClient())
9155 {
9156 if (ScriptInputUserData.CanStoreInputUserData())
9157 {
9158 ScriptInputUserData ctx = new ScriptInputUserData;
9160 ctx.Write(-1);
9161 ItemBase i1 = this; // @NOTE: workaround for correct serialization
9162 ctx.Write(i1);
9163 ctx.Write(item2);
9164 ctx.Write(use_stack_max);
9165 ctx.Write(-1);
9166 ctx.Send();
9167
9168 if (IsCombineAll(item2, use_stack_max))
9169 {
9170 GetGame().GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
9171 }
9172 }
9173 }
9174 else if (!GetGame().IsMultiplayer())
9175 {
9176 CombineItems(item2, use_stack_max);
9177 }
9178 }
9179
9180 bool IsLiquidPresent()
9181 {
9182 return (GetLiquidType() != 0 && HasQuantity());
9183 }
9184
9185 bool IsLiquidContainer()
9186 {
9187 return m_LiquidContainerMask != 0;
9188 }
9189
9191 {
9192 return m_LiquidContainerMask;
9193 }
9194
9195 bool IsBloodContainer()
9196 {
9197 //m_LiquidContainerMask & GROUP_LIQUID_BLOOD ???
9198 return false;
9199 }
9200
9201 bool IsNVG()
9202 {
9203 return false;
9204 }
9205
9208 bool IsExplosive()
9209 {
9210 return false;
9211 }
9212
9214 {
9215 return "";
9216 }
9217
9219
9220 bool IsLightSource()
9221 {
9222 return false;
9223 }
9224
9226 {
9227 return true;
9228 }
9229
9230 //--- ACTION CONDITIONS
9231 //direction
9232 bool IsFacingPlayer(PlayerBase player, string selection)
9233 {
9234 return true;
9235 }
9236
9237 bool IsPlayerInside(PlayerBase player, string selection)
9238 {
9239 return true;
9240 }
9241
9242 override bool CanObstruct()
9243 {
9244 PlayerBase player = PlayerBase.Cast(g_Game.GetPlayer());
9245 return !player || !IsPlayerInside(player, "");
9246 }
9247
9248 override bool IsBeingPlaced()
9249 {
9250 return m_IsBeingPlaced;
9251 }
9252
9253 void SetIsBeingPlaced(bool is_being_placed)
9254 {
9255 m_IsBeingPlaced = is_being_placed;
9256 if (!is_being_placed)
9258 SetSynchDirty();
9259 }
9260
9261 //server-side
9262 void OnEndPlacement() {}
9263
9264 override bool IsHologram()
9265 {
9266 return m_IsHologram;
9267 }
9268
9269 bool CanBeDigged()
9270 {
9271 return m_CanBeDigged;
9272 }
9273
9275 {
9276 return 1;
9277 }
9278
9279 bool CanMakeGardenplot()
9280 {
9281 return false;
9282 }
9283
9284 void SetIsHologram(bool is_hologram)
9285 {
9286 m_IsHologram = is_hologram;
9287 SetSynchDirty();
9288 }
9289 /*
9290 protected float GetNutritionalEnergy()
9291 {
9292 Edible_Base edible = Edible_Base.Cast(this);
9293 return edible.GetFoodEnergy();
9294 }
9295
9296 protected float GetNutritionalWaterContent()
9297 {
9298 Edible_Base edible = Edible_Base.Cast(this);
9299 return edible.GetFoodWater();
9300 }
9301
9302 protected float GetNutritionalIndex()
9303 {
9304 Edible_Base edible = Edible_Base.Cast(this);
9305 return edible.GetFoodNutritionalIndex();
9306 }
9307
9308 protected float GetNutritionalFullnessIndex()
9309 {
9310 Edible_Base edible = Edible_Base.Cast(this);
9311 return edible.GetFoodTotalVolume();
9312 }
9313
9314 protected float GetNutritionalToxicity()
9315 {
9316 Edible_Base edible = Edible_Base.Cast(this);
9317 return edible.GetFoodToxicity();
9318
9319 }
9320 */
9321
9322
9323 // -------------------------------------------------------------------------
9324 override void OnMovedInsideCargo(EntityAI container)
9325 {
9326 super.OnMovedInsideCargo(container);
9327
9328 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9329 }
9330
9331 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
9332 {
9333 super.EEItemLocationChanged(oldLoc,newLoc);
9334
9335 PlayerBase new_player = null;
9336 PlayerBase old_player = null;
9337
9338 if (newLoc.GetParent())
9339 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
9340
9341 if (oldLoc.GetParent())
9342 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
9343
9344 if (old_player && oldLoc.GetType() == InventoryLocationType.HANDS)
9345 {
9346 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
9347
9348 if (r_index >= 0)
9349 {
9350 InventoryLocation r_il = new InventoryLocation;
9351 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9352
9353 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9354 int r_type = r_il.GetType();
9355 if (r_type == InventoryLocationType.CARGO || r_type == InventoryLocationType.PROXYCARGO)
9356 {
9357 r_il.GetParent().GetOnReleaseLock().Invoke(this);
9358 }
9359 else if (r_type == InventoryLocationType.ATTACHMENT)
9360 {
9361 r_il.GetParent().GetOnAttachmentReleaseLock().Invoke(this, r_il.GetSlot());
9362 }
9363
9364 }
9365 }
9366
9367 if (newLoc.GetType() == InventoryLocationType.HANDS)
9368 {
9369 if (new_player)
9370 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
9371
9372 if (new_player == old_player)
9373 {
9374
9375 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
9376 {
9377 if (oldLoc.GetType() == InventoryLocationType.CARGO)
9378 {
9379 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
9380 {
9381 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9382 }
9383 }
9384 else
9385 {
9386 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9387 }
9388 }
9389
9390 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
9391 {
9392 int type = oldLoc.GetType();
9393 if (type == InventoryLocationType.CARGO || type == InventoryLocationType.PROXYCARGO)
9394 {
9395 oldLoc.GetParent().GetOnSetLock().Invoke(this);
9396 }
9397 else if (type == InventoryLocationType.ATTACHMENT)
9398 {
9399 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
9400 }
9401 }
9402 if (!m_OldLocation)
9403 {
9404 m_OldLocation = new InventoryLocation;
9405 }
9406 m_OldLocation.Copy(oldLoc);
9407 }
9408 else
9409 {
9410 if (m_OldLocation)
9411 {
9412 m_OldLocation.Reset();
9413 }
9414 }
9415
9417 }
9418 else
9419 {
9420 if (new_player)
9421 {
9422 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
9423 if (res_index >= 0)
9424 {
9425 InventoryLocation il = new InventoryLocation;
9426 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
9427 ItemBase it = ItemBase.Cast(il.GetItem());
9428 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
9429 int rel_type = il.GetType();
9430 if (rel_type == InventoryLocationType.CARGO || rel_type == InventoryLocationType.PROXYCARGO)
9431 {
9432 il.GetParent().GetOnReleaseLock().Invoke(it);
9433 }
9434 else if (rel_type == InventoryLocationType.ATTACHMENT)
9435 {
9436 il.GetParent().GetOnAttachmentReleaseLock().Invoke(it, il.GetSlot());
9437 }
9438 //it.GetOnReleaseLock().Invoke(it);
9439 }
9440 }
9441 else if (old_player && newLoc.GetType() == InventoryLocationType.GROUND && m_ThrowItemOnDrop)
9442 {
9443 //ThrowPhysically(old_player, vector.Zero);
9444 m_ThrowItemOnDrop = false;
9445 }
9446
9447 if (m_OldLocation)
9448 {
9449 m_OldLocation.Reset();
9450 }
9451 }
9452 }
9453
9454 override void EOnContact(IEntity other, Contact extra)
9455 {
9457 {
9458 int liquidType = -1;
9459 float impactSpeed = ProcessImpactSoundEx(other, extra, m_ConfigWeight, m_ImpactSoundSurfaceHash, liquidType);
9460 if (impactSpeed > 0.0)
9461 {
9462 m_ImpactSpeed = impactSpeed;
9463 #ifndef SERVER
9464 PlayImpactSound(m_ConfigWeight, m_ImpactSpeed, m_ImpactSoundSurfaceHash);
9465 #else
9466 m_WantPlayImpactSound = true;
9467 SetSynchDirty();
9468 #endif
9469 m_CanPlayImpactSound = (liquidType == -1);// prevents further playing of the sound when the surface is a liquid type
9470 }
9471 }
9472
9473 #ifdef SERVER
9474 if (GetCompEM() && GetCompEM().IsPlugged())
9475 {
9476 if (GetCompEM().GetCordLength() < vector.Distance(GetPosition(), GetCompEM().GetEnergySource().GetPosition()))
9477 GetCompEM().UnplugThis();
9478 }
9479 #endif
9480 }
9481
9482 void RefreshPhysics();
9483
9484 override void OnCreatePhysics()
9485 {
9487 }
9488
9489 override void OnItemAttachmentSlotChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
9490 {
9491
9492 }
9493 // -------------------------------------------------------------------------
9494 override void OnItemLocationChanged(EntityAI old_owner, EntityAI new_owner)
9495 {
9496 super.OnItemLocationChanged(old_owner, new_owner);
9497
9498 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
9499 PlayerBase playerNew = PlayerBase.Cast(new_owner);
9500
9501 if (!relatedPlayer && playerNew)
9502 relatedPlayer = playerNew;
9503
9504 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
9505 {
9506 ActionManagerBase actionMgr = relatedPlayer.GetActionManager();
9507 if (actionMgr)
9508 {
9509 ActionBase currentAction = actionMgr.GetRunningAction();
9510 if (currentAction)
9511 currentAction.OnItemLocationChanged(this);
9512 }
9513 }
9514
9515 Man ownerPlayerOld = null;
9516 Man ownerPlayerNew = null;
9517
9518 if (old_owner)
9519 {
9520 if (old_owner.IsMan())
9521 {
9522 ownerPlayerOld = Man.Cast(old_owner);
9523 }
9524 else
9525 {
9526 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
9527 }
9528 }
9529 else
9530 {
9531 if (new_owner && IsElectricAppliance() && GetCompEM() && GetCompEM().IsPlugged())
9532 {
9533 ActionBase action = ActionManagerBase.GetAction(ActionRepositionPluggedItem);
9534
9535 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.GetID())
9536 {
9537 GetCompEM().UnplugThis();
9538 }
9539 }
9540 }
9541
9542 if (new_owner)
9543 {
9544 if (new_owner.IsMan())
9545 {
9546 ownerPlayerNew = Man.Cast(new_owner);
9547 }
9548 else
9549 {
9550 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
9551 }
9552 }
9553
9554 if (ownerPlayerOld != ownerPlayerNew)
9555 {
9556 if (ownerPlayerOld)
9557 {
9558 array<EntityAI> subItemsExit = new array<EntityAI>;
9559 GetInventory().EnumerateInventory(InventoryTraversalType.PREORDER,subItemsExit);
9560 for (int i = 0; i < subItemsExit.Count(); i++)
9561 {
9562 ItemBase itemExit = ItemBase.Cast(subItemsExit.Get(i));
9563 itemExit.OnInventoryExit(ownerPlayerOld);
9564 }
9565 }
9566
9567 if (ownerPlayerNew)
9568 {
9569 array<EntityAI> subItemsEnter = new array<EntityAI>;
9570 GetInventory().EnumerateInventory(InventoryTraversalType.PREORDER,subItemsEnter);
9571 for (int j = 0; j < subItemsEnter.Count(); j++)
9572 {
9573 ItemBase itemEnter = ItemBase.Cast(subItemsEnter.Get(j));
9574 itemEnter.OnInventoryEnter(ownerPlayerNew);
9575 }
9576 }
9577 }
9578 else if (ownerPlayerNew != null)
9579 {
9580 PlayerBase nplayer;
9581 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
9582 {
9583 array<EntityAI> subItemsUpdate = new array<EntityAI>;
9584 GetInventory().EnumerateInventory(InventoryTraversalType.PREORDER,subItemsUpdate);
9585 for (int k = 0; k < subItemsUpdate.Count(); k++)
9586 {
9587 ItemBase itemUpdate = ItemBase.Cast(subItemsUpdate.Get(k));
9588 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
9589 }
9590 }
9591 }
9592
9593 if (old_owner)
9594 old_owner.OnChildItemRemoved(this);
9595 if (new_owner)
9596 new_owner.OnChildItemReceived(this);
9597 }
9598
9599 // -------------------------------------------------------------------------------
9600 override void EEDelete(EntityAI parent)
9601 {
9602 super.EEDelete(parent);
9603 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
9604 if (player)
9605 {
9606 OnInventoryExit(player);
9607
9608 if (player.IsAlive())
9609 {
9610 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9611 if (r_index >= 0)
9612 {
9613 InventoryLocation r_il = new InventoryLocation;
9614 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9615
9616 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9617 int r_type = r_il.GetType();
9618 if (r_type == InventoryLocationType.CARGO || r_type == InventoryLocationType.PROXYCARGO)
9619 {
9620 r_il.GetParent().GetOnReleaseLock().Invoke(this);
9621 }
9622 else if (r_type == InventoryLocationType.ATTACHMENT)
9623 {
9624 r_il.GetParent().GetOnAttachmentReleaseLock().Invoke(this, r_il.GetSlot());
9625 }
9626
9627 }
9628
9629 player.RemoveQuickBarEntityShortcut(this);
9630 }
9631 }
9632 }
9633 // -------------------------------------------------------------------------------
9634 override void EEKilled(Object killer)
9635 {
9636 super.EEKilled(killer);
9637
9639 if (killer && killer.IsFireplace() && CanExplodeInFire())
9640 {
9641 if (GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
9642 {
9643 if (IsMagazine())
9644 {
9645 if (Magazine.Cast(this).GetAmmoCount() > 0)
9646 {
9647 ExplodeAmmo();
9648 }
9649 }
9650 else
9651 {
9652 Explode(DamageType.EXPLOSION);
9653 }
9654 }
9655 }
9656 }
9657
9658 override void OnWasAttached(EntityAI parent, int slot_id)
9659 {
9660 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9661
9662 super.OnWasAttached(parent, slot_id);
9663
9664 if (HasQuantity())
9665 UpdateNetSyncVariableFloat("m_VarQuantity", GetQuantityMin(), m_VarQuantityMax);
9666
9667 PlayAttachSound(InventorySlots.GetSlotName(slot_id));
9668 }
9669
9670 override void OnWasDetached(EntityAI parent, int slot_id)
9671 {
9672 super.OnWasDetached(parent, slot_id);
9673
9674 if (HasQuantity())
9675 UpdateNetSyncVariableFloat("m_VarQuantity", GetQuantityMin(), m_VarQuantityMax);
9676 }
9677
9678 override string ChangeIntoOnAttach(string slot)
9679 {
9680 int idx;
9681 TStringArray inventory_slots = new TStringArray;
9682 TStringArray attach_types = new TStringArray;
9683
9684 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9685 if (inventory_slots.Count() < 1) //is string
9686 {
9687 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
9688 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
9689 }
9690 else //is array
9691 {
9692 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
9693 }
9694
9695 idx = inventory_slots.Find(slot);
9696 if (idx < 0)
9697 return "";
9698
9699 return attach_types.Get(idx);
9700 }
9701
9702 override string ChangeIntoOnDetach()
9703 {
9704 int idx = -1;
9705 string slot;
9706
9707 TStringArray inventory_slots = new TStringArray;
9708 TStringArray detach_types = new TStringArray;
9709
9710 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9711 if (inventory_slots.Count() < 1) //is string
9712 {
9713 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
9714 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9715 }
9716 else //is array
9717 {
9718 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
9719 if (detach_types.Count() < 1)
9720 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9721 }
9722
9723 for (int i = 0; i < inventory_slots.Count(); i++)
9724 {
9725 slot = inventory_slots.Get(i);
9726 }
9727
9728 if (slot != "")
9729 {
9730 if (detach_types.Count() == 1)
9731 idx = 0;
9732 else
9733 idx = inventory_slots.Find(slot);
9734 }
9735 if (idx < 0)
9736 return "";
9737
9738 return detach_types.Get(idx);
9739 }
9740
9741 void ExplodeAmmo()
9742 {
9743 //timer
9744 ref Timer explode_timer = new Timer(CALL_CATEGORY_SYSTEM);
9745
9746 //min/max time
9747 float min_time = 1;
9748 float max_time = 3;
9749 float delay = Math.RandomFloat(min_time, max_time);
9750
9751 explode_timer.Run(delay, this, "DoAmmoExplosion");
9752 }
9753
9754 void DoAmmoExplosion()
9755 {
9756 Magazine magazine = Magazine.Cast(this);
9757 int pop_sounds_count = 6;
9758 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
9759
9760 //play sound
9761 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
9762 string sound_name = pop_sounds[ sound_idx ];
9763 GetGame().CreateSoundOnObject(this, sound_name, 20, false);
9764
9765 //remove ammo count
9766 magazine.ServerAddAmmoCount(-1);
9767
9768 //if condition then repeat -> ExplodeAmmo
9769 float min_temp_to_explode = 100; //min temperature for item to explode
9770
9771 if (magazine.GetAmmoCount() > 0 && GetTemperature() >= min_temp_to_explode) //TODO ? add check for parent -> fireplace
9772 {
9773 ExplodeAmmo();
9774 }
9775 }
9776
9777 // -------------------------------------------------------------------------------
9778 override void EEHitBy(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
9779 {
9780 super.EEHitBy(damageResult, damageType, source, component, dmgZone, ammo, modelPos, speedCoef);
9781
9782 const int CHANCE_DAMAGE_CARGO = 4;
9783 const int CHANCE_DAMAGE_ATTACHMENT = 1;
9784 const int CHANCE_DAMAGE_NOTHING = 2;
9785
9786 if (IsClothing() || IsContainer() || IsItemTent())
9787 {
9788 float dmg = damageResult.GetDamage("","Health") * -0.5;
9789 int chances;
9790 int rnd;
9791
9792 if (GetInventory().GetCargo())
9793 {
9794 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9795 rnd = Math.RandomInt(0,chances);
9796
9797 if (rnd < CHANCE_DAMAGE_CARGO)
9798 {
9799 DamageItemInCargo(dmg);
9800 }
9801 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
9802 {
9804 }
9805 }
9806 else
9807 {
9808 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9809 rnd = Math.RandomInt(0,chances);
9810
9811 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
9812 {
9814 }
9815 }
9816 }
9817 }
9818
9819 bool DamageItemInCargo(float damage)
9820 {
9821 if (GetInventory().GetCargo())
9822 {
9823 int item_count = GetInventory().GetCargo().GetItemCount();
9824 if (item_count > 0)
9825 {
9826 int random_pick = Math.RandomInt(0, item_count);
9827 ItemBase item = ItemBase.Cast(GetInventory().GetCargo().GetItem(random_pick));
9828 if (!item.IsExplosive())
9829 {
9830 item.AddHealth("","",damage);
9831 return true;
9832 }
9833 }
9834 }
9835 return false;
9836 }
9837
9838 bool DamageItemAttachments(float damage)
9839 {
9840 int attachment_count = GetInventory().AttachmentCount();
9841 if (attachment_count > 0)
9842 {
9843 int random_pick = Math.RandomInt(0, attachment_count);
9844 ItemBase attachment = ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
9845 if (!attachment.IsExplosive())
9846 {
9847 attachment.AddHealth("","",damage);
9848 return true;
9849 }
9850 }
9851 return false;
9852 }
9853
9854 override bool IsSplitable()
9855 {
9856 return m_CanThisBeSplit;
9857 }
9858 //----------------
9859 override bool CanBeSplit()
9860 {
9861 if (IsSplitable() && (GetQuantity() > 1))
9862 return GetInventory().CanRemoveEntity();
9863
9864 return false;
9865 }
9866
9867 protected bool ShouldSplitQuantity(float quantity)
9868 {
9869 // don't call 'CanBeSplit' here, too strict and will introduce a freeze-crash when dismantling fence with a fireplace nearby
9870 if (!IsSplitable())
9871 return false;
9872
9873 // nothing to split?
9874 if (GetQuantity() <= 1)
9875 return false;
9876
9877 // check if we should re-use the item instead of creating a new copy?
9878 // implicit cast to int, if 'IsSplitable' returns true, these values are assumed ints
9879 int delta = GetQuantity() - quantity;
9880 if (delta == 0)
9881 return false;
9882
9883 // valid to split
9884 return true;
9885 }
9886
9887 override void SplitIntoStackMaxClient(EntityAI destination_entity, int slot_id )
9888 {
9889 if (GetGame().IsClient())
9890 {
9891 if (ScriptInputUserData.CanStoreInputUserData())
9892 {
9893 ScriptInputUserData ctx = new ScriptInputUserData;
9895 ctx.Write(1);
9896 ItemBase i1 = this; // @NOTE: workaround for correct serialization
9897 ctx.Write(i1);
9898 ctx.Write(destination_entity);
9899 ctx.Write(true);
9900 ctx.Write(slot_id);
9901 ctx.Send();
9902 }
9903 }
9904 else if (!GetGame().IsMultiplayer())
9905 {
9906 SplitIntoStackMax(destination_entity, slot_id, PlayerBase.Cast(GetGame().GetPlayer()));
9907 }
9908 }
9909
9910 void SplitIntoStackMax(EntityAI destination_entity, int slot_id, PlayerBase player)
9911 {
9912 float split_quantity_new;
9913 ItemBase new_item;
9914 float quantity = GetQuantity();
9915 float stack_max = GetTargetQuantityMax(slot_id);
9916 InventoryLocation loc = new InventoryLocation;
9917
9918 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
9919 {
9920 if (stack_max <= GetQuantity())
9921 split_quantity_new = stack_max;
9922 else
9923 split_quantity_new = GetQuantity();
9924
9925 if (ShouldSplitQuantity(split_quantity_new))
9926 {
9927 new_item = ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(this.GetType(), slot_id));
9928 if (new_item)
9929 {
9930 new_item.SetResultOfSplit(true);
9931 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9932 AddQuantity(-split_quantity_new, false, true);
9933 new_item.SetQuantity(split_quantity_new, false, true);
9934 }
9935 }
9936 }
9937 else if (destination_entity && slot_id == -1)
9938 {
9939 if (quantity > stack_max)
9940 split_quantity_new = stack_max;
9941 else
9942 split_quantity_new = quantity;
9943
9944 if (ShouldSplitQuantity(split_quantity_new))
9945 {
9946 if (destination_entity.GetInventory().FindFreeLocationFor(this, FindInventoryLocationType.ANY, loc))
9947 {
9948 Object o = destination_entity.GetInventory().LocationCreateEntity(loc, GetType(), ECE_IN_INVENTORY, RF_DEFAULT);
9949 new_item = ItemBase.Cast(o);
9950 }
9951
9952 if (new_item)
9953 {
9954 new_item.SetResultOfSplit(true);
9955 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9956 AddQuantity(-split_quantity_new, false, true);
9957 new_item.SetQuantity(split_quantity_new, false, true);
9958 }
9959 }
9960 }
9961 else
9962 {
9963 if (stack_max != 0)
9964 {
9965 if (stack_max < GetQuantity())
9966 {
9967 split_quantity_new = GetQuantity() - stack_max;
9968 }
9969
9970 if (split_quantity_new == 0)
9971 {
9972 if (!GetGame().IsMultiplayer())
9973 player.PhysicalPredictiveDropItem(this);
9974 else
9975 player.ServerDropEntity(this);
9976 return;
9977 }
9978
9979 if (ShouldSplitQuantity(split_quantity_new))
9980 {
9981 new_item = ItemBase.Cast(GetGame().CreateObjectEx(GetType(), player.GetWorldPosition(), ECE_PLACE_ON_SURFACE));
9982
9983 if (new_item)
9984 {
9985 new_item.SetResultOfSplit(true);
9986 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9987 SetQuantity(split_quantity_new, false, true);
9988 new_item.SetQuantity(stack_max, false, true);
9989 new_item.PlaceOnSurface();
9990 }
9991 }
9992 }
9993 }
9994 }
9995
9996 override void SplitIntoStackMaxEx(EntityAI destination_entity, int slot_id)
9997 {
9998 float split_quantity_new;
9999 ItemBase new_item;
10000 float quantity = GetQuantity();
10001 float stack_max = GetTargetQuantityMax(slot_id);
10002 InventoryLocation loc = new InventoryLocation;
10003
10004 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10005 {
10006 if (stack_max <= GetQuantity())
10007 split_quantity_new = stack_max;
10008 else
10009 split_quantity_new = GetQuantity();
10010
10011 if (ShouldSplitQuantity(split_quantity_new))
10012 {
10013 new_item = ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(this.GetType(), slot_id));
10014 if (new_item)
10015 {
10016 new_item.SetResultOfSplit(true);
10017 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10018 AddQuantity(-split_quantity_new, false, true);
10019 new_item.SetQuantity(split_quantity_new, false, true);
10020 }
10021 }
10022 }
10023 else if (destination_entity && slot_id == -1)
10024 {
10025 if (quantity > stack_max)
10026 split_quantity_new = stack_max;
10027 else
10028 split_quantity_new = quantity;
10029
10030 if (ShouldSplitQuantity(split_quantity_new))
10031 {
10032 if (destination_entity.GetInventory().FindFreeLocationFor(this, FindInventoryLocationType.ANY, loc))
10033 {
10034 Object o = destination_entity.GetInventory().LocationCreateEntity(loc, GetType(), ECE_IN_INVENTORY, RF_DEFAULT);
10035 new_item = ItemBase.Cast(o);
10036 }
10037
10038 if (new_item)
10039 {
10040 new_item.SetResultOfSplit(true);
10041 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10042 AddQuantity(-split_quantity_new, false, true);
10043 new_item.SetQuantity(split_quantity_new, false, true);
10044 }
10045 }
10046 }
10047 else
10048 {
10049 if (stack_max != 0)
10050 {
10051 if (stack_max < GetQuantity())
10052 {
10053 split_quantity_new = GetQuantity() - stack_max;
10054 }
10055
10056 if (ShouldSplitQuantity(split_quantity_new))
10057 {
10058 new_item = ItemBase.Cast(GetGame().CreateObjectEx(GetType(),GetWorldPosition(), ECE_PLACE_ON_SURFACE));
10059
10060 if (new_item)
10061 {
10062 new_item.SetResultOfSplit(true);
10063 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10064 SetQuantity(split_quantity_new, false, true);
10065 new_item.SetQuantity(stack_max, false, true);
10066 new_item.PlaceOnSurface();
10067 }
10068 }
10069 }
10070 }
10071 }
10072
10073 void SplitIntoStackMaxToInventoryLocationClient(notnull InventoryLocation dst)
10074 {
10075 if (GetGame().IsClient())
10076 {
10077 if (ScriptInputUserData.CanStoreInputUserData())
10078 {
10079 ScriptInputUserData ctx = new ScriptInputUserData;
10081 ctx.Write(4);
10082 ItemBase thiz = this; // @NOTE: workaround for correct serialization
10083 ctx.Write(thiz);
10084 dst.WriteToContext(ctx);
10085 ctx.Send();
10086 }
10087 }
10088 else if (!GetGame().IsMultiplayer())
10089 {
10091 }
10092 }
10093
10094 void SplitIntoStackMaxCargoClient(EntityAI destination_entity, int idx, int row, int col)
10095 {
10096 if (GetGame().IsClient())
10097 {
10098 if (ScriptInputUserData.CanStoreInputUserData())
10099 {
10100 ScriptInputUserData ctx = new ScriptInputUserData;
10102 ctx.Write(2);
10103 ItemBase dummy = this; // @NOTE: workaround for correct serialization
10104 ctx.Write(dummy);
10105 ctx.Write(destination_entity);
10106 ctx.Write(true);
10107 ctx.Write(idx);
10108 ctx.Write(row);
10109 ctx.Write(col);
10110 ctx.Send();
10111 }
10112 }
10113 else if (!GetGame().IsMultiplayer())
10114 {
10115 SplitIntoStackMaxCargo(destination_entity, idx, row, col);
10116 }
10117 }
10118
10119 void SplitIntoStackMaxToInventoryLocation(notnull InventoryLocation dst)
10120 {
10122 }
10123
10124 ItemBase SplitIntoStackMaxToInventoryLocationEx(notnull InventoryLocation dst)
10125 {
10126 float quantity = GetQuantity();
10127 float split_quantity_new;
10128 ItemBase new_item;
10129 if (dst.IsValid())
10130 {
10131 int slot_id = dst.GetSlot();
10132 float stack_max = GetTargetQuantityMax(slot_id);
10133
10134 if (quantity > stack_max)
10135 split_quantity_new = stack_max;
10136 else
10137 split_quantity_new = quantity;
10138
10139 if (ShouldSplitQuantity(split_quantity_new))
10140 {
10141 new_item = ItemBase.Cast(GameInventory.LocationCreateEntity(dst, this.GetType(), ECE_IN_INVENTORY, RF_DEFAULT));
10142
10143 if (new_item)
10144 {
10145 new_item.SetResultOfSplit(true);
10146 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10147 AddQuantity(-split_quantity_new, false, true);
10148 new_item.SetQuantity(split_quantity_new, false, true);
10149 }
10150
10151 return new_item;
10152 }
10153 }
10154
10155 return null;
10156 }
10157
10158 void SplitIntoStackMaxCargo(EntityAI destination_entity, int idx, int row, int col)
10159 {
10160 float quantity = GetQuantity();
10161 float split_quantity_new;
10162 ItemBase new_item;
10163 if (destination_entity)
10164 {
10165 float stackable = GetTargetQuantityMax();
10166 if (quantity > stackable)
10167 split_quantity_new = stackable;
10168 else
10169 split_quantity_new = quantity;
10170
10171 if (ShouldSplitQuantity(split_quantity_new))
10172 {
10173 new_item = ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(this.GetType(), idx, row, col, false));
10174 if (new_item)
10175 {
10176 new_item.SetResultOfSplit(true);
10177 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10178 AddQuantity(-split_quantity_new, false, true);
10179 new_item.SetQuantity(split_quantity_new, false, true);
10180 }
10181 }
10182 }
10183 }
10184
10185 void SplitIntoStackMaxHandsClient(PlayerBase player)
10186 {
10187 if (GetGame().IsClient())
10188 {
10189 if (ScriptInputUserData.CanStoreInputUserData())
10190 {
10191 ScriptInputUserData ctx = new ScriptInputUserData;
10193 ctx.Write(3);
10194 ItemBase i1 = this; // @NOTE: workaround for correct serialization
10195 ctx.Write(i1);
10196 ItemBase destination_entity = this;
10197 ctx.Write(destination_entity);
10198 ctx.Write(true);
10199 ctx.Write(0);
10200 ctx.Send();
10201 }
10202 }
10203 else if (!GetGame().IsMultiplayer())
10204 {
10205 SplitIntoStackMaxHands(player);
10206 }
10207 }
10208
10209 void SplitIntoStackMaxHands(PlayerBase player)
10210 {
10211 float quantity = GetQuantity();
10212 float split_quantity_new;
10213 ref ItemBase new_item;
10214 if (player)
10215 {
10216 float stackable = GetTargetQuantityMax();
10217 if (quantity > stackable)
10218 split_quantity_new = stackable;
10219 else
10220 split_quantity_new = quantity;
10221
10222 if (ShouldSplitQuantity(split_quantity_new))
10223 {
10224 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.GetType());
10225 new_item = ItemBase.Cast(in_hands);
10226 if (new_item)
10227 {
10228 new_item.SetResultOfSplit(true);
10229 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10230 AddQuantity(-split_quantity_new, false, true);
10231 new_item.SetQuantity(split_quantity_new, false, true);
10232 }
10233 }
10234 }
10235 }
10236
10237 void SplitItemToInventoryLocation(notnull InventoryLocation dst)
10238 {
10239 float quantity = GetQuantity();
10240 float split_quantity_new = Math.Floor(quantity * 0.5);
10241
10242 if (!ShouldSplitQuantity(split_quantity_new))
10243 return;
10244
10245 ItemBase new_item = ItemBase.Cast(GameInventory.LocationCreateEntity(dst, GetType(), ECE_IN_INVENTORY, RF_DEFAULT));
10246
10247 if (new_item)
10248 {
10249 if (new_item.GetQuantityMax() < split_quantity_new)
10250 {
10251 split_quantity_new = new_item.GetQuantityMax();
10252 }
10253
10254 new_item.SetResultOfSplit(true);
10255 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10256
10257 if (dst.IsValid() && dst.GetType() == InventoryLocationType.ATTACHMENT && split_quantity_new > 1)
10258 {
10259 AddQuantity(-1, false, true);
10260 new_item.SetQuantity(1, false, true);
10261 }
10262 else
10263 {
10264 AddQuantity(-split_quantity_new, false, true);
10265 new_item.SetQuantity(split_quantity_new, false, true);
10266 }
10267 }
10268 }
10269
10270 void SplitItem(PlayerBase player)
10271 {
10272 float quantity = GetQuantity();
10273 float split_quantity_new = Math.Floor(quantity / 2);
10274
10275 if (!ShouldSplitQuantity(split_quantity_new))
10276 return;
10277
10278 InventoryLocation invloc = new InventoryLocation;
10279 bool found = player.GetInventory().FindFirstFreeLocationForNewEntity(GetType(), FindInventoryLocationType.ATTACHMENT, invloc);
10280
10281 ItemBase new_item;
10282 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
10283
10284 if (new_item)
10285 {
10286 if (new_item.GetQuantityMax() < split_quantity_new)
10287 {
10288 split_quantity_new = new_item.GetQuantityMax();
10289 }
10290 if (found && invloc.IsValid() && invloc.GetType() == InventoryLocationType.ATTACHMENT && split_quantity_new > 1)
10291 {
10292 AddQuantity(-1, false, true);
10293 new_item.SetQuantity(1, false, true);
10294 }
10295 else if (split_quantity_new > 1)
10296 {
10297 AddQuantity(-split_quantity_new, false, true);
10298 new_item.SetQuantity(split_quantity_new, false, true);
10299 }
10300 }
10301 }
10302
10304 void OnQuantityChanged(float delta)
10305 {
10306 SetWeightDirty();
10307 ItemBase parent = ItemBase.Cast(GetHierarchyParent());
10308
10309 if (parent)
10310 parent.OnAttachmentQuantityChangedEx(this, delta);
10311
10312 if (IsLiquidContainer())
10313 {
10314 if (GetQuantityNormalized() <= 0.0)
10315 {
10317 }
10318 else if (GetLiquidType() == LIQUID_NONE)
10319 {
10320 ErrorEx("Undefined liquid type quantity changed, please define liquid type first! Using init value.",ErrorExSeverity.INFO);
10322 }
10323 }
10324
10325 }
10326
10329 {
10330 // insert code here
10331 }
10332
10334 void OnAttachmentQuantityChangedEx(ItemBase item , float delta)
10335 {
10337 }
10338
10339 override void EEHealthLevelChanged(int oldLevel, int newLevel, string zone)
10340 {
10341 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
10342
10343 if (GetGame().IsServer())
10344 {
10345 if (newLevel == GameConstants.STATE_RUINED)
10346 {
10348 EntityAI parent = GetHierarchyParent();
10349 if (parent && parent.IsFireplace())
10350 {
10351 CargoBase cargo = GetInventory().GetCargo();
10352 if (cargo)
10353 {
10354 for (int i = 0; i < cargo.GetItemCount(); ++i)
10355 {
10356 parent.GetInventory().TakeEntityToInventory(InventoryMode.SERVER, FindInventoryLocationType.CARGO, cargo.GetItem(i));
10357 }
10358 }
10359 }
10360 }
10361
10362 if (IsResultOfSplit())
10363 {
10364 // reset the splitting result flag, return to normal item behavior
10365 SetResultOfSplit(false);
10366 return;
10367 }
10368
10369 if (m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
10370 {
10371 SetCleanness(0);//unclean the item upon damage dealt
10372 }
10373 }
10374 }
10375
10376 // just the split? TODO: verify
10377 override void OnRightClick()
10378 {
10379 super.OnRightClick();
10380
10381 if (CanBeSplit() && !GetDayZGame().IsLeftCtrlDown() && !GetGame().GetPlayer().GetInventory().HasInventoryReservation(this,null))
10382 {
10383 if (GetGame().IsClient())
10384 {
10385 if (ScriptInputUserData.CanStoreInputUserData())
10386 {
10387 EntityAI root = GetHierarchyRoot();
10388 Man playerOwner = GetHierarchyRootPlayer();
10389 InventoryLocation dst = new InventoryLocation;
10390
10391 // 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
10392 if (!playerOwner && root && root == this)
10393 {
10395 }
10396 else
10397 {
10398 // 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
10399 GetInventory().GetCurrentInventoryLocation(dst);
10400 if (!dst.GetParent() || dst.GetParent() && !dst.GetParent().GetInventory().FindFreeLocationFor(this, FindInventoryLocationType.CARGO, dst))
10401 {
10402 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
10403 if (!player.GetInventory().FindFreeLocationFor(this, FindInventoryLocationType.CARGO, dst) || !playerOwner)
10404 {
10406 }
10407 else
10408 {
10409 dst.SetCargo(dst.GetParent(), this, dst.GetIdx(), dst.GetRow(), dst.GetCol(), dst.GetFlip());
10410 /* hacky solution to check reservation of "this" item instead of null since the gamecode is checking null against null and returning reservation=true incorrectly
10411 this shouldnt cause issues within this scope*/
10412 if (GetGame().GetPlayer().GetInventory().HasInventoryReservation(this, dst))
10413 {
10415 }
10416 else
10417 {
10418 GetGame().GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
10419 }
10420 }
10421 }
10422 }
10423
10424 ScriptInputUserData ctx = new ScriptInputUserData;
10426 ctx.Write(4);
10427 ItemBase thiz = this; // @NOTE: workaround for correct serialization
10428 ctx.Write(thiz);
10429 dst.WriteToContext(ctx);
10430 ctx.Write(true); // dummy
10431 ctx.Send();
10432 }
10433 }
10434 else if (!GetGame().IsMultiplayer())
10435 {
10436 SplitItem(PlayerBase.Cast(GetGame().GetPlayer()));
10437 }
10438 }
10439 }
10440
10441 protected void SetInventoryLocationToVicinityOrCurrent(EntityAI root, inout InventoryLocation dst)
10442 {
10443 if (root)
10444 {
10445 vector m4[4];
10446 root.GetTransform(m4);
10447 dst.SetGround(this, m4);
10448 }
10449 else
10450 {
10451 GetInventory().GetCurrentInventoryLocation(dst);
10452 }
10453 }
10454
10455 override bool CanBeCombined(EntityAI other_item, bool reservation_check = true, bool stack_max_limit = false)
10456 {
10457 //TODO: delete check zero quantity check after fix double posts hands fsm events
10458 if (!other_item || GetType() != other_item.GetType() || (IsFullQuantity() && other_item.GetQuantity() > 0) || other_item == this)
10459 return false;
10460
10461 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
10462 return false;
10463
10464 //can_this_be_combined = ConfigGetBool("canBeSplit");
10466 return false;
10467
10468
10469 Magazine mag = Magazine.Cast(this);
10470 if (mag)
10471 {
10472 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
10473 return false;
10474
10475 if (stack_max_limit)
10476 {
10477 Magazine other_mag = Magazine.Cast(other_item);
10478 if (other_item)
10479 {
10480 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
10481 return false;
10482 }
10483
10484 }
10485 }
10486 else
10487 {
10488 //TODO: delete check zero quantity check after fix double posts hands fsm events
10489 if (GetQuantity() >= GetQuantityMax() && other_item.GetQuantity() > 0 )
10490 return false;
10491
10492 if (stack_max_limit && (GetQuantity() + other_item.GetQuantity() > GetQuantityMax()))
10493 return false;
10494 }
10495
10496 PlayerBase player = null;
10497 if (CastTo(player, GetHierarchyRootPlayer())) //false when attached to player's attachment slot
10498 {
10499 if (player.GetInventory().HasAttachment(this))
10500 return false;
10501
10502 if (player.IsItemsToDelete())
10503 return false;
10504 }
10505
10506 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
10507 return false;
10508
10509 int slotID;
10510 string slotName;
10511 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
10512 return false;
10513
10514 return true;
10515 }
10516
10517 bool IsCombineAll(ItemBase other_item, bool use_stack_max = false)
10518 {
10519 return ComputeQuantityUsed(other_item, use_stack_max) == other_item.GetQuantity();
10520 }
10521
10522 bool IsResultOfSplit()
10523 {
10524 return m_IsResultOfSplit;
10525 }
10526
10527 void SetResultOfSplit(bool value)
10528 {
10529 m_IsResultOfSplit = value;
10530 }
10531
10532 int ComputeQuantityUsed(ItemBase other_item, bool use_stack_max = true)
10533 {
10534 return ComputeQuantityUsedEx(other_item, use_stack_max);
10535 }
10536
10537 float ComputeQuantityUsedEx(ItemBase other_item, bool use_stack_max = true)
10538 {
10539 float other_item_quantity = other_item.GetQuantity();
10540 float this_free_space;
10541
10542 float stack_max = GetQuantityMax();
10543
10544 this_free_space = stack_max - GetQuantity();
10545
10546 if (other_item_quantity > this_free_space)
10547 {
10548 return this_free_space;
10549 }
10550 else
10551 {
10552 return other_item_quantity;
10553 }
10554 }
10555
10556 override void CombineItemsEx(EntityAI entity2, bool use_stack_max = true)
10557 {
10558 CombineItems(ItemBase.Cast(entity2),use_stack_max);
10559 }
10560
10561 void CombineItems(ItemBase other_item, bool use_stack_max = true)
10562 {
10563 if (!CanBeCombined(other_item, false))
10564 return;
10565
10566 if (!IsMagazine() && other_item)
10567 {
10568 float quantity_used = ComputeQuantityUsedEx(other_item,use_stack_max);
10569 if (quantity_used != 0)
10570 {
10571 float hp1 = GetHealth01("","");
10572 float hp2 = other_item.GetHealth01("","");
10573 float hpResult = ((hp1*GetQuantity()) + (hp2*quantity_used));
10574 hpResult = hpResult / (GetQuantity() + quantity_used);
10575
10576 hpResult *= GetMaxHealth();
10577 Math.Round(hpResult);
10578 SetHealth("", "Health", hpResult);
10579
10580 AddQuantity(quantity_used);
10581 other_item.AddQuantity(-quantity_used);
10582 }
10583 }
10584 OnCombine(other_item);
10585 }
10586
10587 void OnCombine(ItemBase other_item)
10588 {
10589 #ifdef SERVER
10590 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
10591 GetHierarchyParent().IncreaseLifetimeUp();
10592 #endif
10593 };
10594
10595 void GetRecipesActions(Man player, out TSelectableActionInfoArray outputList)
10596 {
10597 PlayerBase p = PlayerBase.Cast(player);
10598
10599 array<int> recipesIds = p.m_Recipes;
10600 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(GetPlugin(PluginRecipesManager));
10601 if (moduleRecipesManager)
10602 {
10603 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
10604 moduleRecipesManager.GetValidRecipes(ItemBase.Cast(this), ItemBase.Cast(itemInHands), recipesIds, p);
10605 }
10606
10607 for (int i = 0;i < recipesIds.Count(); i++)
10608 {
10609 int key = recipesIds.Get(i);
10610 string recipeName = moduleRecipesManager.GetRecipeName(key);
10611 outputList.Insert(new TSelectableActionInfo(SAT_CRAFTING, key, recipeName));
10612 }
10613 }
10614
10615 // -------------------------------------------------------------------------
10616 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
10617 {
10618 super.GetDebugActions(outputList);
10619
10620 //quantity
10621 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_QUANTITY, "Quantity +20%", FadeColors.LIGHT_GREY));
10622 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_QUANTITY, "Quantity -20%", FadeColors.LIGHT_GREY));
10623 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SET_QUANTITY_0, "Set Quantity 0", FadeColors.LIGHT_GREY));
10624 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SET_MAX_QUANTITY, "Set Quantity Max", FadeColors.LIGHT_GREY));
10625 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
10626
10627 //health
10628 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_HEALTH, "Health +20%", FadeColors.LIGHT_GREY));
10629 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_HEALTH, "Health -20%", FadeColors.LIGHT_GREY));
10630 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.DESTROY_HEALTH, "Health 0", FadeColors.LIGHT_GREY));
10631 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
10632 //temperature
10633 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_TEMPERATURE, "Temperature +20", FadeColors.LIGHT_GREY));
10634 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_TEMPERATURE, "Temperature -20", FadeColors.LIGHT_GREY));
10635 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.FLIP_FROZEN, "Toggle Frozen", FadeColors.LIGHT_GREY));
10636 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
10637
10638 //wet
10639 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_WETNESS, "Wetness +20", FadeColors.LIGHT_GREY));
10640 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_WETNESS, "Wetness -20", FadeColors.LIGHT_GREY));
10641 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
10642
10643 //liquidtype
10644 if (IsLiquidContainer())
10645 {
10646 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.LIQUIDTYPE_UP, "LiquidType Next", FadeColors.LIGHT_GREY));
10647 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.LIQUIDTYPE_DOWN, "LiquidType Previous", FadeColors.LIGHT_GREY));
10648 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
10649 }
10650
10651 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.MAKE_SPECIAL, "Make Special", FadeColors.LIGHT_GREY));
10652 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
10653
10654 // watch
10655 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.WATCH_ITEM, "Watch (CTRL-Z)", FadeColors.LIGHT_GREY));
10656 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.WATCH_PLAYER, "Watch Player", FadeColors.LIGHT_GREY));
10657 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
10658
10659 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.DELETE, "Delete", FadeColors.RED));
10660
10661 InventoryLocation loc = new InventoryLocation();
10662 GetInventory().GetCurrentInventoryLocation(loc);
10663 if (!loc || loc.GetType() == InventoryLocationType.GROUND)
10664 {
10665 if (Gizmo_IsSupported())
10666 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.GIZMO_OBJECT, "Gizmo Object", FadeColors.LIGHT_GREY));
10667 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.GIZMO_PHYSICS, "Gizmo Physics (SP Only)", FadeColors.LIGHT_GREY)); // intentionally allowed for testing physics desync
10668 }
10669
10670 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
10671 }
10672
10673 // -------------------------------------------------------------------------
10674 // -------------------------------------------------------------------------
10675 // -------------------------------------------------------------------------
10676 override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
10677 {
10678 super.OnAction(action_id, player, ctx);
10679
10680 if (GetGame().IsClient() || !GetGame().IsMultiplayer())
10681 {
10682 switch (action_id)
10683 {
10684 case EActions.GIZMO_OBJECT:
10685 GetGame().GizmoSelectObject(this);
10686 return true;
10687 case EActions.GIZMO_PHYSICS:
10688 GetGame().GizmoSelectPhysics(GetPhysics());
10689 return true;
10690 }
10691 }
10692
10693 if (GetGame().IsServer())
10694 {
10695 switch (action_id)
10696 {
10697 case EActions.DELETE:
10698 Delete();
10699 return true;
10700 }
10701 }
10702
10703 if (action_id >= EActions.RECIPES_RANGE_START && action_id < EActions.RECIPES_RANGE_END)
10704 {
10705 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(GetPlugin(PluginRecipesManager));
10706 int idWithoutOffset = action_id - EActions.RECIPES_RANGE_START;
10707 PlayerBase p = PlayerBase.Cast(player);
10708 if (EActions.RECIPES_RANGE_START < 1000)
10709 {
10710 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
10711 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
10712 }
10713 }
10714 #ifndef SERVER
10715 else if (action_id == EActions.WATCH_PLAYER)
10716 {
10717 PluginDeveloper.SetDeveloperItemClientEx(player);
10718 }
10719 #endif
10720 if (GetGame().IsServer())
10721 {
10722 if (action_id >= EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id < EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
10723 {
10724 int id = action_id - EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
10725 OnDebugButtonPressServer(id + 1);
10726 }
10727
10728 else if (action_id >= EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id < EActions.DEBUG_AGENTS_RANGE_INJECT_END)
10729 {
10730 int agent_id = action_id - EActions.DEBUG_AGENTS_RANGE_INJECT_START;
10731 InsertAgent(agent_id,100);
10732 }
10733
10734 else if (action_id >= EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id < EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
10735 {
10736 int agent_id2 = action_id - EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
10737 RemoveAgent(agent_id2);
10738 }
10739
10740 else if (action_id == EActions.ADD_QUANTITY)
10741 {
10742 if (IsMagazine())
10743 {
10744 Magazine mag = Magazine.Cast(this);
10745 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
10746 }
10747 else
10748 {
10749 AddQuantity(GetQuantityMax() * 0.2);
10750 }
10751
10752 if (m_EM)
10753 {
10754 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
10755 }
10756 //PrintVariables();
10757 }
10758
10759 else if (action_id == EActions.REMOVE_QUANTITY) //Quantity -20%
10760 {
10761 if (IsMagazine())
10762 {
10763 Magazine mag2 = Magazine.Cast(this);
10764 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
10765 }
10766 else
10767 {
10768 AddQuantity(- GetQuantityMax() * 0.2);
10769 }
10770 if (m_EM)
10771 {
10772 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
10773 }
10774 //PrintVariables();
10775 }
10776
10777 else if (action_id == EActions.SET_QUANTITY_0) //SetMaxQuantity
10778 {
10779 SetQuantity(0);
10780
10781 if (m_EM)
10782 {
10783 m_EM.SetEnergy(0);
10784 }
10785 }
10786
10787 else if (action_id == EActions.SET_MAX_QUANTITY) //SetMaxQuantity
10788 {
10790
10791 if (m_EM)
10792 {
10793 m_EM.SetEnergy(m_EM.GetEnergyMax());
10794 }
10795 }
10796
10797 else if (action_id == EActions.ADD_HEALTH)
10798 {
10799 AddHealth("","",GetMaxHealth("","Health")/5);
10800 }
10801 else if (action_id == EActions.REMOVE_HEALTH)
10802 {
10803 AddHealth("","",-GetMaxHealth("","Health")/5);
10804 }
10805 else if (action_id == EActions.DESTROY_HEALTH)
10806 {
10807 SetHealth01("","",0);
10808 }
10809 else if (action_id == EActions.WATCH_ITEM)
10810 {
10812 mid.RegisterDebugItem(ItemBase.Cast(this), PlayerBase.Cast(player));
10813 #ifdef DEVELOPER
10814 SetDebugDeveloper_item(this);
10815 #endif
10816 }
10817
10818 else if (action_id == EActions.ADD_TEMPERATURE)
10819 {
10820 AddTemperature(20);
10821 //PrintVariables();
10822 }
10823
10824 else if (action_id == EActions.REMOVE_TEMPERATURE)
10825 {
10826 AddTemperature(-20);
10827 //PrintVariables();
10828 }
10829
10830 else if (action_id == EActions.FLIP_FROZEN)
10831 {
10832 SetFrozen(!GetIsFrozen());
10833 //PrintVariables();
10834 }
10835
10836 else if (action_id == EActions.ADD_WETNESS)
10837 {
10838 AddWet(GetWetMax()/5);
10839 //PrintVariables();
10840 }
10841
10842 else if (action_id == EActions.REMOVE_WETNESS)
10843 {
10844 AddWet(-GetWetMax()/5);
10845 //PrintVariables();
10846 }
10847
10848 else if (action_id == EActions.LIQUIDTYPE_UP)
10849 {
10850 int curr_type = GetLiquidType();
10851 SetLiquidType(curr_type * 2);
10852 //AddWet(1);
10853 //PrintVariables();
10854 }
10855
10856 else if (action_id == EActions.LIQUIDTYPE_DOWN)
10857 {
10858 int curr_type2 = GetLiquidType();
10859 SetLiquidType(curr_type2 / 2);
10860 }
10861
10862 else if (action_id == EActions.MAKE_SPECIAL)
10863 {
10864 auto debugParams = DebugSpawnParams.WithPlayer(player);
10865 OnDebugSpawnEx(debugParams);
10866 }
10867
10868 }
10869
10870
10871 return false;
10872 }
10873
10874 // -------------------------------------------------------------------------
10875
10876
10879 void OnActivatedByTripWire();
10880
10882 void OnActivatedByItem(notnull ItemBase item);
10883
10884 //----------------------------------------------------------------
10885 //returns true if item is able to explode when put in fire
10886 bool CanExplodeInFire()
10887 {
10888 return false;
10889 }
10890
10891 //----------------------------------------------------------------
10892 bool CanEat()
10893 {
10894 return true;
10895 }
10896
10897 //----------------------------------------------------------------
10898 override bool IsIgnoredByConstruction()
10899 {
10900 return true;
10901 }
10902
10903 //----------------------------------------------------------------
10904 //has FoodStages in config?
10905 bool HasFoodStage()
10906 {
10907 string config_path = string.Format("CfgVehicles %1 Food FoodStages", GetType());
10908 return GetGame().ConfigIsExisting(config_path);
10909 }
10910
10912 FoodStage GetFoodStage()
10913 {
10914 return null;
10915 }
10916
10917 bool CanBeCooked()
10918 {
10919 return false;
10920 }
10921
10922 bool CanBeCookedOnStick()
10923 {
10924 return false;
10925 }
10926
10928 void RefreshAudioVisualsOnClient( CookingMethodType cooking_method, bool is_done, bool is_empty, bool is_burned );
10930
10931 //----------------------------------------------------------------
10932 bool CanRepair(ItemBase item_repair_kit)
10933 {
10934 PluginRepairing module_repairing = PluginRepairing.Cast(GetPlugin(PluginRepairing));
10935 return module_repairing.CanRepair(this, item_repair_kit);
10936 }
10937
10938 //----------------------------------------------------------------
10939 bool Repair(PlayerBase player, ItemBase item_repair_kit, float specialty_weight)
10940 {
10941 PluginRepairing module_repairing = PluginRepairing.Cast(GetPlugin(PluginRepairing));
10942 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
10943 }
10944
10945 //----------------------------------------------------------------
10946 int GetItemSize()
10947 {
10948 /*
10949 vector v_size = this.ConfigGetVector("itemSize");
10950 int v_size_x = v_size[0];
10951 int v_size_y = v_size[1];
10952 int size = v_size_x * v_size_y;
10953 return size;
10954 */
10955
10956 return 1;
10957 }
10958
10959 //----------------------------------------------------------------
10960 //Override for allowing seemingly unallowed moves when two clients send a conflicting message simultaneously
10961 bool CanBeMovedOverride()
10962 {
10963 return m_CanBeMovedOverride;
10964 }
10965
10966 //----------------------------------------------------------------
10967 //Override for allowing seemingly unallowed moves when two clients send a conflicting message simultaneously
10968 void SetCanBeMovedOverride(bool setting)
10969 {
10970 m_CanBeMovedOverride = setting;
10971 }
10972
10973 //----------------------------------------------------------------
10981 void MessageToOwnerStatus(string text)
10982 {
10983 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10984
10985 if (player)
10986 {
10987 player.MessageStatus(text);
10988 }
10989 }
10990
10991 //----------------------------------------------------------------
10999 void MessageToOwnerAction(string text)
11000 {
11001 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11002
11003 if (player)
11004 {
11005 player.MessageAction(text);
11006 }
11007 }
11008
11009 //----------------------------------------------------------------
11017 void MessageToOwnerFriendly(string text)
11018 {
11019 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11020
11021 if (player)
11022 {
11023 player.MessageFriendly(text);
11024 }
11025 }
11026
11027 //----------------------------------------------------------------
11035 void MessageToOwnerImportant(string text)
11036 {
11037 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11038
11039 if (player)
11040 {
11041 player.MessageImportant(text);
11042 }
11043 }
11044
11045 override bool IsItemBase()
11046 {
11047 return true;
11048 }
11049
11050 // Checks if item is of questioned kind
11051 override bool KindOf(string tag)
11052 {
11053 bool found = false;
11054 string item_name = this.GetType();
11055 ref TStringArray item_tag_array = new TStringArray;
11056 GetGame().ConfigGetTextArray("cfgVehicles " + item_name + " itemInfo", item_tag_array);
11057
11058 int array_size = item_tag_array.Count();
11059 for (int i = 0; i < array_size; i++)
11060 {
11061 if (item_tag_array.Get(i) == tag)
11062 {
11063 found = true;
11064 break;
11065 }
11066 }
11067 return found;
11068 }
11069
11070
11071 override void OnRPC(PlayerIdentity sender, int rpc_type,ParamsReadContext ctx)
11072 {
11073 //Debug.Log("OnRPC called");
11074 super.OnRPC(sender, rpc_type,ctx);
11075
11076 //Play soundset for attachment locking (ActionLockAttachment.c)
11077 switch (rpc_type)
11078 {
11079 #ifndef SERVER
11080 case ERPCs.RPC_SOUND_LOCK_ATTACH:
11081 Param2<bool, string> p = new Param2<bool, string>(false, "");
11082
11083 if (!ctx.Read(p))
11084 return;
11085
11086 bool play = p.param1;
11087 string soundSet = p.param2;
11088
11089 if (play)
11090 {
11091 if (m_LockingSound)
11092 {
11094 {
11095 m_LockingSound = SEffectManager.PlaySound(soundSet, GetPosition(), 0, 0, true);
11096 }
11097 }
11098 else
11099 {
11100 m_LockingSound = SEffectManager.PlaySound(soundSet, GetPosition(), 0, 0, true);
11101 }
11102 }
11103 else
11104 {
11105 SEffectManager.DestroyEffect(m_LockingSound);
11106 }
11107
11108 break;
11109 #endif
11110
11111 }
11112
11113 if (GetWrittenNoteData())
11114 {
11115 GetWrittenNoteData().OnRPC(sender, rpc_type,ctx);
11116 }
11117 }
11118
11119 //-----------------------------
11120 // VARIABLE MANIPULATION SYSTEM
11121 //-----------------------------
11122 int NameToID(string name)
11123 {
11124 PluginVariables plugin = PluginVariables.Cast(GetPlugin(PluginVariables));
11125 return plugin.GetID(name);
11126 }
11127
11128 string IDToName(int id)
11129 {
11130 PluginVariables plugin = PluginVariables.Cast(GetPlugin(PluginVariables));
11131 return plugin.GetName(id);
11132 }
11133
11135 void OnSyncVariables(ParamsReadContext ctx)//with ID optimization
11136 {
11137 //Debug.Log("OnSyncVariables called for item: "+ ToString(this.GetType()),"varSync");
11138 //read the flags
11139 int varFlags;
11140 if (!ctx.Read(varFlags))
11141 return;
11142
11143 if (varFlags & ItemVariableFlags.FLOAT)
11144 {
11145 ReadVarsFromCTX(ctx);
11146 }
11147 }
11148
11149 override void SerializeNumericalVars(array<float> floats_out)
11150 {
11151 //some variables handled on EntityAI level already!
11152 super.SerializeNumericalVars(floats_out);
11153
11154 // the order of serialization must be the same as the order of de-serialization
11155 //--------------------------------------------
11156 if (IsVariableSet(VARIABLE_QUANTITY))
11157 {
11158 floats_out.Insert(m_VarQuantity);
11159 }
11160 //--------------------------------------------
11161 if (IsVariableSet(VARIABLE_WET))
11162 {
11163 floats_out.Insert(m_VarWet);
11164 }
11165 //--------------------------------------------
11166 if (IsVariableSet(VARIABLE_LIQUIDTYPE))
11167 {
11168 floats_out.Insert(m_VarLiquidType);
11169 }
11170 //--------------------------------------------
11171 if (IsVariableSet(VARIABLE_COLOR))
11172 {
11173 floats_out.Insert(m_ColorComponentR);
11174 floats_out.Insert(m_ColorComponentG);
11175 floats_out.Insert(m_ColorComponentB);
11176 floats_out.Insert(m_ColorComponentA);
11177 }
11178 //--------------------------------------------
11179 if (IsVariableSet(VARIABLE_CLEANNESS))
11180 {
11181 floats_out.Insert(m_Cleanness);
11182 }
11183 }
11184
11185 override void DeSerializeNumericalVars(array<float> floats)
11186 {
11187 //some variables handled on EntityAI level already!
11188 super.DeSerializeNumericalVars(floats);
11189
11190 // the order of serialization must be the same as the order of de-serialization
11191 int index = 0;
11192 int mask = Math.Round(floats.Get(index));
11193
11194 index++;
11195 //--------------------------------------------
11196 if (mask & VARIABLE_QUANTITY)
11197 {
11198 if (m_IsStoreLoad)
11199 {
11200 SetStoreLoadedQuantity(floats.Get(index));
11201 }
11202 else
11203 {
11204 float quantity = floats.Get(index);
11205 SetQuantity(quantity, true, false, false, false);
11206 }
11207 index++;
11208 }
11209 //--------------------------------------------
11210 if (mask & VARIABLE_WET)
11211 {
11212 float wet = floats.Get(index);
11213 SetWet(wet);
11214 index++;
11215 }
11216 //--------------------------------------------
11217 if (mask & VARIABLE_LIQUIDTYPE)
11218 {
11219 int liquidtype = Math.Round(floats.Get(index));
11220 SetLiquidType(liquidtype);
11221 index++;
11222 }
11223 //--------------------------------------------
11224 if (mask & VARIABLE_COLOR)
11225 {
11226 m_ColorComponentR = Math.Round(floats.Get(index));
11227 index++;
11228 m_ColorComponentG = Math.Round(floats.Get(index));
11229 index++;
11230 m_ColorComponentB = Math.Round(floats.Get(index));
11231 index++;
11232 m_ColorComponentA = Math.Round(floats.Get(index));
11233 index++;
11234 }
11235 //--------------------------------------------
11236 if (mask & VARIABLE_CLEANNESS)
11237 {
11238 int cleanness = Math.Round(floats.Get(index));
11239 SetCleanness(cleanness);
11240 index++;
11241 }
11242 }
11243
11244 override void WriteVarsToCTX(ParamsWriteContext ctx)
11245 {
11246 super.WriteVarsToCTX(ctx);
11247
11248 //--------------------------------------------
11249 if (IsVariableSet(VARIABLE_QUANTITY))
11250 {
11251 ctx.Write(GetQuantity());
11252 }
11253 //--------------------------------------------
11254 if (IsVariableSet(VARIABLE_WET))
11255 {
11256 ctx.Write(GetWet());
11257 }
11258 //--------------------------------------------
11259 if (IsVariableSet(VARIABLE_LIQUIDTYPE))
11260 {
11261 ctx.Write(GetLiquidType());
11262 }
11263 //--------------------------------------------
11264 if (IsVariableSet(VARIABLE_COLOR))
11265 {
11266 int r,g,b,a;
11267 GetColor(r,g,b,a);
11268 ctx.Write(r);
11269 ctx.Write(g);
11270 ctx.Write(b);
11271 ctx.Write(a);
11272 }
11273 //--------------------------------------------
11274 if (IsVariableSet(VARIABLE_CLEANNESS))
11275 {
11276 ctx.Write(GetCleanness());
11277 }
11278 }
11279
11280 override bool ReadVarsFromCTX(ParamsReadContext ctx, int version = -1)//with ID optimization
11281 {
11282 if (!super.ReadVarsFromCTX(ctx,version))
11283 return false;
11284
11285 int intValue;
11286 float value;
11287
11288 if (version < 140)
11289 {
11290 if (!ctx.Read(intValue))
11291 return false;
11292
11293 m_VariablesMask = intValue;
11294 }
11295
11296 if (m_VariablesMask & VARIABLE_QUANTITY)
11297 {
11298 if (!ctx.Read(value))
11299 return false;
11300
11301 if (IsStoreLoad())
11302 {
11304 }
11305 else
11306 {
11307 SetQuantity(value, true, false, false, false);
11308 }
11309 }
11310 //--------------------------------------------
11311 if (version < 140)
11312 {
11313 if (m_VariablesMask & VARIABLE_TEMPERATURE)
11314 {
11315 if (!ctx.Read(value))
11316 return false;
11317 SetTemperatureDirect(value);
11318 }
11319 }
11320 //--------------------------------------------
11321 if (m_VariablesMask & VARIABLE_WET)
11322 {
11323 if (!ctx.Read(value))
11324 return false;
11325 SetWet(value);
11326 }
11327 //--------------------------------------------
11328 if (m_VariablesMask & VARIABLE_LIQUIDTYPE)
11329 {
11330 if (!ctx.Read(intValue))
11331 return false;
11332 SetLiquidType(intValue);
11333 }
11334 //--------------------------------------------
11335 if (m_VariablesMask & VARIABLE_COLOR)
11336 {
11337 int r,g,b,a;
11338 if (!ctx.Read(r))
11339 return false;
11340 if (!ctx.Read(g))
11341 return false;
11342 if (!ctx.Read(b))
11343 return false;
11344 if (!ctx.Read(a))
11345 return false;
11346
11347 SetColor(r,g,b,a);
11348 }
11349 //--------------------------------------------
11350 if (m_VariablesMask & VARIABLE_CLEANNESS)
11351 {
11352 if (!ctx.Read(intValue))
11353 return false;
11354 SetCleanness(intValue);
11355 }
11356 //--------------------------------------------
11357 if (version >= 138 && version < 140)
11358 {
11359 if (m_VariablesMask & VARIABLE_TEMPERATURE)
11360 {
11361 if (!ctx.Read(intValue))
11362 return false;
11363 SetFrozen(intValue);
11364 }
11365 }
11366
11367 return true;
11368 }
11369
11370 //----------------------------------------------------------------
11371 override bool OnStoreLoad(ParamsReadContext ctx, int version)
11372 {
11373 m_IsStoreLoad = true;
11375 {
11376 m_FixDamageSystemInit = true;
11377 }
11378
11379 if (!super.OnStoreLoad(ctx, version))
11380 {
11381 m_IsStoreLoad = false;
11382 return false;
11383 }
11384
11385 if (version >= 114)
11386 {
11387 bool hasQuickBarIndexSaved;
11388
11389 if (!ctx.Read(hasQuickBarIndexSaved))
11390 {
11391 m_IsStoreLoad = false;
11392 return false;
11393 }
11394
11395 if (hasQuickBarIndexSaved)
11396 {
11397 int itmQBIndex;
11398
11399 //Load quickbar item bind
11400 if (!ctx.Read(itmQBIndex))
11401 {
11402 m_IsStoreLoad = false;
11403 return false;
11404 }
11405
11406 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
11407 if (itmQBIndex != -1 && parentPlayer)
11408 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
11409 }
11410 }
11411 else
11412 {
11413 // Backup of how it used to be
11414 PlayerBase player;
11415 int itemQBIndex;
11416 if (version == int.MAX)
11417 {
11418 if (!ctx.Read(itemQBIndex))
11419 {
11420 m_IsStoreLoad = false;
11421 return false;
11422 }
11423 }
11424 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
11425 {
11426 //Load quickbar item bind
11427 if (!ctx.Read(itemQBIndex))
11428 {
11429 m_IsStoreLoad = false;
11430 return false;
11431 }
11432 if (itemQBIndex != -1 && player)
11433 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
11434 }
11435 }
11436
11437 if (version < 140)
11438 {
11439 // variable management system
11440 if (!LoadVariables(ctx, version))
11441 {
11442 m_IsStoreLoad = false;
11443 return false;
11444 }
11445 }
11446
11447 //agent trasmission system
11448 if (!LoadAgents(ctx, version))
11449 {
11450 m_IsStoreLoad = false;
11451 return false;
11452 }
11453 if (version >= 132)
11454 {
11455 RemotelyActivatedItemBehaviour raib = GetRemotelyActivatedItemBehaviour();
11456 if (raib)
11457 {
11458 if (!raib.OnStoreLoad(ctx,version))
11459 {
11460 m_IsStoreLoad = false;
11461 return false;
11462 }
11463 }
11464 }
11465
11466 m_IsStoreLoad = false;
11467 return true;
11468 }
11469
11470 //----------------------------------------------------------------
11471
11472 override void OnStoreSave(ParamsWriteContext ctx)
11473 {
11474 super.OnStoreSave(ctx);
11475
11476 PlayerBase player;
11477 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
11478 {
11479 ctx.Write(true); // Keep track of if we should actually read this in or not
11480 //Save quickbar item bind
11481 int itemQBIndex = -1;
11482 itemQBIndex = player.FindQuickBarEntityIndex(this);
11483 ctx.Write(itemQBIndex);
11484 }
11485 else
11486 {
11487 ctx.Write(false); // Keep track of if we should actually read this in or not
11488 }
11489
11490 SaveAgents(ctx);//agent trasmission system
11491
11492 RemotelyActivatedItemBehaviour raib = GetRemotelyActivatedItemBehaviour();
11493 if (raib)
11494 {
11495 raib.OnStoreSave(ctx);
11496 }
11497 }
11498 //----------------------------------------------------------------
11499
11500 override void AfterStoreLoad()
11501 {
11502 super.AfterStoreLoad();
11503
11505 {
11507 }
11508
11509 if (GetStoreLoadedQuantity() != float.LOWEST)
11510 {
11512 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
11513 }
11514 }
11515
11516 override void EEOnAfterLoad()
11517 {
11518 super.EEOnAfterLoad();
11519
11521 {
11522 m_FixDamageSystemInit = false;
11523 }
11524
11527 }
11528
11529 bool CanBeDisinfected()
11530 {
11531 return false;
11532 }
11533
11534
11535 //----------------------------------------------------------------
11536 override void OnVariablesSynchronized()
11537 {
11538 if (m_Initialized)
11539 {
11540 #ifdef PLATFORM_CONSOLE
11541 //bruteforce it is
11542 if (IsSplitable())
11543 {
11544 UIScriptedMenu menu = GetGame().GetUIManager().FindMenu(MENU_INVENTORY);
11545 if (menu)
11546 {
11547 menu.Refresh();
11548 }
11549 }
11550 #endif
11551 }
11552
11554 {
11555 PlayImpactSound(m_ConfigWeight, m_ImpactSpeed, m_ImpactSoundSurfaceHash);
11556 m_WantPlayImpactSound = false;
11557 }
11558
11560 {
11561 SetWeightDirty();
11563 }
11564 if (m_VarWet != m_VarWetPrev)
11565 {
11568 }
11569
11570 if (m_SoundSyncPlay != 0)
11571 {
11572 m_ItemSoundHandler.PlayItemSoundClient(m_SoundSyncPlay);
11573 m_SoundSyncPlay = 0;
11574 }
11575 if (m_SoundSyncStop != 0)
11576 {
11577 m_ItemSoundHandler.StopItemSoundClient(m_SoundSyncStop);
11578 m_SoundSyncStop = 0;
11579 }
11580
11581 super.OnVariablesSynchronized();
11582 }
11583
11584 //------------------------- Quantity
11585 //----------------------------------------------------------------
11587 override bool SetQuantity(float value, bool destroy_config = true, bool destroy_forced = false, bool allow_client = false, bool clamp_to_stack_max = true)
11588 {
11589 if (!IsServerCheck(allow_client))
11590 return false;
11591
11592 if (!HasQuantity())
11593 return false;
11594
11595 float min = GetQuantityMin();
11596 float max = GetQuantityMax();
11597
11598 if (value <= (min + 0.001))
11599 value = min;
11600
11601 if (value == min)
11602 {
11603 if (destroy_config)
11604 {
11605 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
11606 if (dstr)
11607 {
11608 m_VarQuantity = Math.Clamp(value, min, max);
11609 this.Delete();
11610 return true;
11611 }
11612 }
11613 else if (destroy_forced)
11614 {
11615 m_VarQuantity = Math.Clamp(value, min, max);
11616 this.Delete();
11617 return true;
11618 }
11619 // we get here if destroy_config IS true AND dstr(config destroy param) IS false;
11620 RemoveAllAgents();//we remove all agents when we got to the min value, but the item is not getting deleted
11621 }
11622
11623 float delta = m_VarQuantity;
11624 m_VarQuantity = Math.Clamp(value, min, max);
11625
11626 if (GetStoreLoadedQuantity() == float.LOWEST)//any other value means we are setting quantity from storage
11627 {
11628 delta = m_VarQuantity - delta;
11629
11630 if (delta)
11631 OnQuantityChanged(delta);
11632 }
11633
11634 SetVariableMask(VARIABLE_QUANTITY);
11635
11636 return false;
11637 }
11638
11639 //----------------------------------------------------------------
11641 bool AddQuantity(float value, bool destroy_config = true, bool destroy_forced = false)
11642 {
11643 return SetQuantity(GetQuantity() + value, destroy_config, destroy_forced);
11644 }
11645 //----------------------------------------------------------------
11646 void SetQuantityMax()
11647 {
11648 float max = GetQuantityMax();
11649 SetQuantity(max);
11650 }
11651
11652 override void SetQuantityToMinimum()
11653 {
11654 float min = GetQuantityMin();
11655 SetQuantity(min);
11656 }
11657 //----------------------------------------------------------------
11659 override void SetQuantityNormalized(float value, bool destroy_config = true, bool destroy_forced = false)
11660 {
11661 float value_clamped = Math.Clamp(value, 0, 1);//just to make sure
11662 int result = Math.Round(Math.Lerp(GetQuantityMin(), GetQuantityMax(), value_clamped));
11663 SetQuantity(result, destroy_config, destroy_forced);
11664 }
11665
11666 //----------------------------------------------------------------
11668 override float GetQuantityNormalized()
11669 {
11670 return Math.InverseLerp(GetQuantityMin(), GetQuantityMax(),m_VarQuantity);
11671 }
11672
11674 {
11675 return GetQuantityNormalized();
11676 }
11677
11678 /*void SetAmmoNormalized(float value)
11679 {
11680 float value_clamped = Math.Clamp(value, 0, 1);
11681 Magazine this_mag = Magazine.Cast(this);
11682 int max_rounds = this_mag.GetAmmoMax();
11683 int result = value * max_rounds;//can the rounded if higher precision is required
11684 this_mag.SetAmmoCount(result);
11685 }*/
11686 //----------------------------------------------------------------
11687 override int GetQuantityMax()
11688 {
11689 int slot = -1;
11690 if (GetInventory())
11691 {
11692 InventoryLocation il = new InventoryLocation;
11693 GetInventory().GetCurrentInventoryLocation(il);
11694 slot = il.GetSlot();
11695 }
11696
11697 return GetTargetQuantityMax(slot);
11698 }
11699
11700 override int GetTargetQuantityMax(int attSlotID = -1)
11701 {
11702 float quantity_max = 0;
11703
11704 if (IsSplitable()) //only stackable/splitable items can check for stack size
11705 {
11706 if (attSlotID != -1)
11707 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
11708
11709 if (quantity_max <= 0)
11710 quantity_max = m_VarStackMax;
11711 }
11712
11713 if (quantity_max <= 0)
11714 quantity_max = m_VarQuantityMax;
11715
11716 return quantity_max;
11717 }
11718 //----------------------------------------------------------------
11719 override int GetQuantityMin()
11720 {
11721 return m_VarQuantityMin;
11722 }
11723 //----------------------------------------------------------------
11724 int GetQuantityInit()
11725 {
11726 return m_VarQuantityInit;
11727 }
11728
11729 //----------------------------------------------------------------
11730 override bool HasQuantity()
11731 {
11732 return !(GetQuantityMax() - GetQuantityMin() == 0);
11733 }
11734
11735 override float GetQuantity()
11736 {
11737 return m_VarQuantity;
11738 }
11739
11740 bool IsFullQuantity()
11741 {
11742 return GetQuantity() >= GetQuantityMax();
11743 }
11744
11745 //Calculates weight of single item without attachments and cargo
11746 override float GetSingleInventoryItemWeightEx()
11747 {
11748 //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
11749 float weightEx = GetWeightEx();//overall weight of the item
11750 float special = GetInventoryAndCargoWeight();//cargo and attachment weight
11751 return weightEx - special;
11752 }
11753
11754 // Obsolete, use GetSingleInventoryItemWeightEx() instead
11756 {
11758 }
11759
11760 override protected float GetWeightSpecialized(bool forceRecalc = false)
11761 {
11762 if (IsSplitable()) //quantity determines size of the stack
11763 {
11764 #ifdef DEVELOPER
11765 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11766 {
11767 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
11768 data1.SetCalcDetails("TIB1: " + GetConfigWeightModifiedDebugText() +" * " + GetQuantity()+"(quantity)");
11769 }
11770 #endif
11771
11772 return GetQuantity() * GetConfigWeightModified();
11773 }
11774 else if (HasEnergyManager())// items with energy manager
11775 {
11776 #ifdef DEVELOPER
11777 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11778 {
11779 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
11780 data2.SetCalcDetails("TIB2: "+super.GetWeightSpecialized(forceRecalc)+"(contents weight) + " + GetConfigWeightModifiedDebugText() +" + " + GetCompEM().GetEnergy()+"(energy) * " + ConfigGetFloat("weightPerQuantityUnit") +"(weightPerQuantityUnit)");
11781 }
11782 #endif
11783 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
11784 }
11785 else//everything else
11786 {
11787 #ifdef DEVELOPER
11788 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11789 {
11790 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
11791 data3.SetCalcDetails("TIB3: "+super.GetWeightSpecialized(forceRecalc)+"(contents weight) + " + GetConfigWeightModifiedDebugText() +" + " + GetQuantity()+"(quantity) * " + ConfigGetFloat("weightPerQuantityUnit") +"(weightPerQuantityUnit))");
11792 }
11793 #endif
11794 return super.GetWeightSpecialized(forceRecalc) + (GetQuantity() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
11795 }
11796 }
11797
11799 int GetNumberOfItems()
11800 {
11801 int item_count = 0;
11802 ItemBase item;
11803
11804 if (GetInventory().GetCargo() != NULL)
11805 {
11806 item_count = GetInventory().GetCargo().GetItemCount();
11807 }
11808
11809 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
11810 {
11811 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
11812 if (item)
11813 item_count += item.GetNumberOfItems();
11814 }
11815 return item_count;
11816 }
11817
11819 float GetUnitWeight(bool include_wetness = true)
11820 {
11821 float weight = 0;
11822 float wetness = 1;
11823 if (include_wetness)
11824 wetness += GetWet();
11825 if (IsSplitable()) //quantity determines size of the stack
11826 {
11827 weight = wetness * m_ConfigWeight;
11828 }
11829 else if (IsLiquidContainer()) //is a liquid container, default liquid weight is set to 1. May revisit later?
11830 {
11831 weight = 1;
11832 }
11833 return weight;
11834 }
11835
11836 //-----------------------------------------------------------------
11837
11838 override void ClearInventory()
11839 {
11840 if ((GetGame().IsServer() || !GetGame().IsMultiplayer()) && GetInventory())
11841 {
11842 GameInventory inv = GetInventory();
11843 array<EntityAI> items = new array<EntityAI>;
11844 inv.EnumerateInventory(InventoryTraversalType.INORDER, items);
11845 for (int i = 0; i < items.Count(); i++)
11846 {
11847 ItemBase item = ItemBase.Cast(items.Get(i));
11848 if (item)
11849 {
11850 GetGame().ObjectDelete(item);
11851 }
11852 }
11853 }
11854 }
11855
11856 //------------------------- Energy
11857
11858 //----------------------------------------------------------------
11859 float GetEnergy()
11860 {
11861 float energy = 0;
11862 if (HasEnergyManager())
11863 {
11864 energy = GetCompEM().GetEnergy();
11865 }
11866 return energy;
11867 }
11868
11869
11870 override void OnEnergyConsumed()
11871 {
11872 super.OnEnergyConsumed();
11873
11875 }
11876
11877 override void OnEnergyAdded()
11878 {
11879 super.OnEnergyAdded();
11880
11882 }
11883
11884 // Converts energy (from Energy Manager) to quantity, if enabled.
11886 {
11887 if (GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
11888 {
11889 if (HasQuantity())
11890 {
11891 float energy_0to1 = GetCompEM().GetEnergy0To1();
11892 SetQuantityNormalized(energy_0to1);
11893 }
11894 }
11895 }
11896
11897 //----------------------------------------------------------------
11898 float GetHeatIsolationInit()
11899 {
11900 return ConfigGetFloat("heatIsolation");
11901 }
11902
11903 float GetHeatIsolation()
11904 {
11905 return m_HeatIsolation;
11906 }
11907
11908 float GetDryingIncrement(string pIncrementName)
11909 {
11910 string paramPath = string.Format("CfgVehicles %1 EnvironmentWetnessIncrements Drying %2", GetType(), pIncrementName);
11911 if (GetGame().ConfigIsExisting(paramPath))
11912 return GetGame().ConfigGetFloat(paramPath);
11913
11914 return 0.0;
11915 }
11916
11917 float GetSoakingIncrement(string pIncrementName)
11918 {
11919 string paramPath = string.Format("CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2", GetType(), pIncrementName);
11920 if (GetGame().ConfigIsExisting(paramPath))
11921 return GetGame().ConfigGetFloat(paramPath);
11922
11923 return 0.0;
11924 }
11925 //----------------------------------------------------------------
11926 override void SetWet(float value, bool allow_client = false)
11927 {
11928 if (!IsServerCheck(allow_client))
11929 return;
11930
11931 float min = GetWetMin();
11932 float max = GetWetMax();
11933
11934 float previousValue = m_VarWet;
11935
11936 m_VarWet = Math.Clamp(value, min, max);
11937
11938 if (previousValue != m_VarWet)
11939 {
11940 SetVariableMask(VARIABLE_WET);
11941 OnWetChanged(m_VarWet, previousValue);
11942 }
11943 }
11944 //----------------------------------------------------------------
11945 override void AddWet(float value)
11946 {
11947 SetWet(GetWet() + value);
11948 }
11949 //----------------------------------------------------------------
11950 override void SetWetMax()
11951 {
11953 }
11954 //----------------------------------------------------------------
11955 override float GetWet()
11956 {
11957 return m_VarWet;
11958 }
11959 //----------------------------------------------------------------
11960 override float GetWetMax()
11961 {
11962 return m_VarWetMax;
11963 }
11964 //----------------------------------------------------------------
11965 override float GetWetMin()
11966 {
11967 return m_VarWetMin;
11968 }
11969 //----------------------------------------------------------------
11970 override float GetWetInit()
11971 {
11972 return m_VarWetInit;
11973 }
11974 //----------------------------------------------------------------
11975 override void OnWetChanged(float newVal, float oldVal)
11976 {
11977 EWetnessLevel newLevel = GetWetLevelInternal(newVal);
11978 EWetnessLevel oldLevel = GetWetLevelInternal(oldVal);
11979 if (newLevel != oldLevel)
11980 {
11981 OnWetLevelChanged(newLevel,oldLevel);
11982 }
11983 }
11984
11985 override void OnWetLevelChanged(EWetnessLevel newLevel, EWetnessLevel oldLevel)
11986 {
11987 SetWeightDirty();
11988 }
11989
11990 override EWetnessLevel GetWetLevel()
11991 {
11992 return GetWetLevelInternal(m_VarWet);
11993 }
11994
11995 //----------------------------------------------------------------
11996
11997 override void SetStoreLoad(bool value)
11998 {
11999 m_IsStoreLoad = value;
12000 }
12001
12002 override bool IsStoreLoad()
12003 {
12004 return m_IsStoreLoad;
12005 }
12006
12007 override void SetStoreLoadedQuantity(float value)
12008 {
12009 m_StoreLoadedQuantity = value;
12010 }
12011
12012 override float GetStoreLoadedQuantity()
12013 {
12014 return m_StoreLoadedQuantity;
12015 }
12016
12017 //----------------------------------------------------------------
12018
12019 float GetItemModelLength()
12020 {
12021 if (ConfigIsExisting("itemModelLength"))
12022 {
12023 return ConfigGetFloat("itemModelLength");
12024 }
12025 return 0;
12026 }
12027
12028 float GetItemAttachOffset()
12029 {
12030 if (ConfigIsExisting("itemAttachOffset"))
12031 {
12032 return ConfigGetFloat("itemAttachOffset");
12033 }
12034 return 0;
12035 }
12036
12037 override void SetCleanness(int value, bool allow_client = false)
12038 {
12039 if (!IsServerCheck(allow_client))
12040 return;
12041
12042 int previousValue = m_Cleanness;
12043
12044 m_Cleanness = Math.Clamp(value, m_CleannessMin, m_CleannessMax);
12045
12046 if (previousValue != m_Cleanness)
12047 SetVariableMask(VARIABLE_CLEANNESS);
12048 }
12049
12050 override int GetCleanness()
12051 {
12052 return m_Cleanness;
12053 }
12054
12056 {
12057 return true;
12058 }
12059
12060 //----------------------------------------------------------------
12061 // ATTACHMENT LOCKING
12062 // Getters relevant to generic ActionLockAttachment
12063 int GetLockType()
12064 {
12065 return m_LockType;
12066 }
12067
12068 string GetLockSoundSet()
12069 {
12070 return m_LockSoundSet;
12071 }
12072
12073 //----------------------------------------------------------------
12074 //------------------------- Color
12075 // sets items color variable given color components
12076 override void SetColor(int r, int g, int b, int a)
12077 {
12082 SetVariableMask(VARIABLE_COLOR);
12083 }
12085 override void GetColor(out int r,out int g,out int b,out int a)
12086 {
12091 }
12092
12093 bool IsColorSet()
12094 {
12095 return IsVariableSet(VARIABLE_COLOR);
12096 }
12097
12099 string GetColorString()
12100 {
12101 int r,g,b,a;
12102 GetColor(r,g,b,a);
12103 r = r/255;
12104 g = g/255;
12105 b = b/255;
12106 a = a/255;
12107 return MiscGameplayFunctions.GetColorString(r, g, b, a);
12108 }
12109 //----------------------------------------------------------------
12110 //------------------------- LiquidType
12111
12112 override void SetLiquidType(int value, bool allow_client = false)
12113 {
12114 if (!IsServerCheck(allow_client))
12115 return;
12116
12117 int old = m_VarLiquidType;
12118 m_VarLiquidType = value;
12119 OnLiquidTypeChanged(old,value);
12120 SetVariableMask(VARIABLE_LIQUIDTYPE);
12121 }
12122
12123 int GetLiquidTypeInit()
12124 {
12125 return ConfigGetInt("varLiquidTypeInit");
12126 }
12127
12128 override int GetLiquidType()
12129 {
12130 return m_VarLiquidType;
12131 }
12132
12133 protected void OnLiquidTypeChanged(int oldType, int newType)
12134 {
12135 if (newType == LIQUID_NONE && GetIsFrozen())
12136 SetFrozen(false);
12137 }
12138
12140 void UpdateQuickbarShortcutVisibility(PlayerBase player)
12141 {
12142 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12143 }
12144
12145 // -------------------------------------------------------------------------
12147 void OnInventoryEnter(Man player)
12148 {
12149 PlayerBase nplayer;
12150 if (PlayerBase.CastTo(nplayer, player))
12151 {
12152 m_CanPlayImpactSound = true;
12153 //nplayer.OnItemInventoryEnter(this);
12154 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12155 }
12156 }
12157
12158 // -------------------------------------------------------------------------
12160 void OnInventoryExit(Man player)
12161 {
12162 PlayerBase nplayer;
12163 if (PlayerBase.CastTo(nplayer,player))
12164 {
12165 //nplayer.OnItemInventoryExit(this);
12166 nplayer.SetEnableQuickBarEntityShortcut(this,false);
12167
12168 }
12169
12170 //if (!GetGame().IsDedicatedServer())
12171 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
12172
12173
12174 if (HasEnergyManager())
12175 {
12176 GetCompEM().UpdatePlugState(); // Unplug the el. device if it's necesarry.
12177 }
12178 }
12179
12180 // ADVANCED PLACEMENT EVENTS
12181 override void OnPlacementStarted(Man player)
12182 {
12183 super.OnPlacementStarted(player);
12184
12185 SetTakeable(false);
12186 }
12187
12188 override void OnPlacementComplete(Man player, vector position = "0 0 0", vector orientation = "0 0 0")
12189 {
12190 if (m_AdminLog)
12191 {
12192 m_AdminLog.OnPlacementComplete(player, this);
12193 }
12194
12195 super.OnPlacementComplete(player, position, orientation);
12196 }
12197
12198 //-----------------------------
12199 // AGENT SYSTEM
12200 //-----------------------------
12201 //--------------------------------------------------------------------------
12202 bool ContainsAgent(int agent_id)
12203 {
12204 if (agent_id & m_AttachedAgents)
12205 {
12206 return true;
12207 }
12208 else
12209 {
12210 return false;
12211 }
12212 }
12213
12214 //--------------------------------------------------------------------------
12215 override void RemoveAgent(int agent_id)
12216 {
12217 if (ContainsAgent(agent_id))
12218 {
12219 m_AttachedAgents = ~agent_id & m_AttachedAgents;
12220 }
12221 }
12222
12223 //--------------------------------------------------------------------------
12224 override void RemoveAllAgents()
12225 {
12226 m_AttachedAgents = 0;
12227 }
12228 //--------------------------------------------------------------------------
12229 override void RemoveAllAgentsExcept(int agent_to_keep)
12230 {
12231 m_AttachedAgents = m_AttachedAgents & agent_to_keep;
12232 }
12233 // -------------------------------------------------------------------------
12234 override void InsertAgent(int agent, float count = 1)
12235 {
12236 if (count < 1)
12237 return;
12238 //Debug.Log("Inserting Agent on item: " + agent.ToString() +" count: " + count.ToString());
12240 }
12241
12243 void TransferAgents(int agents)
12244 {
12246 }
12247
12248 // -------------------------------------------------------------------------
12249 override int GetAgents()
12250 {
12251 return m_AttachedAgents;
12252 }
12253 //----------------------------------------------------------------------
12254
12255 /*int GetContaminationType()
12256 {
12257 int contamination_type;
12258
12259 const int CONTAMINATED_MASK = eAgents.CHOLERA | eAgents.INFLUENZA | eAgents.SALMONELLA | eAgents.BRAIN;
12260 const int POISONED_MASK = eAgents.FOOD_POISON | eAgents.CHEMICAL_POISON;
12261 const int NERVE_GAS_MASK = eAgents.CHEMICAL_POISON;
12262 const int DIRTY_MASK = eAgents.WOUND_AGENT;
12263
12264 Edible_Base edible = Edible_Base.Cast(this);
12265 int agents = GetAgents();
12266 if (edible)
12267 {
12268 NutritionalProfile profile = Edible_Base.GetNutritionalProfile(edible);
12269 if (profile)
12270 {
12271 agents = agents | profile.GetAgents();//merge item's agents with nutritional agents
12272 }
12273 }
12274 if (agents & CONTAMINATED_MASK)
12275 {
12276 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_CONTAMINATED;
12277 }
12278 if (agents & POISONED_MASK)
12279 {
12280 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_POISONED;
12281 }
12282 if (agents & NERVE_GAS_MASK)
12283 {
12284 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_NERVE_GAS;
12285 }
12286 if (agents & DIRTY_MASK)
12287 {
12288 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_DIRTY;
12289 }
12290
12291 return agents;
12292 }*/
12293
12294 // -------------------------------------------------------------------------
12295 bool LoadAgents(ParamsReadContext ctx, int version)
12296 {
12297 if (!ctx.Read(m_AttachedAgents))
12298 return false;
12299 return true;
12300 }
12301 // -------------------------------------------------------------------------
12303 {
12304
12306 }
12307 // -------------------------------------------------------------------------
12308
12310 override void CheckForRoofLimited(float timeTresholdMS = 3000)
12311 {
12312 super.CheckForRoofLimited(timeTresholdMS);
12313
12314 float time = GetGame().GetTime();
12315 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
12316 {
12317 m_PreviousRoofTestTime = time;
12318 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
12319 }
12320 }
12321
12322 // returns item's protection level against enviromental hazard, for masks with filters, returns the filters protection for valid filter, otherwise 0
12323 float GetProtectionLevel(int type, bool consider_filter = false, int system = 0)
12324 {
12325 if (IsDamageDestroyed() || (HasQuantity() && GetQuantity() <= 0))
12326 {
12327 return 0;
12328 }
12329
12330 if (GetInventory().GetAttachmentSlotsCount() != 0)//is it an item with attachable filter ?
12331 {
12332 ItemBase filter = ItemBase.Cast(FindAttachmentBySlotName("GasMaskFilter"));
12333 if (filter)
12334 return filter.GetProtectionLevel(type, false, system);//it's a valid filter, return the protection
12335 else
12336 return 0;//otherwise return 0 when no filter attached
12337 }
12338
12339 string subclassPath, entryName;
12340
12341 switch (type)
12342 {
12343 case DEF_BIOLOGICAL:
12344 entryName = "biological";
12345 break;
12346 case DEF_CHEMICAL:
12347 entryName = "chemical";
12348 break;
12349 default:
12350 entryName = "biological";
12351 break;
12352 }
12353
12354 subclassPath = "CfgVehicles " + this.GetType() + " Protection ";
12355
12356 return GetGame().ConfigGetFloat(subclassPath + entryName);
12357 }
12358
12359
12360
12362 override void EEOnCECreate()
12363 {
12364 if (!IsMagazine())
12366
12368 }
12369
12370
12371 //-------------------------
12372 // OPEN/CLOSE USER ACTIONS
12373 //-------------------------
12375 void Open();
12376 void Close();
12377 bool IsOpen()
12378 {
12379 return true;
12380 }
12381
12382 override bool CanDisplayCargo()
12383 {
12384 return IsOpen();
12385 }
12386
12387
12388 // ------------------------------------------------------------
12389 // CONDITIONS
12390 // ------------------------------------------------------------
12391 override bool CanPutInCargo(EntityAI parent)
12392 {
12393 if (parent)
12394 {
12395 if (parent.IsInherited(DayZInfected))
12396 return true;
12397
12398 if (!parent.IsRuined())
12399 return true;
12400 }
12401
12402 return true;
12403 }
12404
12405 override bool CanPutAsAttachment(EntityAI parent)
12406 {
12407 if (!super.CanPutAsAttachment(parent))
12408 {
12409 return false;
12410 }
12411
12412 if (!IsRuined() && !parent.IsRuined())
12413 {
12414 return true;
12415 }
12416
12417 return false;
12418 }
12419
12420 override bool CanReceiveItemIntoCargo(EntityAI item)
12421 {
12422 //removed 15.06. coz of loading from storage -> after load items in cargo was lost -> waiting for proper solution
12423 //if (GetHealthLevel() == GameConstants.STATE_RUINED)
12424 // return false;
12425
12426 return super.CanReceiveItemIntoCargo(item);
12427 }
12428
12429 override bool CanReceiveAttachment(EntityAI attachment, int slotId)
12430 {
12431 //removed 15.06. coz of loading from storage -> after load items in cargo was lost -> waiting for proper solution
12432 //if (GetHealthLevel() == GameConstants.STATE_RUINED)
12433 // return false;
12434
12435 GameInventory attachmentInv = attachment.GetInventory();
12436 if (attachmentInv && attachmentInv.GetCargo() && attachmentInv.GetCargo().GetItemCount() > 0)
12437 {
12438 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
12439 return false;
12440 }
12441
12442 InventoryLocation loc = new InventoryLocation();
12443 attachment.GetInventory().GetCurrentInventoryLocation(loc);
12444 if (loc && loc.IsValid() && !GetInventory().AreChildrenAccessible())
12445 return false;
12446
12447 return super.CanReceiveAttachment(attachment, slotId);
12448 }
12449
12450 override bool CanReleaseAttachment(EntityAI attachment)
12451 {
12452 if (!super.CanReleaseAttachment(attachment))
12453 return false;
12454
12455 return GetInventory().AreChildrenAccessible();
12456 }
12457
12458 /*override bool CanLoadAttachment(EntityAI attachment)
12459 {
12460 //removed 15.06. coz of loading from storage -> after load items in cargo was lost -> waiting for proper solution
12461 //if (GetHealthLevel() == GameConstants.STATE_RUINED)
12462 // return false;
12463
12464 GameInventory attachmentInv = attachment.GetInventory();
12465 if (attachmentInv && attachmentInv.GetCargo() && attachmentInv.GetCargo().GetItemCount() > 0)
12466 {
12467 bool boo = (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase));
12468 ErrorEx("CanLoadAttachment | this: " + this + " | attachment: " + attachment + " | boo: " + boo,ErrorExSeverity.INFO);
12469
12470 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
12471 return false;
12472 }
12473
12474 return super.CanLoadAttachment(attachment);
12475 }*/
12476
12477 // Plays muzzle flash particle effects
12478 static void PlayFireParticles(ItemBase weapon, int muzzle_index, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
12479 {
12480 int id = muzzle_owner.GetMuzzleID();
12481 array<ref WeaponParticlesOnFire> WPOF_array = m_OnFireEffect.Get(id);
12482
12483 if (WPOF_array)
12484 {
12485 for (int i = 0; i < WPOF_array.Count(); i++)
12486 {
12487 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
12488
12489 if (WPOF)
12490 {
12491 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
12492 }
12493 }
12494 }
12495 }
12496
12497 // Plays bullet eject particle effects (usually just smoke, the bullet itself is a 3D model and is not part of this function)
12498 static void PlayBulletCasingEjectParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
12499 {
12500 int id = muzzle_owner.GetMuzzleID();
12501 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = m_OnBulletCasingEjectEffect.Get(id);
12502
12503 if (WPOBE_array)
12504 {
12505 for (int i = 0; i < WPOBE_array.Count(); i++)
12506 {
12507 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
12508
12509 if (WPOBE)
12510 {
12511 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12512 }
12513 }
12514 }
12515 }
12516
12517 // Plays all weapon overheating particles
12518 static void PlayOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
12519 {
12520 int id = muzzle_owner.GetMuzzleID();
12521 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12522
12523 if (WPOOH_array)
12524 {
12525 for (int i = 0; i < WPOOH_array.Count(); i++)
12526 {
12527 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12528
12529 if (WPOOH)
12530 {
12531 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12532 }
12533 }
12534 }
12535 }
12536
12537 // Updates all weapon overheating particles
12538 static void UpdateOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
12539 {
12540 int id = muzzle_owner.GetMuzzleID();
12541 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12542
12543 if (WPOOH_array)
12544 {
12545 for (int i = 0; i < WPOOH_array.Count(); i++)
12546 {
12547 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12548
12549 if (WPOOH)
12550 {
12551 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12552 }
12553 }
12554 }
12555 }
12556
12557 // Stops overheating particles
12558 static void StopOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
12559 {
12560 int id = muzzle_owner.GetMuzzleID();
12561 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12562
12563 if (WPOOH_array)
12564 {
12565 for (int i = 0; i < WPOOH_array.Count(); i++)
12566 {
12567 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12568
12569 if (WPOOH)
12570 {
12571 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12572 }
12573 }
12574 }
12575 }
12576
12577 //----------------------------------------------------------------
12578 //Item Behaviour - unified approach
12579 override bool IsHeavyBehaviour()
12580 {
12581 if (m_ItemBehaviour == 0)
12582 {
12583 return true;
12584 }
12585
12586 return false;
12587 }
12588
12589 override bool IsOneHandedBehaviour()
12590 {
12591 if (m_ItemBehaviour == 1)
12592 {
12593 return true;
12594 }
12595
12596 return false;
12597 }
12598
12599 override bool IsTwoHandedBehaviour()
12600 {
12601 if (m_ItemBehaviour == 2)
12602 {
12603 return true;
12604 }
12605
12606 return false;
12607 }
12608
12609 bool IsDeployable()
12610 {
12611 return false;
12612 }
12613
12615 float GetDeployTime()
12616 {
12617 return UATimeSpent.DEFAULT_DEPLOY;
12618 }
12619
12620
12621 //----------------------------------------------------------------
12622 // Item Targeting (User Actions)
12623 override void SetTakeable(bool pState)
12624 {
12625 m_IsTakeable = pState;
12626 SetSynchDirty();
12627 }
12628
12629 override bool IsTakeable()
12630 {
12631 return m_IsTakeable;
12632 }
12633
12634 // For cases where we want to show object widget which cant be taken to hands
12636 {
12637 return false;
12638 }
12639
12641 protected void PreLoadSoundAttachmentType()
12642 {
12643 string att_type = "None";
12644
12645 if (ConfigIsExisting("soundAttType"))
12646 {
12647 att_type = ConfigGetString("soundAttType");
12648 }
12649
12650 m_SoundAttType = att_type;
12651 }
12652
12653 override string GetAttachmentSoundType()
12654 {
12655 return m_SoundAttType;
12656 }
12657
12658 //----------------------------------------------------------------
12659 //SOUNDS - ItemSoundHandler
12660 //----------------------------------------------------------------
12661
12662 string GetPlaceSoundset(); // played when deploy starts
12663 string GetLoopDeploySoundset(); // played when deploy starts and stopped when it finishes
12664 string GetDeploySoundset(); // played when deploy sucessfully finishes
12665 string GetLoopFoldSoundset(); // played when fold starts and stopped when it finishes
12666 string GetFoldSoundset(); // played when fold sucessfully finishes
12667
12669 {
12670 if (!m_ItemSoundHandler)
12672
12673 return m_ItemSoundHandler;
12674 }
12675
12676 // override to initialize sounds
12677 protected void InitItemSounds()
12678 {
12679 if (GetPlaceSoundset() == string.Empty && GetDeploySoundset() == string.Empty && GetLoopDeploySoundset() == string.Empty)
12680 return;
12681
12683
12684 if (GetPlaceSoundset() != string.Empty)
12685 handler.AddSound(SoundConstants.ITEM_PLACE, GetPlaceSoundset());
12686
12687 if (GetDeploySoundset() != string.Empty)
12688 handler.AddSound(SoundConstants.ITEM_DEPLOY, GetDeploySoundset());
12689
12690 SoundParameters params = new SoundParameters();
12691 params.m_Loop = true;
12692 if (GetLoopDeploySoundset() != string.Empty)
12693 handler.AddSound(SoundConstants.ITEM_DEPLOY_LOOP, GetLoopDeploySoundset(), params);
12694 }
12695
12696 // Start sound using ItemSoundHandler
12697 void StartItemSoundServer(int id)
12698 {
12699 if (!GetGame().IsServer())
12700 return;
12701
12702 m_SoundSyncPlay = id;
12703 SetSynchDirty();
12704
12705 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).Remove(ClearStartItemSoundServer); // in case one is queued already
12707 }
12708
12709 // Stop sound using ItemSoundHandler
12710 void StopItemSoundServer(int id)
12711 {
12712 if (!GetGame().IsServer())
12713 return;
12714
12715 m_SoundSyncStop = id;
12716 SetSynchDirty();
12717
12718 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).Remove(ClearStopItemSoundServer); // in case one is queued already
12720 }
12721
12722 protected void ClearStartItemSoundServer()
12723 {
12724 m_SoundSyncPlay = 0;
12725 }
12726
12727 protected void ClearStopItemSoundServer()
12728 {
12729 m_SoundSyncStop = 0;
12730 }
12731
12733 void PlayAttachSound(string slot_type)
12734 {
12735 if (!GetGame().IsDedicatedServer())
12736 {
12737 if (ConfigIsExisting("attachSoundSet"))
12738 {
12739 string cfg_path = "";
12740 string soundset = "";
12741 string type_name = GetType();
12742
12743 TStringArray cfg_soundset_array = new TStringArray;
12744 TStringArray cfg_slot_array = new TStringArray;
12745 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
12746 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
12747
12748 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
12749 {
12750 for (int i = 0; i < cfg_soundset_array.Count(); i++)
12751 {
12752 if (cfg_slot_array[i] == slot_type)
12753 {
12754 soundset = cfg_soundset_array[i];
12755 break;
12756 }
12757 }
12758 }
12759
12760 if (soundset != "")
12761 {
12762 EffectSound sound = SEffectManager.PlaySound(soundset, GetPosition());
12763 sound.SetAutodestroy(true);
12764 }
12765 }
12766 }
12767 }
12768
12769 void PlayDetachSound(string slot_type)
12770 {
12771 //TODO - evaluate if needed and devise universal config structure if so
12772 }
12773
12774 void OnApply(PlayerBase player);
12775
12777 {
12778 return 1.0;
12779 };
12780 //returns applicable selection
12781 array<string> GetHeadHidingSelection()
12782 {
12784 }
12785
12787 {
12789 }
12790
12791 WrittenNoteData GetWrittenNoteData() {};
12792
12794 {
12795 SetDynamicPhysicsLifeTime(0.01);
12796 m_ItemBeingDroppedPhys = false;
12797 }
12798
12800 {
12801 array<string> zone_names = new array<string>;
12802 GetDamageZones(zone_names);
12803 for (int i = 0; i < zone_names.Count(); i++)
12804 {
12805 SetHealthMax(zone_names.Get(i),"Health");
12806 }
12807 SetHealthMax("","Health");
12808 }
12809
12811 void SetZoneDamageCEInit()
12812 {
12813 float global_health = GetHealth01("","Health");
12814 array<string> zones = new array<string>;
12815 GetDamageZones(zones);
12816 //set damage of all zones to match global health level
12817 for (int i = 0; i < zones.Count(); i++)
12818 {
12819 SetHealth01(zones.Get(i),"Health",global_health);
12820 }
12821 }
12822
12824 bool IsCoverFaceForShave(string slot_name)
12825 {
12826 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
12827 }
12828
12829 void ProcessItemWetness(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
12830 {
12831 if (!hasRootAsPlayer)
12832 {
12833 if (refParentIB)
12834 {
12835 // parent is wet
12836 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (m_VarWet < m_VarWetMax))
12837 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
12838 // parent has liquid inside
12839 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (m_VarWet < m_VarWetMax))
12840 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
12841 // drying
12842 else if (m_VarWet > m_VarWetMin)
12843 AddWet(-1 * delta * GetDryingIncrement("ground") * 2);
12844 }
12845 else
12846 {
12847 // drying on ground or inside non-itembase (car, ...)
12848 if (m_VarWet > m_VarWetMin)
12849 AddWet(-1 * delta * GetDryingIncrement("ground"));
12850 }
12851 }
12852 }
12853
12854 void ProcessItemTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
12855 {
12857 {
12858 float target = g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(this);
12859 if (GetTemperature() != target || !IsFreezeThawProgressFinished())
12860 {
12861 float heatPermCoef = 1.0;
12862 EntityAI ent = this;
12863 while (ent)
12864 {
12865 heatPermCoef *= ent.GetHeatPermeabilityCoef();
12866 ent = ent.GetHierarchyParent();
12867 }
12868
12869 SetTemperatureEx(new TemperatureDataInterpolated(target,ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
12870 }
12871 }
12872 }
12873
12874 void HierarchyCheck(out bool hasParent, out bool hasRootAsPlayer, out ItemBase refParentIB)
12875 {
12876 // hierarchy check for an item to decide whether it has some parent and it is in some player inventory
12877 EntityAI parent = GetHierarchyParent();
12878 if (!parent)
12879 {
12880 hasParent = false;
12881 hasRootAsPlayer = false;
12882 }
12883 else
12884 {
12885 hasParent = true;
12886 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
12887 refParentIB = ItemBase.Cast(parent);
12888 }
12889 }
12890
12891 protected void ProcessDecay(float delta, bool hasRootAsPlayer)
12892 {
12893 // this is stub, implemented on Edible_Base
12894 }
12895
12896 bool CanDecay()
12897 {
12898 // return true used on selected food clases so they can decay
12899 return false;
12900 }
12901
12902 protected bool CanProcessDecay()
12903 {
12904 // this is stub, implemented on Edible_Base class
12905 // used to determine whether it is still necessary for the food to decay
12906 return false;
12907 }
12908
12909 protected bool CanHaveWetness()
12910 {
12911 // return true used on selected items that have a wetness effect
12912 return false;
12913 }
12914
12916 bool CanBeConsumed(ConsumeConditionData data = null)
12917 {
12918 return !GetIsFrozen() && IsOpen();
12919 }
12920
12921 override void ProcessVariables()
12922 {
12923 bool hasParent = false, hasRootAsPlayer = false;
12924 ItemBase refParentIB;
12925
12926 bool wwtu = g_Game.IsWorldWetTempUpdateEnabled();
12927 bool foodDecay = g_Game.IsFoodDecayEnabled();
12928
12929 if (wwtu || foodDecay)
12930 {
12931 bool processWetness = wwtu && CanHaveWetness();
12932 bool processTemperature = wwtu && CanHaveTemperature();
12933 bool processDecay = foodDecay && CanDecay() && CanProcessDecay();
12934
12935 if (processWetness || processTemperature || processDecay)
12936 {
12937 HierarchyCheck(hasParent, hasRootAsPlayer, refParentIB);
12938
12939 if (processWetness)
12940 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
12941
12942 if (processTemperature)
12943 ProcessItemTemperature(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
12944
12945 if (processDecay)
12946 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
12947 }
12948 }
12949 }
12950
12953 {
12954 return m_TemperaturePerQuantityWeight * GameConstants.ITEM_TEMPERATURE_QUANTITY_WEIGHT_MULTIPLIER;
12955 }
12956
12957 override float GetTemperatureFreezeThreshold()
12958 {
12960 return Liquid.GetFreezeThreshold(GetLiquidType());
12961
12962 return super.GetTemperatureFreezeThreshold();
12963 }
12964
12965 override float GetTemperatureThawThreshold()
12966 {
12968 return Liquid.GetThawThreshold(GetLiquidType());
12969
12970 return super.GetTemperatureThawThreshold();
12971 }
12972
12973 override float GetItemOverheatThreshold()
12974 {
12976 return Liquid.GetBoilThreshold(GetLiquidType());
12977
12978 return super.GetItemOverheatThreshold();
12979 }
12980
12981 override float GetTemperatureFreezeTime()
12982 {
12983 if (HasQuantity())
12984 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),GetQuantityNormalized());
12985
12986 return super.GetTemperatureFreezeTime();
12987 }
12988
12989 override float GetTemperatureThawTime()
12990 {
12991 if (HasQuantity())
12992 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),GetQuantityNormalized());
12993
12994 return super.GetTemperatureThawTime();
12995 }
12996
12998 void AffectLiquidContainerOnFill(int liquid_type, float amount);
13000 void AffectLiquidContainerOnTransfer(int liquidType, float amount, float sourceLiquidTemperature);
13001
13002 bool IsCargoException4x3(EntityAI item)
13003 {
13004 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
13005 }
13006
13008 {
13009 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
13010 }
13011
13013 void AddLightSourceItem(ItemBase lightsource)
13014 {
13015 m_LightSourceItem = lightsource;
13016 }
13017
13019 {
13020 m_LightSourceItem = null;
13021 }
13022
13024 {
13025 return m_LightSourceItem;
13026 }
13027
13029 array<int> GetValidFinishers()
13030 {
13031 return null;
13032 }
13033
13035 bool GetActionWidgetOverride(out typename name)
13036 {
13037 return false;
13038 }
13039
13040 bool PairWithDevice(notnull ItemBase otherDevice)
13041 {
13042 if (GetGame().IsServer())
13043 {
13044 ItemBase explosive = otherDevice;
13046 if (!trg)
13047 {
13048 trg = RemoteDetonatorTrigger.Cast(otherDevice);
13049 explosive = this;
13050 }
13051
13052 explosive.PairRemote(trg);
13053 trg.SetControlledDevice(explosive);
13054
13055 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
13056 trg.SetPersistentPairID(persistentID);
13057 explosive.SetPersistentPairID(persistentID);
13058
13059 return true;
13060 }
13061 return false;
13062 }
13063
13065 float GetBaitEffectivity()
13066 {
13067 float ret = 1.0;
13068 if (HasQuantity())
13069 ret *= GetQuantityNormalized();
13070 ret *= GetHealth01();
13071
13072 return ret;
13073 }
13074
13075 #ifdef DEVELOPER
13076 override void SetDebugItem()
13077 {
13078 super.SetDebugItem();
13079 _itemBase = this;
13080 }
13081
13082 override string GetDebugText()
13083 {
13084 string text = super.GetDebugText();
13085
13086 text += string.Format("Heat isolation(raw): %1\n", GetHeatIsolation());
13087 text += string.Format("Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(this));
13088
13089 return text;
13090 }
13091 #endif
13092
13093 bool CanBeUsedForSuicide()
13094 {
13095 return true;
13096 }
13097
13099 //DEPRECATED BELOW
13101 // Backwards compatibility
13102 void ProcessItemWetnessAndTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
13103 {
13104 ProcessItemWetness(delta, hasParent, hasRootAsPlayer, refParentIB);
13105 ProcessItemTemperature(delta, hasParent, hasRootAsPlayer, refParentIB);
13106 }
13107
13108 // replaced by ItemSoundHandler
13109 protected EffectSound m_SoundDeployFinish;
13110 protected EffectSound m_SoundPlace;
13111 protected EffectSound m_DeployLoopSoundEx;
13112 protected EffectSound m_SoundDeploy;
13113 bool m_IsPlaceSound;
13114 bool m_IsDeploySound;
13116
13117 string GetDeployFinishSoundset();
13118 void PlayDeploySound();
13119 void PlayDeployFinishSound();
13120 void PlayPlaceSound();
13121 void PlayDeployLoopSoundEx();
13122 void StopDeployLoopSoundEx();
13123 void SoundSynchRemoteReset();
13124 void SoundSynchRemote();
13125 bool UsesGlobalDeploy(){return false;}
13126 bool CanPlayDeployLoopSound(){return false;}
13128 bool IsPlaceSound(){return m_IsPlaceSound;}
13129 bool IsDeploySound(){return m_IsDeploySound;}
13130 void SetIsPlaceSound(bool is_place_sound);
13131 void SetIsDeploySound(bool is_deploy_sound);
13132}
13133
13134EntityAI SpawnItemOnLocation(string object_name, notnull InventoryLocation loc, bool full_quantity)
13135{
13136 EntityAI entity = SpawnEntity(object_name, loc, ECE_IN_INVENTORY, RF_DEFAULT);
13137 if (entity)
13138 {
13139 bool is_item = entity.IsInherited(ItemBase);
13140 if (is_item && full_quantity)
13141 {
13142 ItemBase item = ItemBase.Cast(entity);
13143 item.SetQuantity(item.GetQuantityInit());
13144 }
13145 }
13146 else
13147 {
13148 ErrorEx("Cannot spawn entity: " + object_name,ErrorExSeverity.INFO);
13149 return NULL;
13150 }
13151 return entity;
13152}
13153
13154void SetupSpawnedItem(ItemBase item, float health, float quantity)
13155{
13156 if (item)
13157 {
13158 if (health > 0)
13159 item.SetHealth("", "", health);
13160
13161 if (item.CanHaveTemperature())
13162 {
13163 item.SetTemperatureDirect(GameConstants.ITEM_TEMPERATURE_NEUTRAL_ZONE_MIDDLE);
13164 if (item.CanFreeze())
13165 item.SetFrozen(false);
13166 }
13167
13168 if (item.HasEnergyManager())
13169 {
13170 if (quantity >= 0)
13171 {
13172 item.GetCompEM().SetEnergy0To1(quantity);
13173 }
13174 else
13175 {
13176 item.GetCompEM().SetEnergy(Math.AbsFloat(quantity));
13177 }
13178 }
13179 else if (item.IsMagazine())
13180 {
13181 Magazine mag = Magazine.Cast(item);
13182 if (quantity >= 0)
13183 {
13184 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
13185 }
13186 else
13187 {
13188 mag.ServerSetAmmoCount(Math.AbsFloat(quantity));
13189 }
13190
13191 }
13192 else
13193 {
13194 if (quantity >= 0)
13195 {
13196 item.SetQuantityNormalized(quantity, false);
13197 }
13198 else
13199 {
13200 item.SetQuantity(Math.AbsFloat(quantity));
13201 }
13202
13203 }
13204 }
13205}
13206
13207#ifdef DEVELOPER
13208ItemBase _itemBase;//watched item goes here(LCTRL+RMB->Watch)
13209#endif
Param4< int, int, string, int > TSelectableActionInfoWithColor
Определения 3_Game/Entities/EntityAI.c:97
Param3 TSelectableActionInfo
EWetnessLevel
Определения 3_Game/Entities/EntityAI.c:2
InventoryMode
NOTE: PREDICTIVE is not to be used at all in multiplayer.
const int INPUT_UDT_ITEM_MANIPULATION
class LogManager EntityAI
eBleedingSourceType GetType()
ItemSuppressor SuppressorBase
void ActionDropItem()
Определения ActionDropItem.c:14
void ActionManagerBase(PlayerBase player)
Определения ActionManagerBase.c:63
map< typename, ref array< ActionBase_Basic > > TInputActionMap
Определения ActionManagerClient.c:1
void AddAction(typename actionName)
Определения AdvancedCommunication.c:220
void RemoveAction(typename actionName)
Определения AdvancedCommunication.c:252
TInputActionMap m_InputActionMap
Определения AdvancedCommunication.c:137
bool m_ActionsInitialize
Определения AdvancedCommunication.c:138
override void GetActions(typename action_input_type, out array< ActionBase_Basic > actions)
Определения AdvancedCommunication.c:202
void InitializeActions()
Определения AdvancedCommunication.c:190
int GetLiquidType()
Определения CCTWaterSurface.c:129
const int ECE_PLACE_ON_SURFACE
Определения CentralEconomy.c:37
proto native void SpawnEntity(string sClassName, vector vPos, float fRange, int iCount)
Spawn an entity through CE.
const int ECE_IN_INVENTORY
Определения CentralEconomy.c:36
const int RF_DEFAULT
Определения CentralEconomy.c:65
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
PlayerSpawnPreset slotName
Open
Implementations only.
override void EEOnCECreate()
Определения ContaminatedArea_Dynamic.c:42
map
Определения ControlsXboxNew.c:4
CookingMethodType
Определения Cooking.c:2
DamageType
exposed from C++ (do not change)
Определения DamageSystem.c:11
DayZGame g_Game
Определения DayZGame.c:3868
DayZGame GetDayZGame()
Определения DayZGame.c:3870
EActions
Определения EActions.c:2
ERPCs
Определения ERPCs.c:2
PluginAdminLog m_AdminLog
Определения EmoteManager.c:142
const int MAX
Определения EnConvert.c:27
float GetTemperature()
Определения Environment.c:497
override bool IsExplosive()
Определения ExplosivesBase.c:59
override bool CanHaveTemperature()
Определения FireplaceBase.c:559
class GP5GasMask extends MaskBase ItemBase
Empty
Определения Hand_States.c:14
FindInventoryLocationType
flags for searching locations in inventory
Определения InventoryLocation.c:17
InventoryLocationType
types of Inventory Location
Определения InventoryLocation.c:4
class BoxCollidingParams component
ComponentInfo for BoxCollidingResult.
bool DamageItemInCargo(float damage)
Определения ItemBase.c:6380
static bool HasDebugActionsMask(int mask)
Определения ItemBase.c:5620
bool HidesSelectionBySlot()
Определения ItemBase.c:9347
float m_VarWetMin
Определения ItemBase.c:4881
void SplitItem(PlayerBase player)
Определения ItemBase.c:6831
void CopyScriptPropertiesFrom(EntityAI oldItem)
Определения ItemBase.c:9568
override void InsertAgent(int agent, float count=1)
Определения ItemBase.c:8795
override float GetQuantityNormalized()
Gets quantity in normalized 0..1 form between the item's Min a Max values as defined by item's config...
Определения ItemBase.c:8229
static void SetDebugActionsMask(int mask)
Определения ItemBase.c:5625
void SetIsDeploySound(bool is_deploy_sound)
bool IsOpen()
Определения ItemBase.c:8938
void SplitItemToInventoryLocation(notnull InventoryLocation dst)
Определения ItemBase.c:6798
override bool IsHeavyBehaviour()
Определения ItemBase.c:9140
override void SetWetMax()
Определения ItemBase.c:8511
bool IsCoverFaceForShave(string slot_name)
DEPRECATED in use, but returns correct values nontheless. Check performed elsewhere.
Определения ItemBase.c:9385
void ClearStartItemSoundServer()
Определения ItemBase.c:9283
float m_VarWet
Определения ItemBase.c:4878
void ProcessItemTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
Определения ItemBase.c:9415
map< typename, ref ActionOverrideData > TActionAnimOverrideMap
Определения ItemBase.c:2
override void RemoveAllAgentsExcept(int agent_to_keep)
Определения ItemBase.c:8790
static ref map< int, ref array< ref WeaponParticlesOnBulletCasingEject > > m_OnBulletCasingEjectEffect
Определения ItemBase.c:4941
bool CanBeMovedOverride()
Определения ItemBase.c:7522
override void SetWet(float value, bool allow_client=false)
Определения ItemBase.c:8487
ref TIntArray m_SingleUseActions
Определения ItemBase.c:4927
override void ProcessVariables()
Определения ItemBase.c:9482
ref TStringArray m_HeadHidingSelections
Определения ItemBase.c:4955
float GetWeightSpecialized(bool forceRecalc=false)
Определения ItemBase.c:8321
bool LoadAgents(ParamsReadContext ctx, int version)
Определения ItemBase.c:8856
void UpdateQuickbarShortcutVisibility(PlayerBase player)
To be called on moving item within character's inventory; 'player' should never be null.
Определения ItemBase.c:8701
void OverrideActionAnimation(typename action, int commandUID, int stanceMask=-1, int commandUIDProne=-1)
Определения ItemBase.c:5211
ref array< ref OverheatingParticle > m_OverheatingParticles
Определения ItemBase.c:4953
override float GetTemperatureFreezeThreshold()
Определения ItemBase.c:9518
bool m_IsSoundSynchRemote
Определения ItemBase.c:9676
float m_OverheatingShots
Определения ItemBase.c:4948
void StopItemSoundServer(int id)
Определения ItemBase.c:9271
static void ToggleDebugActionsMask(int mask)
Определения ItemBase.c:5640
void IncreaseOverheating(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:5364
override float GetTemperatureFreezeTime()
Определения ItemBase.c:9542
ref array< int > m_CompatibleLocks
Определения ItemBase.c:4965
bool CanBeCooked()
Определения ItemBase.c:7478
override void CombineItemsClient(EntityAI entity2, bool use_stack_max=true)
Определения ItemBase.c:5707
float m_TemperaturePerQuantityWeight
Определения ItemBase.c:4977
bool m_RecipesInitialized
Определения ItemBase.c:4863
void SplitIntoStackMax(EntityAI destination_entity, int slot_id, PlayerBase player)
Определения ItemBase.c:6471
override float GetTemperatureThawThreshold()
Определения ItemBase.c:9526
override void OnEnergyConsumed()
Определения ItemBase.c:8431
void RefreshAudioVisualsOnClient(CookingMethodType cooking_method, bool is_done, bool is_empty, bool is_burned)
cooking-related effect methods
Определения Bottle_Base.c:158
int GetNumberOfItems()
Returns the number of items in cargo, otherwise returns 0(non-cargo objects). Recursive.
Определения ItemBase.c:8360
override EWetnessLevel GetWetLevel()
Определения ItemBase.c:8551
float GetSingleInventoryItemWeight()
Определения ItemBase.c:8316
ref TIntArray m_InteractActions
Определения ItemBase.c:4929
void MessageToOwnerStatus(string text)
Send message to owner player in grey color.
Определения ItemBase.c:7542
float m_VarQuantity
Определения ItemBase.c:4869
bool CanPlayDeployLoopSound()
Определения ItemBase.c:9687
override float GetWetMax()
Определения ItemBase.c:8521
bool CanBeUsedForSuicide()
Определения ItemBase.c:9654
override void CombineItemsEx(EntityAI entity2, bool use_stack_max=true)
Определения ItemBase.c:7117
void OnItemInHandsPlayerSwimStart(PlayerBase player)
void SetIsHologram(bool is_hologram)
Определения ItemBase.c:5845
void OnSyncVariables(ParamsReadContext ctx)
DEPRECATED (most likely)
Определения ItemBase.c:7696
void StartItemSoundServer(int id)
Определения ItemBase.c:9258
void DoAmmoExplosion()
Определения ItemBase.c:6315
static ref map< int, ref array< ref WeaponParticlesOnFire > > m_OnFireEffect
Определения ItemBase.c:4940
void SplitIntoStackMaxCargoClient(EntityAI destination_entity, int idx, int row, int col)
Определения ItemBase.c:6655
int GetItemSize()
Определения ItemBase.c:7507
bool m_CanBeMovedOverride
Определения ItemBase.c:4906
override string ChangeIntoOnAttach(string slot)
Определения ItemBase.c:6239
void UpdateOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
Определения ItemBase.c:5432
bool CanDecay()
Определения ItemBase.c:9457
ScriptedLightBase GetLight()
string GetPlaceSoundset()
bool AddQuantity(float value, bool destroy_config=true, bool destroy_forced=false)
add item quantity[related to varQuantity... config entry], destroy_config = true > if the quantity re...
Определения ItemBase.c:8202
void SetQuantityMax()
Определения ItemBase.c:8207
override float GetQuantity()
Определения ItemBase.c:8296
int m_ColorComponentR
Определения ItemBase.c:4918
int m_ShotsToStartOverheating
Определения ItemBase.c:4950
override void OnWetChanged(float newVal, float oldVal)
Определения ItemBase.c:8536
void StopOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
Определения ItemBase.c:5439
static void PlayFireParticles(ItemBase weapon, int muzzle_index, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:9039
void OnOverheatingDecay()
Определения ItemBase.c:5402
float GetDryingIncrement(string pIncrementName)
Определения ItemBase.c:8469
void SoundSynchRemoteReset()
int m_Cleanness
Определения ItemBase.c:4884
bool HasMuzzle()
Returns true if this item has a muzzle (weapons, suppressors)
Определения ItemBase.c:5540
bool UsesGlobalDeploy()
Определения ItemBase.c:9686
int m_ItemBehaviour
Определения ItemBase.c:4899
override bool CanReleaseAttachment(EntityAI attachment)
Определения ItemBase.c:9011
float m_HeatIsolation
Определения ItemBase.c:4894
float m_VarWetInit
Определения ItemBase.c:4880
override void OnMovedInsideCargo(EntityAI container)
Определения ItemBase.c:5885
void SetCEBasedQuantity()
Определения ItemBase.c:5653
bool m_CanPlayImpactSound
Определения ItemBase.c:4890
override string GetAttachmentSoundType()
Определения ItemBase.c:9214
float GetOverheatingCoef()
Определения ItemBase.c:5459
array< string > GetHeadHidingSelection()
Определения ItemBase.c:9342
void PlayAttachSound(string slot_type)
Plays sound on item attach. Be advised, the config structure may slightly change in 1....
Определения ItemBase.c:9294
override bool IsStoreLoad()
Определения ItemBase.c:8563
int ComputeQuantityUsed(ItemBase other_item, bool use_stack_max=true)
Определения ItemBase.c:7093
bool IsLightSource()
Определения ItemBase.c:5781
bool m_HasQuantityBar
Определения ItemBase.c:4912
void SetResultOfSplit(bool value)
Определения ItemBase.c:7088
void SplitIntoStackMaxCargo(EntityAI destination_entity, int idx, int row, int col)
Определения ItemBase.c:6719
void OnAttachmentQuantityChanged(ItemBase item)
Called on server side when some attachment's quantity is changed. Call super.OnAttachmentQuantityChan...
Определения ItemBase.c:6889
void UpdateAllOverheatingParticles()
Определения ItemBase.c:5467
float GetSoakingIncrement(string pIncrementName)
Определения ItemBase.c:8478
static void StopOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:9119
override float GetStoreLoadedQuantity()
Определения ItemBase.c:8573
int m_LockType
Определения ItemBase.c:4966
const int ITEM_SOUNDS_MAX
Определения ItemBase.c:4971
bool m_CanBeDigged
Определения ItemBase.c:4913
float m_ItemAttachOffset
Определения ItemBase.c:4896
float GetItemModelLength()
Определения ItemBase.c:8580
bool m_ThrowItemOnDrop
Определения ItemBase.c:4904
override bool ReadVarsFromCTX(ParamsReadContext ctx, int version=-1)
Определения ItemBase.c:7841
override void CheckForRoofLimited(float timeTresholdMS=3000)
Roof check for entity, limited by time (anti-spam solution)
Определения ItemBase.c:8871
void Close()
float GetHeatIsolation()
Определения ItemBase.c:8464
void CombineItems(ItemBase other_item, bool use_stack_max=true)
Определения ItemBase.c:7122
void TransferModifiers(PlayerBase reciever)
appears to be deprecated, legacy code
float GetTemperaturePerQuantityWeight()
Used in heat comfort calculations only!
Определения ItemBase.c:9513
bool CanHaveWetness()
Определения ItemBase.c:9470
int m_CleannessMin
Определения ItemBase.c:4886
void TransferAgents(int agents)
transfer agents from another item
Определения ItemBase.c:8804
string IDToName(int id)
Определения ItemBase.c:7689
bool CanBeConsumed(ConsumeConditionData data=null)
Items cannot be consumed if frozen by default. Override for exceptions.
Определения ItemBase.c:9477
float GetHeatIsolationInit()
Определения ItemBase.c:8459
void PlayPlaceSound()
void SetCanBeMovedOverride(bool setting)
Определения ItemBase.c:7529
override bool HasQuantity()
Определения ItemBase.c:8291
float m_VarWetPrev
Определения ItemBase.c:4879
int m_SoundSyncStop
Определения ItemBase.c:4973
bool IsCargoException4x3(EntityAI item)
Определения ItemBase.c:9563
ref TIntArray m_ContinuousActions
Определения ItemBase.c:4928
int GetMuzzleID()
Returns global muzzle ID. If not found, then it gets automatically registered.
Определения ItemBase.c:5549
void LoadParticleConfigOnFire(int id)
Определения ItemBase.c:5234
int m_VarLiquidType
Определения ItemBase.c:4898
int m_QuickBarBonus
Определения ItemBase.c:4900
void PreLoadSoundAttachmentType()
Attachment Sound Type getting from config file.
Определения ItemBase.c:9202
override float GetWetInit()
Определения ItemBase.c:8531
int m_ImpactSoundSurfaceHash
Определения ItemBase.c:4892
int m_SoundSyncPlay
Определения ItemBase.c:4972
int m_MaxOverheatingValue
Определения ItemBase.c:4951
void SetupSpawnedItem(ItemBase item, float health, float quantity)
Определения ItemBase.c:4875
bool m_IsTakeable
Определения ItemBase.c:4903
bool ShouldSplitQuantity(float quantity)
Определения ItemBase.c:6428
static ref map< string, int > m_WeaponTypeToID
Определения ItemBase.c:4943
string GetLockSoundSet()
Определения ItemBase.c:8629
string GetColorString()
Returns item's PROCEDURAL color as formated string, i.e. "#(argb,8,8,3)color(0.15,...
Определения ItemBase.c:8660
array< int > GetValidFinishers()
returns an array of possible finishers
Определения ItemBase.c:9590
void OnAttachmentQuantityChangedEx(ItemBase item, float delta)
Called on server side when some attachment's quantity is changed. Call super.OnAttachmentQuantityChan...
Определения ItemBase.c:6895
class ItemBase extends InventoryItem SpawnItemOnLocation(string object_name, notnull InventoryLocation loc, bool full_quantity)
Определения ItemBase.c:4855
ItemSoundHandler GetItemSoundHandler()
Определения ItemBase.c:9229
override int GetQuantityMin()
Определения ItemBase.c:8280
void SplitIntoStackMaxToInventoryLocationClient(notnull InventoryLocation dst)
Определения ItemBase.c:6634
override int GetQuickBarBonus()
Определения ItemBase.c:5119
override void SetTakeable(bool pState)
Определения ItemBase.c:9184
float m_OverheatingDecayInterval
Определения ItemBase.c:4952
void SetIsPlaceSound(bool is_place_sound)
override void SplitIntoStackMaxClient(EntityAI destination_entity, int slot_id)
Определения ItemBase.c:6448
void HierarchyCheck(out bool hasParent, out bool hasRootAsPlayer, out ItemBase refParentIB)
Определения ItemBase.c:9435
bool CanProcessDecay()
Определения ItemBase.c:9463
void RemoveAudioVisualsOnClient()
Определения Bottle_Base.c:151
void SoundSynchRemote()
static void AddDebugActionsMask(int mask)
Определения ItemBase.c:5630
void PlayDeployLoopSoundEx()
void RemoveLightSourceItem()
Определения ItemBase.c:9579
bool CanRepair(ItemBase item_repair_kit)
Определения ItemBase.c:7493
bool can_this_be_combined
Определения ItemBase.c:4908
EffectSound m_SoundDeploy
Определения ItemBase.c:9673
int m_Count
Определения ItemBase.c:4874
float GetBaitEffectivity()
generic effectivity as a bait for animal catching
Определения ItemBase.c:9626
float GetDeployTime()
how long it takes to deploy this item in seconds
Определения ItemBase.c:9176
override bool IsSplitable()
Определения ItemBase.c:6415
bool DamageItemAttachments(float damage)
Определения ItemBase.c:6399
override void WriteVarsToCTX(ParamsWriteContext ctx)
Определения ItemBase.c:7805
void ConvertEnergyToQuantity()
Определения ItemBase.c:8446
override void RemoveAllAgents()
Определения ItemBase.c:8785
override void SetQuantityToMinimum()
Определения ItemBase.c:8213
bool m_WantPlayImpactSound
Определения ItemBase.c:4889
override float GetTemperatureThawTime()
Определения ItemBase.c:9550
ref map< int, ref array< ref WeaponParticlesOnOverheating > > m_OnOverheatingEffect
Определения ItemBase.c:4942
int m_ColorComponentG
Определения ItemBase.c:4919
float m_StoreLoadedQuantity
Определения ItemBase.c:4876
void MessageToOwnerAction(string text)
Send message to owner player in yellow color.
Определения ItemBase.c:7560
int m_ColorComponentA
Определения ItemBase.c:4921
int m_VarQuantityInit
Определения ItemBase.c:4871
float GetFilterDamageRatio()
Определения ItemBase.c:5534
override void SetLiquidType(int value, bool allow_client=false)
Определения ItemBase.c:8673
void OnQuantityChanged(float delta)
Called on server side when this item's quantity is changed. Call super.OnQuantityChanged(); first whe...
Определения ItemBase.c:6865
void OnApply(PlayerBase player)
override void SetQuantityNormalized(float value, bool destroy_config=true, bool destroy_forced=false)
Sets quantity in normalized 0..1 form between the item's Min a Max values as defined by item's config...
Определения ItemBase.c:8220
bool m_HideSelectionsBySlot
Определения ItemBase.c:4956
bool IsOverheatingEffectActive()
Определения ItemBase.c:5397
void SetIsBeingPlaced(bool is_being_placed)
Определения ItemBase.c:5814
int GetLiquidContainerMask()
Определения ItemBase.c:5751
void SetInventoryLocationToVicinityOrCurrent(EntityAI root, inout InventoryLocation dst)
Определения ItemBase.c:7002
ref Timer m_CheckOverheating
Определения ItemBase.c:4949
void RegisterOverheatingParticle(Particle p, float min_heat_coef, float max_heat_coef, int particle_id, Object parent, vector local_pos, vector local_ori)
Определения ItemBase.c:5445
float GetEnergy()
Определения ItemBase.c:8420
bool CanBeDigged()
Определения ItemBase.c:5830
bool GetActionWidgetOverride(out typename name)
If we need a different (handheld)item action widget displayed, the logic goes in here.
Определения ItemBase.c:9596
bool IsNVG()
Определения ItemBase.c:5762
float GetUnitWeight(bool include_wetness=true)
Obsolete, use GetWeightEx instead.
Определения ItemBase.c:8380
void SetZoneDamageCEInit()
Sets zone damages to match randomized global health set by CE (CE spawn only)
Определения ItemBase.c:9372
bool m_IsDeploySound
Определения ItemBase.c:9675
bool CanEat()
Определения ItemBase.c:7453
static void PlayOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:9079
override bool IsOneHandedBehaviour()
Определения ItemBase.c:9150
void AddLightSourceItem(ItemBase lightsource)
Adds a light source child.
Определения ItemBase.c:9574
bool IsLiquidContainer()
Определения ItemBase.c:5746
FoodStage GetFoodStage()
overridden on Edible_Base; so we don't have to parse configs all the time
Определения ItemBase.c:7473
override float GetSingleInventoryItemWeightEx()
Определения ItemBase.c:8307
void SaveAgents(ParamsWriteContext ctx)
Определения ItemBase.c:8863
override int GetTargetQuantityMax(int attSlotID=-1)
Определения ItemBase.c:8261
int m_CleannessInit
Определения ItemBase.c:4885
float GetDisinfectQuantity(int system=0, Param param1=null)
Определения ItemBase.c:5529
override int GetAgents()
Определения ItemBase.c:8810
int m_VarQuantityMax
Определения ItemBase.c:4873
override bool IsHologram()
Определения ItemBase.c:5825
float GetItemAttachOffset()
Определения ItemBase.c:8589
bool IsPlaceSound()
Определения ItemBase.c:9689
static int GetDebugActionsMask()
Определения ItemBase.c:5615
void ProcessDecay(float delta, bool hasRootAsPlayer)
Определения ItemBase.c:9452
override bool IsItemBase()
Определения ItemBase.c:7606
void PlayDeploySound()
override bool IsTwoHandedBehaviour()
Определения ItemBase.c:9160
void ExplodeAmmo()
Определения ItemBase.c:6302
bool IsCombineAll(ItemBase other_item, bool use_stack_max=false)
Определения ItemBase.c:7078
float GetProtectionLevel(int type, bool consider_filter=false, int system=0)
Определения ItemBase.c:8884
static void PlayBulletCasingEjectParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:9059
override void OnEnergyAdded()
Определения ItemBase.c:8438
void AffectLiquidContainerOnFill(int liquid_type, float amount)
from enviro source
void AffectLiquidContainerOnTransfer(int liquidType, float amount, float sourceLiquidTemperature)
from other liquid container source
string GetExplosiveTriggerSlotName()
Определения ItemBase.c:5774
EffectSound m_DeployLoopSoundEx
Определения ItemBase.c:9672
override void DeSerializeNumericalVars(array< float > floats)
Определения ItemBase.c:7746
void StopItemDynamicPhysics()
Определения ItemBase.c:9354
bool HasFoodStage()
Определения ItemBase.c:7466
override void SetStoreLoad(bool value)
Определения ItemBase.c:8558
float GetOverheatingValue()
Определения ItemBase.c:5359
bool ContainsAgent(int agent_id)
Определения ItemBase.c:8763
override void AddWet(float value)
Определения ItemBase.c:8506
bool IsLiquidPresent()
Определения ItemBase.c:5741
bool IsFullQuantity()
Определения ItemBase.c:8301
override void EOnContact(IEntity other, Contact extra)
Определения ItemBase.c:6015
void SplitIntoStackMaxHands(PlayerBase player)
Определения ItemBase.c:6770
void SplitIntoStackMaxHandsClient(PlayerBase player)
Определения ItemBase.c:6746
int m_CleannessMax
Определения ItemBase.c:4887
float m_VarStackMax
Определения ItemBase.c:4875
ref Timer m_PhysDropTimer
Определения ItemBase.c:4962
void MessageToOwnerFriendly(string text)
Send message to owner player in green color.
Определения ItemBase.c:7578
override void SetStoreLoadedQuantity(float value)
Определения ItemBase.c:8568
bool m_IsResultOfSplit string m_SoundAttType
distinguish if item has been created as new or it came from splitting (server only flag)
Определения ItemBase.c:4916
void CheckOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
Определения ItemBase.c:5380
void UnlockFromParent()
Unlocks this item from its attachment slot of its parent.
Определения ItemBase.c:5695
bool Repair(PlayerBase player, ItemBase item_repair_kit, float specialty_weight)
Определения ItemBase.c:7500
void OnLiquidTypeChanged(int oldType, int newType)
Определения ItemBase.c:8694
void StartOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
Определения ItemBase.c:5426
void PlayDeployFinishSound()
bool AllowFoodConsumption()
Определения ItemBase.c:8616
bool m_IsOverheatingEffectActive
Определения ItemBase.c:4947
int m_LiquidContainerMask
Определения ItemBase.c:4897
void ProcessItemWetness(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
Определения ItemBase.c:9390
override int GetCleanness()
Определения ItemBase.c:8611
bool PairWithDevice(notnull ItemBase otherDevice)
Определения ItemBase.c:9601
bool IsDeploySound()
Определения ItemBase.c:9690
static void RemoveDebugActionsMask(int mask)
Определения ItemBase.c:5635
static void UpdateOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:9099
int m_VarQuantityMin
Определения ItemBase.c:4872
void PerformDamageSystemReinit()
Определения ItemBase.c:9360
override void ClearInventory()
Определения ItemBase.c:8399
static int m_LastRegisteredWeaponID
Определения ItemBase.c:4944
ItemBase GetLightSourceItem()
Определения ItemBase.c:9584
void MessageToOwnerImportant(string text)
Send message to owner player in red color.
Определения ItemBase.c:7596
override float GetItemOverheatThreshold()
Определения ItemBase.c:9534
void StopDeployLoopSoundEx()
bool m_CanThisBeSplit
Определения ItemBase.c:4909
override void SerializeNumericalVars(array< float > floats_out)
Определения ItemBase.c:7710
ItemBase SplitIntoStackMaxToInventoryLocationEx(notnull InventoryLocation dst)
Определения ItemBase.c:6685
float m_ItemModelLength
Определения ItemBase.c:4895
bool m_IsHologram
Определения ItemBase.c:4902
static int m_DebugActionsMask
Определения ItemBase.c:4862
void KillAllOverheatingParticles()
Определения ItemBase.c:5495
bool CanBeCookedOnStick()
Определения ItemBase.c:7483
override int GetQuantityMax()
Определения ItemBase.c:8248
void GetRecipesActions(Man player, out TSelectableActionInfoArray outputList)
Определения ItemBase.c:7156
void OnActivatedByTripWire()
bool IsColorSet()
Определения ItemBase.c:8654
override void RemoveAgent(int agent_id)
Определения ItemBase.c:8776
bool m_ItemBeingDroppedPhys
Определения ItemBase.c:4905
override bool CanPutAsAttachment(EntityAI parent)
Определения ItemBase.c:8966
void PlayDetachSound(string slot_type)
Определения ItemBase.c:9330
static ref map< typename, ref TInputActionMap > m_ItemTypeActionsMap
Определения ItemBase.c:4856
void ProcessItemWetnessAndTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
Определения ItemBase.c:9663
override bool IsBeingPlaced()
Определения ItemBase.c:5809
int GetQuantityInit()
Определения ItemBase.c:8285
float ComputeQuantityUsedEx(ItemBase other_item, bool use_stack_max=true)
Определения ItemBase.c:7098
bool IsResultOfSplit()
Определения ItemBase.c:7083
bool m_FixDamageSystemInit
Определения ItemBase.c:4907
float m_ImpactSpeed
Определения ItemBase.c:4891
bool m_IsStoreLoad
Определения ItemBase.c:4910
int GetLiquidTypeInit()
Определения ItemBase.c:8684
string GetDeployFinishSoundset()
ItemBase m_LightSourceItem
Определения ItemBase.c:4925
void LockToParent()
Locks this item in it's current attachment slot of its parent. This makes the "locked" icon visible i...
Определения ItemBase.c:5682
override void SplitIntoStackMaxEx(EntityAI destination_entity, int slot_id)
Определения ItemBase.c:6557
int m_AttachedAgents
Определения ItemBase.c:4933
string m_LockSoundSet
Определения ItemBase.c:4968
void LoadParticleConfigOnOverheating(int id)
Определения ItemBase.c:5303
float m_VarQuantityPrev
Определения ItemBase.c:4870
bool IsSoundSynchRemote()
Определения ItemBase.c:9688
bool m_CanShowQuantity
Определения ItemBase.c:4911
override void OnRightClick()
Определения ItemBase.c:6938
int m_ColorComponentB
Определения ItemBase.c:4920
static ref map< typename, ref TActionAnimOverrideMap > m_ItemActionOverrides
Определения ItemBase.c:4858
bool IsActionTargetVisible()
Определения ItemBase.c:9196
override void OnItemAttachmentSlotChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
Определения ItemBase.c:6050
override void EEHitBy(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
Определения ItemBase.c:6339
bool m_IsBeingPlaced
Определения ItemBase.c:4901
int NameToID(string name)
Определения ItemBase.c:7683
void ~ItemBase()
Определения ItemBase.c:5580
override void OnWetLevelChanged(EWetnessLevel newLevel, EWetnessLevel oldLevel)
Определения ItemBase.c:8546
void ClearStopItemSoundServer()
Определения ItemBase.c:9288
override string ChangeIntoOnDetach()
Определения ItemBase.c:6263
float m_VarWetMax
Определения ItemBase.c:4882
void SplitIntoStackMaxToInventoryLocation(notnull InventoryLocation dst)
Определения ItemBase.c:6680
int GetLockType()
Определения ItemBase.c:8624
EffectSound m_SoundDeployFinish
Определения ItemBase.c:9670
override float GetWet()
Определения ItemBase.c:8516
EffectSound m_SoundPlace
Определения ItemBase.c:9671
float GetQuantityNormalizedScripted()
Определения ItemBase.c:8234
override void SetCleanness(int value, bool allow_client=false)
Определения ItemBase.c:8598
bool m_IsPlaceSound
Определения ItemBase.c:9674
override float GetWetMin()
Определения ItemBase.c:8526
ref ItemSoundHandler m_ItemSoundHandler
Определения ItemBase.c:4974
override bool KindOf(string tag)
Определения ItemBase.c:7612
void ItemSoundHandler(ItemBase parent)
Определения ItemSoundHandler.c:31
string Type
Определения JsonDataContaminatedArea.c:11
EffectSound m_LockingSound
Определения Land_Underground_Entrance.c:321
string GetDebugText()
Определения ModifierBase.c:71
PlayerBase GetPlayer()
Определения ModifierBase.c:51
@ LOWEST
Определения PPEConstants.c:54
void PluginItemDiagnostic()
Определения PluginItemDiagnostic.c:74
PluginBase GetPlugin(typename plugin_type)
Определения PluginManager.c:316
EntityAI GetItem()
Определения RadialQuickbarMenu.c:37
override RemotelyActivatedItemBehaviour GetRemotelyActivatedItemBehaviour()
Определения RemoteDetonator.c:272
void RemoteDetonatorTrigger()
Определения RemoteDetonator.c:233
override void OnActivatedByItem(notnull ItemBase item)
Called when this item is activated by other.
Определения RemoteDetonator.c:305
int particle_id
Определения SmokeSimulation.c:28
ETemperatureAccessTypes
Определения TemperatureAccessConstants.c:2
override void Explode(int damageType, string ammoType="")
Определения Trap_LandMine.c:220
bool m_Initialized
Определения UiHintPanel.c:317
void Debug()
Определения UniversalTemperatureSource.c:349
int GetID()
Определения ActionBase.c:1360
void OnItemLocationChanged(ItemBase item)
Определения ActionBase.c:998
GetInputType()
Определения ActionBase.c:215
int m_StanceMask
Определения ActionBase.c:25
int m_CommandUIDProne
Определения ActionBase.c:24
int m_CommandUID
Определения ActionBase.c:23
void OnItemAttachedAtPlayer(EntityAI item, string slot_name)
Определения AnalyticsManagerClient.c:77
proto native UIManager GetUIManager()
proto bool ConfigGetChildName(string path, int index, out string name)
Get name of subclass in config class on path.
proto native float ConfigGetFloat(string path)
Get float value from config on path.
override ScriptCallQueue GetCallQueue(int call_category)
Определения DayZGame.c:1187
proto native void GizmoSelectObject(Object object)
proto native bool ConfigIsExisting(string path)
proto native void ConfigGetTextArray(string path, out TStringArray values)
Get array of strings from config on path.
proto native DayZPlayer GetPlayer()
proto native void GizmoSelectPhysics(Physics physics)
proto int GetTime()
returns mission time in milliseconds
proto native int ConfigGetType(string path)
Returns type of config value.
AnalyticsManagerClient GetAnalyticsClient()
Определения Global/game.c:1568
proto native int ConfigGetChildrenCount(string path)
Get count of subclasses in config class on path.
proto native SoundOnVehicle CreateSoundOnObject(Object source, string sound_name, float distance, bool looped, bool create_local=false)
proto native void ObjectDelete(Object obj)
proto native int GetItemCount()
proto native EntityAI GetItem(int index)
float GetEnergyAtSpawn()
Определения ComponentEnergyManager.c:1280
void SetEnergy0To1(float energy01)
Energy manager: Sets stored energy for this device between 0 and MAX based on relative input value be...
Определения ComponentEnergyManager.c:541
float GetEnergyMaxPristine()
Energy manager: Returns the maximum amount of energy this device can store. It's damage is NOT taken ...
Определения ComponentEnergyManager.c:1275
override void SetAutodestroy(bool auto_destroy)
Sets whether Effect automatically cleans up when it stops.
Определения EffectSound.c:603
bool IsSoundPlaying()
Get whether EffectSound is currently playing.
Определения EffectSound.c:274
override bool IsMan()
Определения 3_Game/Entities/Man.c:44
proto native bool EnumerateInventory(InventoryTraversalType tt, out array< EntityAI > items)
enumerate inventory using traversal type and filling items array
proto native CargoBase GetCargo()
cargo
Определения ItemBase.c:15
proto native bool IsValid()
verify current set inventory location
proto native EntityAI GetParent()
returns parent of current inventory location
proto native int GetSlot()
returns slot id if current type is Attachment
proto native int GetCol()
returns column of cargo if current type is Cargo / ProxyCargo
proto native int GetRow()
returns row of cargo if current type is Cargo / ProxyCargo
bool WriteToContext(ParamsWriteContext ctx)
Определения InventoryLocation.c:469
proto native int GetType()
returns type of InventoryLocation
proto native int GetIdx()
returns index of cargo if current type is Cargo / ProxyCargo
proto native void SetCargo(notnull EntityAI parent, EntityAI e, int idx, int row, int col, bool flip)
sets current inventory location type to Cargo with coordinates (idx, row, col)
proto native bool GetFlip()
returns flip status of cargo
proto native EntityAI GetItem()
returns item of current inventory location
InventoryLocation.
Определения InventoryLocation.c:29
override bool CanDisplayCargo()
Определения UndergroundStash.c:24
override void OnInventoryEnter(Man player)
Определения BarbedWire.c:203
override string GetFoldSoundset()
Определения BaseBuildingBase.c:108
override bool CanPutAsAttachment(EntityAI parent)
Определения ItemBase.c:6
override bool CanReceiveItemIntoCargo(EntityAI item)
Определения TentBase.c:913
override bool OnStoreLoad(ParamsReadContext ctx, int version)
Определения GardenBase.c:199
override void OnWasDetached(EntityAI parent, int slot_id)
override void EEOnAfterLoad()
Определения GardenBase.c:242
override void EEDelete(EntityAI parent)
Определения BaseBuildingBase.c:68
override bool CanBeRepairedByCrafting()
Определения TentBase.c:86
override void OnPlacementStarted(Man player)
Определения BatteryCharger.c:376
override void OnItemLocationChanged(EntityAI old_owner, EntityAI new_owner)
Определения BarbedWire.c:357
override bool IsElectricAppliance()
Определения BatteryCharger.c:43
override bool IsItemTent()
Определения TentBase.c:81
override void SetActions()
override string GetLoopFoldSoundset()
Определения BaseBuildingBase.c:113
override bool CanMakeGardenplot()
Определения FieldShovel.c:3
override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
Определения PowerGenerator.c:412
override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
Определения HandcuffsLocked.c:12
override WrittenNoteData GetWrittenNoteData()
Определения Paper.c:30
override int GetDamageSystemVersionChange()
Определения BaseBuildingBase.c:1238
override bool SetQuantity(float value, bool destroy_config=true, bool destroy_forced=false, bool allow_client=false, bool clamp_to_stack_max=true)
Определения PileOfWoodenPlanks.c:88
override void InitItemVariables()
Определения Matchbox.c:3
override void SetActionAnimOverrides()
Определения PickAxe.c:28
override void OnCreatePhysics()
Определения BaseBuildingBase.c:489
override string GetDeploySoundset()
Определения BarbedWire.c:392
override float GetBandagingEffectivity()
Определения BandageDressing.c:49
override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
Определения PowerGenerator.c:424
override void EEHealthLevelChanged(int oldLevel, int newLevel, string zone)
Определения BaseBuildingBase.c:496
override void OnStoreSave(ParamsWriteContext ctx)
Определения GardenBase.c:266
override void AfterStoreLoad()
Определения BarbedWire.c:155
override int GetOnDigWormsAmount()
Определения FieldShovel.c:27
override bool IsSelfAdjustingTemperature()
Определения PortableGasStove.c:287
override bool IsPlayerInside(PlayerBase player, string selection)
Определения BaseBuildingBase.c:1037
override void OnVariablesSynchronized()
Определения GardenBase.c:97
override void RefreshPhysics()
Определения BatteryCharger.c:359
override bool CanObstruct()
Определения BaseBuildingBase.c:84
override void OnWasAttached(EntityAI parent, int slot_id)
override bool CanReceiveAttachment(EntityAI attachment, int slotId)
Определения BaseBuildingBase.c:982
override bool CanPutInCargo(EntityAI parent)
Определения GardenBase.c:331
override string GetLoopDeploySoundset()
Определения BarbedWire.c:397
override void OnPlacementComplete(Man player, vector position="0 0 0", vector orientation="0 0 0")
Определения BarbedWire.c:372
override void OnInventoryExit(Man player)
Определения BatteryCharger.c:341
override bool IsTakeable()
Определения BaseBuildingBase.c:1008
override bool IsIgnoredByConstruction()
Определения BaseBuildingBase.c:1170
override void InitItemSounds()
Определения BaseBuildingBase.c:94
override void EEKilled(Object killer)
Определения HandcuffsLocked.c:70
override void OnCombine(ItemBase other_item)
Определения BandageDressing.c:71
override bool CanExplodeInFire()
Определения LargeGasCannister.c:3
override bool IsFacingPlayer(PlayerBase player, string selection)
Определения BaseBuildingBase.c:1032
override bool CanBeCombined(EntityAI other_item, bool reservation_check=true, bool stack_max_limit=false)
Определения Rag.c:61
override bool IsBloodContainer()
Определения BloodContainerBase.c:10
override bool IsClothing()
override bool CanBeSplit()
Определения Rag.c:34
override bool IsDeployable()
Определения BaseBuildingBase.c:365
override void OnRPC(PlayerIdentity sender, int rpc_type, ParamsReadContext ctx)
Определения ToolBase.c:24
override bool CanBeDisinfected()
Определения BandageDressing.c:54
override float GetInfectionChance(int system=0, Param param=null)
Определения BandageDressing.c:59
override void OnEndPlacement()
Определения KitBase.c:65
Определения EnMath.c:7
float GetOverheatingLimitMax()
Определения WeaponParticles.c:417
void SetOverheatingLimitMax(float max)
Определения WeaponParticles.c:407
void SetParticleParams(int particle_id, Object parent, vector local_pos, vector local_ori)
Определения WeaponParticles.c:422
float GetOverheatingLimitMin()
Определения WeaponParticles.c:412
Particle GetParticle()
Определения WeaponParticles.c:397
void SetOverheatingLimitMin(float min)
Определения WeaponParticles.c:402
void RegisterParticle(Particle p)
Определения WeaponParticles.c:392
void Stop()
Legacy function for backwards compatibility with 1.14 and below.
Определения Particle.c:266
void SetControlledDevice(EntityAI pDevice)
Определения RemoteDetonator.c:140
bool OnStoreLoad(ParamsReadContext ctx, int version)
void OnStoreSave(ParamsWriteContext ctx)
proto void Remove(func fn)
remove specific call from queue
proto void CallLater(func fn, int delay=0, bool repeat=false, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL)
adds call into the queue with given parameters and arguments (arguments are held in memory until the ...
proto native void Send()
proto bool Write(void value_out)
proto bool Read(void value_in)
bool m_Loop
Определения ItemSoundHandler.c:5
override void Stop()
Определения DayZPlayerImplement.c:64
proto native float GetDamage(string zoneName, string healthType)
UIScriptedMenu FindMenu(int id)
Returns menu with specific ID if it is open (see MenuID)
Определения UIManager.c:160
override void Refresh()
Определения ChatInputMenu.c:70
void SetCalcDetails(string details)
Определения 3_Game/tools/Debug.c:816
void OnRPC(PlayerIdentity sender, int rpc_type, ParamsReadContext ctx)
Определения WrittenNoteData.c:13
const float LOWEST
Определения EnConvert.c:100
Serializer ParamsReadContext
Определения gameplay.c:15
class LOD Object
InventoryTraversalType
tree traversal type, for more see http://en.wikipedia.org/wiki/Tree_traversal
Определения gameplay.c:6
proto native CGame GetGame()
Serializer ParamsWriteContext
Определения gameplay.c:16
const int DEF_BIOLOGICAL
Определения 3_Game/constants.c:512
const int DEF_CHEMICAL
Определения 3_Game/constants.c:513
const int COMP_TYPE_ENERGY_MANAGER
Определения Component.c:9
ErrorExSeverity
Определения EnDebug.c:62
void Error(string err)
Messagebox with error message.
Определения EnDebug.c:90
enum ShapeType ErrorEx
proto native void SetColor(int color)
array< string > TStringArray
Определения EnScript.c:709
array< int > TIntArray
Определения EnScript.c:711
EntityEvent
Entity events for event-mask, or throwing event from code.
Определения EnEntity.c:45
static const float ITEM_TEMPERATURE_NEUTRAL_ZONE_MIDDLE
Определения 3_Game/constants.c:808
const int VARIABLE_LIQUIDTYPE
Определения 3_Game/constants.c:632
const int VARIABLE_CLEANNESS
Определения 3_Game/constants.c:635
const int VARIABLE_COLOR
Определения 3_Game/constants.c:634
const int VARIABLE_TEMPERATURE
Определения 3_Game/constants.c:630
const int VARIABLE_QUANTITY
Определения 3_Game/constants.c:628
const int VARIABLE_WET
Определения 3_Game/constants.c:631
const int LIQUID_NONE
Определения 3_Game/constants.c:529
static proto float AbsFloat(float f)
Returns absolute value.
const int MENU_INVENTORY
Определения 3_Game/constants.c:180
proto native bool dBodyIsDynamic(notnull IEntity ent)
const int SAT_CRAFTING
Определения 3_Game/constants.c:453
const int SAT_DEBUG_ACTION
Определения 3_Game/constants.c:454
class JsonUndergroundAreaTriggerData GetPosition
Определения UndergroundAreaLoader.c:9
static proto string Format(string fmt, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL)
Gets n-th character from string.
const int CALL_CATEGORY_GAMEPLAY
Определения 3_Game/tools/tools.c:10
const int CALL_CATEGORY_SYSTEM
Определения 3_Game/tools/tools.c:8
proto native int GetColor()

Используется в InventoryItem::GetQuantityNormalized(), InventoryItem::HasQuantity(), InventoryItem::InitItemVariables(), InventoryItem::OnWasAttached(), InventoryItem::OnWasDetached(), Release(), InventoryItem::SetQuantity() и InventoryItem::SetQuantityToMinimum().