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

◆ IsSoundSynchRemote()

bool SpawnItemOnLocation::IsSoundSynchRemote ( )
protected

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

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