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

◆ IsStoreLoad()

override bool SpawnItemOnLocation::IsStoreLoad ( )
protected

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

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

Используется в InventoryItem::ReadVarsFromCTX().