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

◆ OnInventoryExit()

void SpawnItemOnLocation::OnInventoryExit ( Man player)
protected

Event called on item when it is removed from the player(Man) inventory, passes the old owner as a parameter.

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

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