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

◆ IsPlaceSound()

bool SpawnItemOnLocation::IsPlaceSound ( )
protected

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

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