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

◆ UsesGlobalDeploy()

bool SpawnItemOnLocation::UsesGlobalDeploy ( )
protected

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

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