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

◆ OnLiquidTypeChanged()

void SpawnItemOnLocation::OnLiquidTypeChanged ( int oldType,
int newType )
protected

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

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