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

◆ IsSoundSynchRemote()

bool SpawnItemOnLocation::IsSoundSynchRemote ( )
protected

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

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