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

◆ ProcessItemWetnessAndTemperature()

void SpawnItemOnLocation::ProcessItemWetnessAndTemperature ( float delta,
bool hasParent,
bool hasRootAsPlayer,
ItemBase refParentIB )
protected

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

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