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

◆ IsCargoException4x3()

bool SpawnItemOnLocation::IsCargoException4x3 ( EntityAI item)
protected

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

9567{
9568 override bool CanPutAsAttachment(EntityAI parent)
9569 {
9570 return true;
9571 }
9572};
9573
9574//const bool QUANTITY_DEBUG_REMOVE_ME = false;
9575
9576class ItemBase extends InventoryItem
9577{
9581
9583
9584 static int m_DebugActionsMask;
9586 // ============================================
9587 // Variable Manipulation System
9588 // ============================================
9589 // Quantity
9590
9591 float m_VarQuantity;
9592 float m_VarQuantityPrev;//for client to know quantity changed during synchronization
9594 int m_VarQuantityMin;
9595 int m_VarQuantityMax;
9596 int m_Count;
9597 float m_VarStackMax;
9598 float m_StoreLoadedQuantity = float.LOWEST;
9599 // Wet
9600 float m_VarWet;
9601 float m_VarWetPrev;//for client to know wetness changed during synchronization
9602 float m_VarWetInit;
9603 float m_VarWetMin;
9604 float m_VarWetMax;
9605 // Cleanness
9606 int m_Cleanness;
9607 int m_CleannessInit;
9608 int m_CleannessMin;
9609 int m_CleannessMax;
9610 // impact sounds
9612 bool m_CanPlayImpactSound = true;
9613 float m_ImpactSpeed;
9615 //
9616 float m_HeatIsolation;
9617 float m_ItemModelLength;
9618 float m_ItemAttachOffset; // Offset length for when the item is attached e.g. to weapon
9620 int m_VarLiquidType;
9621 int m_ItemBehaviour; // -1 = not specified; 0 = heavy item; 1= onehanded item; 2 = twohanded item
9622 int m_QuickBarBonus;
9623 bool m_IsBeingPlaced;
9624 bool m_IsHologram;
9625 bool m_IsTakeable;
9626 bool m_ThrowItemOnDrop;
9629 bool m_FixDamageSystemInit = false; //can be changed on storage version check
9630 bool can_this_be_combined; //Check if item can be combined
9631 bool m_CanThisBeSplit; //Check if item can be split
9632 bool m_IsStoreLoad = false;
9633 bool m_CanShowQuantity;
9634 bool m_HasQuantityBar;
9635 protected bool m_CanBeDigged;
9636 protected bool m_IsResultOfSplit
9637
9638 string m_SoundAttType;
9639 // items color variables
9644 //-------------------------------------------------------
9645
9646 // light source managing
9648
9652
9653 //==============================================
9654 // agent system
9655 private int m_AttachedAgents;
9656
9658 void TransferModifiers(PlayerBase reciever);
9659
9660
9661 // Weapons & suppressors particle effects
9666 static int m_LastRegisteredWeaponID = 0;
9667
9668 // Overheating effects
9670 float m_OverheatingShots;
9671 ref Timer m_CheckOverheating;
9672 int m_ShotsToStartOverheating = 0; // After these many shots, the overheating effect begins
9673 int m_MaxOverheatingValue = 0; // Limits the number of shots that will be tracked
9674 float m_OverheatingDecayInterval = 1; // Timer's interval for decrementing overheat effect's lifespan
9675 ref array <ref OverheatingParticle> m_OverheatingParticles;
9676
9678 protected bool m_HideSelectionsBySlot;
9679
9680 // Admin Log
9681 PluginAdminLog m_AdminLog;
9682
9683 // misc
9684 ref Timer m_PhysDropTimer;
9685
9686 // Attachment Locking variables
9687 ref array<int> m_CompatibleLocks;
9688 protected int m_LockType;
9689 protected ref EffectSound m_LockingSound;
9690 protected string m_LockSoundSet;
9691
9692 // ItemSoundHandler
9693 protected const int ITEM_SOUNDS_MAX = 63; // optimize network synch
9694 protected int m_SoundSyncPlay; // id for sound to play
9695 protected int m_SoundSyncStop; // id for sound to stop
9697
9698 //temperature
9699 private float m_TemperaturePerQuantityWeight;
9700
9701 // -------------------------------------------------------------------------
9702 void ItemBase()
9703 {
9704 SetEventMask(EntityEvent.INIT); // Enable EOnInit event
9708
9709 if (!GetGame().IsDedicatedServer())
9710 {
9711 if (HasMuzzle())
9712 {
9714
9716 {
9718 }
9719 }
9720
9722 m_ActionsInitialize = false;
9723 }
9724
9725 m_OldLocation = null;
9726
9727 if (GetGame().IsServer())
9728 {
9729 m_AdminLog = PluginAdminLog.Cast(GetPlugin(PluginAdminLog));
9730 }
9731
9732 if (ConfigIsExisting("headSelectionsToHide"))
9733 {
9735 ConfigGetTextArray("headSelectionsToHide",m_HeadHidingSelections);
9736 }
9737
9738 m_HideSelectionsBySlot = false;
9739 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
9740 {
9741 m_HideSelectionsBySlot = ConfigGetBool("hideSelectionsByinventorySlot");
9742 }
9743
9744 m_QuickBarBonus = Math.Max(0, ConfigGetInt("quickBarBonus"));
9745
9746 m_IsResultOfSplit = false;
9747
9749 }
9750
9751 override void InitItemVariables()
9752 {
9753 super.InitItemVariables();
9754
9755 m_VarQuantityInit = ConfigGetInt("varQuantityInit");
9756 m_VarQuantity = m_VarQuantityInit;//should be by the CE, this is just a precaution
9757 m_VarQuantityMin = ConfigGetInt("varQuantityMin");
9758 m_VarQuantityMax = ConfigGetInt("varQuantityMax");
9759 m_VarStackMax = ConfigGetFloat("varStackMax");
9760 m_Count = ConfigGetInt("count");
9761
9762 m_CanShowQuantity = ConfigGetBool("quantityShow");
9763 m_HasQuantityBar = ConfigGetBool("quantityBar");
9764
9765 m_CleannessInit = ConfigGetInt("varCleannessInit");
9767 m_CleannessMin = ConfigGetInt("varCleannessMin");
9768 m_CleannessMax = ConfigGetInt("varCleannessMax");
9769
9770 m_WantPlayImpactSound = false;
9771 m_ImpactSpeed = 0.0;
9772
9773 m_VarWetInit = ConfigGetFloat("varWetInit");
9775 m_VarWetMin = ConfigGetFloat("varWetMin");
9776 m_VarWetMax = ConfigGetFloat("varWetMax");
9777
9778 m_LiquidContainerMask = ConfigGetInt("liquidContainerType");
9779 if (IsLiquidContainer() && GetQuantity() != 0)
9781 m_IsBeingPlaced = false;
9782 m_IsHologram = false;
9783 m_IsTakeable = true;
9784 m_CanBeMovedOverride = false;
9788 m_CanBeDigged = ConfigGetBool("canBeDigged");
9789
9790 m_CompatibleLocks = new array<int>();
9791 ConfigGetIntArray("compatibleLocks", m_CompatibleLocks);
9792 m_LockType = ConfigGetInt("lockType");
9793
9794 //Define if item can be split and set ability to be combined accordingly
9795 m_CanThisBeSplit = false;
9796 can_this_be_combined = false;
9797 if (ConfigIsExisting("canBeSplit"))
9798 {
9799 can_this_be_combined = ConfigGetBool("canBeSplit");
9801 }
9802
9803 m_ItemBehaviour = -1;
9804 if (ConfigIsExisting("itemBehaviour"))
9805 m_ItemBehaviour = ConfigGetInt("itemBehaviour");
9806
9807 //RegisterNetSyncVariableInt("m_VariablesMask");
9808 if (HasQuantity()) RegisterNetSyncVariableFloat("m_VarQuantity", GetQuantityMin(), m_VarQuantityMax);
9809 RegisterNetSyncVariableFloat("m_VarWet", GetWetMin(), GetWetMax(), 2);
9810 RegisterNetSyncVariableInt("m_VarLiquidType");
9811 RegisterNetSyncVariableInt("m_Cleanness",0,1);
9812
9813 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
9814 RegisterNetSyncVariableFloat("m_ImpactSpeed");
9815 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
9816
9817 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
9818 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
9819 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
9820 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
9821
9822 RegisterNetSyncVariableBool("m_IsBeingPlaced");
9823 RegisterNetSyncVariableBool("m_IsTakeable");
9824 RegisterNetSyncVariableBool("m_IsHologram");
9825
9826 InitItemSounds();
9828 {
9829 RegisterNetSyncVariableInt("m_SoundSyncPlay", 0, ITEM_SOUNDS_MAX);
9830 RegisterNetSyncVariableInt("m_SoundSyncStop", 0, ITEM_SOUNDS_MAX);
9831 }
9832
9833 m_LockSoundSet = ConfigGetString("lockSoundSet");
9834
9836 if (ConfigIsExisting("temperaturePerQuantityWeight"))
9837 m_TemperaturePerQuantityWeight = ConfigGetFloat("temperaturePerQuantityWeight");
9838
9839 }
9840
9841 override int GetQuickBarBonus()
9842 {
9843 return m_QuickBarBonus;
9844 }
9845
9846 void InitializeActions()
9847 {
9849 if (!m_InputActionMap)
9850 {
9852 m_InputActionMap = iam;
9853 SetActions();
9855 }
9856 }
9857
9858 override void GetActions(typename action_input_type, out array<ActionBase_Basic> actions)
9859 {
9861 {
9862 m_ActionsInitialize = true;
9864 }
9865
9866 actions = m_InputActionMap.Get(action_input_type);
9867 }
9868
9869 void SetActions()
9870 {
9871 AddAction(ActionTakeItem);
9872 AddAction(ActionTakeItemToHands);
9873 AddAction(ActionWorldCraft);
9875 AddAction(ActionAttachWithSwitch);
9876 }
9877
9878 void SetActionAnimOverrides(); // Override action animation for specific item
9879
9880 void AddAction(typename actionName)
9881 {
9882 ActionBase action = ActionManagerBase.GetAction(actionName);
9883
9884 if (!action)
9885 {
9886 Debug.LogError("Action " + actionName + " dosn't exist!");
9887 return;
9888 }
9889
9890 typename ai = action.GetInputType();
9891 if (!ai)
9892 {
9893 m_ActionsInitialize = false;
9894 return;
9895 }
9896
9897 array<ActionBase_Basic> action_array = m_InputActionMap.Get(ai);
9898 if (!action_array)
9899 {
9900 action_array = new array<ActionBase_Basic>;
9901 m_InputActionMap.Insert(ai, action_array);
9902 }
9903 if (LogManager.IsActionLogEnable())
9904 {
9905 Debug.ActionLog(action.ToString() + " -> " + ai, this.ToString() , "n/a", "Add action");
9906 }
9907
9908 if (action_array.Find(action) != -1)
9909 {
9910 Debug.Log("Action " + action.Type() + " already added to " + this + ", skipping!");
9911 }
9912 else
9913 {
9914 action_array.Insert(action);
9915 }
9916 }
9917
9918 void RemoveAction(typename actionName)
9919 {
9920 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
9921 ActionBase action = player.GetActionManager().GetAction(actionName);
9922 typename ai = action.GetInputType();
9923 array<ActionBase_Basic> action_array = m_InputActionMap.Get(ai);
9924
9925 if (action_array)
9926 {
9927 action_array.RemoveItem(action);
9928 }
9929 }
9930
9931 // Allows override of default action command per item, defined in the SetActionAnimOverrides() of the item's class
9932 // Set -1 for params which should stay in default state
9933 void OverrideActionAnimation(typename action, int commandUID, int stanceMask = -1, int commandUIDProne = -1)
9934 {
9935 ActionOverrideData overrideData = new ActionOverrideData();
9936 overrideData.m_CommandUID = commandUID;
9937 overrideData.m_CommandUIDProne = commandUIDProne;
9938 overrideData.m_StanceMask = stanceMask;
9939
9940 TActionAnimOverrideMap actionMap = m_ItemActionOverrides.Get(action);
9941 if (!actionMap) // create new map of action > overidables map
9942 {
9943 actionMap = new TActionAnimOverrideMap();
9944 m_ItemActionOverrides.Insert(action, actionMap);
9945 }
9946
9947 actionMap.Insert(this.Type(), overrideData); // insert item -> overrides
9948
9949 }
9950
9951 void OnItemInHandsPlayerSwimStart(PlayerBase player);
9952
9953 ScriptedLightBase GetLight();
9954
9955 // Loads muzzle flash particle configuration from config and saves it to a map for faster access
9956 void LoadParticleConfigOnFire(int id)
9957 {
9958 if (!m_OnFireEffect)
9960
9963
9964 string config_to_search = "CfgVehicles";
9965 string muzzle_owner_config;
9966
9967 if (!m_OnFireEffect.Contains(id))
9968 {
9969 if (IsInherited(Weapon))
9970 config_to_search = "CfgWeapons";
9971
9972 muzzle_owner_config = config_to_search + " " + GetType() + " ";
9973
9974 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
9975
9976 int config_OnFire_subclass_count = GetGame().ConfigGetChildrenCount(config_OnFire_class);
9977
9978 if (config_OnFire_subclass_count > 0)
9979 {
9980 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
9981
9982 for (int i = 0; i < config_OnFire_subclass_count; i++)
9983 {
9984 string particle_class = "";
9985 GetGame().ConfigGetChildName(config_OnFire_class, i, particle_class);
9986 string config_OnFire_entry = config_OnFire_class + particle_class;
9987 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
9988 WPOF_array.Insert(WPOF);
9989 }
9990
9991
9992 m_OnFireEffect.Insert(id, WPOF_array);
9993 }
9994 }
9995
9996 if (!m_OnBulletCasingEjectEffect.Contains(id))
9997 {
9998 config_to_search = "CfgWeapons"; // Bullet Eject efect is supported on weapons only.
9999 muzzle_owner_config = config_to_search + " " + GetType() + " ";
10000
10001 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
10002
10003 int config_OnBulletCasingEject_count = GetGame().ConfigGetChildrenCount(config_OnBulletCasingEject_class);
10004
10005 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
10006 {
10007 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
10008
10009 for (i = 0; i < config_OnBulletCasingEject_count; i++)
10010 {
10011 string particle_class2 = "";
10012 GetGame().ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
10013 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
10014 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
10015 WPOBE_array.Insert(WPOBE);
10016 }
10017
10018
10019 m_OnBulletCasingEjectEffect.Insert(id, WPOBE_array);
10020 }
10021 }
10022 }
10023
10024 // Loads muzzle flash particle configuration from config and saves it to a map for faster access
10026 {
10029
10030 if (!m_OnOverheatingEffect.Contains(id))
10031 {
10032 string config_to_search = "CfgVehicles";
10033
10034 if (IsInherited(Weapon))
10035 config_to_search = "CfgWeapons";
10036
10037 string muzzle_owner_config = config_to_search + " " + GetType() + " ";
10038 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
10039
10040 if (GetGame().ConfigIsExisting(config_OnOverheating_class))
10041 {
10042
10043 m_ShotsToStartOverheating = GetGame().ConfigGetFloat(config_OnOverheating_class + "shotsToStartOverheating");
10044
10046 {
10047 m_ShotsToStartOverheating = -1; // This prevents futher readings from config for future creations of this item
10048 string error = "Error reading config " + GetType() + ">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
10049 Error(error);
10050 return;
10051 }
10052
10053 m_OverheatingDecayInterval = GetGame().ConfigGetFloat(config_OnOverheating_class + "overheatingDecayInterval");
10054 m_MaxOverheatingValue = GetGame().ConfigGetFloat(config_OnOverheating_class + "maxOverheatingValue");
10055
10056
10057
10058 int config_OnOverheating_subclass_count = GetGame().ConfigGetChildrenCount(config_OnOverheating_class);
10059 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
10060
10061 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
10062 {
10063 string particle_class = "";
10064 GetGame().ConfigGetChildName(config_OnOverheating_class, i, particle_class);
10065 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
10066 int entry_type = GetGame().ConfigGetType(config_OnOverheating_entry);
10067
10068 if (entry_type == CT_CLASS)
10069 {
10070 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
10071 WPOOH_array.Insert(WPOF);
10072 }
10073 }
10074
10075
10076 m_OnOverheatingEffect.Insert(id, WPOOH_array);
10077 }
10078 }
10079 }
10080
10081 float GetOverheatingValue()
10082 {
10083 return m_OverheatingShots;
10084 }
10085
10086 void IncreaseOverheating(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
10087 {
10088 if (m_MaxOverheatingValue > 0)
10089 {
10091
10092 if (!m_CheckOverheating)
10094
10096 m_CheckOverheating.Run(m_OverheatingDecayInterval, this, "OnOverheatingDecay");
10097
10098 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10099 }
10100 }
10101
10102 void CheckOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
10103 {
10105 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10106
10108 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10109
10111 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10112
10114 {
10116 }
10117 }
10118
10120 {
10122 }
10123
10124 void OnOverheatingDecay()
10125 {
10126 if (m_MaxOverheatingValue > 0)
10127 m_OverheatingShots -= 1 + m_OverheatingShots / m_MaxOverheatingValue; // The hotter a barrel is, the faster it needs to cool down.
10128 else
10130
10131 if (m_OverheatingShots <= 0)
10132 {
10135 }
10136 else
10137 {
10138 if (!m_CheckOverheating)
10140
10142 m_CheckOverheating.Run(m_OverheatingDecayInterval, this, "OnOverheatingDecay");
10143 }
10144
10145 CheckOverheating(this, "", this);
10146 }
10147
10148 void StartOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
10149 {
10151 ItemBase.PlayOverheatingParticles(this, ammoType, this, suppressor, "CfgWeapons");
10152 }
10153
10154 void UpdateOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
10155 {
10157 ItemBase.UpdateOverheatingParticles(this, ammoType, this, suppressor, "CfgWeapons");
10159 }
10160
10161 void StopOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
10162 {
10164 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10165 }
10166
10167 void RegisterOverheatingParticle(Particle p, float min_heat_coef, float max_heat_coef, int particle_id, Object parent, vector local_pos, vector local_ori)
10168 {
10170 m_OverheatingParticles = new array<ref OverheatingParticle>;
10171
10172 OverheatingParticle OP = new OverheatingParticle();
10173 OP.RegisterParticle(p);
10174 OP.SetOverheatingLimitMin(min_heat_coef);
10175 OP.SetOverheatingLimitMax(max_heat_coef);
10176 OP.SetParticleParams(particle_id, parent, local_pos, local_ori);
10177
10178 m_OverheatingParticles.Insert(OP);
10179 }
10180
10181 float GetOverheatingCoef()
10182 {
10183 if (m_MaxOverheatingValue > 0)
10185
10186 return -1;
10187 }
10188
10190 {
10192 {
10193 float overheat_coef = GetOverheatingCoef();
10194 int count = m_OverheatingParticles.Count();
10195
10196 for (int i = count; i > 0; --i)
10197 {
10198 int id = i - 1;
10199 OverheatingParticle OP = m_OverheatingParticles.Get(id);
10200 Particle p = OP.GetParticle();
10201
10202 float overheat_min = OP.GetOverheatingLimitMin();
10203 float overheat_max = OP.GetOverheatingLimitMax();
10204
10205 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
10206 {
10207 if (p)
10208 {
10209 p.Stop();
10210 OP.RegisterParticle(null);
10211 }
10212 }
10213 }
10214 }
10215 }
10216
10218 {
10220 {
10221 for (int i = m_OverheatingParticles.Count(); i > 0; i--)
10222 {
10223 int id = i - 1;
10224 OverheatingParticle OP = m_OverheatingParticles.Get(id);
10225
10226 if (OP)
10227 {
10228 Particle p = OP.GetParticle();
10229
10230 if (p)
10231 {
10232 p.Stop();
10233 }
10234
10235 delete OP;
10236 }
10237 }
10238
10239 m_OverheatingParticles.Clear();
10241 }
10242 }
10243
10245 float GetInfectionChance(int system = 0, Param param = null)
10246 {
10247 return 0.0;
10248 }
10249
10250
10251 float GetDisinfectQuantity(int system = 0, Param param1 = null)
10252 {
10253 return 250;//default value
10254 }
10255
10256 float GetFilterDamageRatio()
10257 {
10258 return 0;
10259 }
10260
10262 bool HasMuzzle()
10263 {
10264 if (IsInherited(Weapon) || IsInherited(SuppressorBase))
10265 return true;
10266
10267 return false;
10268 }
10269
10271 int GetMuzzleID()
10272 {
10273 if (!m_WeaponTypeToID)
10275
10276 if (m_WeaponTypeToID.Contains(GetType()))
10277 {
10278 return m_WeaponTypeToID.Get(GetType());
10279 }
10280 else
10281 {
10282 // Register new weapon ID
10284 }
10285
10287 }
10288
10295 {
10296 return -1;
10297 }
10298
10299
10300
10301 // -------------------------------------------------------------------------
10302 void ~ItemBase()
10303 {
10304 if (GetGame() && GetGame().GetPlayer() && (!GetGame().IsDedicatedServer()))
10305 {
10306 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
10307 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10308
10309 if (r_index >= 0)
10310 {
10311 InventoryLocation r_il = new InventoryLocation;
10312 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10313
10314 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10315 int r_type = r_il.GetType();
10316 if (r_type == InventoryLocationType.CARGO || r_type == InventoryLocationType.PROXYCARGO)
10317 {
10318 r_il.GetParent().GetOnReleaseLock().Invoke(this);
10319 }
10320 else if (r_type == InventoryLocationType.ATTACHMENT)
10321 {
10322 r_il.GetParent().GetOnAttachmentReleaseLock().Invoke(this, r_il.GetSlot());
10323 }
10324
10325 }
10326
10327 player.GetHumanInventory().ClearUserReservedLocation(this);
10328 }
10329
10330 if (m_LockingSound)
10331 SEffectManager.DestroyEffect(m_LockingSound);
10332 }
10333
10334
10335
10336 // -------------------------------------------------------------------------
10337 static int GetDebugActionsMask()
10338 {
10339 return ItemBase.m_DebugActionsMask;
10340 }
10341
10342 static bool HasDebugActionsMask(int mask)
10343 {
10344 return ItemBase.m_DebugActionsMask & mask;
10345 }
10346
10347 static void SetDebugActionsMask(int mask)
10348 {
10349 ItemBase.m_DebugActionsMask = mask;
10350 }
10351
10352 static void AddDebugActionsMask(int mask)
10353 {
10354 ItemBase.m_DebugActionsMask |= mask;
10355 }
10356
10357 static void RemoveDebugActionsMask(int mask)
10358 {
10359 ItemBase.m_DebugActionsMask &= ~mask;
10360 }
10361
10362 static void ToggleDebugActionsMask(int mask)
10363 {
10364 if (HasDebugActionsMask(mask))
10365 {
10367 }
10368 else
10369 {
10370 AddDebugActionsMask(mask);
10371 }
10372 }
10373
10374 // -------------------------------------------------------------------------
10375 void SetCEBasedQuantity()
10376 {
10377 if (GetEconomyProfile())
10378 {
10379 float q_max = GetEconomyProfile().GetQuantityMax();
10380 if (q_max > 0)
10381 {
10382 float q_min = GetEconomyProfile().GetQuantityMin();
10383 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
10384
10385 if (HasComponent(COMP_TYPE_ENERGY_MANAGER))//more direct access for speed
10386 {
10387 ComponentEnergyManager comp = GetCompEM();
10388 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
10389 {
10390 comp.SetEnergy0To1(quantity_randomized);
10391 }
10392 }
10393 else if (HasQuantity())
10394 {
10395 SetQuantityNormalized(quantity_randomized, false);
10396 //PrintString("<==> Normalized quantity for item: "+ GetType()+", qmin:"+q_min.ToString()+"; qmax:"+q_max.ToString()+";quantity:" +quantity_randomized.ToString());
10397 }
10398
10399 }
10400 }
10401 }
10402
10404 void LockToParent()
10405 {
10406 EntityAI parent = GetHierarchyParent();
10407
10408 if (parent)
10409 {
10410 InventoryLocation inventory_location_to_lock = new InventoryLocation;
10411 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
10412 parent.GetInventory().SetSlotLock(inventory_location_to_lock.GetSlot(), true);
10413 }
10414 }
10415
10417 void UnlockFromParent()
10418 {
10419 EntityAI parent = GetHierarchyParent();
10420
10421 if (parent)
10422 {
10423 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
10424 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
10425 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.GetSlot(), false);
10426 }
10427 }
10428
10429 override void CombineItemsClient(EntityAI entity2, bool use_stack_max = true)
10430 {
10431 /*
10432 ref Param1<EntityAI> item = new Param1<EntityAI>(entity2);
10433 RPCSingleParam(ERPCs.RPC_ITEM_COMBINE, item, GetGame().GetPlayer());
10434 */
10435 ItemBase item2 = ItemBase.Cast(entity2);
10436
10437 if (GetGame().IsClient())
10438 {
10439 if (ScriptInputUserData.CanStoreInputUserData())
10440 {
10441 ScriptInputUserData ctx = new ScriptInputUserData;
10443 ctx.Write(-1);
10444 ItemBase i1 = this; // @NOTE: workaround for correct serialization
10445 ctx.Write(i1);
10446 ctx.Write(item2);
10447 ctx.Write(use_stack_max);
10448 ctx.Write(-1);
10449 ctx.Send();
10450
10451 if (IsCombineAll(item2, use_stack_max))
10452 {
10453 GetGame().GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
10454 }
10455 }
10456 }
10457 else if (!GetGame().IsMultiplayer())
10458 {
10459 CombineItems(item2, use_stack_max);
10460 }
10461 }
10462
10463 bool IsLiquidPresent()
10464 {
10465 return (GetLiquidType() != 0 && HasQuantity());
10466 }
10467
10468 bool IsLiquidContainer()
10469 {
10470 return m_LiquidContainerMask != 0;
10471 }
10472
10474 {
10475 return m_LiquidContainerMask;
10476 }
10477
10478 bool IsBloodContainer()
10479 {
10480 //m_LiquidContainerMask & GROUP_LIQUID_BLOOD ???
10481 return false;
10482 }
10483
10484 bool IsNVG()
10485 {
10486 return false;
10487 }
10488
10491 bool IsExplosive()
10492 {
10493 return false;
10494 }
10495
10497 {
10498 return "";
10499 }
10500
10502
10503 bool IsLightSource()
10504 {
10505 return false;
10506 }
10507
10509 {
10510 return true;
10511 }
10512
10513 //--- ACTION CONDITIONS
10514 //direction
10515 bool IsFacingPlayer(PlayerBase player, string selection)
10516 {
10517 return true;
10518 }
10519
10520 bool IsPlayerInside(PlayerBase player, string selection)
10521 {
10522 return true;
10523 }
10524
10525 override bool CanObstruct()
10526 {
10527 PlayerBase player = PlayerBase.Cast(g_Game.GetPlayer());
10528 return !player || !IsPlayerInside(player, "");
10529 }
10530
10531 override bool IsBeingPlaced()
10532 {
10533 return m_IsBeingPlaced;
10534 }
10535
10536 void SetIsBeingPlaced(bool is_being_placed)
10537 {
10538 m_IsBeingPlaced = is_being_placed;
10539 if (!is_being_placed)
10541 SetSynchDirty();
10542 }
10543
10544 //server-side
10545 void OnEndPlacement() {}
10546
10547 override bool IsHologram()
10548 {
10549 return m_IsHologram;
10550 }
10551
10552 bool CanBeDigged()
10553 {
10554 return m_CanBeDigged;
10555 }
10556
10558 {
10559 return 1;
10560 }
10561
10562 bool CanMakeGardenplot()
10563 {
10564 return false;
10565 }
10566
10567 void SetIsHologram(bool is_hologram)
10568 {
10569 m_IsHologram = is_hologram;
10570 SetSynchDirty();
10571 }
10572 /*
10573 protected float GetNutritionalEnergy()
10574 {
10575 Edible_Base edible = Edible_Base.Cast(this);
10576 return edible.GetFoodEnergy();
10577 }
10578
10579 protected float GetNutritionalWaterContent()
10580 {
10581 Edible_Base edible = Edible_Base.Cast(this);
10582 return edible.GetFoodWater();
10583 }
10584
10585 protected float GetNutritionalIndex()
10586 {
10587 Edible_Base edible = Edible_Base.Cast(this);
10588 return edible.GetFoodNutritionalIndex();
10589 }
10590
10591 protected float GetNutritionalFullnessIndex()
10592 {
10593 Edible_Base edible = Edible_Base.Cast(this);
10594 return edible.GetFoodTotalVolume();
10595 }
10596
10597 protected float GetNutritionalToxicity()
10598 {
10599 Edible_Base edible = Edible_Base.Cast(this);
10600 return edible.GetFoodToxicity();
10601
10602 }
10603 */
10604
10605
10606 // -------------------------------------------------------------------------
10607 override void OnMovedInsideCargo(EntityAI container)
10608 {
10609 super.OnMovedInsideCargo(container);
10610
10611 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10612 }
10613
10614 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
10615 {
10616 super.EEItemLocationChanged(oldLoc,newLoc);
10617
10618 PlayerBase new_player = null;
10619 PlayerBase old_player = null;
10620
10621 if (newLoc.GetParent())
10622 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
10623
10624 if (oldLoc.GetParent())
10625 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
10626
10627 if (old_player && oldLoc.GetType() == InventoryLocationType.HANDS)
10628 {
10629 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
10630
10631 if (r_index >= 0)
10632 {
10633 InventoryLocation r_il = new InventoryLocation;
10634 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10635
10636 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10637 int r_type = r_il.GetType();
10638 if (r_type == InventoryLocationType.CARGO || r_type == InventoryLocationType.PROXYCARGO)
10639 {
10640 r_il.GetParent().GetOnReleaseLock().Invoke(this);
10641 }
10642 else if (r_type == InventoryLocationType.ATTACHMENT)
10643 {
10644 r_il.GetParent().GetOnAttachmentReleaseLock().Invoke(this, r_il.GetSlot());
10645 }
10646
10647 }
10648 }
10649
10650 if (newLoc.GetType() == InventoryLocationType.HANDS)
10651 {
10652 if (new_player)
10653 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
10654
10655 if (new_player == old_player)
10656 {
10657
10658 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
10659 {
10660 if (oldLoc.GetType() == InventoryLocationType.CARGO)
10661 {
10662 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
10663 {
10664 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10665 }
10666 }
10667 else
10668 {
10669 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10670 }
10671 }
10672
10673 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
10674 {
10675 int type = oldLoc.GetType();
10676 if (type == InventoryLocationType.CARGO || type == InventoryLocationType.PROXYCARGO)
10677 {
10678 oldLoc.GetParent().GetOnSetLock().Invoke(this);
10679 }
10680 else if (type == InventoryLocationType.ATTACHMENT)
10681 {
10682 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
10683 }
10684 }
10685 if (!m_OldLocation)
10686 {
10687 m_OldLocation = new InventoryLocation;
10688 }
10689 m_OldLocation.Copy(oldLoc);
10690 }
10691 else
10692 {
10693 if (m_OldLocation)
10694 {
10695 m_OldLocation.Reset();
10696 }
10697 }
10698
10700 }
10701 else
10702 {
10703 if (new_player)
10704 {
10705 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
10706 if (res_index >= 0)
10707 {
10708 InventoryLocation il = new InventoryLocation;
10709 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
10710 ItemBase it = ItemBase.Cast(il.GetItem());
10711 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
10712 int rel_type = il.GetType();
10713 if (rel_type == InventoryLocationType.CARGO || rel_type == InventoryLocationType.PROXYCARGO)
10714 {
10715 il.GetParent().GetOnReleaseLock().Invoke(it);
10716 }
10717 else if (rel_type == InventoryLocationType.ATTACHMENT)
10718 {
10719 il.GetParent().GetOnAttachmentReleaseLock().Invoke(it, il.GetSlot());
10720 }
10721 //it.GetOnReleaseLock().Invoke(it);
10722 }
10723 }
10724 else if (old_player && newLoc.GetType() == InventoryLocationType.GROUND && m_ThrowItemOnDrop)
10725 {
10726 //ThrowPhysically(old_player, vector.Zero);
10727 m_ThrowItemOnDrop = false;
10728 }
10729
10730 if (m_OldLocation)
10731 {
10732 m_OldLocation.Reset();
10733 }
10734 }
10735 }
10736
10737 override void EOnContact(IEntity other, Contact extra)
10738 {
10740 {
10741 int liquidType = -1;
10742 float impactSpeed = ProcessImpactSoundEx(other, extra, m_ConfigWeight, m_ImpactSoundSurfaceHash, liquidType);
10743 if (impactSpeed > 0.0)
10744 {
10745 m_ImpactSpeed = impactSpeed;
10746 #ifndef SERVER
10747 PlayImpactSound(m_ConfigWeight, m_ImpactSpeed, m_ImpactSoundSurfaceHash);
10748 #else
10749 m_WantPlayImpactSound = true;
10750 SetSynchDirty();
10751 #endif
10752 m_CanPlayImpactSound = (liquidType == -1);// prevents further playing of the sound when the surface is a liquid type
10753 }
10754 }
10755
10756 #ifdef SERVER
10757 if (GetCompEM() && GetCompEM().IsPlugged())
10758 {
10759 if (GetCompEM().GetCordLength() < vector.Distance(GetPosition(), GetCompEM().GetEnergySource().GetPosition()))
10760 GetCompEM().UnplugThis();
10761 }
10762 #endif
10763 }
10764
10765 void RefreshPhysics();
10766
10767 override void OnCreatePhysics()
10768 {
10770 }
10771
10772 override void OnItemAttachmentSlotChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
10773 {
10774
10775 }
10776 // -------------------------------------------------------------------------
10777 override void OnItemLocationChanged(EntityAI old_owner, EntityAI new_owner)
10778 {
10779 super.OnItemLocationChanged(old_owner, new_owner);
10780
10781 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
10782 PlayerBase playerNew = PlayerBase.Cast(new_owner);
10783
10784 if (!relatedPlayer && playerNew)
10785 relatedPlayer = playerNew;
10786
10787 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
10788 {
10789 ActionManagerBase actionMgr = relatedPlayer.GetActionManager();
10790 if (actionMgr)
10791 {
10792 ActionBase currentAction = actionMgr.GetRunningAction();
10793 if (currentAction)
10794 currentAction.OnItemLocationChanged(this);
10795 }
10796 }
10797
10798 Man ownerPlayerOld = null;
10799 Man ownerPlayerNew = null;
10800
10801 if (old_owner)
10802 {
10803 if (old_owner.IsMan())
10804 {
10805 ownerPlayerOld = Man.Cast(old_owner);
10806 }
10807 else
10808 {
10809 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
10810 }
10811 }
10812 else
10813 {
10814 if (new_owner && IsElectricAppliance() && GetCompEM() && GetCompEM().IsPlugged())
10815 {
10816 ActionBase action = ActionManagerBase.GetAction(ActionRepositionPluggedItem);
10817
10818 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.GetID())
10819 {
10820 GetCompEM().UnplugThis();
10821 }
10822 }
10823 }
10824
10825 if (new_owner)
10826 {
10827 if (new_owner.IsMan())
10828 {
10829 ownerPlayerNew = Man.Cast(new_owner);
10830 }
10831 else
10832 {
10833 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
10834 }
10835 }
10836
10837 if (ownerPlayerOld != ownerPlayerNew)
10838 {
10839 if (ownerPlayerOld)
10840 {
10841 array<EntityAI> subItemsExit = new array<EntityAI>;
10842 GetInventory().EnumerateInventory(InventoryTraversalType.PREORDER,subItemsExit);
10843 for (int i = 0; i < subItemsExit.Count(); i++)
10844 {
10845 ItemBase itemExit = ItemBase.Cast(subItemsExit.Get(i));
10846 itemExit.OnInventoryExit(ownerPlayerOld);
10847 }
10848 }
10849
10850 if (ownerPlayerNew)
10851 {
10852 array<EntityAI> subItemsEnter = new array<EntityAI>;
10853 GetInventory().EnumerateInventory(InventoryTraversalType.PREORDER,subItemsEnter);
10854 for (int j = 0; j < subItemsEnter.Count(); j++)
10855 {
10856 ItemBase itemEnter = ItemBase.Cast(subItemsEnter.Get(j));
10857 itemEnter.OnInventoryEnter(ownerPlayerNew);
10858 }
10859 }
10860 }
10861 else if (ownerPlayerNew != null)
10862 {
10863 PlayerBase nplayer;
10864 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
10865 {
10866 array<EntityAI> subItemsUpdate = new array<EntityAI>;
10867 GetInventory().EnumerateInventory(InventoryTraversalType.PREORDER,subItemsUpdate);
10868 for (int k = 0; k < subItemsUpdate.Count(); k++)
10869 {
10870 ItemBase itemUpdate = ItemBase.Cast(subItemsUpdate.Get(k));
10871 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
10872 }
10873 }
10874 }
10875
10876 if (old_owner)
10877 old_owner.OnChildItemRemoved(this);
10878 if (new_owner)
10879 new_owner.OnChildItemReceived(this);
10880 }
10881
10882 // -------------------------------------------------------------------------------
10883 override void EEDelete(EntityAI parent)
10884 {
10885 super.EEDelete(parent);
10886 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
10887 if (player)
10888 {
10889 OnInventoryExit(player);
10890
10891 if (player.IsAlive())
10892 {
10893 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10894 if (r_index >= 0)
10895 {
10896 InventoryLocation r_il = new InventoryLocation;
10897 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10898
10899 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10900 int r_type = r_il.GetType();
10901 if (r_type == InventoryLocationType.CARGO || r_type == InventoryLocationType.PROXYCARGO)
10902 {
10903 r_il.GetParent().GetOnReleaseLock().Invoke(this);
10904 }
10905 else if (r_type == InventoryLocationType.ATTACHMENT)
10906 {
10907 r_il.GetParent().GetOnAttachmentReleaseLock().Invoke(this, r_il.GetSlot());
10908 }
10909
10910 }
10911
10912 player.RemoveQuickBarEntityShortcut(this);
10913 }
10914 }
10915 }
10916 // -------------------------------------------------------------------------------
10917 override void EEKilled(Object killer)
10918 {
10919 super.EEKilled(killer);
10920
10922 if (killer && killer.IsFireplace() && CanExplodeInFire())
10923 {
10924 if (GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
10925 {
10926 if (IsMagazine())
10927 {
10928 if (Magazine.Cast(this).GetAmmoCount() > 0)
10929 {
10930 ExplodeAmmo();
10931 }
10932 }
10933 else
10934 {
10935 Explode(DamageType.EXPLOSION);
10936 }
10937 }
10938 }
10939 }
10940
10941 override void OnWasAttached(EntityAI parent, int slot_id)
10942 {
10943 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10944
10945 super.OnWasAttached(parent, slot_id);
10946
10947 if (HasQuantity())
10948 UpdateNetSyncVariableFloat("m_VarQuantity", GetQuantityMin(), m_VarQuantityMax);
10949
10950 PlayAttachSound(InventorySlots.GetSlotName(slot_id));
10951 }
10952
10953 override void OnWasDetached(EntityAI parent, int slot_id)
10954 {
10955 super.OnWasDetached(parent, slot_id);
10956
10957 if (HasQuantity())
10958 UpdateNetSyncVariableFloat("m_VarQuantity", GetQuantityMin(), m_VarQuantityMax);
10959 }
10960
10961 override string ChangeIntoOnAttach(string slot)
10962 {
10963 int idx;
10964 TStringArray inventory_slots = new TStringArray;
10965 TStringArray attach_types = new TStringArray;
10966
10967 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10968 if (inventory_slots.Count() < 1) //is string
10969 {
10970 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
10971 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
10972 }
10973 else //is array
10974 {
10975 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
10976 }
10977
10978 idx = inventory_slots.Find(slot);
10979 if (idx < 0)
10980 return "";
10981
10982 return attach_types.Get(idx);
10983 }
10984
10985 override string ChangeIntoOnDetach()
10986 {
10987 int idx = -1;
10988 string slot;
10989
10990 TStringArray inventory_slots = new TStringArray;
10991 TStringArray detach_types = new TStringArray;
10992
10993 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10994 if (inventory_slots.Count() < 1) //is string
10995 {
10996 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
10997 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10998 }
10999 else //is array
11000 {
11001 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
11002 if (detach_types.Count() < 1)
11003 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
11004 }
11005
11006 for (int i = 0; i < inventory_slots.Count(); i++)
11007 {
11008 slot = inventory_slots.Get(i);
11009 }
11010
11011 if (slot != "")
11012 {
11013 if (detach_types.Count() == 1)
11014 idx = 0;
11015 else
11016 idx = inventory_slots.Find(slot);
11017 }
11018 if (idx < 0)
11019 return "";
11020
11021 return detach_types.Get(idx);
11022 }
11023
11024 void ExplodeAmmo()
11025 {
11026 //timer
11027 ref Timer explode_timer = new Timer(CALL_CATEGORY_SYSTEM);
11028
11029 //min/max time
11030 float min_time = 1;
11031 float max_time = 3;
11032 float delay = Math.RandomFloat(min_time, max_time);
11033
11034 explode_timer.Run(delay, this, "DoAmmoExplosion");
11035 }
11036
11037 void DoAmmoExplosion()
11038 {
11039 Magazine magazine = Magazine.Cast(this);
11040 int pop_sounds_count = 6;
11041 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
11042
11043 //play sound
11044 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
11045 string sound_name = pop_sounds[ sound_idx ];
11046 GetGame().CreateSoundOnObject(this, sound_name, 20, false);
11047
11048 //remove ammo count
11049 magazine.ServerAddAmmoCount(-1);
11050
11051 //if condition then repeat -> ExplodeAmmo
11052 float min_temp_to_explode = 100; //min temperature for item to explode
11053
11054 if (magazine.GetAmmoCount() > 0 && GetTemperature() >= min_temp_to_explode) //TODO ? add check for parent -> fireplace
11055 {
11056 ExplodeAmmo();
11057 }
11058 }
11059
11060 // -------------------------------------------------------------------------------
11061 override void EEHitBy(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
11062 {
11063 super.EEHitBy(damageResult, damageType, source, component, dmgZone, ammo, modelPos, speedCoef);
11064
11065 const int CHANCE_DAMAGE_CARGO = 4;
11066 const int CHANCE_DAMAGE_ATTACHMENT = 1;
11067 const int CHANCE_DAMAGE_NOTHING = 2;
11068
11069 if (IsClothing() || IsContainer() || IsItemTent())
11070 {
11071 float dmg = damageResult.GetDamage("","Health") * -0.5;
11072 int chances;
11073 int rnd;
11074
11075 if (GetInventory().GetCargo())
11076 {
11077 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
11078 rnd = Math.RandomInt(0,chances);
11079
11080 if (rnd < CHANCE_DAMAGE_CARGO)
11081 {
11082 DamageItemInCargo(dmg);
11083 }
11084 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
11085 {
11087 }
11088 }
11089 else
11090 {
11091 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
11092 rnd = Math.RandomInt(0,chances);
11093
11094 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
11095 {
11097 }
11098 }
11099 }
11100 }
11101
11102 bool DamageItemInCargo(float damage)
11103 {
11104 if (GetInventory().GetCargo())
11105 {
11106 int item_count = GetInventory().GetCargo().GetItemCount();
11107 if (item_count > 0)
11108 {
11109 int random_pick = Math.RandomInt(0, item_count);
11110 ItemBase item = ItemBase.Cast(GetInventory().GetCargo().GetItem(random_pick));
11111 if (!item.IsExplosive())
11112 {
11113 item.AddHealth("","",damage);
11114 return true;
11115 }
11116 }
11117 }
11118 return false;
11119 }
11120
11121 bool DamageItemAttachments(float damage)
11122 {
11123 int attachment_count = GetInventory().AttachmentCount();
11124 if (attachment_count > 0)
11125 {
11126 int random_pick = Math.RandomInt(0, attachment_count);
11127 ItemBase attachment = ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
11128 if (!attachment.IsExplosive())
11129 {
11130 attachment.AddHealth("","",damage);
11131 return true;
11132 }
11133 }
11134 return false;
11135 }
11136
11137 override bool IsSplitable()
11138 {
11139 return m_CanThisBeSplit;
11140 }
11141 //----------------
11142 override bool CanBeSplit()
11143 {
11144 if (IsSplitable() && (GetQuantity() > 1))
11145 return GetInventory().CanRemoveEntity();
11146
11147 return false;
11148 }
11149
11150 protected bool ShouldSplitQuantity(float quantity)
11151 {
11152 // don't call 'CanBeSplit' here, too strict and will introduce a freeze-crash when dismantling fence with a fireplace nearby
11153 if (!IsSplitable())
11154 return false;
11155
11156 // nothing to split?
11157 if (GetQuantity() <= 1)
11158 return false;
11159
11160 // check if we should re-use the item instead of creating a new copy?
11161 // implicit cast to int, if 'IsSplitable' returns true, these values are assumed ints
11162 int delta = GetQuantity() - quantity;
11163 if (delta == 0)
11164 return false;
11165
11166 // valid to split
11167 return true;
11168 }
11169
11170 override void SplitIntoStackMaxClient(EntityAI destination_entity, int slot_id )
11171 {
11172 if (GetGame().IsClient())
11173 {
11174 if (ScriptInputUserData.CanStoreInputUserData())
11175 {
11176 ScriptInputUserData ctx = new ScriptInputUserData;
11178 ctx.Write(1);
11179 ItemBase i1 = this; // @NOTE: workaround for correct serialization
11180 ctx.Write(i1);
11181 ctx.Write(destination_entity);
11182 ctx.Write(true);
11183 ctx.Write(slot_id);
11184 ctx.Send();
11185 }
11186 }
11187 else if (!GetGame().IsMultiplayer())
11188 {
11189 SplitIntoStackMax(destination_entity, slot_id, PlayerBase.Cast(GetGame().GetPlayer()));
11190 }
11191 }
11192
11193 void SplitIntoStackMax(EntityAI destination_entity, int slot_id, PlayerBase player)
11194 {
11195 float split_quantity_new;
11196 ItemBase new_item;
11197 float quantity = GetQuantity();
11198 float stack_max = GetTargetQuantityMax(slot_id);
11199 InventoryLocation loc = new InventoryLocation;
11200
11201 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
11202 {
11203 if (stack_max <= GetQuantity())
11204 split_quantity_new = stack_max;
11205 else
11206 split_quantity_new = GetQuantity();
11207
11208 if (ShouldSplitQuantity(split_quantity_new))
11209 {
11210 new_item = ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(this.GetType(), slot_id));
11211 if (new_item)
11212 {
11213 new_item.SetResultOfSplit(true);
11214 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11215 AddQuantity(-split_quantity_new, false, true);
11216 new_item.SetQuantity(split_quantity_new, false, true);
11217 }
11218 }
11219 }
11220 else if (destination_entity && slot_id == -1)
11221 {
11222 if (quantity > stack_max)
11223 split_quantity_new = stack_max;
11224 else
11225 split_quantity_new = quantity;
11226
11227 if (ShouldSplitQuantity(split_quantity_new))
11228 {
11229 if (destination_entity.GetInventory().FindFreeLocationFor(this, FindInventoryLocationType.ANY, loc))
11230 {
11231 Object o = destination_entity.GetInventory().LocationCreateEntity(loc, GetType(), ECE_IN_INVENTORY, RF_DEFAULT);
11232 new_item = ItemBase.Cast(o);
11233 }
11234
11235 if (new_item)
11236 {
11237 new_item.SetResultOfSplit(true);
11238 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11239 AddQuantity(-split_quantity_new, false, true);
11240 new_item.SetQuantity(split_quantity_new, false, true);
11241 }
11242 }
11243 }
11244 else
11245 {
11246 if (stack_max != 0)
11247 {
11248 if (stack_max < GetQuantity())
11249 {
11250 split_quantity_new = GetQuantity() - stack_max;
11251 }
11252
11253 if (split_quantity_new == 0)
11254 {
11255 if (!GetGame().IsMultiplayer())
11256 player.PhysicalPredictiveDropItem(this);
11257 else
11258 player.ServerDropEntity(this);
11259 return;
11260 }
11261
11262 if (ShouldSplitQuantity(split_quantity_new))
11263 {
11264 new_item = ItemBase.Cast(GetGame().CreateObjectEx(GetType(), player.GetWorldPosition(), ECE_PLACE_ON_SURFACE));
11265
11266 if (new_item)
11267 {
11268 new_item.SetResultOfSplit(true);
11269 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11270 SetQuantity(split_quantity_new, false, true);
11271 new_item.SetQuantity(stack_max, false, true);
11272 new_item.PlaceOnSurface();
11273 }
11274 }
11275 }
11276 }
11277 }
11278
11279 override void SplitIntoStackMaxEx(EntityAI destination_entity, int slot_id)
11280 {
11281 float split_quantity_new;
11282 ItemBase new_item;
11283 float quantity = GetQuantity();
11284 float stack_max = GetTargetQuantityMax(slot_id);
11285 InventoryLocation loc = new InventoryLocation;
11286
11287 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
11288 {
11289 if (stack_max <= GetQuantity())
11290 split_quantity_new = stack_max;
11291 else
11292 split_quantity_new = GetQuantity();
11293
11294 if (ShouldSplitQuantity(split_quantity_new))
11295 {
11296 new_item = ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(this.GetType(), slot_id));
11297 if (new_item)
11298 {
11299 new_item.SetResultOfSplit(true);
11300 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11301 AddQuantity(-split_quantity_new, false, true);
11302 new_item.SetQuantity(split_quantity_new, false, true);
11303 }
11304 }
11305 }
11306 else if (destination_entity && slot_id == -1)
11307 {
11308 if (quantity > stack_max)
11309 split_quantity_new = stack_max;
11310 else
11311 split_quantity_new = quantity;
11312
11313 if (ShouldSplitQuantity(split_quantity_new))
11314 {
11315 if (destination_entity.GetInventory().FindFreeLocationFor(this, FindInventoryLocationType.ANY, loc))
11316 {
11317 Object o = destination_entity.GetInventory().LocationCreateEntity(loc, GetType(), ECE_IN_INVENTORY, RF_DEFAULT);
11318 new_item = ItemBase.Cast(o);
11319 }
11320
11321 if (new_item)
11322 {
11323 new_item.SetResultOfSplit(true);
11324 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11325 AddQuantity(-split_quantity_new, false, true);
11326 new_item.SetQuantity(split_quantity_new, false, true);
11327 }
11328 }
11329 }
11330 else
11331 {
11332 if (stack_max != 0)
11333 {
11334 if (stack_max < GetQuantity())
11335 {
11336 split_quantity_new = GetQuantity() - stack_max;
11337 }
11338
11339 if (ShouldSplitQuantity(split_quantity_new))
11340 {
11341 new_item = ItemBase.Cast(GetGame().CreateObjectEx(GetType(),GetWorldPosition(), ECE_PLACE_ON_SURFACE));
11342
11343 if (new_item)
11344 {
11345 new_item.SetResultOfSplit(true);
11346 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11347 SetQuantity(split_quantity_new, false, true);
11348 new_item.SetQuantity(stack_max, false, true);
11349 new_item.PlaceOnSurface();
11350 }
11351 }
11352 }
11353 }
11354 }
11355
11356 void SplitIntoStackMaxToInventoryLocationClient(notnull InventoryLocation dst)
11357 {
11358 if (GetGame().IsClient())
11359 {
11360 if (ScriptInputUserData.CanStoreInputUserData())
11361 {
11362 ScriptInputUserData ctx = new ScriptInputUserData;
11364 ctx.Write(4);
11365 ItemBase thiz = this; // @NOTE: workaround for correct serialization
11366 ctx.Write(thiz);
11367 dst.WriteToContext(ctx);
11368 ctx.Send();
11369 }
11370 }
11371 else if (!GetGame().IsMultiplayer())
11372 {
11374 }
11375 }
11376
11377 void SplitIntoStackMaxCargoClient(EntityAI destination_entity, int idx, int row, int col)
11378 {
11379 if (GetGame().IsClient())
11380 {
11381 if (ScriptInputUserData.CanStoreInputUserData())
11382 {
11383 ScriptInputUserData ctx = new ScriptInputUserData;
11385 ctx.Write(2);
11386 ItemBase dummy = this; // @NOTE: workaround for correct serialization
11387 ctx.Write(dummy);
11388 ctx.Write(destination_entity);
11389 ctx.Write(true);
11390 ctx.Write(idx);
11391 ctx.Write(row);
11392 ctx.Write(col);
11393 ctx.Send();
11394 }
11395 }
11396 else if (!GetGame().IsMultiplayer())
11397 {
11398 SplitIntoStackMaxCargo(destination_entity, idx, row, col);
11399 }
11400 }
11401
11402 void SplitIntoStackMaxToInventoryLocation(notnull InventoryLocation dst)
11403 {
11405 }
11406
11407 ItemBase SplitIntoStackMaxToInventoryLocationEx(notnull InventoryLocation dst)
11408 {
11409 float quantity = GetQuantity();
11410 float split_quantity_new;
11411 ItemBase new_item;
11412 if (dst.IsValid())
11413 {
11414 int slot_id = dst.GetSlot();
11415 float stack_max = GetTargetQuantityMax(slot_id);
11416
11417 if (quantity > stack_max)
11418 split_quantity_new = stack_max;
11419 else
11420 split_quantity_new = quantity;
11421
11422 if (ShouldSplitQuantity(split_quantity_new))
11423 {
11424 new_item = ItemBase.Cast(GameInventory.LocationCreateEntity(dst, this.GetType(), ECE_IN_INVENTORY, RF_DEFAULT));
11425
11426 if (new_item)
11427 {
11428 new_item.SetResultOfSplit(true);
11429 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11430 AddQuantity(-split_quantity_new, false, true);
11431 new_item.SetQuantity(split_quantity_new, false, true);
11432 }
11433
11434 return new_item;
11435 }
11436 }
11437
11438 return null;
11439 }
11440
11441 void SplitIntoStackMaxCargo(EntityAI destination_entity, int idx, int row, int col)
11442 {
11443 float quantity = GetQuantity();
11444 float split_quantity_new;
11445 ItemBase new_item;
11446 if (destination_entity)
11447 {
11448 float stackable = GetTargetQuantityMax();
11449 if (quantity > stackable)
11450 split_quantity_new = stackable;
11451 else
11452 split_quantity_new = quantity;
11453
11454 if (ShouldSplitQuantity(split_quantity_new))
11455 {
11456 new_item = ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(this.GetType(), idx, row, col, false));
11457 if (new_item)
11458 {
11459 new_item.SetResultOfSplit(true);
11460 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11461 AddQuantity(-split_quantity_new, false, true);
11462 new_item.SetQuantity(split_quantity_new, false, true);
11463 }
11464 }
11465 }
11466 }
11467
11468 void SplitIntoStackMaxHandsClient(PlayerBase player)
11469 {
11470 if (GetGame().IsClient())
11471 {
11472 if (ScriptInputUserData.CanStoreInputUserData())
11473 {
11474 ScriptInputUserData ctx = new ScriptInputUserData;
11476 ctx.Write(3);
11477 ItemBase i1 = this; // @NOTE: workaround for correct serialization
11478 ctx.Write(i1);
11479 ItemBase destination_entity = this;
11480 ctx.Write(destination_entity);
11481 ctx.Write(true);
11482 ctx.Write(0);
11483 ctx.Send();
11484 }
11485 }
11486 else if (!GetGame().IsMultiplayer())
11487 {
11488 SplitIntoStackMaxHands(player);
11489 }
11490 }
11491
11492 void SplitIntoStackMaxHands(PlayerBase player)
11493 {
11494 float quantity = GetQuantity();
11495 float split_quantity_new;
11496 ref ItemBase new_item;
11497 if (player)
11498 {
11499 float stackable = GetTargetQuantityMax();
11500 if (quantity > stackable)
11501 split_quantity_new = stackable;
11502 else
11503 split_quantity_new = quantity;
11504
11505 if (ShouldSplitQuantity(split_quantity_new))
11506 {
11507 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.GetType());
11508 new_item = ItemBase.Cast(in_hands);
11509 if (new_item)
11510 {
11511 new_item.SetResultOfSplit(true);
11512 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11513 AddQuantity(-split_quantity_new, false, true);
11514 new_item.SetQuantity(split_quantity_new, false, true);
11515 }
11516 }
11517 }
11518 }
11519
11520 void SplitItemToInventoryLocation(notnull InventoryLocation dst)
11521 {
11522 float quantity = GetQuantity();
11523 float split_quantity_new = Math.Floor(quantity * 0.5);
11524
11525 if (!ShouldSplitQuantity(split_quantity_new))
11526 return;
11527
11528 ItemBase new_item = ItemBase.Cast(GameInventory.LocationCreateEntity(dst, GetType(), ECE_IN_INVENTORY, RF_DEFAULT));
11529
11530 if (new_item)
11531 {
11532 if (new_item.GetQuantityMax() < split_quantity_new)
11533 {
11534 split_quantity_new = new_item.GetQuantityMax();
11535 }
11536
11537 new_item.SetResultOfSplit(true);
11538 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11539
11540 if (dst.IsValid() && dst.GetType() == InventoryLocationType.ATTACHMENT && split_quantity_new > 1)
11541 {
11542 AddQuantity(-1, false, true);
11543 new_item.SetQuantity(1, false, true);
11544 }
11545 else
11546 {
11547 AddQuantity(-split_quantity_new, false, true);
11548 new_item.SetQuantity(split_quantity_new, false, true);
11549 }
11550 }
11551 }
11552
11553 void SplitItem(PlayerBase player)
11554 {
11555 float quantity = GetQuantity();
11556 float split_quantity_new = Math.Floor(quantity / 2);
11557
11558 if (!ShouldSplitQuantity(split_quantity_new))
11559 return;
11560
11561 InventoryLocation invloc = new InventoryLocation;
11562 bool found = player.GetInventory().FindFirstFreeLocationForNewEntity(GetType(), FindInventoryLocationType.ATTACHMENT, invloc);
11563
11564 ItemBase new_item;
11565 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
11566
11567 if (new_item)
11568 {
11569 if (new_item.GetQuantityMax() < split_quantity_new)
11570 {
11571 split_quantity_new = new_item.GetQuantityMax();
11572 }
11573 if (found && invloc.IsValid() && invloc.GetType() == InventoryLocationType.ATTACHMENT && split_quantity_new > 1)
11574 {
11575 AddQuantity(-1, false, true);
11576 new_item.SetQuantity(1, false, true);
11577 }
11578 else if (split_quantity_new > 1)
11579 {
11580 AddQuantity(-split_quantity_new, false, true);
11581 new_item.SetQuantity(split_quantity_new, false, true);
11582 }
11583 }
11584 }
11585
11587 void OnQuantityChanged(float delta)
11588 {
11589 SetWeightDirty();
11590 ItemBase parent = ItemBase.Cast(GetHierarchyParent());
11591
11592 if (parent)
11593 parent.OnAttachmentQuantityChangedEx(this, delta);
11594
11595 if (IsLiquidContainer())
11596 {
11597 if (GetQuantityNormalized() <= 0.0)
11598 {
11600 }
11601 else if (GetLiquidType() == LIQUID_NONE)
11602 {
11603 ErrorEx("Undefined liquid type quantity changed, please define liquid type first! Using init value.",ErrorExSeverity.INFO);
11605 }
11606 }
11607
11608 }
11609
11612 {
11613 // insert code here
11614 }
11615
11617 void OnAttachmentQuantityChangedEx(ItemBase item , float delta)
11618 {
11620 }
11621
11622 override void EEHealthLevelChanged(int oldLevel, int newLevel, string zone)
11623 {
11624 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
11625
11626 if (GetGame().IsServer())
11627 {
11628 if (newLevel == GameConstants.STATE_RUINED)
11629 {
11631 EntityAI parent = GetHierarchyParent();
11632 if (parent && parent.IsFireplace())
11633 {
11634 CargoBase cargo = GetInventory().GetCargo();
11635 if (cargo)
11636 {
11637 for (int i = 0; i < cargo.GetItemCount(); ++i)
11638 {
11639 parent.GetInventory().TakeEntityToInventory(InventoryMode.SERVER, FindInventoryLocationType.CARGO, cargo.GetItem(i));
11640 }
11641 }
11642 }
11643 }
11644
11645 if (IsResultOfSplit())
11646 {
11647 // reset the splitting result flag, return to normal item behavior
11648 SetResultOfSplit(false);
11649 return;
11650 }
11651
11652 if (m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
11653 {
11654 SetCleanness(0);//unclean the item upon damage dealt
11655 }
11656 }
11657 }
11658
11659 // just the split? TODO: verify
11660 override void OnRightClick()
11661 {
11662 super.OnRightClick();
11663
11664 if (CanBeSplit() && !GetDayZGame().IsLeftCtrlDown() && !GetGame().GetPlayer().GetInventory().HasInventoryReservation(this,null))
11665 {
11666 if (GetGame().IsClient())
11667 {
11668 if (ScriptInputUserData.CanStoreInputUserData())
11669 {
11670 EntityAI root = GetHierarchyRoot();
11671 Man playerOwner = GetHierarchyRootPlayer();
11672 InventoryLocation dst = new InventoryLocation;
11673
11674 // 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
11675 if (!playerOwner && root && root == this)
11676 {
11678 }
11679 else
11680 {
11681 // 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
11682 GetInventory().GetCurrentInventoryLocation(dst);
11683 if (!dst.GetParent() || dst.GetParent() && !dst.GetParent().GetInventory().FindFreeLocationFor(this, FindInventoryLocationType.CARGO, dst))
11684 {
11685 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
11686 if (!player.GetInventory().FindFreeLocationFor(this, FindInventoryLocationType.CARGO, dst) || !playerOwner)
11687 {
11689 }
11690 else
11691 {
11692 dst.SetCargo(dst.GetParent(), this, dst.GetIdx(), dst.GetRow(), dst.GetCol(), dst.GetFlip());
11693 /* hacky solution to check reservation of "this" item instead of null since the gamecode is checking null against null and returning reservation=true incorrectly
11694 this shouldnt cause issues within this scope*/
11695 if (GetGame().GetPlayer().GetInventory().HasInventoryReservation(this, dst))
11696 {
11698 }
11699 else
11700 {
11701 GetGame().GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
11702 }
11703 }
11704 }
11705 }
11706
11707 ScriptInputUserData ctx = new ScriptInputUserData;
11709 ctx.Write(4);
11710 ItemBase thiz = this; // @NOTE: workaround for correct serialization
11711 ctx.Write(thiz);
11712 dst.WriteToContext(ctx);
11713 ctx.Write(true); // dummy
11714 ctx.Send();
11715 }
11716 }
11717 else if (!GetGame().IsMultiplayer())
11718 {
11719 SplitItem(PlayerBase.Cast(GetGame().GetPlayer()));
11720 }
11721 }
11722 }
11723
11724 protected void SetInventoryLocationToVicinityOrCurrent(EntityAI root, inout InventoryLocation dst)
11725 {
11726 if (root)
11727 {
11728 vector m4[4];
11729 root.GetTransform(m4);
11730 dst.SetGround(this, m4);
11731 }
11732 else
11733 {
11734 GetInventory().GetCurrentInventoryLocation(dst);
11735 }
11736 }
11737
11738 override bool CanBeCombined(EntityAI other_item, bool reservation_check = true, bool stack_max_limit = false)
11739 {
11740 //TODO: delete check zero quantity check after fix double posts hands fsm events
11741 if (!other_item || GetType() != other_item.GetType() || (IsFullQuantity() && other_item.GetQuantity() > 0) || other_item == this)
11742 return false;
11743
11744 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
11745 return false;
11746
11747 //can_this_be_combined = ConfigGetBool("canBeSplit");
11749 return false;
11750
11751
11752 Magazine mag = Magazine.Cast(this);
11753 if (mag)
11754 {
11755 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
11756 return false;
11757
11758 if (stack_max_limit)
11759 {
11760 Magazine other_mag = Magazine.Cast(other_item);
11761 if (other_item)
11762 {
11763 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
11764 return false;
11765 }
11766
11767 }
11768 }
11769 else
11770 {
11771 //TODO: delete check zero quantity check after fix double posts hands fsm events
11772 if (GetQuantity() >= GetQuantityMax() && other_item.GetQuantity() > 0 )
11773 return false;
11774
11775 if (stack_max_limit && (GetQuantity() + other_item.GetQuantity() > GetQuantityMax()))
11776 return false;
11777 }
11778
11779 PlayerBase player = null;
11780 if (CastTo(player, GetHierarchyRootPlayer())) //false when attached to player's attachment slot
11781 {
11782 if (player.GetInventory().HasAttachment(this))
11783 return false;
11784
11785 if (player.IsItemsToDelete())
11786 return false;
11787 }
11788
11789 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
11790 return false;
11791
11792 int slotID;
11793 string slotName;
11794 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
11795 return false;
11796
11797 return true;
11798 }
11799
11800 bool IsCombineAll(ItemBase other_item, bool use_stack_max = false)
11801 {
11802 return ComputeQuantityUsed(other_item, use_stack_max) == other_item.GetQuantity();
11803 }
11804
11805 bool IsResultOfSplit()
11806 {
11807 return m_IsResultOfSplit;
11808 }
11809
11810 void SetResultOfSplit(bool value)
11811 {
11812 m_IsResultOfSplit = value;
11813 }
11814
11815 int ComputeQuantityUsed(ItemBase other_item, bool use_stack_max = true)
11816 {
11817 return ComputeQuantityUsedEx(other_item, use_stack_max);
11818 }
11819
11820 float ComputeQuantityUsedEx(ItemBase other_item, bool use_stack_max = true)
11821 {
11822 float other_item_quantity = other_item.GetQuantity();
11823 float this_free_space;
11824
11825 float stack_max = GetQuantityMax();
11826
11827 this_free_space = stack_max - GetQuantity();
11828
11829 if (other_item_quantity > this_free_space)
11830 {
11831 return this_free_space;
11832 }
11833 else
11834 {
11835 return other_item_quantity;
11836 }
11837 }
11838
11839 override void CombineItemsEx(EntityAI entity2, bool use_stack_max = true)
11840 {
11841 CombineItems(ItemBase.Cast(entity2),use_stack_max);
11842 }
11843
11844 void CombineItems(ItemBase other_item, bool use_stack_max = true)
11845 {
11846 if (!CanBeCombined(other_item, false))
11847 return;
11848
11849 if (!IsMagazine() && other_item)
11850 {
11851 float quantity_used = ComputeQuantityUsedEx(other_item,use_stack_max);
11852 if (quantity_used != 0)
11853 {
11854 float hp1 = GetHealth01("","");
11855 float hp2 = other_item.GetHealth01("","");
11856 float hpResult = ((hp1*GetQuantity()) + (hp2*quantity_used));
11857 hpResult = hpResult / (GetQuantity() + quantity_used);
11858
11859 hpResult *= GetMaxHealth();
11860 Math.Round(hpResult);
11861 SetHealth("", "Health", hpResult);
11862
11863 AddQuantity(quantity_used);
11864 other_item.AddQuantity(-quantity_used);
11865 }
11866 }
11867 OnCombine(other_item);
11868 }
11869
11870 void OnCombine(ItemBase other_item)
11871 {
11872 #ifdef SERVER
11873 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
11874 GetHierarchyParent().IncreaseLifetimeUp();
11875 #endif
11876 };
11877
11878 void GetRecipesActions(Man player, out TSelectableActionInfoArray outputList)
11879 {
11880 PlayerBase p = PlayerBase.Cast(player);
11881
11882 array<int> recipesIds = p.m_Recipes;
11883 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(GetPlugin(PluginRecipesManager));
11884 if (moduleRecipesManager)
11885 {
11886 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
11887 moduleRecipesManager.GetValidRecipes(ItemBase.Cast(this), ItemBase.Cast(itemInHands), recipesIds, p);
11888 }
11889
11890 for (int i = 0;i < recipesIds.Count(); i++)
11891 {
11892 int key = recipesIds.Get(i);
11893 string recipeName = moduleRecipesManager.GetRecipeName(key);
11894 outputList.Insert(new TSelectableActionInfo(SAT_CRAFTING, key, recipeName));
11895 }
11896 }
11897
11898 // -------------------------------------------------------------------------
11899 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
11900 {
11901 super.GetDebugActions(outputList);
11902
11903 //quantity
11904 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_QUANTITY, "Quantity +20%", FadeColors.LIGHT_GREY));
11905 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_QUANTITY, "Quantity -20%", FadeColors.LIGHT_GREY));
11906 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SET_QUANTITY_0, "Set Quantity 0", FadeColors.LIGHT_GREY));
11907 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SET_MAX_QUANTITY, "Set Quantity Max", FadeColors.LIGHT_GREY));
11908 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
11909
11910 //health
11911 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_HEALTH, "Health +20%", FadeColors.LIGHT_GREY));
11912 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_HEALTH, "Health -20%", FadeColors.LIGHT_GREY));
11913 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.DESTROY_HEALTH, "Health 0", FadeColors.LIGHT_GREY));
11914 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
11915 //temperature
11916 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_TEMPERATURE, "Temperature +20", FadeColors.LIGHT_GREY));
11917 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_TEMPERATURE, "Temperature -20", FadeColors.LIGHT_GREY));
11918 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.FLIP_FROZEN, "Toggle Frozen", FadeColors.LIGHT_GREY));
11919 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
11920
11921 //wet
11922 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_WETNESS, "Wetness +20", FadeColors.LIGHT_GREY));
11923 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_WETNESS, "Wetness -20", FadeColors.LIGHT_GREY));
11924 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
11925
11926 //liquidtype
11927 if (IsLiquidContainer())
11928 {
11929 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.LIQUIDTYPE_UP, "LiquidType Next", FadeColors.LIGHT_GREY));
11930 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.LIQUIDTYPE_DOWN, "LiquidType Previous", FadeColors.LIGHT_GREY));
11931 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
11932 }
11933
11934 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.MAKE_SPECIAL, "Make Special", FadeColors.LIGHT_GREY));
11935 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
11936
11937 // watch
11938 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.WATCH_ITEM, "Watch (CTRL-Z)", FadeColors.LIGHT_GREY));
11939 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.WATCH_PLAYER, "Watch Player", FadeColors.LIGHT_GREY));
11940 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
11941
11942 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.DELETE, "Delete", FadeColors.RED));
11943
11944 InventoryLocation loc = new InventoryLocation();
11945 GetInventory().GetCurrentInventoryLocation(loc);
11946 if (!loc || loc.GetType() == InventoryLocationType.GROUND)
11947 {
11948 if (Gizmo_IsSupported())
11949 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.GIZMO_OBJECT, "Gizmo Object", FadeColors.LIGHT_GREY));
11950 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.GIZMO_PHYSICS, "Gizmo Physics (SP Only)", FadeColors.LIGHT_GREY)); // intentionally allowed for testing physics desync
11951 }
11952
11953 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
11954 }
11955
11956 // -------------------------------------------------------------------------
11957 // -------------------------------------------------------------------------
11958 // -------------------------------------------------------------------------
11959 override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
11960 {
11961 super.OnAction(action_id, player, ctx);
11962
11963 if (GetGame().IsClient() || !GetGame().IsMultiplayer())
11964 {
11965 switch (action_id)
11966 {
11967 case EActions.GIZMO_OBJECT:
11968 GetGame().GizmoSelectObject(this);
11969 return true;
11970 case EActions.GIZMO_PHYSICS:
11971 GetGame().GizmoSelectPhysics(GetPhysics());
11972 return true;
11973 }
11974 }
11975
11976 if (GetGame().IsServer())
11977 {
11978 switch (action_id)
11979 {
11980 case EActions.DELETE:
11981 Delete();
11982 return true;
11983 }
11984 }
11985
11986 if (action_id >= EActions.RECIPES_RANGE_START && action_id < EActions.RECIPES_RANGE_END)
11987 {
11988 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(GetPlugin(PluginRecipesManager));
11989 int idWithoutOffset = action_id - EActions.RECIPES_RANGE_START;
11990 PlayerBase p = PlayerBase.Cast(player);
11991 if (EActions.RECIPES_RANGE_START < 1000)
11992 {
11993 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
11994 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
11995 }
11996 }
11997 #ifndef SERVER
11998 else if (action_id == EActions.WATCH_PLAYER)
11999 {
12000 PluginDeveloper.SetDeveloperItemClientEx(player);
12001 }
12002 #endif
12003 if (GetGame().IsServer())
12004 {
12005 if (action_id >= EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id < EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
12006 {
12007 int id = action_id - EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
12008 OnDebugButtonPressServer(id + 1);
12009 }
12010
12011 else if (action_id >= EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id < EActions.DEBUG_AGENTS_RANGE_INJECT_END)
12012 {
12013 int agent_id = action_id - EActions.DEBUG_AGENTS_RANGE_INJECT_START;
12014 InsertAgent(agent_id,100);
12015 }
12016
12017 else if (action_id >= EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id < EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
12018 {
12019 int agent_id2 = action_id - EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
12020 RemoveAgent(agent_id2);
12021 }
12022
12023 else if (action_id == EActions.ADD_QUANTITY)
12024 {
12025 if (IsMagazine())
12026 {
12027 Magazine mag = Magazine.Cast(this);
12028 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
12029 }
12030 else
12031 {
12032 AddQuantity(GetQuantityMax() * 0.2);
12033 }
12034
12035 if (m_EM)
12036 {
12037 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
12038 }
12039 //PrintVariables();
12040 }
12041
12042 else if (action_id == EActions.REMOVE_QUANTITY) //Quantity -20%
12043 {
12044 if (IsMagazine())
12045 {
12046 Magazine mag2 = Magazine.Cast(this);
12047 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
12048 }
12049 else
12050 {
12051 AddQuantity(- GetQuantityMax() * 0.2);
12052 }
12053 if (m_EM)
12054 {
12055 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
12056 }
12057 //PrintVariables();
12058 }
12059
12060 else if (action_id == EActions.SET_QUANTITY_0) //SetMaxQuantity
12061 {
12062 SetQuantity(0);
12063
12064 if (m_EM)
12065 {
12066 m_EM.SetEnergy(0);
12067 }
12068 }
12069
12070 else if (action_id == EActions.SET_MAX_QUANTITY) //SetMaxQuantity
12071 {
12073
12074 if (m_EM)
12075 {
12076 m_EM.SetEnergy(m_EM.GetEnergyMax());
12077 }
12078 }
12079
12080 else if (action_id == EActions.ADD_HEALTH)
12081 {
12082 AddHealth("","",GetMaxHealth("","Health")/5);
12083 }
12084 else if (action_id == EActions.REMOVE_HEALTH)
12085 {
12086 AddHealth("","",-GetMaxHealth("","Health")/5);
12087 }
12088 else if (action_id == EActions.DESTROY_HEALTH)
12089 {
12090 SetHealth01("","",0);
12091 }
12092 else if (action_id == EActions.WATCH_ITEM)
12093 {
12095 mid.RegisterDebugItem(ItemBase.Cast(this), PlayerBase.Cast(player));
12096 #ifdef DEVELOPER
12097 SetDebugDeveloper_item(this);
12098 #endif
12099 }
12100
12101 else if (action_id == EActions.ADD_TEMPERATURE)
12102 {
12103 AddTemperature(20);
12104 //PrintVariables();
12105 }
12106
12107 else if (action_id == EActions.REMOVE_TEMPERATURE)
12108 {
12109 AddTemperature(-20);
12110 //PrintVariables();
12111 }
12112
12113 else if (action_id == EActions.FLIP_FROZEN)
12114 {
12115 SetFrozen(!GetIsFrozen());
12116 //PrintVariables();
12117 }
12118
12119 else if (action_id == EActions.ADD_WETNESS)
12120 {
12121 AddWet(GetWetMax()/5);
12122 //PrintVariables();
12123 }
12124
12125 else if (action_id == EActions.REMOVE_WETNESS)
12126 {
12127 AddWet(-GetWetMax()/5);
12128 //PrintVariables();
12129 }
12130
12131 else if (action_id == EActions.LIQUIDTYPE_UP)
12132 {
12133 int curr_type = GetLiquidType();
12134 SetLiquidType(curr_type * 2);
12135 //AddWet(1);
12136 //PrintVariables();
12137 }
12138
12139 else if (action_id == EActions.LIQUIDTYPE_DOWN)
12140 {
12141 int curr_type2 = GetLiquidType();
12142 SetLiquidType(curr_type2 / 2);
12143 }
12144
12145 else if (action_id == EActions.MAKE_SPECIAL)
12146 {
12147 auto debugParams = DebugSpawnParams.WithPlayer(player);
12148 OnDebugSpawnEx(debugParams);
12149 }
12150
12151 }
12152
12153
12154 return false;
12155 }
12156
12157 // -------------------------------------------------------------------------
12158
12159
12162 void OnActivatedByTripWire();
12163
12165 void OnActivatedByItem(notnull ItemBase item);
12166
12167 //----------------------------------------------------------------
12168 //returns true if item is able to explode when put in fire
12169 bool CanExplodeInFire()
12170 {
12171 return false;
12172 }
12173
12174 //----------------------------------------------------------------
12175 bool CanEat()
12176 {
12177 return true;
12178 }
12179
12180 //----------------------------------------------------------------
12181 override bool IsIgnoredByConstruction()
12182 {
12183 return true;
12184 }
12185
12186 //----------------------------------------------------------------
12187 //has FoodStages in config?
12188 bool HasFoodStage()
12189 {
12190 string config_path = string.Format("CfgVehicles %1 Food FoodStages", GetType());
12191 return GetGame().ConfigIsExisting(config_path);
12192 }
12193
12195 FoodStage GetFoodStage()
12196 {
12197 return null;
12198 }
12199
12200 bool CanBeCooked()
12201 {
12202 return false;
12203 }
12204
12205 bool CanBeCookedOnStick()
12206 {
12207 return false;
12208 }
12209
12211 void RefreshAudioVisualsOnClient( CookingMethodType cooking_method, bool is_done, bool is_empty, bool is_burned );
12213
12214 //----------------------------------------------------------------
12215 bool CanRepair(ItemBase item_repair_kit)
12216 {
12217 PluginRepairing module_repairing = PluginRepairing.Cast(GetPlugin(PluginRepairing));
12218 return module_repairing.CanRepair(this, item_repair_kit);
12219 }
12220
12221 //----------------------------------------------------------------
12222 bool Repair(PlayerBase player, ItemBase item_repair_kit, float specialty_weight)
12223 {
12224 PluginRepairing module_repairing = PluginRepairing.Cast(GetPlugin(PluginRepairing));
12225 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
12226 }
12227
12228 //----------------------------------------------------------------
12229 int GetItemSize()
12230 {
12231 /*
12232 vector v_size = this.ConfigGetVector("itemSize");
12233 int v_size_x = v_size[0];
12234 int v_size_y = v_size[1];
12235 int size = v_size_x * v_size_y;
12236 return size;
12237 */
12238
12239 return 1;
12240 }
12241
12242 //----------------------------------------------------------------
12243 //Override for allowing seemingly unallowed moves when two clients send a conflicting message simultaneously
12244 bool CanBeMovedOverride()
12245 {
12246 return m_CanBeMovedOverride;
12247 }
12248
12249 //----------------------------------------------------------------
12250 //Override for allowing seemingly unallowed moves when two clients send a conflicting message simultaneously
12251 void SetCanBeMovedOverride(bool setting)
12252 {
12253 m_CanBeMovedOverride = setting;
12254 }
12255
12256 //----------------------------------------------------------------
12264 void MessageToOwnerStatus(string text)
12265 {
12266 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12267
12268 if (player)
12269 {
12270 player.MessageStatus(text);
12271 }
12272 }
12273
12274 //----------------------------------------------------------------
12282 void MessageToOwnerAction(string text)
12283 {
12284 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12285
12286 if (player)
12287 {
12288 player.MessageAction(text);
12289 }
12290 }
12291
12292 //----------------------------------------------------------------
12300 void MessageToOwnerFriendly(string text)
12301 {
12302 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12303
12304 if (player)
12305 {
12306 player.MessageFriendly(text);
12307 }
12308 }
12309
12310 //----------------------------------------------------------------
12318 void MessageToOwnerImportant(string text)
12319 {
12320 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12321
12322 if (player)
12323 {
12324 player.MessageImportant(text);
12325 }
12326 }
12327
12328 override bool IsItemBase()
12329 {
12330 return true;
12331 }
12332
12333 // Checks if item is of questioned kind
12334 override bool KindOf(string tag)
12335 {
12336 bool found = false;
12337 string item_name = this.GetType();
12338 ref TStringArray item_tag_array = new TStringArray;
12339 GetGame().ConfigGetTextArray("cfgVehicles " + item_name + " itemInfo", item_tag_array);
12340
12341 int array_size = item_tag_array.Count();
12342 for (int i = 0; i < array_size; i++)
12343 {
12344 if (item_tag_array.Get(i) == tag)
12345 {
12346 found = true;
12347 break;
12348 }
12349 }
12350 return found;
12351 }
12352
12353
12354 override void OnRPC(PlayerIdentity sender, int rpc_type,ParamsReadContext ctx)
12355 {
12356 //Debug.Log("OnRPC called");
12357 super.OnRPC(sender, rpc_type,ctx);
12358
12359 //Play soundset for attachment locking (ActionLockAttachment.c)
12360 switch (rpc_type)
12361 {
12362 #ifndef SERVER
12363 case ERPCs.RPC_SOUND_LOCK_ATTACH:
12364 Param2<bool, string> p = new Param2<bool, string>(false, "");
12365
12366 if (!ctx.Read(p))
12367 return;
12368
12369 bool play = p.param1;
12370 string soundSet = p.param2;
12371
12372 if (play)
12373 {
12374 if (m_LockingSound)
12375 {
12377 {
12378 m_LockingSound = SEffectManager.PlaySound(soundSet, GetPosition(), 0, 0, true);
12379 }
12380 }
12381 else
12382 {
12383 m_LockingSound = SEffectManager.PlaySound(soundSet, GetPosition(), 0, 0, true);
12384 }
12385 }
12386 else
12387 {
12388 SEffectManager.DestroyEffect(m_LockingSound);
12389 }
12390
12391 break;
12392 #endif
12393
12394 }
12395
12396 if (GetWrittenNoteData())
12397 {
12398 GetWrittenNoteData().OnRPC(sender, rpc_type,ctx);
12399 }
12400 }
12401
12402 //-----------------------------
12403 // VARIABLE MANIPULATION SYSTEM
12404 //-----------------------------
12405 int NameToID(string name)
12406 {
12407 PluginVariables plugin = PluginVariables.Cast(GetPlugin(PluginVariables));
12408 return plugin.GetID(name);
12409 }
12410
12411 string IDToName(int id)
12412 {
12413 PluginVariables plugin = PluginVariables.Cast(GetPlugin(PluginVariables));
12414 return plugin.GetName(id);
12415 }
12416
12418 void OnSyncVariables(ParamsReadContext ctx)//with ID optimization
12419 {
12420 //Debug.Log("OnSyncVariables called for item: "+ ToString(this.GetType()),"varSync");
12421 //read the flags
12422 int varFlags;
12423 if (!ctx.Read(varFlags))
12424 return;
12425
12426 if (varFlags & ItemVariableFlags.FLOAT)
12427 {
12428 ReadVarsFromCTX(ctx);
12429 }
12430 }
12431
12432 override void SerializeNumericalVars(array<float> floats_out)
12433 {
12434 //some variables handled on EntityAI level already!
12435 super.SerializeNumericalVars(floats_out);
12436
12437 // the order of serialization must be the same as the order of de-serialization
12438 //--------------------------------------------
12439 if (IsVariableSet(VARIABLE_QUANTITY))
12440 {
12441 floats_out.Insert(m_VarQuantity);
12442 }
12443 //--------------------------------------------
12444 if (IsVariableSet(VARIABLE_WET))
12445 {
12446 floats_out.Insert(m_VarWet);
12447 }
12448 //--------------------------------------------
12449 if (IsVariableSet(VARIABLE_LIQUIDTYPE))
12450 {
12451 floats_out.Insert(m_VarLiquidType);
12452 }
12453 //--------------------------------------------
12454 if (IsVariableSet(VARIABLE_COLOR))
12455 {
12456 floats_out.Insert(m_ColorComponentR);
12457 floats_out.Insert(m_ColorComponentG);
12458 floats_out.Insert(m_ColorComponentB);
12459 floats_out.Insert(m_ColorComponentA);
12460 }
12461 //--------------------------------------------
12462 if (IsVariableSet(VARIABLE_CLEANNESS))
12463 {
12464 floats_out.Insert(m_Cleanness);
12465 }
12466 }
12467
12468 override void DeSerializeNumericalVars(array<float> floats)
12469 {
12470 //some variables handled on EntityAI level already!
12471 super.DeSerializeNumericalVars(floats);
12472
12473 // the order of serialization must be the same as the order of de-serialization
12474 int index = 0;
12475 int mask = Math.Round(floats.Get(index));
12476
12477 index++;
12478 //--------------------------------------------
12479 if (mask & VARIABLE_QUANTITY)
12480 {
12481 if (m_IsStoreLoad)
12482 {
12483 SetStoreLoadedQuantity(floats.Get(index));
12484 }
12485 else
12486 {
12487 float quantity = floats.Get(index);
12488 SetQuantity(quantity, true, false, false, false);
12489 }
12490 index++;
12491 }
12492 //--------------------------------------------
12493 if (mask & VARIABLE_WET)
12494 {
12495 float wet = floats.Get(index);
12496 SetWet(wet);
12497 index++;
12498 }
12499 //--------------------------------------------
12500 if (mask & VARIABLE_LIQUIDTYPE)
12501 {
12502 int liquidtype = Math.Round(floats.Get(index));
12503 SetLiquidType(liquidtype);
12504 index++;
12505 }
12506 //--------------------------------------------
12507 if (mask & VARIABLE_COLOR)
12508 {
12509 m_ColorComponentR = Math.Round(floats.Get(index));
12510 index++;
12511 m_ColorComponentG = Math.Round(floats.Get(index));
12512 index++;
12513 m_ColorComponentB = Math.Round(floats.Get(index));
12514 index++;
12515 m_ColorComponentA = Math.Round(floats.Get(index));
12516 index++;
12517 }
12518 //--------------------------------------------
12519 if (mask & VARIABLE_CLEANNESS)
12520 {
12521 int cleanness = Math.Round(floats.Get(index));
12522 SetCleanness(cleanness);
12523 index++;
12524 }
12525 }
12526
12527 override void WriteVarsToCTX(ParamsWriteContext ctx)
12528 {
12529 super.WriteVarsToCTX(ctx);
12530
12531 //--------------------------------------------
12532 if (IsVariableSet(VARIABLE_QUANTITY))
12533 {
12534 ctx.Write(GetQuantity());
12535 }
12536 //--------------------------------------------
12537 if (IsVariableSet(VARIABLE_WET))
12538 {
12539 ctx.Write(GetWet());
12540 }
12541 //--------------------------------------------
12542 if (IsVariableSet(VARIABLE_LIQUIDTYPE))
12543 {
12544 ctx.Write(GetLiquidType());
12545 }
12546 //--------------------------------------------
12547 if (IsVariableSet(VARIABLE_COLOR))
12548 {
12549 int r,g,b,a;
12550 GetColor(r,g,b,a);
12551 ctx.Write(r);
12552 ctx.Write(g);
12553 ctx.Write(b);
12554 ctx.Write(a);
12555 }
12556 //--------------------------------------------
12557 if (IsVariableSet(VARIABLE_CLEANNESS))
12558 {
12559 ctx.Write(GetCleanness());
12560 }
12561 }
12562
12563 override bool ReadVarsFromCTX(ParamsReadContext ctx, int version = -1)//with ID optimization
12564 {
12565 if (!super.ReadVarsFromCTX(ctx,version))
12566 return false;
12567
12568 int intValue;
12569 float value;
12570
12571 if (version < 140)
12572 {
12573 if (!ctx.Read(intValue))
12574 return false;
12575
12576 m_VariablesMask = intValue;
12577 }
12578
12579 if (m_VariablesMask & VARIABLE_QUANTITY)
12580 {
12581 if (!ctx.Read(value))
12582 return false;
12583
12584 if (IsStoreLoad())
12585 {
12587 }
12588 else
12589 {
12590 SetQuantity(value, true, false, false, false);
12591 }
12592 }
12593 //--------------------------------------------
12594 if (version < 140)
12595 {
12596 if (m_VariablesMask & VARIABLE_TEMPERATURE)
12597 {
12598 if (!ctx.Read(value))
12599 return false;
12600 SetTemperatureDirect(value);
12601 }
12602 }
12603 //--------------------------------------------
12604 if (m_VariablesMask & VARIABLE_WET)
12605 {
12606 if (!ctx.Read(value))
12607 return false;
12608 SetWet(value);
12609 }
12610 //--------------------------------------------
12611 if (m_VariablesMask & VARIABLE_LIQUIDTYPE)
12612 {
12613 if (!ctx.Read(intValue))
12614 return false;
12615 SetLiquidType(intValue);
12616 }
12617 //--------------------------------------------
12618 if (m_VariablesMask & VARIABLE_COLOR)
12619 {
12620 int r,g,b,a;
12621 if (!ctx.Read(r))
12622 return false;
12623 if (!ctx.Read(g))
12624 return false;
12625 if (!ctx.Read(b))
12626 return false;
12627 if (!ctx.Read(a))
12628 return false;
12629
12630 SetColor(r,g,b,a);
12631 }
12632 //--------------------------------------------
12633 if (m_VariablesMask & VARIABLE_CLEANNESS)
12634 {
12635 if (!ctx.Read(intValue))
12636 return false;
12637 SetCleanness(intValue);
12638 }
12639 //--------------------------------------------
12640 if (version >= 138 && version < 140)
12641 {
12642 if (m_VariablesMask & VARIABLE_TEMPERATURE)
12643 {
12644 if (!ctx.Read(intValue))
12645 return false;
12646 SetFrozen(intValue);
12647 }
12648 }
12649
12650 return true;
12651 }
12652
12653 //----------------------------------------------------------------
12654 override bool OnStoreLoad(ParamsReadContext ctx, int version)
12655 {
12656 m_IsStoreLoad = true;
12658 {
12659 m_FixDamageSystemInit = true;
12660 }
12661
12662 if (!super.OnStoreLoad(ctx, version))
12663 {
12664 m_IsStoreLoad = false;
12665 return false;
12666 }
12667
12668 if (version >= 114)
12669 {
12670 bool hasQuickBarIndexSaved;
12671
12672 if (!ctx.Read(hasQuickBarIndexSaved))
12673 {
12674 m_IsStoreLoad = false;
12675 return false;
12676 }
12677
12678 if (hasQuickBarIndexSaved)
12679 {
12680 int itmQBIndex;
12681
12682 //Load quickbar item bind
12683 if (!ctx.Read(itmQBIndex))
12684 {
12685 m_IsStoreLoad = false;
12686 return false;
12687 }
12688
12689 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
12690 if (itmQBIndex != -1 && parentPlayer)
12691 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
12692 }
12693 }
12694 else
12695 {
12696 // Backup of how it used to be
12697 PlayerBase player;
12698 int itemQBIndex;
12699 if (version == int.MAX)
12700 {
12701 if (!ctx.Read(itemQBIndex))
12702 {
12703 m_IsStoreLoad = false;
12704 return false;
12705 }
12706 }
12707 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
12708 {
12709 //Load quickbar item bind
12710 if (!ctx.Read(itemQBIndex))
12711 {
12712 m_IsStoreLoad = false;
12713 return false;
12714 }
12715 if (itemQBIndex != -1 && player)
12716 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
12717 }
12718 }
12719
12720 if (version < 140)
12721 {
12722 // variable management system
12723 if (!LoadVariables(ctx, version))
12724 {
12725 m_IsStoreLoad = false;
12726 return false;
12727 }
12728 }
12729
12730 //agent trasmission system
12731 if (!LoadAgents(ctx, version))
12732 {
12733 m_IsStoreLoad = false;
12734 return false;
12735 }
12736 if (version >= 132)
12737 {
12738 RemotelyActivatedItemBehaviour raib = GetRemotelyActivatedItemBehaviour();
12739 if (raib)
12740 {
12741 if (!raib.OnStoreLoad(ctx,version))
12742 {
12743 m_IsStoreLoad = false;
12744 return false;
12745 }
12746 }
12747 }
12748
12749 m_IsStoreLoad = false;
12750 return true;
12751 }
12752
12753 //----------------------------------------------------------------
12754
12755 override void OnStoreSave(ParamsWriteContext ctx)
12756 {
12757 super.OnStoreSave(ctx);
12758
12759 PlayerBase player;
12760 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
12761 {
12762 ctx.Write(true); // Keep track of if we should actually read this in or not
12763 //Save quickbar item bind
12764 int itemQBIndex = -1;
12765 itemQBIndex = player.FindQuickBarEntityIndex(this);
12766 ctx.Write(itemQBIndex);
12767 }
12768 else
12769 {
12770 ctx.Write(false); // Keep track of if we should actually read this in or not
12771 }
12772
12773 SaveAgents(ctx);//agent trasmission system
12774
12775 RemotelyActivatedItemBehaviour raib = GetRemotelyActivatedItemBehaviour();
12776 if (raib)
12777 {
12778 raib.OnStoreSave(ctx);
12779 }
12780 }
12781 //----------------------------------------------------------------
12782
12783 override void AfterStoreLoad()
12784 {
12785 super.AfterStoreLoad();
12786
12788 {
12790 }
12791
12792 if (GetStoreLoadedQuantity() != float.LOWEST)
12793 {
12795 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
12796 }
12797 }
12798
12799 override void EEOnAfterLoad()
12800 {
12801 super.EEOnAfterLoad();
12802
12804 {
12805 m_FixDamageSystemInit = false;
12806 }
12807
12810 }
12811
12812 bool CanBeDisinfected()
12813 {
12814 return false;
12815 }
12816
12817
12818 //----------------------------------------------------------------
12819 override void OnVariablesSynchronized()
12820 {
12821 if (m_Initialized)
12822 {
12823 #ifdef PLATFORM_CONSOLE
12824 //bruteforce it is
12825 if (IsSplitable())
12826 {
12827 UIScriptedMenu menu = GetGame().GetUIManager().FindMenu(MENU_INVENTORY);
12828 if (menu)
12829 {
12830 menu.Refresh();
12831 }
12832 }
12833 #endif
12834 }
12835
12837 {
12838 PlayImpactSound(m_ConfigWeight, m_ImpactSpeed, m_ImpactSoundSurfaceHash);
12839 m_WantPlayImpactSound = false;
12840 }
12841
12843 {
12844 SetWeightDirty();
12846 }
12847 if (m_VarWet != m_VarWetPrev)
12848 {
12851 }
12852
12853 if (m_SoundSyncPlay != 0)
12854 {
12855 m_ItemSoundHandler.PlayItemSoundClient(m_SoundSyncPlay);
12856 m_SoundSyncPlay = 0;
12857 }
12858 if (m_SoundSyncStop != 0)
12859 {
12860 m_ItemSoundHandler.StopItemSoundClient(m_SoundSyncStop);
12861 m_SoundSyncStop = 0;
12862 }
12863
12864 super.OnVariablesSynchronized();
12865 }
12866
12867 //------------------------- Quantity
12868 //----------------------------------------------------------------
12870 override bool SetQuantity(float value, bool destroy_config = true, bool destroy_forced = false, bool allow_client = false, bool clamp_to_stack_max = true)
12871 {
12872 if (!IsServerCheck(allow_client))
12873 return false;
12874
12875 if (!HasQuantity())
12876 return false;
12877
12878 float min = GetQuantityMin();
12879 float max = GetQuantityMax();
12880
12881 if (value <= (min + 0.001))
12882 value = min;
12883
12884 if (value == min)
12885 {
12886 if (destroy_config)
12887 {
12888 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
12889 if (dstr)
12890 {
12891 m_VarQuantity = Math.Clamp(value, min, max);
12892 this.Delete();
12893 return true;
12894 }
12895 }
12896 else if (destroy_forced)
12897 {
12898 m_VarQuantity = Math.Clamp(value, min, max);
12899 this.Delete();
12900 return true;
12901 }
12902 // we get here if destroy_config IS true AND dstr(config destroy param) IS false;
12903 RemoveAllAgents();//we remove all agents when we got to the min value, but the item is not getting deleted
12904 }
12905
12906 float delta = m_VarQuantity;
12907 m_VarQuantity = Math.Clamp(value, min, max);
12908
12909 if (GetStoreLoadedQuantity() == float.LOWEST)//any other value means we are setting quantity from storage
12910 {
12911 delta = m_VarQuantity - delta;
12912
12913 if (delta)
12914 OnQuantityChanged(delta);
12915 }
12916
12917 SetVariableMask(VARIABLE_QUANTITY);
12918
12919 return false;
12920 }
12921
12922 //----------------------------------------------------------------
12924 bool AddQuantity(float value, bool destroy_config = true, bool destroy_forced = false)
12925 {
12926 return SetQuantity(GetQuantity() + value, destroy_config, destroy_forced);
12927 }
12928 //----------------------------------------------------------------
12929 void SetQuantityMax()
12930 {
12931 float max = GetQuantityMax();
12932 SetQuantity(max);
12933 }
12934
12935 override void SetQuantityToMinimum()
12936 {
12937 float min = GetQuantityMin();
12938 SetQuantity(min);
12939 }
12940 //----------------------------------------------------------------
12942 override void SetQuantityNormalized(float value, bool destroy_config = true, bool destroy_forced = false)
12943 {
12944 float value_clamped = Math.Clamp(value, 0, 1);//just to make sure
12945 int result = Math.Round(Math.Lerp(GetQuantityMin(), GetQuantityMax(), value_clamped));
12946 SetQuantity(result, destroy_config, destroy_forced);
12947 }
12948
12949 //----------------------------------------------------------------
12951 override float GetQuantityNormalized()
12952 {
12953 return Math.InverseLerp(GetQuantityMin(), GetQuantityMax(),m_VarQuantity);
12954 }
12955
12957 {
12958 return GetQuantityNormalized();
12959 }
12960
12961 /*void SetAmmoNormalized(float value)
12962 {
12963 float value_clamped = Math.Clamp(value, 0, 1);
12964 Magazine this_mag = Magazine.Cast(this);
12965 int max_rounds = this_mag.GetAmmoMax();
12966 int result = value * max_rounds;//can the rounded if higher precision is required
12967 this_mag.SetAmmoCount(result);
12968 }*/
12969 //----------------------------------------------------------------
12970 override int GetQuantityMax()
12971 {
12972 int slot = -1;
12973 if (GetInventory())
12974 {
12975 InventoryLocation il = new InventoryLocation;
12976 GetInventory().GetCurrentInventoryLocation(il);
12977 slot = il.GetSlot();
12978 }
12979
12980 return GetTargetQuantityMax(slot);
12981 }
12982
12983 override int GetTargetQuantityMax(int attSlotID = -1)
12984 {
12985 float quantity_max = 0;
12986
12987 if (IsSplitable()) //only stackable/splitable items can check for stack size
12988 {
12989 if (attSlotID != -1)
12990 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
12991
12992 if (quantity_max <= 0)
12993 quantity_max = m_VarStackMax;
12994 }
12995
12996 if (quantity_max <= 0)
12997 quantity_max = m_VarQuantityMax;
12998
12999 return quantity_max;
13000 }
13001 //----------------------------------------------------------------
13002 override int GetQuantityMin()
13003 {
13004 return m_VarQuantityMin;
13005 }
13006 //----------------------------------------------------------------
13007 int GetQuantityInit()
13008 {
13009 return m_VarQuantityInit;
13010 }
13011
13012 //----------------------------------------------------------------
13013 override bool HasQuantity()
13014 {
13015 return !(GetQuantityMax() - GetQuantityMin() == 0);
13016 }
13017
13018 override float GetQuantity()
13019 {
13020 return m_VarQuantity;
13021 }
13022
13023 bool IsFullQuantity()
13024 {
13025 return GetQuantity() >= GetQuantityMax();
13026 }
13027
13028 //Calculates weight of single item without attachments and cargo
13029 override float GetSingleInventoryItemWeightEx()
13030 {
13031 //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
13032 float weightEx = GetWeightEx();//overall weight of the item
13033 float special = GetInventoryAndCargoWeight();//cargo and attachment weight
13034 return weightEx - special;
13035 }
13036
13037 // Obsolete, use GetSingleInventoryItemWeightEx() instead
13039 {
13041 }
13042
13043 override protected float GetWeightSpecialized(bool forceRecalc = false)
13044 {
13045 if (IsSplitable()) //quantity determines size of the stack
13046 {
13047 #ifdef DEVELOPER
13048 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
13049 {
13050 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
13051 data1.SetCalcDetails("TIB1: " + GetConfigWeightModifiedDebugText() +" * " + GetQuantity()+"(quantity)");
13052 }
13053 #endif
13054
13055 return GetQuantity() * GetConfigWeightModified();
13056 }
13057 else if (HasEnergyManager())// items with energy manager
13058 {
13059 #ifdef DEVELOPER
13060 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
13061 {
13062 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
13063 data2.SetCalcDetails("TIB2: "+super.GetWeightSpecialized(forceRecalc)+"(contents weight) + " + GetConfigWeightModifiedDebugText() +" + " + GetCompEM().GetEnergy()+"(energy) * " + ConfigGetFloat("weightPerQuantityUnit") +"(weightPerQuantityUnit)");
13064 }
13065 #endif
13066 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
13067 }
13068 else//everything else
13069 {
13070 #ifdef DEVELOPER
13071 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
13072 {
13073 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
13074 data3.SetCalcDetails("TIB3: "+super.GetWeightSpecialized(forceRecalc)+"(contents weight) + " + GetConfigWeightModifiedDebugText() +" + " + GetQuantity()+"(quantity) * " + ConfigGetFloat("weightPerQuantityUnit") +"(weightPerQuantityUnit))");
13075 }
13076 #endif
13077 return super.GetWeightSpecialized(forceRecalc) + (GetQuantity() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
13078 }
13079 }
13080
13082 int GetNumberOfItems()
13083 {
13084 int item_count = 0;
13085 ItemBase item;
13086
13087 if (GetInventory().GetCargo() != NULL)
13088 {
13089 item_count = GetInventory().GetCargo().GetItemCount();
13090 }
13091
13092 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
13093 {
13094 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
13095 if (item)
13096 item_count += item.GetNumberOfItems();
13097 }
13098 return item_count;
13099 }
13100
13102 float GetUnitWeight(bool include_wetness = true)
13103 {
13104 float weight = 0;
13105 float wetness = 1;
13106 if (include_wetness)
13107 wetness += GetWet();
13108 if (IsSplitable()) //quantity determines size of the stack
13109 {
13110 weight = wetness * m_ConfigWeight;
13111 }
13112 else if (IsLiquidContainer()) //is a liquid container, default liquid weight is set to 1. May revisit later?
13113 {
13114 weight = 1;
13115 }
13116 return weight;
13117 }
13118
13119 //-----------------------------------------------------------------
13120
13121 override void ClearInventory()
13122 {
13123 if ((GetGame().IsServer() || !GetGame().IsMultiplayer()) && GetInventory())
13124 {
13125 GameInventory inv = GetInventory();
13126 array<EntityAI> items = new array<EntityAI>;
13127 inv.EnumerateInventory(InventoryTraversalType.INORDER, items);
13128 for (int i = 0; i < items.Count(); i++)
13129 {
13130 ItemBase item = ItemBase.Cast(items.Get(i));
13131 if (item)
13132 {
13133 GetGame().ObjectDelete(item);
13134 }
13135 }
13136 }
13137 }
13138
13139 //------------------------- Energy
13140
13141 //----------------------------------------------------------------
13142 float GetEnergy()
13143 {
13144 float energy = 0;
13145 if (HasEnergyManager())
13146 {
13147 energy = GetCompEM().GetEnergy();
13148 }
13149 return energy;
13150 }
13151
13152
13153 override void OnEnergyConsumed()
13154 {
13155 super.OnEnergyConsumed();
13156
13158 }
13159
13160 override void OnEnergyAdded()
13161 {
13162 super.OnEnergyAdded();
13163
13165 }
13166
13167 // Converts energy (from Energy Manager) to quantity, if enabled.
13169 {
13170 if (GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
13171 {
13172 if (HasQuantity())
13173 {
13174 float energy_0to1 = GetCompEM().GetEnergy0To1();
13175 SetQuantityNormalized(energy_0to1);
13176 }
13177 }
13178 }
13179
13180 //----------------------------------------------------------------
13181 float GetHeatIsolationInit()
13182 {
13183 return ConfigGetFloat("heatIsolation");
13184 }
13185
13186 float GetHeatIsolation()
13187 {
13188 return m_HeatIsolation;
13189 }
13190
13191 float GetDryingIncrement(string pIncrementName)
13192 {
13193 string paramPath = string.Format("CfgVehicles %1 EnvironmentWetnessIncrements Drying %2", GetType(), pIncrementName);
13194 if (GetGame().ConfigIsExisting(paramPath))
13195 return GetGame().ConfigGetFloat(paramPath);
13196
13197 return 0.0;
13198 }
13199
13200 float GetSoakingIncrement(string pIncrementName)
13201 {
13202 string paramPath = string.Format("CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2", GetType(), pIncrementName);
13203 if (GetGame().ConfigIsExisting(paramPath))
13204 return GetGame().ConfigGetFloat(paramPath);
13205
13206 return 0.0;
13207 }
13208 //----------------------------------------------------------------
13209 override void SetWet(float value, bool allow_client = false)
13210 {
13211 if (!IsServerCheck(allow_client))
13212 return;
13213
13214 float min = GetWetMin();
13215 float max = GetWetMax();
13216
13217 float previousValue = m_VarWet;
13218
13219 m_VarWet = Math.Clamp(value, min, max);
13220
13221 if (previousValue != m_VarWet)
13222 {
13223 SetVariableMask(VARIABLE_WET);
13224 OnWetChanged(m_VarWet, previousValue);
13225 }
13226 }
13227 //----------------------------------------------------------------
13228 override void AddWet(float value)
13229 {
13230 SetWet(GetWet() + value);
13231 }
13232 //----------------------------------------------------------------
13233 override void SetWetMax()
13234 {
13236 }
13237 //----------------------------------------------------------------
13238 override float GetWet()
13239 {
13240 return m_VarWet;
13241 }
13242 //----------------------------------------------------------------
13243 override float GetWetMax()
13244 {
13245 return m_VarWetMax;
13246 }
13247 //----------------------------------------------------------------
13248 override float GetWetMin()
13249 {
13250 return m_VarWetMin;
13251 }
13252 //----------------------------------------------------------------
13253 override float GetWetInit()
13254 {
13255 return m_VarWetInit;
13256 }
13257 //----------------------------------------------------------------
13258 override void OnWetChanged(float newVal, float oldVal)
13259 {
13260 EWetnessLevel newLevel = GetWetLevelInternal(newVal);
13261 EWetnessLevel oldLevel = GetWetLevelInternal(oldVal);
13262 if (newLevel != oldLevel)
13263 {
13264 OnWetLevelChanged(newLevel,oldLevel);
13265 }
13266 }
13267
13268 override void OnWetLevelChanged(EWetnessLevel newLevel, EWetnessLevel oldLevel)
13269 {
13270 SetWeightDirty();
13271 }
13272
13273 override EWetnessLevel GetWetLevel()
13274 {
13275 return GetWetLevelInternal(m_VarWet);
13276 }
13277
13278 //----------------------------------------------------------------
13279
13280 override void SetStoreLoad(bool value)
13281 {
13282 m_IsStoreLoad = value;
13283 }
13284
13285 override bool IsStoreLoad()
13286 {
13287 return m_IsStoreLoad;
13288 }
13289
13290 override void SetStoreLoadedQuantity(float value)
13291 {
13292 m_StoreLoadedQuantity = value;
13293 }
13294
13295 override float GetStoreLoadedQuantity()
13296 {
13297 return m_StoreLoadedQuantity;
13298 }
13299
13300 //----------------------------------------------------------------
13301
13302 float GetItemModelLength()
13303 {
13304 if (ConfigIsExisting("itemModelLength"))
13305 {
13306 return ConfigGetFloat("itemModelLength");
13307 }
13308 return 0;
13309 }
13310
13311 float GetItemAttachOffset()
13312 {
13313 if (ConfigIsExisting("itemAttachOffset"))
13314 {
13315 return ConfigGetFloat("itemAttachOffset");
13316 }
13317 return 0;
13318 }
13319
13320 override void SetCleanness(int value, bool allow_client = false)
13321 {
13322 if (!IsServerCheck(allow_client))
13323 return;
13324
13325 int previousValue = m_Cleanness;
13326
13327 m_Cleanness = Math.Clamp(value, m_CleannessMin, m_CleannessMax);
13328
13329 if (previousValue != m_Cleanness)
13330 SetVariableMask(VARIABLE_CLEANNESS);
13331 }
13332
13333 override int GetCleanness()
13334 {
13335 return m_Cleanness;
13336 }
13337
13339 {
13340 return true;
13341 }
13342
13343 //----------------------------------------------------------------
13344 // ATTACHMENT LOCKING
13345 // Getters relevant to generic ActionLockAttachment
13346 int GetLockType()
13347 {
13348 return m_LockType;
13349 }
13350
13351 string GetLockSoundSet()
13352 {
13353 return m_LockSoundSet;
13354 }
13355
13356 //----------------------------------------------------------------
13357 //------------------------- Color
13358 // sets items color variable given color components
13359 override void SetColor(int r, int g, int b, int a)
13360 {
13365 SetVariableMask(VARIABLE_COLOR);
13366 }
13368 override void GetColor(out int r,out int g,out int b,out int a)
13369 {
13374 }
13375
13376 bool IsColorSet()
13377 {
13378 return IsVariableSet(VARIABLE_COLOR);
13379 }
13380
13382 string GetColorString()
13383 {
13384 int r,g,b,a;
13385 GetColor(r,g,b,a);
13386 r = r/255;
13387 g = g/255;
13388 b = b/255;
13389 a = a/255;
13390 return MiscGameplayFunctions.GetColorString(r, g, b, a);
13391 }
13392 //----------------------------------------------------------------
13393 //------------------------- LiquidType
13394
13395 override void SetLiquidType(int value, bool allow_client = false)
13396 {
13397 if (!IsServerCheck(allow_client))
13398 return;
13399
13400 int old = m_VarLiquidType;
13401 m_VarLiquidType = value;
13402 OnLiquidTypeChanged(old,value);
13403 SetVariableMask(VARIABLE_LIQUIDTYPE);
13404 }
13405
13406 int GetLiquidTypeInit()
13407 {
13408 return ConfigGetInt("varLiquidTypeInit");
13409 }
13410
13411 override int GetLiquidType()
13412 {
13413 return m_VarLiquidType;
13414 }
13415
13416 protected void OnLiquidTypeChanged(int oldType, int newType)
13417 {
13418 if (newType == LIQUID_NONE && GetIsFrozen())
13419 SetFrozen(false);
13420 }
13421
13423 void UpdateQuickbarShortcutVisibility(PlayerBase player)
13424 {
13425 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13426 }
13427
13428 // -------------------------------------------------------------------------
13430 void OnInventoryEnter(Man player)
13431 {
13432 PlayerBase nplayer;
13433 if (PlayerBase.CastTo(nplayer, player))
13434 {
13435 m_CanPlayImpactSound = true;
13436 //nplayer.OnItemInventoryEnter(this);
13437 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13438 }
13439 }
13440
13441 // -------------------------------------------------------------------------
13443 void OnInventoryExit(Man player)
13444 {
13445 PlayerBase nplayer;
13446 if (PlayerBase.CastTo(nplayer,player))
13447 {
13448 //nplayer.OnItemInventoryExit(this);
13449 nplayer.SetEnableQuickBarEntityShortcut(this,false);
13450
13451 }
13452
13453 //if (!GetGame().IsDedicatedServer())
13454 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
13455
13456
13457 if (HasEnergyManager())
13458 {
13459 GetCompEM().UpdatePlugState(); // Unplug the el. device if it's necesarry.
13460 }
13461 }
13462
13463 // ADVANCED PLACEMENT EVENTS
13464 override void OnPlacementStarted(Man player)
13465 {
13466 super.OnPlacementStarted(player);
13467
13468 SetTakeable(false);
13469 }
13470
13471 override void OnPlacementComplete(Man player, vector position = "0 0 0", vector orientation = "0 0 0")
13472 {
13473 if (m_AdminLog)
13474 {
13475 m_AdminLog.OnPlacementComplete(player, this);
13476 }
13477
13478 super.OnPlacementComplete(player, position, orientation);
13479 }
13480
13481 //-----------------------------
13482 // AGENT SYSTEM
13483 //-----------------------------
13484 //--------------------------------------------------------------------------
13485 bool ContainsAgent(int agent_id)
13486 {
13487 if (agent_id & m_AttachedAgents)
13488 {
13489 return true;
13490 }
13491 else
13492 {
13493 return false;
13494 }
13495 }
13496
13497 //--------------------------------------------------------------------------
13498 override void RemoveAgent(int agent_id)
13499 {
13500 if (ContainsAgent(agent_id))
13501 {
13502 m_AttachedAgents = ~agent_id & m_AttachedAgents;
13503 }
13504 }
13505
13506 //--------------------------------------------------------------------------
13507 override void RemoveAllAgents()
13508 {
13509 m_AttachedAgents = 0;
13510 }
13511 //--------------------------------------------------------------------------
13512 override void RemoveAllAgentsExcept(int agent_to_keep)
13513 {
13514 m_AttachedAgents = m_AttachedAgents & agent_to_keep;
13515 }
13516 // -------------------------------------------------------------------------
13517 override void InsertAgent(int agent, float count = 1)
13518 {
13519 if (count < 1)
13520 return;
13521 //Debug.Log("Inserting Agent on item: " + agent.ToString() +" count: " + count.ToString());
13523 }
13524
13526 void TransferAgents(int agents)
13527 {
13529 }
13530
13531 // -------------------------------------------------------------------------
13532 override int GetAgents()
13533 {
13534 return m_AttachedAgents;
13535 }
13536 //----------------------------------------------------------------------
13537
13538 /*int GetContaminationType()
13539 {
13540 int contamination_type;
13541
13542 const int CONTAMINATED_MASK = eAgents.CHOLERA | eAgents.INFLUENZA | eAgents.SALMONELLA | eAgents.BRAIN;
13543 const int POISONED_MASK = eAgents.FOOD_POISON | eAgents.CHEMICAL_POISON;
13544 const int NERVE_GAS_MASK = eAgents.CHEMICAL_POISON;
13545 const int DIRTY_MASK = eAgents.WOUND_AGENT;
13546
13547 Edible_Base edible = Edible_Base.Cast(this);
13548 int agents = GetAgents();
13549 if (edible)
13550 {
13551 NutritionalProfile profile = Edible_Base.GetNutritionalProfile(edible);
13552 if (profile)
13553 {
13554 agents = agents | profile.GetAgents();//merge item's agents with nutritional agents
13555 }
13556 }
13557 if (agents & CONTAMINATED_MASK)
13558 {
13559 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_CONTAMINATED;
13560 }
13561 if (agents & POISONED_MASK)
13562 {
13563 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_POISONED;
13564 }
13565 if (agents & NERVE_GAS_MASK)
13566 {
13567 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_NERVE_GAS;
13568 }
13569 if (agents & DIRTY_MASK)
13570 {
13571 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_DIRTY;
13572 }
13573
13574 return agents;
13575 }*/
13576
13577 // -------------------------------------------------------------------------
13578 bool LoadAgents(ParamsReadContext ctx, int version)
13579 {
13580 if (!ctx.Read(m_AttachedAgents))
13581 return false;
13582 return true;
13583 }
13584 // -------------------------------------------------------------------------
13586 {
13587
13589 }
13590 // -------------------------------------------------------------------------
13591
13593 override void CheckForRoofLimited(float timeTresholdMS = 3000)
13594 {
13595 super.CheckForRoofLimited(timeTresholdMS);
13596
13597 float time = GetGame().GetTime();
13598 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
13599 {
13600 m_PreviousRoofTestTime = time;
13601 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
13602 }
13603 }
13604
13605 // returns item's protection level against enviromental hazard, for masks with filters, returns the filters protection for valid filter, otherwise 0
13606 float GetProtectionLevel(int type, bool consider_filter = false, int system = 0)
13607 {
13608 if (IsDamageDestroyed() || (HasQuantity() && GetQuantity() <= 0))
13609 {
13610 return 0;
13611 }
13612
13613 if (GetInventory().GetAttachmentSlotsCount() != 0)//is it an item with attachable filter ?
13614 {
13615 ItemBase filter = ItemBase.Cast(FindAttachmentBySlotName("GasMaskFilter"));
13616 if (filter)
13617 return filter.GetProtectionLevel(type, false, system);//it's a valid filter, return the protection
13618 else
13619 return 0;//otherwise return 0 when no filter attached
13620 }
13621
13622 string subclassPath, entryName;
13623
13624 switch (type)
13625 {
13626 case DEF_BIOLOGICAL:
13627 entryName = "biological";
13628 break;
13629 case DEF_CHEMICAL:
13630 entryName = "chemical";
13631 break;
13632 default:
13633 entryName = "biological";
13634 break;
13635 }
13636
13637 subclassPath = "CfgVehicles " + this.GetType() + " Protection ";
13638
13639 return GetGame().ConfigGetFloat(subclassPath + entryName);
13640 }
13641
13642
13643
13645 override void EEOnCECreate()
13646 {
13647 if (!IsMagazine())
13649
13651 }
13652
13653
13654 //-------------------------
13655 // OPEN/CLOSE USER ACTIONS
13656 //-------------------------
13658 void Open();
13659 void Close();
13660 bool IsOpen()
13661 {
13662 return true;
13663 }
13664
13665 override bool CanDisplayCargo()
13666 {
13667 return IsOpen();
13668 }
13669
13670
13671 // ------------------------------------------------------------
13672 // CONDITIONS
13673 // ------------------------------------------------------------
13674 override bool CanPutInCargo(EntityAI parent)
13675 {
13676 if (parent)
13677 {
13678 if (parent.IsInherited(DayZInfected))
13679 return true;
13680
13681 if (!parent.IsRuined())
13682 return true;
13683 }
13684
13685 return true;
13686 }
13687
13688 override bool CanPutAsAttachment(EntityAI parent)
13689 {
13690 if (!super.CanPutAsAttachment(parent))
13691 {
13692 return false;
13693 }
13694
13695 if (!IsRuined() && !parent.IsRuined())
13696 {
13697 return true;
13698 }
13699
13700 return false;
13701 }
13702
13703 override bool CanReceiveItemIntoCargo(EntityAI item)
13704 {
13705 //removed 15.06. coz of loading from storage -> after load items in cargo was lost -> waiting for proper solution
13706 //if (GetHealthLevel() == GameConstants.STATE_RUINED)
13707 // return false;
13708
13709 return super.CanReceiveItemIntoCargo(item);
13710 }
13711
13712 override bool CanReceiveAttachment(EntityAI attachment, int slotId)
13713 {
13714 //removed 15.06. coz of loading from storage -> after load items in cargo was lost -> waiting for proper solution
13715 //if (GetHealthLevel() == GameConstants.STATE_RUINED)
13716 // return false;
13717
13718 GameInventory attachmentInv = attachment.GetInventory();
13719 if (attachmentInv && attachmentInv.GetCargo() && attachmentInv.GetCargo().GetItemCount() > 0)
13720 {
13721 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
13722 return false;
13723 }
13724
13725 InventoryLocation loc = new InventoryLocation();
13726 attachment.GetInventory().GetCurrentInventoryLocation(loc);
13727 if (loc && loc.IsValid() && !GetInventory().AreChildrenAccessible())
13728 return false;
13729
13730 return super.CanReceiveAttachment(attachment, slotId);
13731 }
13732
13733 override bool CanReleaseAttachment(EntityAI attachment)
13734 {
13735 if (!super.CanReleaseAttachment(attachment))
13736 return false;
13737
13738 return GetInventory().AreChildrenAccessible();
13739 }
13740
13741 /*override bool CanLoadAttachment(EntityAI attachment)
13742 {
13743 //removed 15.06. coz of loading from storage -> after load items in cargo was lost -> waiting for proper solution
13744 //if (GetHealthLevel() == GameConstants.STATE_RUINED)
13745 // return false;
13746
13747 GameInventory attachmentInv = attachment.GetInventory();
13748 if (attachmentInv && attachmentInv.GetCargo() && attachmentInv.GetCargo().GetItemCount() > 0)
13749 {
13750 bool boo = (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase));
13751 ErrorEx("CanLoadAttachment | this: " + this + " | attachment: " + attachment + " | boo: " + boo,ErrorExSeverity.INFO);
13752
13753 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
13754 return false;
13755 }
13756
13757 return super.CanLoadAttachment(attachment);
13758 }*/
13759
13760 // Plays muzzle flash particle effects
13761 static void PlayFireParticles(ItemBase weapon, int muzzle_index, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
13762 {
13763 int id = muzzle_owner.GetMuzzleID();
13764 array<ref WeaponParticlesOnFire> WPOF_array = m_OnFireEffect.Get(id);
13765
13766 if (WPOF_array)
13767 {
13768 for (int i = 0; i < WPOF_array.Count(); i++)
13769 {
13770 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
13771
13772 if (WPOF)
13773 {
13774 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
13775 }
13776 }
13777 }
13778 }
13779
13780 // Plays bullet eject particle effects (usually just smoke, the bullet itself is a 3D model and is not part of this function)
13781 static void PlayBulletCasingEjectParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
13782 {
13783 int id = muzzle_owner.GetMuzzleID();
13784 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = m_OnBulletCasingEjectEffect.Get(id);
13785
13786 if (WPOBE_array)
13787 {
13788 for (int i = 0; i < WPOBE_array.Count(); i++)
13789 {
13790 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
13791
13792 if (WPOBE)
13793 {
13794 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13795 }
13796 }
13797 }
13798 }
13799
13800 // Plays all weapon overheating particles
13801 static void PlayOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
13802 {
13803 int id = muzzle_owner.GetMuzzleID();
13804 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13805
13806 if (WPOOH_array)
13807 {
13808 for (int i = 0; i < WPOOH_array.Count(); i++)
13809 {
13810 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13811
13812 if (WPOOH)
13813 {
13814 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13815 }
13816 }
13817 }
13818 }
13819
13820 // Updates all weapon overheating particles
13821 static void UpdateOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
13822 {
13823 int id = muzzle_owner.GetMuzzleID();
13824 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13825
13826 if (WPOOH_array)
13827 {
13828 for (int i = 0; i < WPOOH_array.Count(); i++)
13829 {
13830 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13831
13832 if (WPOOH)
13833 {
13834 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13835 }
13836 }
13837 }
13838 }
13839
13840 // Stops overheating particles
13841 static void StopOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
13842 {
13843 int id = muzzle_owner.GetMuzzleID();
13844 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13845
13846 if (WPOOH_array)
13847 {
13848 for (int i = 0; i < WPOOH_array.Count(); i++)
13849 {
13850 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13851
13852 if (WPOOH)
13853 {
13854 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13855 }
13856 }
13857 }
13858 }
13859
13860 //----------------------------------------------------------------
13861 //Item Behaviour - unified approach
13862 override bool IsHeavyBehaviour()
13863 {
13864 if (m_ItemBehaviour == 0)
13865 {
13866 return true;
13867 }
13868
13869 return false;
13870 }
13871
13872 override bool IsOneHandedBehaviour()
13873 {
13874 if (m_ItemBehaviour == 1)
13875 {
13876 return true;
13877 }
13878
13879 return false;
13880 }
13881
13882 override bool IsTwoHandedBehaviour()
13883 {
13884 if (m_ItemBehaviour == 2)
13885 {
13886 return true;
13887 }
13888
13889 return false;
13890 }
13891
13892 bool IsDeployable()
13893 {
13894 return false;
13895 }
13896
13898 float GetDeployTime()
13899 {
13900 return UATimeSpent.DEFAULT_DEPLOY;
13901 }
13902
13903
13904 //----------------------------------------------------------------
13905 // Item Targeting (User Actions)
13906 override void SetTakeable(bool pState)
13907 {
13908 m_IsTakeable = pState;
13909 SetSynchDirty();
13910 }
13911
13912 override bool IsTakeable()
13913 {
13914 return m_IsTakeable;
13915 }
13916
13917 // For cases where we want to show object widget which cant be taken to hands
13919 {
13920 return false;
13921 }
13922
13924 protected void PreLoadSoundAttachmentType()
13925 {
13926 string att_type = "None";
13927
13928 if (ConfigIsExisting("soundAttType"))
13929 {
13930 att_type = ConfigGetString("soundAttType");
13931 }
13932
13933 m_SoundAttType = att_type;
13934 }
13935
13936 override string GetAttachmentSoundType()
13937 {
13938 return m_SoundAttType;
13939 }
13940
13941 //----------------------------------------------------------------
13942 //SOUNDS - ItemSoundHandler
13943 //----------------------------------------------------------------
13944
13945 string GetPlaceSoundset(); // played when deploy starts
13946 string GetLoopDeploySoundset(); // played when deploy starts and stopped when it finishes
13947 string GetDeploySoundset(); // played when deploy sucessfully finishes
13948 string GetLoopFoldSoundset(); // played when fold starts and stopped when it finishes
13949 string GetFoldSoundset(); // played when fold sucessfully finishes
13950
13952 {
13953 if (!m_ItemSoundHandler)
13955
13956 return m_ItemSoundHandler;
13957 }
13958
13959 // override to initialize sounds
13960 protected void InitItemSounds()
13961 {
13962 if (GetPlaceSoundset() == string.Empty && GetDeploySoundset() == string.Empty && GetLoopDeploySoundset() == string.Empty)
13963 return;
13964
13966
13967 if (GetPlaceSoundset() != string.Empty)
13968 handler.AddSound(SoundConstants.ITEM_PLACE, GetPlaceSoundset());
13969
13970 if (GetDeploySoundset() != string.Empty)
13971 handler.AddSound(SoundConstants.ITEM_DEPLOY, GetDeploySoundset());
13972
13973 SoundParameters params = new SoundParameters();
13974 params.m_Loop = true;
13975 if (GetLoopDeploySoundset() != string.Empty)
13976 handler.AddSound(SoundConstants.ITEM_DEPLOY_LOOP, GetLoopDeploySoundset(), params);
13977 }
13978
13979 // Start sound using ItemSoundHandler
13980 void StartItemSoundServer(int id)
13981 {
13982 if (!GetGame().IsServer())
13983 return;
13984
13985 m_SoundSyncPlay = id;
13986 SetSynchDirty();
13987
13988 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).Remove(ClearStartItemSoundServer); // in case one is queued already
13990 }
13991
13992 // Stop sound using ItemSoundHandler
13993 void StopItemSoundServer(int id)
13994 {
13995 if (!GetGame().IsServer())
13996 return;
13997
13998 m_SoundSyncStop = id;
13999 SetSynchDirty();
14000
14001 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).Remove(ClearStopItemSoundServer); // in case one is queued already
14003 }
14004
14005 protected void ClearStartItemSoundServer()
14006 {
14007 m_SoundSyncPlay = 0;
14008 }
14009
14010 protected void ClearStopItemSoundServer()
14011 {
14012 m_SoundSyncStop = 0;
14013 }
14014
14016 void PlayAttachSound(string slot_type)
14017 {
14018 if (!GetGame().IsDedicatedServer())
14019 {
14020 if (ConfigIsExisting("attachSoundSet"))
14021 {
14022 string cfg_path = "";
14023 string soundset = "";
14024 string type_name = GetType();
14025
14026 TStringArray cfg_soundset_array = new TStringArray;
14027 TStringArray cfg_slot_array = new TStringArray;
14028 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
14029 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
14030
14031 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
14032 {
14033 for (int i = 0; i < cfg_soundset_array.Count(); i++)
14034 {
14035 if (cfg_slot_array[i] == slot_type)
14036 {
14037 soundset = cfg_soundset_array[i];
14038 break;
14039 }
14040 }
14041 }
14042
14043 if (soundset != "")
14044 {
14045 EffectSound sound = SEffectManager.PlaySound(soundset, GetPosition());
14046 sound.SetAutodestroy(true);
14047 }
14048 }
14049 }
14050 }
14051
14052 void PlayDetachSound(string slot_type)
14053 {
14054 //TODO - evaluate if needed and devise universal config structure if so
14055 }
14056
14057 void OnApply(PlayerBase player);
14058
14060 {
14061 return 1.0;
14062 };
14063 //returns applicable selection
14064 array<string> GetHeadHidingSelection()
14065 {
14067 }
14068
14070 {
14072 }
14073
14074 WrittenNoteData GetWrittenNoteData() {};
14075
14077 {
14078 SetDynamicPhysicsLifeTime(0.01);
14079 m_ItemBeingDroppedPhys = false;
14080 }
14081
14083 {
14084 array<string> zone_names = new array<string>;
14085 GetDamageZones(zone_names);
14086 for (int i = 0; i < zone_names.Count(); i++)
14087 {
14088 SetHealthMax(zone_names.Get(i),"Health");
14089 }
14090 SetHealthMax("","Health");
14091 }
14092
14094 void SetZoneDamageCEInit()
14095 {
14096 float global_health = GetHealth01("","Health");
14097 array<string> zones = new array<string>;
14098 GetDamageZones(zones);
14099 //set damage of all zones to match global health level
14100 for (int i = 0; i < zones.Count(); i++)
14101 {
14102 SetHealth01(zones.Get(i),"Health",global_health);
14103 }
14104 }
14105
14107 bool IsCoverFaceForShave(string slot_name)
14108 {
14109 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
14110 }
14111
14112 void ProcessItemWetness(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
14113 {
14114 if (!hasRootAsPlayer)
14115 {
14116 if (refParentIB)
14117 {
14118 // parent is wet
14119 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (m_VarWet < m_VarWetMax))
14120 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
14121 // parent has liquid inside
14122 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (m_VarWet < m_VarWetMax))
14123 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
14124 // drying
14125 else if (m_VarWet > m_VarWetMin)
14126 AddWet(-1 * delta * GetDryingIncrement("ground") * 2);
14127 }
14128 else
14129 {
14130 // drying on ground or inside non-itembase (car, ...)
14131 if (m_VarWet > m_VarWetMin)
14132 AddWet(-1 * delta * GetDryingIncrement("ground"));
14133 }
14134 }
14135 }
14136
14137 void ProcessItemTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
14138 {
14140 {
14141 float target = g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(this);
14142 if (GetTemperature() != target || !IsFreezeThawProgressFinished())
14143 {
14144 float heatPermCoef = 1.0;
14145 EntityAI ent = this;
14146 while (ent)
14147 {
14148 heatPermCoef *= ent.GetHeatPermeabilityCoef();
14149 ent = ent.GetHierarchyParent();
14150 }
14151
14152 SetTemperatureEx(new TemperatureDataInterpolated(target,ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
14153 }
14154 }
14155 }
14156
14157 void HierarchyCheck(out bool hasParent, out bool hasRootAsPlayer, out ItemBase refParentIB)
14158 {
14159 // hierarchy check for an item to decide whether it has some parent and it is in some player inventory
14160 EntityAI parent = GetHierarchyParent();
14161 if (!parent)
14162 {
14163 hasParent = false;
14164 hasRootAsPlayer = false;
14165 }
14166 else
14167 {
14168 hasParent = true;
14169 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
14170 refParentIB = ItemBase.Cast(parent);
14171 }
14172 }
14173
14174 protected void ProcessDecay(float delta, bool hasRootAsPlayer)
14175 {
14176 // this is stub, implemented on Edible_Base
14177 }
14178
14179 bool CanDecay()
14180 {
14181 // return true used on selected food clases so they can decay
14182 return false;
14183 }
14184
14185 protected bool CanProcessDecay()
14186 {
14187 // this is stub, implemented on Edible_Base class
14188 // used to determine whether it is still necessary for the food to decay
14189 return false;
14190 }
14191
14192 protected bool CanHaveWetness()
14193 {
14194 // return true used on selected items that have a wetness effect
14195 return false;
14196 }
14197
14199 bool CanBeConsumed(ConsumeConditionData data = null)
14200 {
14201 return !GetIsFrozen() && IsOpen();
14202 }
14203
14204 override void ProcessVariables()
14205 {
14206 bool hasParent = false, hasRootAsPlayer = false;
14207 ItemBase refParentIB;
14208
14209 bool wwtu = g_Game.IsWorldWetTempUpdateEnabled();
14210 bool foodDecay = g_Game.IsFoodDecayEnabled();
14211
14212 if (wwtu || foodDecay)
14213 {
14214 bool processWetness = wwtu && CanHaveWetness();
14215 bool processTemperature = wwtu && CanHaveTemperature();
14216 bool processDecay = foodDecay && CanDecay() && CanProcessDecay();
14217
14218 if (processWetness || processTemperature || processDecay)
14219 {
14220 HierarchyCheck(hasParent, hasRootAsPlayer, refParentIB);
14221
14222 if (processWetness)
14223 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
14224
14225 if (processTemperature)
14226 ProcessItemTemperature(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
14227
14228 if (processDecay)
14229 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
14230 }
14231 }
14232 }
14233
14236 {
14237 return m_TemperaturePerQuantityWeight * GameConstants.ITEM_TEMPERATURE_QUANTITY_WEIGHT_MULTIPLIER;
14238 }
14239
14240 override float GetTemperatureFreezeThreshold()
14241 {
14243 return Liquid.GetFreezeThreshold(GetLiquidType());
14244
14245 return super.GetTemperatureFreezeThreshold();
14246 }
14247
14248 override float GetTemperatureThawThreshold()
14249 {
14251 return Liquid.GetThawThreshold(GetLiquidType());
14252
14253 return super.GetTemperatureThawThreshold();
14254 }
14255
14256 override float GetItemOverheatThreshold()
14257 {
14259 return Liquid.GetBoilThreshold(GetLiquidType());
14260
14261 return super.GetItemOverheatThreshold();
14262 }
14263
14264 override float GetTemperatureFreezeTime()
14265 {
14266 if (HasQuantity())
14267 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),GetQuantityNormalized());
14268
14269 return super.GetTemperatureFreezeTime();
14270 }
14271
14272 override float GetTemperatureThawTime()
14273 {
14274 if (HasQuantity())
14275 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),GetQuantityNormalized());
14276
14277 return super.GetTemperatureThawTime();
14278 }
14279
14281 void AffectLiquidContainerOnFill(int liquid_type, float amount);
14283 void AffectLiquidContainerOnTransfer(int liquidType, float amount, float sourceLiquidTemperature);
14284
14285 bool IsCargoException4x3(EntityAI item)
14286 {
14287 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
14288 }
14289
14291 {
14292 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
14293 }
14294
14296 void AddLightSourceItem(ItemBase lightsource)
14297 {
14298 m_LightSourceItem = lightsource;
14299 }
14300
14302 {
14303 m_LightSourceItem = null;
14304 }
14305
14307 {
14308 return m_LightSourceItem;
14309 }
14310
14312 array<int> GetValidFinishers()
14313 {
14314 return null;
14315 }
14316
14318 bool GetActionWidgetOverride(out typename name)
14319 {
14320 return false;
14321 }
14322
14323 bool PairWithDevice(notnull ItemBase otherDevice)
14324 {
14325 if (GetGame().IsServer())
14326 {
14327 ItemBase explosive = otherDevice;
14329 if (!trg)
14330 {
14331 trg = RemoteDetonatorTrigger.Cast(otherDevice);
14332 explosive = this;
14333 }
14334
14335 explosive.PairRemote(trg);
14336 trg.SetControlledDevice(explosive);
14337
14338 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
14339 trg.SetPersistentPairID(persistentID);
14340 explosive.SetPersistentPairID(persistentID);
14341
14342 return true;
14343 }
14344 return false;
14345 }
14346
14348 float GetBaitEffectivity()
14349 {
14350 float ret = 1.0;
14351 if (HasQuantity())
14352 ret *= GetQuantityNormalized();
14353 ret *= GetHealth01();
14354
14355 return ret;
14356 }
14357
14358 #ifdef DEVELOPER
14359 override void SetDebugItem()
14360 {
14361 super.SetDebugItem();
14362 _itemBase = this;
14363 }
14364
14365 override string GetDebugText()
14366 {
14367 string text = super.GetDebugText();
14368
14369 text += string.Format("Heat isolation(raw): %1\n", GetHeatIsolation());
14370 text += string.Format("Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(this));
14371
14372 return text;
14373 }
14374 #endif
14375
14376 bool CanBeUsedForSuicide()
14377 {
14378 return true;
14379 }
14380
14382 //DEPRECATED BELOW
14384 // Backwards compatibility
14385 void ProcessItemWetnessAndTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
14386 {
14387 ProcessItemWetness(delta, hasParent, hasRootAsPlayer, refParentIB);
14388 ProcessItemTemperature(delta, hasParent, hasRootAsPlayer, refParentIB);
14389 }
14390
14391 // replaced by ItemSoundHandler
14392 protected EffectSound m_SoundDeployFinish;
14393 protected EffectSound m_SoundPlace;
14394 protected EffectSound m_DeployLoopSoundEx;
14395 protected EffectSound m_SoundDeploy;
14396 bool m_IsPlaceSound;
14397 bool m_IsDeploySound;
14399
14400 string GetDeployFinishSoundset();
14401 void PlayDeploySound();
14402 void PlayDeployFinishSound();
14403 void PlayPlaceSound();
14404 void PlayDeployLoopSoundEx();
14405 void StopDeployLoopSoundEx();
14406 void SoundSynchRemoteReset();
14407 void SoundSynchRemote();
14408 bool UsesGlobalDeploy(){return false;}
14409 bool CanPlayDeployLoopSound(){return false;}
14411 bool IsPlaceSound(){return m_IsPlaceSound;}
14412 bool IsDeploySound(){return m_IsDeploySound;}
14413 void SetIsPlaceSound(bool is_place_sound);
14414 void SetIsDeploySound(bool is_deploy_sound);
14415}
14416
14417EntityAI SpawnItemOnLocation(string object_name, notnull InventoryLocation loc, bool full_quantity)
14418{
14419 EntityAI entity = SpawnEntity(object_name, loc, ECE_IN_INVENTORY, RF_DEFAULT);
14420 if (entity)
14421 {
14422 bool is_item = entity.IsInherited(ItemBase);
14423 if (is_item && full_quantity)
14424 {
14425 ItemBase item = ItemBase.Cast(entity);
14426 item.SetQuantity(item.GetQuantityInit());
14427 }
14428 }
14429 else
14430 {
14431 ErrorEx("Cannot spawn entity: " + object_name,ErrorExSeverity.INFO);
14432 return NULL;
14433 }
14434 return entity;
14435}
14436
14437void SetupSpawnedItem(ItemBase item, float health, float quantity)
14438{
14439 if (item)
14440 {
14441 if (health > 0)
14442 item.SetHealth("", "", health);
14443
14444 if (item.CanHaveTemperature())
14445 {
14446 item.SetTemperatureDirect(GameConstants.ITEM_TEMPERATURE_NEUTRAL_ZONE_MIDDLE);
14447 if (item.CanFreeze())
14448 item.SetFrozen(false);
14449 }
14450
14451 if (item.HasEnergyManager())
14452 {
14453 if (quantity >= 0)
14454 {
14455 item.GetCompEM().SetEnergy0To1(quantity);
14456 }
14457 else
14458 {
14459 item.GetCompEM().SetEnergy(Math.AbsFloat(quantity));
14460 }
14461 }
14462 else if (item.IsMagazine())
14463 {
14464 Magazine mag = Magazine.Cast(item);
14465 if (quantity >= 0)
14466 {
14467 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
14468 }
14469 else
14470 {
14471 mag.ServerSetAmmoCount(Math.AbsFloat(quantity));
14472 }
14473
14474 }
14475 else
14476 {
14477 if (quantity >= 0)
14478 {
14479 item.SetQuantityNormalized(quantity, false);
14480 }
14481 else
14482 {
14483 item.SetQuantity(Math.AbsFloat(quantity));
14484 }
14485
14486 }
14487 }
14488}
14489
14490#ifdef DEVELOPER
14491ItemBase _itemBase;//watched item goes here(LCTRL+RMB->Watch)
14492#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()

Используется в Cauldron::CanLoadItemIntoCargo(), FryingPan::CanLoadItemIntoCargo(), Pot::CanLoadItemIntoCargo(), Cauldron::CanPutInCargo(), FryingPan::CanPutInCargo(), Pot::CanPutInCargo(), Cauldron::CanReceiveItemIntoCargo(), FryingPan::CanReceiveItemIntoCargo() и Pot::CanReceiveItemIntoCargo().