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

◆ IsDeploySound()

bool SpawnItemOnLocation::IsDeploySound ( )
protected

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

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