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

◆ SetCleanness()

override void SpawnItemOnLocation::SetCleanness ( int value,
bool allow_client = false )
protected

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

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

Используется в InventoryItem::DeSerializeNumericalVars(), InventoryItem::EEHealthLevelChanged(), ItemBase::OnCombine(), SewingKit::OnCombine() и InventoryItem::ReadVarsFromCTX().