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

◆ UsesGlobalDeploy()

bool SpawnItemOnLocation::UsesGlobalDeploy ( )
protected

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

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