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

◆ GetTemperatureThawTime()

override float SpawnItemOnLocation::GetTemperatureThawTime ( )
protected

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

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

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