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

◆ GetOnDigWormsAmount()

int SpawnItemOnLocation::GetOnDigWormsAmount ( )
private

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

5767{
5768 override bool CanPutAsAttachment(EntityAI parent)
5769 {
5770 return true;
5771 }
5772};
5773
5774//const bool QUANTITY_DEBUG_REMOVE_ME = false;
5775
5776class ItemBase extends InventoryItem
5777{
5781
5783
5784 static int m_DebugActionsMask;
5786 // ============================================
5787 // Variable Manipulation System
5788 // ============================================
5789 // Quantity
5790
5791 float m_VarQuantity;
5792 float m_VarQuantityPrev;//for client to know quantity changed during synchronization
5794 int m_VarQuantityMin;
5795 int m_VarQuantityMax;
5796 int m_Count;
5797 float m_VarStackMax;
5798 float m_StoreLoadedQuantity = float.LOWEST;
5799 // Wet
5800 float m_VarWet;
5801 float m_VarWetPrev;//for client to know wetness changed during synchronization
5802 float m_VarWetInit;
5803 float m_VarWetMin;
5804 float m_VarWetMax;
5805 // Cleanness
5806 int m_Cleanness;
5807 int m_CleannessInit;
5808 int m_CleannessMin;
5809 int m_CleannessMax;
5810 // impact sounds
5812 bool m_CanPlayImpactSound = true;
5813 float m_ImpactSpeed;
5815 //
5816 float m_HeatIsolation;
5817 float m_ItemModelLength;
5818 float m_ItemAttachOffset; // Offset length for when the item is attached e.g. to weapon
5820 int m_VarLiquidType;
5821 int m_ItemBehaviour; // -1 = not specified; 0 = heavy item; 1= onehanded item; 2 = twohanded item
5822 int m_QuickBarBonus;
5823 bool m_IsBeingPlaced;
5824 bool m_IsHologram;
5825 bool m_IsTakeable;
5826 bool m_ThrowItemOnDrop;
5829 bool m_FixDamageSystemInit = false; //can be changed on storage version check
5830 bool can_this_be_combined; //Check if item can be combined
5831 bool m_CanThisBeSplit; //Check if item can be split
5832 bool m_IsStoreLoad = false;
5833 bool m_CanShowQuantity;
5834 bool m_HasQuantityBar;
5835 protected bool m_CanBeDigged;
5836 protected bool m_IsResultOfSplit
5837
5838 string m_SoundAttType;
5839 // items color variables
5844 //-------------------------------------------------------
5845
5846 // light source managing
5848
5852
5853 //==============================================
5854 // agent system
5855 private int m_AttachedAgents;
5856
5858 void TransferModifiers(PlayerBase reciever);
5859
5860
5861 // Weapons & suppressors particle effects
5866 static int m_LastRegisteredWeaponID = 0;
5867
5868 // Overheating effects
5870 float m_OverheatingShots;
5871 ref Timer m_CheckOverheating;
5872 int m_ShotsToStartOverheating = 0; // After these many shots, the overheating effect begins
5873 int m_MaxOverheatingValue = 0; // Limits the number of shots that will be tracked
5874 float m_OverheatingDecayInterval = 1; // Timer's interval for decrementing overheat effect's lifespan
5875 ref array <ref OverheatingParticle> m_OverheatingParticles;
5876
5878 protected bool m_HideSelectionsBySlot;
5879
5880 // Admin Log
5881 PluginAdminLog m_AdminLog;
5882
5883 // misc
5884 ref Timer m_PhysDropTimer;
5885
5886 // Attachment Locking variables
5887 ref array<int> m_CompatibleLocks;
5888 protected int m_LockType;
5889 protected ref EffectSound m_LockingSound;
5890 protected string m_LockSoundSet;
5891
5892 // ItemSoundHandler
5893 protected const int ITEM_SOUNDS_MAX = 63; // optimize network synch
5894 protected int m_SoundSyncPlay; // id for sound to play
5895 protected int m_SoundSyncStop; // id for sound to stop
5897
5898 //temperature
5899 private float m_TemperaturePerQuantityWeight;
5900
5901 // -------------------------------------------------------------------------
5902 void ItemBase()
5903 {
5904 SetEventMask(EntityEvent.INIT); // Enable EOnInit event
5908
5909 if (!GetGame().IsDedicatedServer())
5910 {
5911 if (HasMuzzle())
5912 {
5914
5916 {
5918 }
5919 }
5920
5922 m_ActionsInitialize = false;
5923 }
5924
5925 m_OldLocation = null;
5926
5927 if (GetGame().IsServer())
5928 {
5929 m_AdminLog = PluginAdminLog.Cast(GetPlugin(PluginAdminLog));
5930 }
5931
5932 if (ConfigIsExisting("headSelectionsToHide"))
5933 {
5935 ConfigGetTextArray("headSelectionsToHide",m_HeadHidingSelections);
5936 }
5937
5938 m_HideSelectionsBySlot = false;
5939 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
5940 {
5941 m_HideSelectionsBySlot = ConfigGetBool("hideSelectionsByinventorySlot");
5942 }
5943
5944 m_QuickBarBonus = Math.Max(0, ConfigGetInt("quickBarBonus"));
5945
5946 m_IsResultOfSplit = false;
5947
5949 }
5950
5951 override void InitItemVariables()
5952 {
5953 super.InitItemVariables();
5954
5955 m_VarQuantityInit = ConfigGetInt("varQuantityInit");
5956 m_VarQuantity = m_VarQuantityInit;//should be by the CE, this is just a precaution
5957 m_VarQuantityMin = ConfigGetInt("varQuantityMin");
5958 m_VarQuantityMax = ConfigGetInt("varQuantityMax");
5959 m_VarStackMax = ConfigGetFloat("varStackMax");
5960 m_Count = ConfigGetInt("count");
5961
5962 m_CanShowQuantity = ConfigGetBool("quantityShow");
5963 m_HasQuantityBar = ConfigGetBool("quantityBar");
5964
5965 m_CleannessInit = ConfigGetInt("varCleannessInit");
5967 m_CleannessMin = ConfigGetInt("varCleannessMin");
5968 m_CleannessMax = ConfigGetInt("varCleannessMax");
5969
5970 m_WantPlayImpactSound = false;
5971 m_ImpactSpeed = 0.0;
5972
5973 m_VarWetInit = ConfigGetFloat("varWetInit");
5975 m_VarWetMin = ConfigGetFloat("varWetMin");
5976 m_VarWetMax = ConfigGetFloat("varWetMax");
5977
5978 m_LiquidContainerMask = ConfigGetInt("liquidContainerType");
5979 if (IsLiquidContainer() && GetQuantity() != 0)
5981 m_IsBeingPlaced = false;
5982 m_IsHologram = false;
5983 m_IsTakeable = true;
5984 m_CanBeMovedOverride = false;
5988 m_CanBeDigged = ConfigGetBool("canBeDigged");
5989
5990 m_CompatibleLocks = new array<int>();
5991 ConfigGetIntArray("compatibleLocks", m_CompatibleLocks);
5992 m_LockType = ConfigGetInt("lockType");
5993
5994 //Define if item can be split and set ability to be combined accordingly
5995 m_CanThisBeSplit = false;
5996 can_this_be_combined = false;
5997 if (ConfigIsExisting("canBeSplit"))
5998 {
5999 can_this_be_combined = ConfigGetBool("canBeSplit");
6001 }
6002
6003 m_ItemBehaviour = -1;
6004 if (ConfigIsExisting("itemBehaviour"))
6005 m_ItemBehaviour = ConfigGetInt("itemBehaviour");
6006
6007 //RegisterNetSyncVariableInt("m_VariablesMask");
6008 if (HasQuantity()) RegisterNetSyncVariableFloat("m_VarQuantity", GetQuantityMin(), m_VarQuantityMax);
6009 RegisterNetSyncVariableFloat("m_VarWet", GetWetMin(), GetWetMax(), 2);
6010 RegisterNetSyncVariableInt("m_VarLiquidType");
6011 RegisterNetSyncVariableInt("m_Cleanness",0,1);
6012
6013 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
6014 RegisterNetSyncVariableFloat("m_ImpactSpeed");
6015 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
6016
6017 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
6018 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
6019 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
6020 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
6021
6022 RegisterNetSyncVariableBool("m_IsBeingPlaced");
6023 RegisterNetSyncVariableBool("m_IsTakeable");
6024 RegisterNetSyncVariableBool("m_IsHologram");
6025
6026 InitItemSounds();
6028 {
6029 RegisterNetSyncVariableInt("m_SoundSyncPlay", 0, ITEM_SOUNDS_MAX);
6030 RegisterNetSyncVariableInt("m_SoundSyncStop", 0, ITEM_SOUNDS_MAX);
6031 }
6032
6033 m_LockSoundSet = ConfigGetString("lockSoundSet");
6034
6036 if (ConfigIsExisting("temperaturePerQuantityWeight"))
6037 m_TemperaturePerQuantityWeight = ConfigGetFloat("temperaturePerQuantityWeight");
6038
6039 }
6040
6041 override int GetQuickBarBonus()
6042 {
6043 return m_QuickBarBonus;
6044 }
6045
6046 void InitializeActions()
6047 {
6049 if (!m_InputActionMap)
6050 {
6052 m_InputActionMap = iam;
6053 SetActions();
6055 }
6056 }
6057
6058 override void GetActions(typename action_input_type, out array<ActionBase_Basic> actions)
6059 {
6061 {
6062 m_ActionsInitialize = true;
6064 }
6065
6066 actions = m_InputActionMap.Get(action_input_type);
6067 }
6068
6069 void SetActions()
6070 {
6071 AddAction(ActionTakeItem);
6072 AddAction(ActionTakeItemToHands);
6073 AddAction(ActionWorldCraft);
6075 AddAction(ActionAttachWithSwitch);
6076 }
6077
6078 void SetActionAnimOverrides(); // Override action animation for specific item
6079
6080 void AddAction(typename actionName)
6081 {
6082 ActionBase action = ActionManagerBase.GetAction(actionName);
6083
6084 if (!action)
6085 {
6086 Debug.LogError("Action " + actionName + " dosn't exist!");
6087 return;
6088 }
6089
6090 typename ai = action.GetInputType();
6091 if (!ai)
6092 {
6093 m_ActionsInitialize = false;
6094 return;
6095 }
6096
6097 array<ActionBase_Basic> action_array = m_InputActionMap.Get(ai);
6098 if (!action_array)
6099 {
6100 action_array = new array<ActionBase_Basic>;
6101 m_InputActionMap.Insert(ai, action_array);
6102 }
6103 if (LogManager.IsActionLogEnable())
6104 {
6105 Debug.ActionLog(action.ToString() + " -> " + ai, this.ToString() , "n/a", "Add action");
6106 }
6107
6108 if (action_array.Find(action) != -1)
6109 {
6110 Debug.Log("Action " + action.Type() + " already added to " + this + ", skipping!");
6111 }
6112 else
6113 {
6114 action_array.Insert(action);
6115 }
6116 }
6117
6118 void RemoveAction(typename actionName)
6119 {
6120 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
6121 ActionBase action = player.GetActionManager().GetAction(actionName);
6122 typename ai = action.GetInputType();
6123 array<ActionBase_Basic> action_array = m_InputActionMap.Get(ai);
6124
6125 if (action_array)
6126 {
6127 action_array.RemoveItem(action);
6128 }
6129 }
6130
6131 // Allows override of default action command per item, defined in the SetActionAnimOverrides() of the item's class
6132 // Set -1 for params which should stay in default state
6133 void OverrideActionAnimation(typename action, int commandUID, int stanceMask = -1, int commandUIDProne = -1)
6134 {
6135 ActionOverrideData overrideData = new ActionOverrideData();
6136 overrideData.m_CommandUID = commandUID;
6137 overrideData.m_CommandUIDProne = commandUIDProne;
6138 overrideData.m_StanceMask = stanceMask;
6139
6140 TActionAnimOverrideMap actionMap = m_ItemActionOverrides.Get(action);
6141 if (!actionMap) // create new map of action > overidables map
6142 {
6143 actionMap = new TActionAnimOverrideMap();
6144 m_ItemActionOverrides.Insert(action, actionMap);
6145 }
6146
6147 actionMap.Insert(this.Type(), overrideData); // insert item -> overrides
6148
6149 }
6150
6151 void OnItemInHandsPlayerSwimStart(PlayerBase player);
6152
6153 ScriptedLightBase GetLight();
6154
6155 // Loads muzzle flash particle configuration from config and saves it to a map for faster access
6156 void LoadParticleConfigOnFire(int id)
6157 {
6158 if (!m_OnFireEffect)
6160
6163
6164 string config_to_search = "CfgVehicles";
6165 string muzzle_owner_config;
6166
6167 if (!m_OnFireEffect.Contains(id))
6168 {
6169 if (IsInherited(Weapon))
6170 config_to_search = "CfgWeapons";
6171
6172 muzzle_owner_config = config_to_search + " " + GetType() + " ";
6173
6174 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
6175
6176 int config_OnFire_subclass_count = GetGame().ConfigGetChildrenCount(config_OnFire_class);
6177
6178 if (config_OnFire_subclass_count > 0)
6179 {
6180 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
6181
6182 for (int i = 0; i < config_OnFire_subclass_count; i++)
6183 {
6184 string particle_class = "";
6185 GetGame().ConfigGetChildName(config_OnFire_class, i, particle_class);
6186 string config_OnFire_entry = config_OnFire_class + particle_class;
6187 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
6188 WPOF_array.Insert(WPOF);
6189 }
6190
6191
6192 m_OnFireEffect.Insert(id, WPOF_array);
6193 }
6194 }
6195
6196 if (!m_OnBulletCasingEjectEffect.Contains(id))
6197 {
6198 config_to_search = "CfgWeapons"; // Bullet Eject efect is supported on weapons only.
6199 muzzle_owner_config = config_to_search + " " + GetType() + " ";
6200
6201 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
6202
6203 int config_OnBulletCasingEject_count = GetGame().ConfigGetChildrenCount(config_OnBulletCasingEject_class);
6204
6205 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
6206 {
6207 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
6208
6209 for (i = 0; i < config_OnBulletCasingEject_count; i++)
6210 {
6211 string particle_class2 = "";
6212 GetGame().ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
6213 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
6214 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
6215 WPOBE_array.Insert(WPOBE);
6216 }
6217
6218
6219 m_OnBulletCasingEjectEffect.Insert(id, WPOBE_array);
6220 }
6221 }
6222 }
6223
6224 // Loads muzzle flash particle configuration from config and saves it to a map for faster access
6226 {
6229
6230 if (!m_OnOverheatingEffect.Contains(id))
6231 {
6232 string config_to_search = "CfgVehicles";
6233
6234 if (IsInherited(Weapon))
6235 config_to_search = "CfgWeapons";
6236
6237 string muzzle_owner_config = config_to_search + " " + GetType() + " ";
6238 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
6239
6240 if (GetGame().ConfigIsExisting(config_OnOverheating_class))
6241 {
6242
6243 m_ShotsToStartOverheating = GetGame().ConfigGetFloat(config_OnOverheating_class + "shotsToStartOverheating");
6244
6246 {
6247 m_ShotsToStartOverheating = -1; // This prevents futher readings from config for future creations of this item
6248 string error = "Error reading config " + GetType() + ">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
6249 Error(error);
6250 return;
6251 }
6252
6253 m_OverheatingDecayInterval = GetGame().ConfigGetFloat(config_OnOverheating_class + "overheatingDecayInterval");
6254 m_MaxOverheatingValue = GetGame().ConfigGetFloat(config_OnOverheating_class + "maxOverheatingValue");
6255
6256
6257
6258 int config_OnOverheating_subclass_count = GetGame().ConfigGetChildrenCount(config_OnOverheating_class);
6259 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
6260
6261 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
6262 {
6263 string particle_class = "";
6264 GetGame().ConfigGetChildName(config_OnOverheating_class, i, particle_class);
6265 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
6266 int entry_type = GetGame().ConfigGetType(config_OnOverheating_entry);
6267
6268 if (entry_type == CT_CLASS)
6269 {
6270 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
6271 WPOOH_array.Insert(WPOF);
6272 }
6273 }
6274
6275
6276 m_OnOverheatingEffect.Insert(id, WPOOH_array);
6277 }
6278 }
6279 }
6280
6281 float GetOverheatingValue()
6282 {
6283 return m_OverheatingShots;
6284 }
6285
6286 void IncreaseOverheating(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
6287 {
6288 if (m_MaxOverheatingValue > 0)
6289 {
6291
6292 if (!m_CheckOverheating)
6294
6296 m_CheckOverheating.Run(m_OverheatingDecayInterval, this, "OnOverheatingDecay");
6297
6298 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6299 }
6300 }
6301
6302 void CheckOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
6303 {
6305 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6306
6308 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6309
6311 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6312
6314 {
6316 }
6317 }
6318
6320 {
6322 }
6323
6324 void OnOverheatingDecay()
6325 {
6326 if (m_MaxOverheatingValue > 0)
6327 m_OverheatingShots -= 1 + m_OverheatingShots / m_MaxOverheatingValue; // The hotter a barrel is, the faster it needs to cool down.
6328 else
6330
6331 if (m_OverheatingShots <= 0)
6332 {
6335 }
6336 else
6337 {
6338 if (!m_CheckOverheating)
6340
6342 m_CheckOverheating.Run(m_OverheatingDecayInterval, this, "OnOverheatingDecay");
6343 }
6344
6345 CheckOverheating(this, "", this);
6346 }
6347
6348 void StartOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
6349 {
6351 ItemBase.PlayOverheatingParticles(this, ammoType, this, suppressor, "CfgWeapons");
6352 }
6353
6354 void UpdateOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
6355 {
6357 ItemBase.UpdateOverheatingParticles(this, ammoType, this, suppressor, "CfgWeapons");
6359 }
6360
6361 void StopOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
6362 {
6364 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6365 }
6366
6367 void RegisterOverheatingParticle(Particle p, float min_heat_coef, float max_heat_coef, int particle_id, Object parent, vector local_pos, vector local_ori)
6368 {
6370 m_OverheatingParticles = new array<ref OverheatingParticle>;
6371
6372 OverheatingParticle OP = new OverheatingParticle();
6373 OP.RegisterParticle(p);
6374 OP.SetOverheatingLimitMin(min_heat_coef);
6375 OP.SetOverheatingLimitMax(max_heat_coef);
6376 OP.SetParticleParams(particle_id, parent, local_pos, local_ori);
6377
6378 m_OverheatingParticles.Insert(OP);
6379 }
6380
6381 float GetOverheatingCoef()
6382 {
6383 if (m_MaxOverheatingValue > 0)
6385
6386 return -1;
6387 }
6388
6390 {
6392 {
6393 float overheat_coef = GetOverheatingCoef();
6394 int count = m_OverheatingParticles.Count();
6395
6396 for (int i = count; i > 0; --i)
6397 {
6398 int id = i - 1;
6399 OverheatingParticle OP = m_OverheatingParticles.Get(id);
6400 Particle p = OP.GetParticle();
6401
6402 float overheat_min = OP.GetOverheatingLimitMin();
6403 float overheat_max = OP.GetOverheatingLimitMax();
6404
6405 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
6406 {
6407 if (p)
6408 {
6409 p.Stop();
6410 OP.RegisterParticle(null);
6411 }
6412 }
6413 }
6414 }
6415 }
6416
6418 {
6420 {
6421 for (int i = m_OverheatingParticles.Count(); i > 0; i--)
6422 {
6423 int id = i - 1;
6424 OverheatingParticle OP = m_OverheatingParticles.Get(id);
6425
6426 if (OP)
6427 {
6428 Particle p = OP.GetParticle();
6429
6430 if (p)
6431 {
6432 p.Stop();
6433 }
6434
6435 delete OP;
6436 }
6437 }
6438
6439 m_OverheatingParticles.Clear();
6441 }
6442 }
6443
6445 float GetInfectionChance(int system = 0, Param param = null)
6446 {
6447 return 0.0;
6448 }
6449
6450
6451 float GetDisinfectQuantity(int system = 0, Param param1 = null)
6452 {
6453 return 250;//default value
6454 }
6455
6456 float GetFilterDamageRatio()
6457 {
6458 return 0;
6459 }
6460
6462 bool HasMuzzle()
6463 {
6464 if (IsInherited(Weapon) || IsInherited(SuppressorBase))
6465 return true;
6466
6467 return false;
6468 }
6469
6471 int GetMuzzleID()
6472 {
6473 if (!m_WeaponTypeToID)
6475
6476 if (m_WeaponTypeToID.Contains(GetType()))
6477 {
6478 return m_WeaponTypeToID.Get(GetType());
6479 }
6480 else
6481 {
6482 // Register new weapon ID
6484 }
6485
6487 }
6488
6495 {
6496 return -1;
6497 }
6498
6499
6500
6501 // -------------------------------------------------------------------------
6502 void ~ItemBase()
6503 {
6504 if (GetGame() && GetGame().GetPlayer() && (!GetGame().IsDedicatedServer()))
6505 {
6506 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
6507 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6508
6509 if (r_index >= 0)
6510 {
6511 InventoryLocation r_il = new InventoryLocation;
6512 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6513
6514 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6515 int r_type = r_il.GetType();
6516 if (r_type == InventoryLocationType.CARGO || r_type == InventoryLocationType.PROXYCARGO)
6517 {
6518 r_il.GetParent().GetOnReleaseLock().Invoke(this);
6519 }
6520 else if (r_type == InventoryLocationType.ATTACHMENT)
6521 {
6522 r_il.GetParent().GetOnAttachmentReleaseLock().Invoke(this, r_il.GetSlot());
6523 }
6524
6525 }
6526
6527 player.GetHumanInventory().ClearUserReservedLocation(this);
6528 }
6529
6530 if (m_LockingSound)
6531 SEffectManager.DestroyEffect(m_LockingSound);
6532 }
6533
6534
6535
6536 // -------------------------------------------------------------------------
6537 static int GetDebugActionsMask()
6538 {
6539 return ItemBase.m_DebugActionsMask;
6540 }
6541
6542 static bool HasDebugActionsMask(int mask)
6543 {
6544 return ItemBase.m_DebugActionsMask & mask;
6545 }
6546
6547 static void SetDebugActionsMask(int mask)
6548 {
6549 ItemBase.m_DebugActionsMask = mask;
6550 }
6551
6552 static void AddDebugActionsMask(int mask)
6553 {
6554 ItemBase.m_DebugActionsMask |= mask;
6555 }
6556
6557 static void RemoveDebugActionsMask(int mask)
6558 {
6559 ItemBase.m_DebugActionsMask &= ~mask;
6560 }
6561
6562 static void ToggleDebugActionsMask(int mask)
6563 {
6564 if (HasDebugActionsMask(mask))
6565 {
6567 }
6568 else
6569 {
6570 AddDebugActionsMask(mask);
6571 }
6572 }
6573
6574 // -------------------------------------------------------------------------
6575 void SetCEBasedQuantity()
6576 {
6577 if (GetEconomyProfile())
6578 {
6579 float q_max = GetEconomyProfile().GetQuantityMax();
6580 if (q_max > 0)
6581 {
6582 float q_min = GetEconomyProfile().GetQuantityMin();
6583 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
6584
6585 if (HasComponent(COMP_TYPE_ENERGY_MANAGER))//more direct access for speed
6586 {
6587 ComponentEnergyManager comp = GetCompEM();
6588 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
6589 {
6590 comp.SetEnergy0To1(quantity_randomized);
6591 }
6592 }
6593 else if (HasQuantity())
6594 {
6595 SetQuantityNormalized(quantity_randomized, false);
6596 //PrintString("<==> Normalized quantity for item: "+ GetType()+", qmin:"+q_min.ToString()+"; qmax:"+q_max.ToString()+";quantity:" +quantity_randomized.ToString());
6597 }
6598
6599 }
6600 }
6601 }
6602
6604 void LockToParent()
6605 {
6606 EntityAI parent = GetHierarchyParent();
6607
6608 if (parent)
6609 {
6610 InventoryLocation inventory_location_to_lock = new InventoryLocation;
6611 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
6612 parent.GetInventory().SetSlotLock(inventory_location_to_lock.GetSlot(), true);
6613 }
6614 }
6615
6617 void UnlockFromParent()
6618 {
6619 EntityAI parent = GetHierarchyParent();
6620
6621 if (parent)
6622 {
6623 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
6624 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
6625 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.GetSlot(), false);
6626 }
6627 }
6628
6629 override void CombineItemsClient(EntityAI entity2, bool use_stack_max = true)
6630 {
6631 /*
6632 ref Param1<EntityAI> item = new Param1<EntityAI>(entity2);
6633 RPCSingleParam(ERPCs.RPC_ITEM_COMBINE, item, GetGame().GetPlayer());
6634 */
6635 ItemBase item2 = ItemBase.Cast(entity2);
6636
6637 if (GetGame().IsClient())
6638 {
6639 if (ScriptInputUserData.CanStoreInputUserData())
6640 {
6641 ScriptInputUserData ctx = new ScriptInputUserData;
6643 ctx.Write(-1);
6644 ItemBase i1 = this; // @NOTE: workaround for correct serialization
6645 ctx.Write(i1);
6646 ctx.Write(item2);
6647 ctx.Write(use_stack_max);
6648 ctx.Write(-1);
6649 ctx.Send();
6650
6651 if (IsCombineAll(item2, use_stack_max))
6652 {
6653 GetGame().GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
6654 }
6655 }
6656 }
6657 else if (!GetGame().IsMultiplayer())
6658 {
6659 CombineItems(item2, use_stack_max);
6660 }
6661 }
6662
6663 bool IsLiquidPresent()
6664 {
6665 return (GetLiquidType() != 0 && HasQuantity());
6666 }
6667
6668 bool IsLiquidContainer()
6669 {
6670 return m_LiquidContainerMask != 0;
6671 }
6672
6674 {
6675 return m_LiquidContainerMask;
6676 }
6677
6678 bool IsBloodContainer()
6679 {
6680 //m_LiquidContainerMask & GROUP_LIQUID_BLOOD ???
6681 return false;
6682 }
6683
6684 bool IsNVG()
6685 {
6686 return false;
6687 }
6688
6691 bool IsExplosive()
6692 {
6693 return false;
6694 }
6695
6697 {
6698 return "";
6699 }
6700
6702
6703 bool IsLightSource()
6704 {
6705 return false;
6706 }
6707
6709 {
6710 return true;
6711 }
6712
6713 //--- ACTION CONDITIONS
6714 //direction
6715 bool IsFacingPlayer(PlayerBase player, string selection)
6716 {
6717 return true;
6718 }
6719
6720 bool IsPlayerInside(PlayerBase player, string selection)
6721 {
6722 return true;
6723 }
6724
6725 override bool CanObstruct()
6726 {
6727 PlayerBase player = PlayerBase.Cast(g_Game.GetPlayer());
6728 return !player || !IsPlayerInside(player, "");
6729 }
6730
6731 override bool IsBeingPlaced()
6732 {
6733 return m_IsBeingPlaced;
6734 }
6735
6736 void SetIsBeingPlaced(bool is_being_placed)
6737 {
6738 m_IsBeingPlaced = is_being_placed;
6739 if (!is_being_placed)
6741 SetSynchDirty();
6742 }
6743
6744 //server-side
6745 void OnEndPlacement() {}
6746
6747 override bool IsHologram()
6748 {
6749 return m_IsHologram;
6750 }
6751
6752 bool CanBeDigged()
6753 {
6754 return m_CanBeDigged;
6755 }
6756
6758 {
6759 return 1;
6760 }
6761
6762 bool CanMakeGardenplot()
6763 {
6764 return false;
6765 }
6766
6767 void SetIsHologram(bool is_hologram)
6768 {
6769 m_IsHologram = is_hologram;
6770 SetSynchDirty();
6771 }
6772 /*
6773 protected float GetNutritionalEnergy()
6774 {
6775 Edible_Base edible = Edible_Base.Cast(this);
6776 return edible.GetFoodEnergy();
6777 }
6778
6779 protected float GetNutritionalWaterContent()
6780 {
6781 Edible_Base edible = Edible_Base.Cast(this);
6782 return edible.GetFoodWater();
6783 }
6784
6785 protected float GetNutritionalIndex()
6786 {
6787 Edible_Base edible = Edible_Base.Cast(this);
6788 return edible.GetFoodNutritionalIndex();
6789 }
6790
6791 protected float GetNutritionalFullnessIndex()
6792 {
6793 Edible_Base edible = Edible_Base.Cast(this);
6794 return edible.GetFoodTotalVolume();
6795 }
6796
6797 protected float GetNutritionalToxicity()
6798 {
6799 Edible_Base edible = Edible_Base.Cast(this);
6800 return edible.GetFoodToxicity();
6801
6802 }
6803 */
6804
6805
6806 // -------------------------------------------------------------------------
6807 override void OnMovedInsideCargo(EntityAI container)
6808 {
6809 super.OnMovedInsideCargo(container);
6810
6811 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6812 }
6813
6814 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
6815 {
6816 super.EEItemLocationChanged(oldLoc,newLoc);
6817
6818 PlayerBase new_player = null;
6819 PlayerBase old_player = null;
6820
6821 if (newLoc.GetParent())
6822 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
6823
6824 if (oldLoc.GetParent())
6825 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
6826
6827 if (old_player && oldLoc.GetType() == InventoryLocationType.HANDS)
6828 {
6829 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
6830
6831 if (r_index >= 0)
6832 {
6833 InventoryLocation r_il = new InventoryLocation;
6834 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6835
6836 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6837 int r_type = r_il.GetType();
6838 if (r_type == InventoryLocationType.CARGO || r_type == InventoryLocationType.PROXYCARGO)
6839 {
6840 r_il.GetParent().GetOnReleaseLock().Invoke(this);
6841 }
6842 else if (r_type == InventoryLocationType.ATTACHMENT)
6843 {
6844 r_il.GetParent().GetOnAttachmentReleaseLock().Invoke(this, r_il.GetSlot());
6845 }
6846
6847 }
6848 }
6849
6850 if (newLoc.GetType() == InventoryLocationType.HANDS)
6851 {
6852 if (new_player)
6853 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
6854
6855 if (new_player == old_player)
6856 {
6857
6858 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
6859 {
6860 if (oldLoc.GetType() == InventoryLocationType.CARGO)
6861 {
6862 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
6863 {
6864 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6865 }
6866 }
6867 else
6868 {
6869 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6870 }
6871 }
6872
6873 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
6874 {
6875 int type = oldLoc.GetType();
6876 if (type == InventoryLocationType.CARGO || type == InventoryLocationType.PROXYCARGO)
6877 {
6878 oldLoc.GetParent().GetOnSetLock().Invoke(this);
6879 }
6880 else if (type == InventoryLocationType.ATTACHMENT)
6881 {
6882 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
6883 }
6884 }
6885 if (!m_OldLocation)
6886 {
6887 m_OldLocation = new InventoryLocation;
6888 }
6889 m_OldLocation.Copy(oldLoc);
6890 }
6891 else
6892 {
6893 if (m_OldLocation)
6894 {
6895 m_OldLocation.Reset();
6896 }
6897 }
6898
6900 }
6901 else
6902 {
6903 if (new_player)
6904 {
6905 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
6906 if (res_index >= 0)
6907 {
6908 InventoryLocation il = new InventoryLocation;
6909 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
6910 ItemBase it = ItemBase.Cast(il.GetItem());
6911 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
6912 int rel_type = il.GetType();
6913 if (rel_type == InventoryLocationType.CARGO || rel_type == InventoryLocationType.PROXYCARGO)
6914 {
6915 il.GetParent().GetOnReleaseLock().Invoke(it);
6916 }
6917 else if (rel_type == InventoryLocationType.ATTACHMENT)
6918 {
6919 il.GetParent().GetOnAttachmentReleaseLock().Invoke(it, il.GetSlot());
6920 }
6921 //it.GetOnReleaseLock().Invoke(it);
6922 }
6923 }
6924 else if (old_player && newLoc.GetType() == InventoryLocationType.GROUND && m_ThrowItemOnDrop)
6925 {
6926 //ThrowPhysically(old_player, vector.Zero);
6927 m_ThrowItemOnDrop = false;
6928 }
6929
6930 if (m_OldLocation)
6931 {
6932 m_OldLocation.Reset();
6933 }
6934 }
6935 }
6936
6937 override void EOnContact(IEntity other, Contact extra)
6938 {
6940 {
6941 int liquidType = -1;
6942 float impactSpeed = ProcessImpactSoundEx(other, extra, m_ConfigWeight, m_ImpactSoundSurfaceHash, liquidType);
6943 if (impactSpeed > 0.0)
6944 {
6945 m_ImpactSpeed = impactSpeed;
6946 #ifndef SERVER
6947 PlayImpactSound(m_ConfigWeight, m_ImpactSpeed, m_ImpactSoundSurfaceHash);
6948 #else
6949 m_WantPlayImpactSound = true;
6950 SetSynchDirty();
6951 #endif
6952 m_CanPlayImpactSound = (liquidType == -1);// prevents further playing of the sound when the surface is a liquid type
6953 }
6954 }
6955
6956 #ifdef SERVER
6957 if (GetCompEM() && GetCompEM().IsPlugged())
6958 {
6959 if (GetCompEM().GetCordLength() < vector.Distance(GetPosition(), GetCompEM().GetEnergySource().GetPosition()))
6960 GetCompEM().UnplugThis();
6961 }
6962 #endif
6963 }
6964
6965 void RefreshPhysics();
6966
6967 override void OnCreatePhysics()
6968 {
6970 }
6971
6972 override void OnItemAttachmentSlotChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
6973 {
6974
6975 }
6976 // -------------------------------------------------------------------------
6977 override void OnItemLocationChanged(EntityAI old_owner, EntityAI new_owner)
6978 {
6979 super.OnItemLocationChanged(old_owner, new_owner);
6980
6981 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
6982 PlayerBase playerNew = PlayerBase.Cast(new_owner);
6983
6984 if (!relatedPlayer && playerNew)
6985 relatedPlayer = playerNew;
6986
6987 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
6988 {
6989 ActionManagerBase actionMgr = relatedPlayer.GetActionManager();
6990 if (actionMgr)
6991 {
6992 ActionBase currentAction = actionMgr.GetRunningAction();
6993 if (currentAction)
6994 currentAction.OnItemLocationChanged(this);
6995 }
6996 }
6997
6998 Man ownerPlayerOld = null;
6999 Man ownerPlayerNew = null;
7000
7001 if (old_owner)
7002 {
7003 if (old_owner.IsMan())
7004 {
7005 ownerPlayerOld = Man.Cast(old_owner);
7006 }
7007 else
7008 {
7009 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
7010 }
7011 }
7012 else
7013 {
7014 if (new_owner && IsElectricAppliance() && GetCompEM() && GetCompEM().IsPlugged())
7015 {
7016 ActionBase action = ActionManagerBase.GetAction(ActionRepositionPluggedItem);
7017
7018 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.GetID())
7019 {
7020 GetCompEM().UnplugThis();
7021 }
7022 }
7023 }
7024
7025 if (new_owner)
7026 {
7027 if (new_owner.IsMan())
7028 {
7029 ownerPlayerNew = Man.Cast(new_owner);
7030 }
7031 else
7032 {
7033 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
7034 }
7035 }
7036
7037 if (ownerPlayerOld != ownerPlayerNew)
7038 {
7039 if (ownerPlayerOld)
7040 {
7041 array<EntityAI> subItemsExit = new array<EntityAI>;
7042 GetInventory().EnumerateInventory(InventoryTraversalType.PREORDER,subItemsExit);
7043 for (int i = 0; i < subItemsExit.Count(); i++)
7044 {
7045 ItemBase itemExit = ItemBase.Cast(subItemsExit.Get(i));
7046 itemExit.OnInventoryExit(ownerPlayerOld);
7047 }
7048 }
7049
7050 if (ownerPlayerNew)
7051 {
7052 array<EntityAI> subItemsEnter = new array<EntityAI>;
7053 GetInventory().EnumerateInventory(InventoryTraversalType.PREORDER,subItemsEnter);
7054 for (int j = 0; j < subItemsEnter.Count(); j++)
7055 {
7056 ItemBase itemEnter = ItemBase.Cast(subItemsEnter.Get(j));
7057 itemEnter.OnInventoryEnter(ownerPlayerNew);
7058 }
7059 }
7060 }
7061 else if (ownerPlayerNew != null)
7062 {
7063 PlayerBase nplayer;
7064 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
7065 {
7066 array<EntityAI> subItemsUpdate = new array<EntityAI>;
7067 GetInventory().EnumerateInventory(InventoryTraversalType.PREORDER,subItemsUpdate);
7068 for (int k = 0; k < subItemsUpdate.Count(); k++)
7069 {
7070 ItemBase itemUpdate = ItemBase.Cast(subItemsUpdate.Get(k));
7071 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
7072 }
7073 }
7074 }
7075
7076 if (old_owner)
7077 old_owner.OnChildItemRemoved(this);
7078 if (new_owner)
7079 new_owner.OnChildItemReceived(this);
7080 }
7081
7082 // -------------------------------------------------------------------------------
7083 override void EEDelete(EntityAI parent)
7084 {
7085 super.EEDelete(parent);
7086 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
7087 if (player)
7088 {
7089 OnInventoryExit(player);
7090
7091 if (player.IsAlive())
7092 {
7093 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7094 if (r_index >= 0)
7095 {
7096 InventoryLocation r_il = new InventoryLocation;
7097 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7098
7099 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7100 int r_type = r_il.GetType();
7101 if (r_type == InventoryLocationType.CARGO || r_type == InventoryLocationType.PROXYCARGO)
7102 {
7103 r_il.GetParent().GetOnReleaseLock().Invoke(this);
7104 }
7105 else if (r_type == InventoryLocationType.ATTACHMENT)
7106 {
7107 r_il.GetParent().GetOnAttachmentReleaseLock().Invoke(this, r_il.GetSlot());
7108 }
7109
7110 }
7111
7112 player.RemoveQuickBarEntityShortcut(this);
7113 }
7114 }
7115 }
7116 // -------------------------------------------------------------------------------
7117 override void EEKilled(Object killer)
7118 {
7119 super.EEKilled(killer);
7120
7122 if (killer && killer.IsFireplace() && CanExplodeInFire())
7123 {
7124 if (GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
7125 {
7126 if (IsMagazine())
7127 {
7128 if (Magazine.Cast(this).GetAmmoCount() > 0)
7129 {
7130 ExplodeAmmo();
7131 }
7132 }
7133 else
7134 {
7135 Explode(DamageType.EXPLOSION);
7136 }
7137 }
7138 }
7139 }
7140
7141 override void OnWasAttached(EntityAI parent, int slot_id)
7142 {
7143 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7144
7145 super.OnWasAttached(parent, slot_id);
7146
7147 if (HasQuantity())
7148 UpdateNetSyncVariableFloat("m_VarQuantity", GetQuantityMin(), m_VarQuantityMax);
7149
7150 PlayAttachSound(InventorySlots.GetSlotName(slot_id));
7151 }
7152
7153 override void OnWasDetached(EntityAI parent, int slot_id)
7154 {
7155 super.OnWasDetached(parent, slot_id);
7156
7157 if (HasQuantity())
7158 UpdateNetSyncVariableFloat("m_VarQuantity", GetQuantityMin(), m_VarQuantityMax);
7159 }
7160
7161 override string ChangeIntoOnAttach(string slot)
7162 {
7163 int idx;
7164 TStringArray inventory_slots = new TStringArray;
7165 TStringArray attach_types = new TStringArray;
7166
7167 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7168 if (inventory_slots.Count() < 1) //is string
7169 {
7170 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
7171 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
7172 }
7173 else //is array
7174 {
7175 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
7176 }
7177
7178 idx = inventory_slots.Find(slot);
7179 if (idx < 0)
7180 return "";
7181
7182 return attach_types.Get(idx);
7183 }
7184
7185 override string ChangeIntoOnDetach()
7186 {
7187 int idx = -1;
7188 string slot;
7189
7190 TStringArray inventory_slots = new TStringArray;
7191 TStringArray detach_types = new TStringArray;
7192
7193 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7194 if (inventory_slots.Count() < 1) //is string
7195 {
7196 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
7197 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7198 }
7199 else //is array
7200 {
7201 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
7202 if (detach_types.Count() < 1)
7203 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7204 }
7205
7206 for (int i = 0; i < inventory_slots.Count(); i++)
7207 {
7208 slot = inventory_slots.Get(i);
7209 }
7210
7211 if (slot != "")
7212 {
7213 if (detach_types.Count() == 1)
7214 idx = 0;
7215 else
7216 idx = inventory_slots.Find(slot);
7217 }
7218 if (idx < 0)
7219 return "";
7220
7221 return detach_types.Get(idx);
7222 }
7223
7224 void ExplodeAmmo()
7225 {
7226 //timer
7227 ref Timer explode_timer = new Timer(CALL_CATEGORY_SYSTEM);
7228
7229 //min/max time
7230 float min_time = 1;
7231 float max_time = 3;
7232 float delay = Math.RandomFloat(min_time, max_time);
7233
7234 explode_timer.Run(delay, this, "DoAmmoExplosion");
7235 }
7236
7237 void DoAmmoExplosion()
7238 {
7239 Magazine magazine = Magazine.Cast(this);
7240 int pop_sounds_count = 6;
7241 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
7242
7243 //play sound
7244 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
7245 string sound_name = pop_sounds[ sound_idx ];
7246 GetGame().CreateSoundOnObject(this, sound_name, 20, false);
7247
7248 //remove ammo count
7249 magazine.ServerAddAmmoCount(-1);
7250
7251 //if condition then repeat -> ExplodeAmmo
7252 float min_temp_to_explode = 100; //min temperature for item to explode
7253
7254 if (magazine.GetAmmoCount() > 0 && GetTemperature() >= min_temp_to_explode) //TODO ? add check for parent -> fireplace
7255 {
7256 ExplodeAmmo();
7257 }
7258 }
7259
7260 // -------------------------------------------------------------------------------
7261 override void EEHitBy(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
7262 {
7263 super.EEHitBy(damageResult, damageType, source, component, dmgZone, ammo, modelPos, speedCoef);
7264
7265 const int CHANCE_DAMAGE_CARGO = 4;
7266 const int CHANCE_DAMAGE_ATTACHMENT = 1;
7267 const int CHANCE_DAMAGE_NOTHING = 2;
7268
7269 if (IsClothing() || IsContainer() || IsItemTent())
7270 {
7271 float dmg = damageResult.GetDamage("","Health") * -0.5;
7272 int chances;
7273 int rnd;
7274
7275 if (GetInventory().GetCargo())
7276 {
7277 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7278 rnd = Math.RandomInt(0,chances);
7279
7280 if (rnd < CHANCE_DAMAGE_CARGO)
7281 {
7282 DamageItemInCargo(dmg);
7283 }
7284 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
7285 {
7287 }
7288 }
7289 else
7290 {
7291 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7292 rnd = Math.RandomInt(0,chances);
7293
7294 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
7295 {
7297 }
7298 }
7299 }
7300 }
7301
7302 bool DamageItemInCargo(float damage)
7303 {
7304 if (GetInventory().GetCargo())
7305 {
7306 int item_count = GetInventory().GetCargo().GetItemCount();
7307 if (item_count > 0)
7308 {
7309 int random_pick = Math.RandomInt(0, item_count);
7310 ItemBase item = ItemBase.Cast(GetInventory().GetCargo().GetItem(random_pick));
7311 if (!item.IsExplosive())
7312 {
7313 item.AddHealth("","",damage);
7314 return true;
7315 }
7316 }
7317 }
7318 return false;
7319 }
7320
7321 bool DamageItemAttachments(float damage)
7322 {
7323 int attachment_count = GetInventory().AttachmentCount();
7324 if (attachment_count > 0)
7325 {
7326 int random_pick = Math.RandomInt(0, attachment_count);
7327 ItemBase attachment = ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
7328 if (!attachment.IsExplosive())
7329 {
7330 attachment.AddHealth("","",damage);
7331 return true;
7332 }
7333 }
7334 return false;
7335 }
7336
7337 override bool IsSplitable()
7338 {
7339 return m_CanThisBeSplit;
7340 }
7341 //----------------
7342 override bool CanBeSplit()
7343 {
7344 if (IsSplitable() && (GetQuantity() > 1))
7345 return GetInventory().CanRemoveEntity();
7346
7347 return false;
7348 }
7349
7350 override void SplitIntoStackMaxClient(EntityAI destination_entity, int slot_id )
7351 {
7352 if (!CanBeSplit())
7353 return;
7354
7355 if (GetGame().IsClient())
7356 {
7357 if (ScriptInputUserData.CanStoreInputUserData())
7358 {
7359 ScriptInputUserData ctx = new ScriptInputUserData;
7361 ctx.Write(1);
7362 ItemBase i1 = this; // @NOTE: workaround for correct serialization
7363 ctx.Write(i1);
7364 ctx.Write(destination_entity);
7365 ctx.Write(true);
7366 ctx.Write(slot_id);
7367 ctx.Send();
7368 }
7369 }
7370 else if (!GetGame().IsMultiplayer())
7371 {
7372 SplitIntoStackMax(destination_entity, slot_id, PlayerBase.Cast(GetGame().GetPlayer()));
7373 }
7374 }
7375
7376 void SplitIntoStackMax(EntityAI destination_entity, int slot_id, PlayerBase player)
7377 {
7378 if (!CanBeSplit())
7379 return;
7380
7381 float split_quantity_new;
7382 ref ItemBase new_item;
7383 float quantity = GetQuantity();
7384 float stack_max = GetTargetQuantityMax(slot_id);
7385 InventoryLocation loc = new InventoryLocation;
7386
7387 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7388 {
7389 if (stack_max <= GetQuantity())
7390 split_quantity_new = stack_max;
7391 else
7392 split_quantity_new = GetQuantity();
7393
7394 new_item = ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(this.GetType(), slot_id));
7395 if (new_item)
7396 {
7397 new_item.SetResultOfSplit(true);
7398 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7399 AddQuantity(-split_quantity_new);
7400 new_item.SetQuantity(split_quantity_new);
7401 }
7402 }
7403 else if (destination_entity && slot_id == -1)
7404 {
7405 if (quantity > stack_max)
7406 split_quantity_new = stack_max;
7407 else
7408 split_quantity_new = quantity;
7409
7410 if (destination_entity.GetInventory().FindFreeLocationFor(this, FindInventoryLocationType.ANY, loc))
7411 {
7412 Object o = destination_entity.GetInventory().LocationCreateEntity(loc, GetType(), ECE_IN_INVENTORY, RF_DEFAULT);
7413 new_item = ItemBase.Cast(o);
7414 }
7415
7416 if (new_item)
7417 {
7418 new_item.SetResultOfSplit(true);
7419 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7420 AddQuantity(-split_quantity_new);
7421 new_item.SetQuantity(split_quantity_new);
7422 }
7423 }
7424 else
7425 {
7426 if (stack_max != 0)
7427 {
7428 if (stack_max < GetQuantity())
7429 {
7430 split_quantity_new = GetQuantity() - stack_max;
7431 }
7432
7433 if (split_quantity_new == 0)
7434 {
7435 if (!GetGame().IsMultiplayer())
7436 player.PhysicalPredictiveDropItem(this);
7437 else
7438 player.ServerDropEntity(this);
7439 return;
7440 }
7441
7442 new_item = ItemBase.Cast(GetGame().CreateObjectEx(GetType(), player.GetWorldPosition(), ECE_PLACE_ON_SURFACE));
7443
7444 if (new_item)
7445 {
7446 new_item.SetResultOfSplit(true);
7447 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7448 SetQuantity(split_quantity_new);
7449 new_item.SetQuantity(stack_max);
7450 new_item.PlaceOnSurface();
7451 }
7452 }
7453 }
7454 }
7455
7456 override void SplitIntoStackMaxEx(EntityAI destination_entity, int slot_id)
7457 {
7458 if (!CanBeSplit())
7459 return;
7460
7461 float split_quantity_new;
7462 ref ItemBase new_item;
7463 float quantity = GetQuantity();
7464 float stack_max = GetTargetQuantityMax(slot_id);
7465 InventoryLocation loc = new InventoryLocation;
7466
7467 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7468 {
7469 if (stack_max <= GetQuantity())
7470 split_quantity_new = stack_max;
7471 else
7472 split_quantity_new = GetQuantity();
7473
7474 new_item = ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(this.GetType(), slot_id));
7475 if (new_item)
7476 {
7477 new_item.SetResultOfSplit(true);
7478 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7479 AddQuantity(-split_quantity_new);
7480 new_item.SetQuantity(split_quantity_new);
7481 }
7482 }
7483 else if (destination_entity && slot_id == -1)
7484 {
7485 if (quantity > stack_max)
7486 split_quantity_new = stack_max;
7487 else
7488 split_quantity_new = quantity;
7489
7490 if (destination_entity.GetInventory().FindFreeLocationFor(this, FindInventoryLocationType.ANY, loc))
7491 {
7492 Object o = destination_entity.GetInventory().LocationCreateEntity(loc, GetType(), ECE_IN_INVENTORY, RF_DEFAULT);
7493 new_item = ItemBase.Cast(o);
7494 }
7495
7496 if (new_item)
7497 {
7498 new_item.SetResultOfSplit(true);
7499 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7500 AddQuantity(-split_quantity_new);
7501 new_item.SetQuantity(split_quantity_new);
7502 }
7503 }
7504 else
7505 {
7506 if (stack_max != 0)
7507 {
7508 if (stack_max < GetQuantity())
7509 {
7510 split_quantity_new = GetQuantity() - stack_max;
7511 }
7512
7513 new_item = ItemBase.Cast(GetGame().CreateObjectEx(GetType(),GetWorldPosition(), ECE_PLACE_ON_SURFACE));
7514
7515 if (new_item)
7516 {
7517 new_item.SetResultOfSplit(true);
7518 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7519 SetQuantity(split_quantity_new);
7520 new_item.SetQuantity(stack_max);
7521 new_item.PlaceOnSurface();
7522 }
7523 }
7524 }
7525 }
7526
7527 void SplitIntoStackMaxToInventoryLocationClient(notnull InventoryLocation dst)
7528 {
7529 if (!CanBeSplit())
7530 return;
7531
7532 if (GetGame().IsClient())
7533 {
7534 if (ScriptInputUserData.CanStoreInputUserData())
7535 {
7536 ScriptInputUserData ctx = new ScriptInputUserData;
7538 ctx.Write(4);
7539 ItemBase thiz = this; // @NOTE: workaround for correct serialization
7540 ctx.Write(thiz);
7541 dst.WriteToContext(ctx);
7542 ctx.Send();
7543 }
7544 }
7545 else if (!GetGame().IsMultiplayer())
7546 {
7548 }
7549 }
7550
7551 void SplitIntoStackMaxCargoClient(EntityAI destination_entity, int idx, int row, int col)
7552 {
7553 if (!CanBeSplit())
7554 return;
7555
7556 if (GetGame().IsClient())
7557 {
7558 if (ScriptInputUserData.CanStoreInputUserData())
7559 {
7560 ScriptInputUserData ctx = new ScriptInputUserData;
7562 ctx.Write(2);
7563 ItemBase dummy = this; // @NOTE: workaround for correct serialization
7564 ctx.Write(dummy);
7565 ctx.Write(destination_entity);
7566 ctx.Write(true);
7567 ctx.Write(idx);
7568 ctx.Write(row);
7569 ctx.Write(col);
7570 ctx.Send();
7571 }
7572 }
7573 else if (!GetGame().IsMultiplayer())
7574 {
7575 SplitIntoStackMaxCargo(destination_entity, idx, row, col);
7576 }
7577 }
7578
7579 void SplitIntoStackMaxToInventoryLocation(notnull InventoryLocation dst)
7580 {
7582 }
7583
7584 ItemBase SplitIntoStackMaxToInventoryLocationEx(notnull InventoryLocation dst)
7585 {
7586 if (!CanBeSplit())
7587 return this;
7588
7589 float quantity = GetQuantity();
7590 float split_quantity_new;
7591 ItemBase new_item;
7592 if (dst.IsValid())
7593 {
7594 int slot_id = dst.GetSlot();
7595 float stack_max = GetTargetQuantityMax(slot_id);
7596
7597 if (quantity > stack_max)
7598 split_quantity_new = stack_max;
7599 else
7600 split_quantity_new = quantity;
7601
7602 new_item = ItemBase.Cast(GameInventory.LocationCreateEntity(dst, this.GetType(), ECE_IN_INVENTORY, RF_DEFAULT));
7603
7604 if (new_item)
7605 {
7606 new_item.SetResultOfSplit(true);
7607 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7608 AddQuantity(-split_quantity_new);
7609 new_item.SetQuantity(split_quantity_new);
7610 }
7611
7612 return new_item;
7613 }
7614
7615 return null;
7616 }
7617
7618 void SplitIntoStackMaxCargo(EntityAI destination_entity, int idx, int row, int col)
7619 {
7620 if (!CanBeSplit())
7621 return;
7622
7623 float quantity = GetQuantity();
7624 float split_quantity_new;
7625 ref ItemBase new_item;
7626 if (destination_entity)
7627 {
7628 float stackable = GetTargetQuantityMax();
7629 if (quantity > stackable)
7630 split_quantity_new = stackable;
7631 else
7632 split_quantity_new = quantity;
7633
7634 new_item = ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(this.GetType(), idx, row, col, false));
7635 if (new_item)
7636 {
7637 new_item.SetResultOfSplit(true);
7638 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7639 AddQuantity(-split_quantity_new);
7640 new_item.SetQuantity(split_quantity_new);
7641 }
7642 }
7643 }
7644
7645 void SplitIntoStackMaxHandsClient(PlayerBase player)
7646 {
7647 if (!CanBeSplit())
7648 return;
7649
7650 if (GetGame().IsClient())
7651 {
7652 if (ScriptInputUserData.CanStoreInputUserData())
7653 {
7654 ScriptInputUserData ctx = new ScriptInputUserData;
7656 ctx.Write(3);
7657 ItemBase i1 = this; // @NOTE: workaround for correct serialization
7658 ctx.Write(i1);
7659 ItemBase destination_entity = this;
7660 ctx.Write(destination_entity);
7661 ctx.Write(true);
7662 ctx.Write(0);
7663 ctx.Send();
7664 }
7665 }
7666 else if (!GetGame().IsMultiplayer())
7667 {
7668 SplitIntoStackMaxHands(player);
7669 }
7670 }
7671
7672 void SplitIntoStackMaxHands(PlayerBase player)
7673 {
7674 if (!CanBeSplit())
7675 return;
7676
7677 float quantity = GetQuantity();
7678 float split_quantity_new;
7679 ref ItemBase new_item;
7680 if (player)
7681 {
7682 float stackable = GetTargetQuantityMax();
7683 if (quantity > stackable)
7684 split_quantity_new = stackable;
7685 else
7686 split_quantity_new = quantity;
7687
7688 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.GetType());
7689 new_item = ItemBase.Cast(in_hands);
7690 if (new_item)
7691 {
7692 new_item.SetResultOfSplit(true);
7693 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7694 AddQuantity(-split_quantity_new);
7695 new_item.SetQuantity(split_quantity_new);
7696 }
7697 }
7698 }
7699
7700 void SplitItemToInventoryLocation(notnull InventoryLocation dst)
7701 {
7702 if (!CanBeSplit())
7703 return;
7704
7705 float quantity = GetQuantity();
7706 float split_quantity_new = Math.Floor(quantity * 0.5);
7707
7708 ItemBase new_item = ItemBase.Cast(GameInventory.LocationCreateEntity(dst, GetType(), ECE_IN_INVENTORY, RF_DEFAULT));
7709
7710 if (new_item)
7711 {
7712 if (new_item.GetQuantityMax() < split_quantity_new)
7713 {
7714 split_quantity_new = new_item.GetQuantityMax();
7715 }
7716
7717 new_item.SetResultOfSplit(true);
7718 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7719
7720 if (dst.IsValid() && dst.GetType() == InventoryLocationType.ATTACHMENT && split_quantity_new > 1)
7721 {
7722 AddQuantity(-1);
7723 new_item.SetQuantity(1);
7724 }
7725 else
7726 {
7727 AddQuantity(-split_quantity_new);
7728 new_item.SetQuantity(split_quantity_new);
7729 }
7730 }
7731 }
7732
7733 void SplitItem(PlayerBase player)
7734 {
7735 if (!CanBeSplit())
7736 return;
7737
7738 float quantity = GetQuantity();
7739 float split_quantity_new = Math.Floor(quantity / 2);
7740
7741 InventoryLocation invloc = new InventoryLocation;
7742 bool found = player.GetInventory().FindFirstFreeLocationForNewEntity(GetType(), FindInventoryLocationType.ATTACHMENT, invloc);
7743
7744 ItemBase new_item;
7745 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
7746
7747 if (new_item)
7748 {
7749 if (new_item.GetQuantityMax() < split_quantity_new)
7750 {
7751 split_quantity_new = new_item.GetQuantityMax();
7752 }
7753 if (found && invloc.IsValid() && invloc.GetType() == InventoryLocationType.ATTACHMENT && split_quantity_new > 1)
7754 {
7755 AddQuantity(-1);
7756 new_item.SetQuantity(1);
7757 }
7758 else
7759 {
7760 AddQuantity(-split_quantity_new);
7761 new_item.SetQuantity(split_quantity_new);
7762 }
7763 }
7764 }
7765
7767 void OnQuantityChanged(float delta)
7768 {
7769 SetWeightDirty();
7770 ItemBase parent = ItemBase.Cast(GetHierarchyParent());
7771
7772 if (parent)
7773 parent.OnAttachmentQuantityChangedEx(this, delta);
7774
7775 if (IsLiquidContainer())
7776 {
7777 if (GetQuantityNormalized() <= 0.0)
7778 {
7780 }
7781 else if (GetLiquidType() == LIQUID_NONE)
7782 {
7783 ErrorEx("Undefined liquid type quantity changed, please define liquid type first! Using init value.",ErrorExSeverity.INFO);
7785 }
7786 }
7787
7788 }
7789
7792 {
7793 // insert code here
7794 }
7795
7797 void OnAttachmentQuantityChangedEx(ItemBase item , float delta)
7798 {
7800 }
7801
7802 override void EEHealthLevelChanged(int oldLevel, int newLevel, string zone)
7803 {
7804 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
7805
7806 if (GetGame().IsServer())
7807 {
7808 if (newLevel == GameConstants.STATE_RUINED)
7809 {
7811 EntityAI parent = GetHierarchyParent();
7812 if (parent && parent.IsFireplace())
7813 {
7814 CargoBase cargo = GetInventory().GetCargo();
7815 if (cargo)
7816 {
7817 for (int i = 0; i < cargo.GetItemCount(); ++i)
7818 {
7819 parent.GetInventory().TakeEntityToInventory(InventoryMode.SERVER, FindInventoryLocationType.CARGO, cargo.GetItem(i));
7820 }
7821 }
7822 }
7823 }
7824
7825 if (IsResultOfSplit())
7826 {
7827 // reset the splitting result flag, return to normal item behavior
7828 SetResultOfSplit(false);
7829 return;
7830 }
7831
7832 if (m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
7833 {
7834 SetCleanness(0);//unclean the item upon damage dealt
7835 }
7836 }
7837 }
7838
7839 // just the split? TODO: verify
7840 override void OnRightClick()
7841 {
7842 super.OnRightClick();
7843
7844 if (CanBeSplit() && !GetDayZGame().IsLeftCtrlDown() && !GetGame().GetPlayer().GetInventory().HasInventoryReservation(this,null))
7845 {
7846 if (GetGame().IsClient())
7847 {
7848 if (ScriptInputUserData.CanStoreInputUserData())
7849 {
7850 vector m4[4];
7851 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
7852
7853 EntityAI root = GetHierarchyRoot();
7854
7855 InventoryLocation dst = new InventoryLocation;
7856 if (!player.GetInventory().FindFirstFreeLocationForNewEntity(GetType(), FindInventoryLocationType.CARGO, dst))
7857 {
7858 if (root)
7859 {
7860 root.GetTransform(m4);
7861 dst.SetGround(this, m4);
7862 }
7863 else
7864 GetInventory().GetCurrentInventoryLocation(dst);
7865 }
7866 else
7867 {
7868 dst.SetCargo(dst.GetParent(), this, dst.GetIdx(), dst.GetRow(), dst.GetCol(), dst.GetFlip());
7869 /* hacky solution to check reservation of "this" item instead of null since the gamecode is checking null against null and returning reservation=true incorrectly
7870 this shouldnt cause issues within this scope*/
7871 if (GetGame().GetPlayer().GetInventory().HasInventoryReservation(this, dst))
7872 {
7873 if (root)
7874 {
7875 root.GetTransform(m4);
7876 dst.SetGround(this, m4);
7877 }
7878 else
7879 GetInventory().GetCurrentInventoryLocation(dst);
7880 }
7881 else
7882 {
7883 GetGame().GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
7884 }
7885 }
7886
7887 ScriptInputUserData ctx = new ScriptInputUserData;
7889 ctx.Write(4);
7890 ItemBase thiz = this; // @NOTE: workaround for correct serialization
7891 ctx.Write(thiz);
7892 dst.WriteToContext(ctx);
7893 ctx.Write(true); // dummy
7894 ctx.Send();
7895 }
7896 }
7897 else if (!GetGame().IsMultiplayer())
7898 {
7899 SplitItem(PlayerBase.Cast(GetGame().GetPlayer()));
7900 }
7901 }
7902 }
7903
7904 override bool CanBeCombined(EntityAI other_item, bool reservation_check = true, bool stack_max_limit = false)
7905 {
7906 //TODO: delete check zero quantity check after fix double posts hands fsm events
7907 if (!other_item || GetType() != other_item.GetType() || (IsFullQuantity() && other_item.GetQuantity() > 0) || other_item == this)
7908 return false;
7909
7910 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
7911 return false;
7912
7913 //can_this_be_combined = ConfigGetBool("canBeSplit");
7915 return false;
7916
7917
7918 Magazine mag = Magazine.Cast(this);
7919 if (mag)
7920 {
7921 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
7922 return false;
7923
7924 if (stack_max_limit)
7925 {
7926 Magazine other_mag = Magazine.Cast(other_item);
7927 if (other_item)
7928 {
7929 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
7930 return false;
7931 }
7932
7933 }
7934 }
7935 else
7936 {
7937 //TODO: delete check zero quantity check after fix double posts hands fsm events
7938 if (GetQuantity() >= GetQuantityMax() && other_item.GetQuantity() > 0 )
7939 return false;
7940
7941 if (stack_max_limit && (GetQuantity() + other_item.GetQuantity() > GetQuantityMax()))
7942 return false;
7943 }
7944
7945 PlayerBase player = null;
7946 if (CastTo(player, GetHierarchyRootPlayer())) //false when attached to player's attachment slot
7947 {
7948 if (player.GetInventory().HasAttachment(this))
7949 return false;
7950
7951 if (player.IsItemsToDelete())
7952 return false;
7953 }
7954
7955 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
7956 return false;
7957
7958 int slotID;
7959 string slotName;
7960 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
7961 return false;
7962
7963 return true;
7964 }
7965
7966 bool IsCombineAll(ItemBase other_item, bool use_stack_max = false)
7967 {
7968 return ComputeQuantityUsed(other_item, use_stack_max) == other_item.GetQuantity();
7969 }
7970
7971 bool IsResultOfSplit()
7972 {
7973 return m_IsResultOfSplit;
7974 }
7975
7976 void SetResultOfSplit(bool value)
7977 {
7978 m_IsResultOfSplit = value;
7979 }
7980
7981 int ComputeQuantityUsed(ItemBase other_item, bool use_stack_max = true)
7982 {
7983 return ComputeQuantityUsedEx(other_item, use_stack_max);
7984 }
7985
7986 float ComputeQuantityUsedEx(ItemBase other_item, bool use_stack_max = true)
7987 {
7988 float other_item_quantity = other_item.GetQuantity();
7989 float this_free_space;
7990
7991 float stack_max = GetQuantityMax();
7992
7993 this_free_space = stack_max - GetQuantity();
7994
7995 if (other_item_quantity > this_free_space)
7996 {
7997 return this_free_space;
7998 }
7999 else
8000 {
8001 return other_item_quantity;
8002 }
8003 }
8004
8005 override void CombineItemsEx(EntityAI entity2, bool use_stack_max = true)
8006 {
8007 CombineItems(ItemBase.Cast(entity2),use_stack_max);
8008 }
8009
8010 void CombineItems(ItemBase other_item, bool use_stack_max = true)
8011 {
8012 if (!CanBeCombined(other_item, false))
8013 return;
8014
8015 if (!IsMagazine() && other_item)
8016 {
8017 float quantity_used = ComputeQuantityUsedEx(other_item,use_stack_max);
8018 if (quantity_used != 0)
8019 {
8020 float hp1 = GetHealth01("","");
8021 float hp2 = other_item.GetHealth01("","");
8022 float hpResult = ((hp1*GetQuantity()) + (hp2*quantity_used));
8023 hpResult = hpResult / (GetQuantity() + quantity_used);
8024
8025 hpResult *= GetMaxHealth();
8026 Math.Round(hpResult);
8027 SetHealth("", "Health", hpResult);
8028
8029 AddQuantity(quantity_used);
8030 other_item.AddQuantity(-quantity_used);
8031 }
8032 }
8033 OnCombine(other_item);
8034 }
8035
8036 void OnCombine(ItemBase other_item)
8037 {
8038 #ifdef SERVER
8039 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
8040 GetHierarchyParent().IncreaseLifetimeUp();
8041 #endif
8042 };
8043
8044 void GetRecipesActions(Man player, out TSelectableActionInfoArray outputList)
8045 {
8046 PlayerBase p = PlayerBase.Cast(player);
8047
8048 array<int> recipesIds = p.m_Recipes;
8049 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(GetPlugin(PluginRecipesManager));
8050 if (moduleRecipesManager)
8051 {
8052 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
8053 moduleRecipesManager.GetValidRecipes(ItemBase.Cast(this), ItemBase.Cast(itemInHands), recipesIds, p);
8054 }
8055
8056 for (int i = 0;i < recipesIds.Count(); i++)
8057 {
8058 int key = recipesIds.Get(i);
8059 string recipeName = moduleRecipesManager.GetRecipeName(key);
8060 outputList.Insert(new TSelectableActionInfo(SAT_CRAFTING, key, recipeName));
8061 }
8062 }
8063
8064 // -------------------------------------------------------------------------
8065 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
8066 {
8067 super.GetDebugActions(outputList);
8068
8069 //quantity
8070 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_QUANTITY, "Quantity +20%", FadeColors.LIGHT_GREY));
8071 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_QUANTITY, "Quantity -20%", FadeColors.LIGHT_GREY));
8072 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SET_QUANTITY_0, "Set Quantity 0", FadeColors.LIGHT_GREY));
8073 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SET_MAX_QUANTITY, "Set Quantity Max", FadeColors.LIGHT_GREY));
8074
8075 //health
8076 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_HEALTH, "Health +20%", FadeColors.LIGHT_GREY));
8077 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_HEALTH, "Health -20%", FadeColors.LIGHT_GREY));
8078 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.DESTROY_HEALTH, "Health 0", FadeColors.LIGHT_GREY));
8079 //temperature
8080 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_TEMPERATURE, "Temperature +20", FadeColors.LIGHT_GREY));
8081 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_TEMPERATURE, "Temperature -20", FadeColors.LIGHT_GREY));
8082 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.FLIP_FROZEN, "Toggle Frozen", FadeColors.LIGHT_GREY));
8083
8084 //wet
8085 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_WETNESS, "Wetness +20", FadeColors.LIGHT_GREY));
8086 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_WETNESS, "Wetness -20", FadeColors.LIGHT_GREY));
8087
8088 //liquidtype
8089 if (IsLiquidContainer())
8090 {
8091 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.LIQUIDTYPE_UP, "LiquidType Next", FadeColors.LIGHT_GREY));
8092 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.LIQUIDTYPE_DOWN, "LiquidType Previous", FadeColors.LIGHT_GREY));
8093 }
8094
8095 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.MAKE_SPECIAL, "Make Special", FadeColors.LIGHT_GREY));
8096 // watch
8097 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.WATCH_ITEM, "Watch (CTRL-Z)", FadeColors.LIGHT_GREY));
8098 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.WATCH_PLAYER, "Watch Player", FadeColors.LIGHT_GREY));
8099
8100 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "", FadeColors.RED));
8101 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.DELETE, "Delete", FadeColors.RED));
8102 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "", FadeColors.RED));
8103 }
8104
8105 // -------------------------------------------------------------------------
8106 // -------------------------------------------------------------------------
8107 // -------------------------------------------------------------------------
8108 override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
8109 {
8110 super.OnAction(action_id, player, ctx);
8111 if (action_id >= EActions.RECIPES_RANGE_START && action_id < EActions.RECIPES_RANGE_END)
8112 {
8113 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(GetPlugin(PluginRecipesManager));
8114 int idWithoutOffset = action_id - EActions.RECIPES_RANGE_START;
8115 PlayerBase p = PlayerBase.Cast(player);
8116 if (EActions.RECIPES_RANGE_START < 1000)
8117 {
8118 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
8119 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
8120 }
8121 }
8122 #ifndef SERVER
8123 else if (action_id == EActions.WATCH_PLAYER)
8124 {
8125 PluginDeveloper.SetDeveloperItemClientEx(player);
8126 }
8127 #endif
8128 if (GetGame().IsServer())
8129 {
8130 if (action_id >= EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id < EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
8131 {
8132 int id = action_id - EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
8133 OnDebugButtonPressServer(id + 1);
8134 }
8135
8136 else if (action_id >= EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id < EActions.DEBUG_AGENTS_RANGE_INJECT_END)
8137 {
8138 int agent_id = action_id - EActions.DEBUG_AGENTS_RANGE_INJECT_START;
8139 InsertAgent(agent_id,100);
8140 }
8141
8142 else if (action_id >= EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id < EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
8143 {
8144 int agent_id2 = action_id - EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
8145 RemoveAgent(agent_id2);
8146 }
8147
8148 else if (action_id == EActions.ADD_QUANTITY)
8149 {
8150 if (IsMagazine())
8151 {
8152 Magazine mag = Magazine.Cast(this);
8153 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
8154 }
8155 else
8156 {
8157 AddQuantity(GetQuantityMax() * 0.2);
8158 }
8159
8160 if (m_EM)
8161 {
8162 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
8163 }
8164 //PrintVariables();
8165 }
8166
8167 else if (action_id == EActions.REMOVE_QUANTITY) //Quantity -20%
8168 {
8169 if (IsMagazine())
8170 {
8171 Magazine mag2 = Magazine.Cast(this);
8172 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
8173 }
8174 else
8175 {
8176 AddQuantity(- GetQuantityMax() * 0.2);
8177 }
8178 if (m_EM)
8179 {
8180 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
8181 }
8182 //PrintVariables();
8183 }
8184
8185 else if (action_id == EActions.SET_QUANTITY_0) //SetMaxQuantity
8186 {
8187 SetQuantity(0);
8188
8189 if (m_EM)
8190 {
8191 m_EM.SetEnergy(0);
8192 }
8193 }
8194
8195 else if (action_id == EActions.SET_MAX_QUANTITY) //SetMaxQuantity
8196 {
8198
8199 if (m_EM)
8200 {
8201 m_EM.SetEnergy(m_EM.GetEnergyMax());
8202 }
8203 }
8204
8205 else if (action_id == EActions.ADD_HEALTH)
8206 {
8207 AddHealth("","",GetMaxHealth("","Health")/5);
8208 }
8209 else if (action_id == EActions.REMOVE_HEALTH)
8210 {
8211 AddHealth("","",-GetMaxHealth("","Health")/5);
8212 }
8213 else if (action_id == EActions.DESTROY_HEALTH)
8214 {
8215 SetHealth01("","",0);
8216 }
8217 else if (action_id == EActions.WATCH_ITEM)
8218 {
8220 mid.RegisterDebugItem(ItemBase.Cast(this), PlayerBase.Cast(player));
8221 #ifdef DEVELOPER
8222 SetDebugDeveloper_item(this);
8223 #endif
8224 }
8225
8226 else if (action_id == EActions.ADD_TEMPERATURE)
8227 {
8228 AddTemperature(20);
8229 //PrintVariables();
8230 }
8231
8232 else if (action_id == EActions.REMOVE_TEMPERATURE)
8233 {
8234 AddTemperature(-20);
8235 //PrintVariables();
8236 }
8237
8238 else if (action_id == EActions.FLIP_FROZEN)
8239 {
8240 SetFrozen(!GetIsFrozen());
8241 //PrintVariables();
8242 }
8243
8244 else if (action_id == EActions.ADD_WETNESS)
8245 {
8246 AddWet(GetWetMax()/5);
8247 //PrintVariables();
8248 }
8249
8250 else if (action_id == EActions.REMOVE_WETNESS)
8251 {
8252 AddWet(-GetWetMax()/5);
8253 //PrintVariables();
8254 }
8255
8256 else if (action_id == EActions.LIQUIDTYPE_UP)
8257 {
8258 int curr_type = GetLiquidType();
8259 SetLiquidType(curr_type * 2);
8260 //AddWet(1);
8261 //PrintVariables();
8262 }
8263
8264 else if (action_id == EActions.LIQUIDTYPE_DOWN)
8265 {
8266 int curr_type2 = GetLiquidType();
8267 SetLiquidType(curr_type2 / 2);
8268 }
8269
8270 else if (action_id == EActions.MAKE_SPECIAL)
8271 {
8272 auto debugParams = DebugSpawnParams.WithPlayer(player);
8273 OnDebugSpawnEx(debugParams);
8274 }
8275
8276 else if (action_id == EActions.DELETE)
8277 {
8278 Delete();
8279 }
8280
8281 }
8282
8283
8284 return false;
8285 }
8286
8287 // -------------------------------------------------------------------------
8288
8289
8292 void OnActivatedByTripWire();
8293
8295 void OnActivatedByItem(notnull ItemBase item);
8296
8297 //----------------------------------------------------------------
8298 //returns true if item is able to explode when put in fire
8299 bool CanExplodeInFire()
8300 {
8301 return false;
8302 }
8303
8304 //----------------------------------------------------------------
8305 bool CanEat()
8306 {
8307 return true;
8308 }
8309
8310 //----------------------------------------------------------------
8311 override bool IsIgnoredByConstruction()
8312 {
8313 return true;
8314 }
8315
8316 //----------------------------------------------------------------
8317 //has FoodStages in config?
8318 bool HasFoodStage()
8319 {
8320 string config_path = string.Format("CfgVehicles %1 Food FoodStages", GetType());
8321 return GetGame().ConfigIsExisting(config_path);
8322 }
8323
8325 FoodStage GetFoodStage()
8326 {
8327 return null;
8328 }
8329
8330 bool CanBeCooked()
8331 {
8332 return false;
8333 }
8334
8335 bool CanBeCookedOnStick()
8336 {
8337 return false;
8338 }
8339
8341 void RefreshAudioVisualsOnClient( CookingMethodType cooking_method, bool is_done, bool is_empty, bool is_burned );
8343
8344 //----------------------------------------------------------------
8345 bool CanRepair(ItemBase item_repair_kit)
8346 {
8347 PluginRepairing module_repairing = PluginRepairing.Cast(GetPlugin(PluginRepairing));
8348 return module_repairing.CanRepair(this, item_repair_kit);
8349 }
8350
8351 //----------------------------------------------------------------
8352 bool Repair(PlayerBase player, ItemBase item_repair_kit, float specialty_weight)
8353 {
8354 PluginRepairing module_repairing = PluginRepairing.Cast(GetPlugin(PluginRepairing));
8355 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
8356 }
8357
8358 //----------------------------------------------------------------
8359 int GetItemSize()
8360 {
8361 /*
8362 vector v_size = this.ConfigGetVector("itemSize");
8363 int v_size_x = v_size[0];
8364 int v_size_y = v_size[1];
8365 int size = v_size_x * v_size_y;
8366 return size;
8367 */
8368
8369 return 1;
8370 }
8371
8372 //----------------------------------------------------------------
8373 //Override for allowing seemingly unallowed moves when two clients send a conflicting message simultaneously
8374 bool CanBeMovedOverride()
8375 {
8376 return m_CanBeMovedOverride;
8377 }
8378
8379 //----------------------------------------------------------------
8380 //Override for allowing seemingly unallowed moves when two clients send a conflicting message simultaneously
8381 void SetCanBeMovedOverride(bool setting)
8382 {
8383 m_CanBeMovedOverride = setting;
8384 }
8385
8386 //----------------------------------------------------------------
8394 void MessageToOwnerStatus(string text)
8395 {
8396 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8397
8398 if (player)
8399 {
8400 player.MessageStatus(text);
8401 }
8402 }
8403
8404 //----------------------------------------------------------------
8412 void MessageToOwnerAction(string text)
8413 {
8414 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8415
8416 if (player)
8417 {
8418 player.MessageAction(text);
8419 }
8420 }
8421
8422 //----------------------------------------------------------------
8430 void MessageToOwnerFriendly(string text)
8431 {
8432 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8433
8434 if (player)
8435 {
8436 player.MessageFriendly(text);
8437 }
8438 }
8439
8440 //----------------------------------------------------------------
8448 void MessageToOwnerImportant(string text)
8449 {
8450 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8451
8452 if (player)
8453 {
8454 player.MessageImportant(text);
8455 }
8456 }
8457
8458 override bool IsItemBase()
8459 {
8460 return true;
8461 }
8462
8463 // Checks if item is of questioned kind
8464 override bool KindOf(string tag)
8465 {
8466 bool found = false;
8467 string item_name = this.GetType();
8468 ref TStringArray item_tag_array = new TStringArray;
8469 GetGame().ConfigGetTextArray("cfgVehicles " + item_name + " itemInfo", item_tag_array);
8470
8471 int array_size = item_tag_array.Count();
8472 for (int i = 0; i < array_size; i++)
8473 {
8474 if (item_tag_array.Get(i) == tag)
8475 {
8476 found = true;
8477 break;
8478 }
8479 }
8480 return found;
8481 }
8482
8483
8484 override void OnRPC(PlayerIdentity sender, int rpc_type,ParamsReadContext ctx)
8485 {
8486 //Debug.Log("OnRPC called");
8487 super.OnRPC(sender, rpc_type,ctx);
8488
8489 //Play soundset for attachment locking (ActionLockAttachment.c)
8490 switch (rpc_type)
8491 {
8492 #ifndef SERVER
8493 case ERPCs.RPC_SOUND_LOCK_ATTACH:
8494 Param2<bool, string> p = new Param2<bool, string>(false, "");
8495
8496 if (!ctx.Read(p))
8497 return;
8498
8499 bool play = p.param1;
8500 string soundSet = p.param2;
8501
8502 if (play)
8503 {
8504 if (m_LockingSound)
8505 {
8507 {
8508 m_LockingSound = SEffectManager.PlaySound(soundSet, GetPosition(), 0, 0, true);
8509 }
8510 }
8511 else
8512 {
8513 m_LockingSound = SEffectManager.PlaySound(soundSet, GetPosition(), 0, 0, true);
8514 }
8515 }
8516 else
8517 {
8518 SEffectManager.DestroyEffect(m_LockingSound);
8519 }
8520
8521 break;
8522 #endif
8523
8524 }
8525
8526 if (GetWrittenNoteData())
8527 {
8528 GetWrittenNoteData().OnRPC(sender, rpc_type,ctx);
8529 }
8530 }
8531
8532 //-----------------------------
8533 // VARIABLE MANIPULATION SYSTEM
8534 //-----------------------------
8535 int NameToID(string name)
8536 {
8537 PluginVariables plugin = PluginVariables.Cast(GetPlugin(PluginVariables));
8538 return plugin.GetID(name);
8539 }
8540
8541 string IDToName(int id)
8542 {
8543 PluginVariables plugin = PluginVariables.Cast(GetPlugin(PluginVariables));
8544 return plugin.GetName(id);
8545 }
8546
8548 void OnSyncVariables(ParamsReadContext ctx)//with ID optimization
8549 {
8550 //Debug.Log("OnSyncVariables called for item: "+ ToString(this.GetType()),"varSync");
8551 //read the flags
8552 int varFlags;
8553 if (!ctx.Read(varFlags))
8554 return;
8555
8556 if (varFlags & ItemVariableFlags.FLOAT)
8557 {
8558 ReadVarsFromCTX(ctx);
8559 }
8560 }
8561
8562 override void SerializeNumericalVars(array<float> floats_out)
8563 {
8564 //some variables handled on EntityAI level already!
8565 super.SerializeNumericalVars(floats_out);
8566
8567 // the order of serialization must be the same as the order of de-serialization
8568 //--------------------------------------------
8569 if (IsVariableSet(VARIABLE_QUANTITY))
8570 {
8571 floats_out.Insert(m_VarQuantity);
8572 }
8573 //--------------------------------------------
8574 if (IsVariableSet(VARIABLE_WET))
8575 {
8576 floats_out.Insert(m_VarWet);
8577 }
8578 //--------------------------------------------
8579 if (IsVariableSet(VARIABLE_LIQUIDTYPE))
8580 {
8581 floats_out.Insert(m_VarLiquidType);
8582 }
8583 //--------------------------------------------
8584 if (IsVariableSet(VARIABLE_COLOR))
8585 {
8586 floats_out.Insert(m_ColorComponentR);
8587 floats_out.Insert(m_ColorComponentG);
8588 floats_out.Insert(m_ColorComponentB);
8589 floats_out.Insert(m_ColorComponentA);
8590 }
8591 //--------------------------------------------
8592 if (IsVariableSet(VARIABLE_CLEANNESS))
8593 {
8594 floats_out.Insert(m_Cleanness);
8595 }
8596 }
8597
8598 override void DeSerializeNumericalVars(array<float> floats)
8599 {
8600 //some variables handled on EntityAI level already!
8601 super.DeSerializeNumericalVars(floats);
8602
8603 // the order of serialization must be the same as the order of de-serialization
8604 int index = 0;
8605 int mask = Math.Round(floats.Get(index));
8606
8607 index++;
8608 //--------------------------------------------
8609 if (mask & VARIABLE_QUANTITY)
8610 {
8611 if (m_IsStoreLoad)
8612 {
8613 SetStoreLoadedQuantity(floats.Get(index));
8614 }
8615 else
8616 {
8617 float quantity = floats.Get(index);
8618 SetQuantity(quantity, true, false, false, false);
8619 }
8620 index++;
8621 }
8622 //--------------------------------------------
8623 if (mask & VARIABLE_WET)
8624 {
8625 float wet = floats.Get(index);
8626 SetWet(wet);
8627 index++;
8628 }
8629 //--------------------------------------------
8630 if (mask & VARIABLE_LIQUIDTYPE)
8631 {
8632 int liquidtype = Math.Round(floats.Get(index));
8633 SetLiquidType(liquidtype);
8634 index++;
8635 }
8636 //--------------------------------------------
8637 if (mask & VARIABLE_COLOR)
8638 {
8639 m_ColorComponentR = Math.Round(floats.Get(index));
8640 index++;
8641 m_ColorComponentG = Math.Round(floats.Get(index));
8642 index++;
8643 m_ColorComponentB = Math.Round(floats.Get(index));
8644 index++;
8645 m_ColorComponentA = Math.Round(floats.Get(index));
8646 index++;
8647 }
8648 //--------------------------------------------
8649 if (mask & VARIABLE_CLEANNESS)
8650 {
8651 int cleanness = Math.Round(floats.Get(index));
8652 SetCleanness(cleanness);
8653 index++;
8654 }
8655 }
8656
8657 override void WriteVarsToCTX(ParamsWriteContext ctx)
8658 {
8659 super.WriteVarsToCTX(ctx);
8660
8661 //--------------------------------------------
8662 if (IsVariableSet(VARIABLE_QUANTITY))
8663 {
8664 ctx.Write(GetQuantity());
8665 }
8666 //--------------------------------------------
8667 if (IsVariableSet(VARIABLE_WET))
8668 {
8669 ctx.Write(GetWet());
8670 }
8671 //--------------------------------------------
8672 if (IsVariableSet(VARIABLE_LIQUIDTYPE))
8673 {
8674 ctx.Write(GetLiquidType());
8675 }
8676 //--------------------------------------------
8677 if (IsVariableSet(VARIABLE_COLOR))
8678 {
8679 int r,g,b,a;
8680 GetColor(r,g,b,a);
8681 ctx.Write(r);
8682 ctx.Write(g);
8683 ctx.Write(b);
8684 ctx.Write(a);
8685 }
8686 //--------------------------------------------
8687 if (IsVariableSet(VARIABLE_CLEANNESS))
8688 {
8689 ctx.Write(GetCleanness());
8690 }
8691 }
8692
8693 override bool ReadVarsFromCTX(ParamsReadContext ctx, int version = -1)//with ID optimization
8694 {
8695 if (!super.ReadVarsFromCTX(ctx,version))
8696 return false;
8697
8698 int intValue;
8699 float value;
8700
8701 if (version < 140)
8702 {
8703 if (!ctx.Read(intValue))
8704 return false;
8705
8706 m_VariablesMask = intValue;
8707 }
8708
8709 if (m_VariablesMask & VARIABLE_QUANTITY)
8710 {
8711 if (!ctx.Read(value))
8712 return false;
8713
8714 if (IsStoreLoad())
8715 {
8717 }
8718 else
8719 {
8720 SetQuantity(value, true, false, false, false);
8721 }
8722 }
8723 //--------------------------------------------
8724 if (version < 140)
8725 {
8726 if (m_VariablesMask & VARIABLE_TEMPERATURE)
8727 {
8728 if (!ctx.Read(value))
8729 return false;
8730 SetTemperatureDirect(value);
8731 }
8732 }
8733 //--------------------------------------------
8734 if (m_VariablesMask & VARIABLE_WET)
8735 {
8736 if (!ctx.Read(value))
8737 return false;
8738 SetWet(value);
8739 }
8740 //--------------------------------------------
8741 if (m_VariablesMask & VARIABLE_LIQUIDTYPE)
8742 {
8743 if (!ctx.Read(intValue))
8744 return false;
8745 SetLiquidType(intValue);
8746 }
8747 //--------------------------------------------
8748 if (m_VariablesMask & VARIABLE_COLOR)
8749 {
8750 int r,g,b,a;
8751 if (!ctx.Read(r))
8752 return false;
8753 if (!ctx.Read(g))
8754 return false;
8755 if (!ctx.Read(b))
8756 return false;
8757 if (!ctx.Read(a))
8758 return false;
8759
8760 SetColor(r,g,b,a);
8761 }
8762 //--------------------------------------------
8763 if (m_VariablesMask & VARIABLE_CLEANNESS)
8764 {
8765 if (!ctx.Read(intValue))
8766 return false;
8767 SetCleanness(intValue);
8768 }
8769 //--------------------------------------------
8770 if (version >= 138 && version < 140)
8771 {
8772 if (m_VariablesMask & VARIABLE_TEMPERATURE)
8773 {
8774 if (!ctx.Read(intValue))
8775 return false;
8776 SetFrozen(intValue);
8777 }
8778 }
8779
8780 return true;
8781 }
8782
8783 //----------------------------------------------------------------
8784 override bool OnStoreLoad(ParamsReadContext ctx, int version)
8785 {
8786 m_IsStoreLoad = true;
8788 {
8789 m_FixDamageSystemInit = true;
8790 }
8791
8792 if (!super.OnStoreLoad(ctx, version))
8793 {
8794 m_IsStoreLoad = false;
8795 return false;
8796 }
8797
8798 if (version >= 114)
8799 {
8800 bool hasQuickBarIndexSaved;
8801
8802 if (!ctx.Read(hasQuickBarIndexSaved))
8803 {
8804 m_IsStoreLoad = false;
8805 return false;
8806 }
8807
8808 if (hasQuickBarIndexSaved)
8809 {
8810 int itmQBIndex;
8811
8812 //Load quickbar item bind
8813 if (!ctx.Read(itmQBIndex))
8814 {
8815 m_IsStoreLoad = false;
8816 return false;
8817 }
8818
8819 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
8820 if (itmQBIndex != -1 && parentPlayer)
8821 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
8822 }
8823 }
8824 else
8825 {
8826 // Backup of how it used to be
8827 PlayerBase player;
8828 int itemQBIndex;
8829 if (version == int.MAX)
8830 {
8831 if (!ctx.Read(itemQBIndex))
8832 {
8833 m_IsStoreLoad = false;
8834 return false;
8835 }
8836 }
8837 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
8838 {
8839 //Load quickbar item bind
8840 if (!ctx.Read(itemQBIndex))
8841 {
8842 m_IsStoreLoad = false;
8843 return false;
8844 }
8845 if (itemQBIndex != -1 && player)
8846 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
8847 }
8848 }
8849
8850 if (version < 140)
8851 {
8852 // variable management system
8853 if (!LoadVariables(ctx, version))
8854 {
8855 m_IsStoreLoad = false;
8856 return false;
8857 }
8858 }
8859
8860 //agent trasmission system
8861 if (!LoadAgents(ctx, version))
8862 {
8863 m_IsStoreLoad = false;
8864 return false;
8865 }
8866 if (version >= 132)
8867 {
8868 RemotelyActivatedItemBehaviour raib = GetRemotelyActivatedItemBehaviour();
8869 if (raib)
8870 {
8871 if (!raib.OnStoreLoad(ctx,version))
8872 {
8873 m_IsStoreLoad = false;
8874 return false;
8875 }
8876 }
8877 }
8878
8879 m_IsStoreLoad = false;
8880 return true;
8881 }
8882
8883 //----------------------------------------------------------------
8884
8885 override void OnStoreSave(ParamsWriteContext ctx)
8886 {
8887 super.OnStoreSave(ctx);
8888
8889 PlayerBase player;
8890 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
8891 {
8892 ctx.Write(true); // Keep track of if we should actually read this in or not
8893 //Save quickbar item bind
8894 int itemQBIndex = -1;
8895 itemQBIndex = player.FindQuickBarEntityIndex(this);
8896 ctx.Write(itemQBIndex);
8897 }
8898 else
8899 {
8900 ctx.Write(false); // Keep track of if we should actually read this in or not
8901 }
8902
8903 SaveAgents(ctx);//agent trasmission system
8904
8905 RemotelyActivatedItemBehaviour raib = GetRemotelyActivatedItemBehaviour();
8906 if (raib)
8907 {
8908 raib.OnStoreSave(ctx);
8909 }
8910 }
8911 //----------------------------------------------------------------
8912
8913 override void AfterStoreLoad()
8914 {
8915 super.AfterStoreLoad();
8916
8918 {
8920 }
8921
8922 if (GetStoreLoadedQuantity() != float.LOWEST)
8923 {
8925 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
8926 }
8927 }
8928
8929 override void EEOnAfterLoad()
8930 {
8931 super.EEOnAfterLoad();
8932
8934 {
8935 m_FixDamageSystemInit = false;
8936 }
8937
8940 }
8941
8942 bool CanBeDisinfected()
8943 {
8944 return false;
8945 }
8946
8947
8948 //----------------------------------------------------------------
8949 override void OnVariablesSynchronized()
8950 {
8951 if (m_Initialized)
8952 {
8953 #ifdef PLATFORM_CONSOLE
8954 //bruteforce it is
8955 if (IsSplitable())
8956 {
8957 UIScriptedMenu menu = GetGame().GetUIManager().FindMenu(MENU_INVENTORY);
8958 if (menu)
8959 {
8960 menu.Refresh();
8961 }
8962 }
8963 #endif
8964 }
8965
8967 {
8968 PlayImpactSound(m_ConfigWeight, m_ImpactSpeed, m_ImpactSoundSurfaceHash);
8969 m_WantPlayImpactSound = false;
8970 }
8971
8973 {
8974 SetWeightDirty();
8976 }
8977 if (m_VarWet != m_VarWetPrev)
8978 {
8981 }
8982
8983 if (m_SoundSyncPlay != 0)
8984 {
8985 m_ItemSoundHandler.PlayItemSoundClient(m_SoundSyncPlay);
8986 m_SoundSyncPlay = 0;
8987 }
8988 if (m_SoundSyncStop != 0)
8989 {
8990 m_ItemSoundHandler.StopItemSoundClient(m_SoundSyncStop);
8991 m_SoundSyncStop = 0;
8992 }
8993
8994 super.OnVariablesSynchronized();
8995 }
8996
8997 //------------------------- Quantity
8998 //----------------------------------------------------------------
9000 override bool SetQuantity(float value, bool destroy_config = true, bool destroy_forced = false, bool allow_client = false, bool clamp_to_stack_max = true)
9001 {
9002 if (!IsServerCheck(allow_client))
9003 return false;
9004
9005 if (!HasQuantity())
9006 return false;
9007
9008 float min = GetQuantityMin();
9009 float max = GetQuantityMax();
9010
9011 if (value <= (min + 0.001))
9012 value = min;
9013
9014 if (value == min)
9015 {
9016 if (destroy_config)
9017 {
9018 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
9019 if (dstr)
9020 {
9021 m_VarQuantity = Math.Clamp(value, min, max);
9022 this.Delete();
9023 return true;
9024 }
9025 }
9026 else if (destroy_forced)
9027 {
9028 m_VarQuantity = Math.Clamp(value, min, max);
9029 this.Delete();
9030 return true;
9031 }
9032 // we get here if destroy_config IS true AND dstr(config destroy param) IS false;
9033 RemoveAllAgents();//we remove all agents when we got to the min value, but the item is not getting deleted
9034 }
9035
9036 float delta = m_VarQuantity;
9037 m_VarQuantity = Math.Clamp(value, min, max);
9038
9039 if (GetStoreLoadedQuantity() == float.LOWEST)//any other value means we are setting quantity from storage
9040 {
9041 delta = m_VarQuantity - delta;
9042
9043 if (delta)
9044 OnQuantityChanged(delta);
9045 }
9046
9047 SetVariableMask(VARIABLE_QUANTITY);
9048
9049 return false;
9050 }
9051
9052 //----------------------------------------------------------------
9054 bool AddQuantity(float value, bool destroy_config = true, bool destroy_forced = false)
9055 {
9056 return SetQuantity(GetQuantity() + value, destroy_config, destroy_forced);
9057 }
9058 //----------------------------------------------------------------
9059 void SetQuantityMax()
9060 {
9061 float max = GetQuantityMax();
9062 SetQuantity(max);
9063 }
9064
9065 override void SetQuantityToMinimum()
9066 {
9067 float min = GetQuantityMin();
9068 SetQuantity(min);
9069 }
9070 //----------------------------------------------------------------
9072 void SetQuantityNormalized(float value, bool destroy_config = true, bool destroy_forced = false)
9073 {
9074 float value_clamped = Math.Clamp(value, 0, 1);//just to make sure
9075 int result = Math.Round(Math.Lerp(GetQuantityMin(), GetQuantityMax(), value_clamped));
9076 SetQuantity(result, destroy_config, destroy_forced);
9077 }
9078
9079 //----------------------------------------------------------------
9081 override float GetQuantityNormalized()
9082 {
9083 return Math.InverseLerp(GetQuantityMin(), GetQuantityMax(),m_VarQuantity);
9084 }
9085
9087 {
9088 return GetQuantityNormalized();
9089 }
9090
9091 /*void SetAmmoNormalized(float value)
9092 {
9093 float value_clamped = Math.Clamp(value, 0, 1);
9094 Magazine this_mag = Magazine.Cast(this);
9095 int max_rounds = this_mag.GetAmmoMax();
9096 int result = value * max_rounds;//can the rounded if higher precision is required
9097 this_mag.SetAmmoCount(result);
9098 }*/
9099 //----------------------------------------------------------------
9100 override int GetQuantityMax()
9101 {
9102 int slot = -1;
9103 if (GetInventory())
9104 {
9105 InventoryLocation il = new InventoryLocation;
9106 GetInventory().GetCurrentInventoryLocation(il);
9107 slot = il.GetSlot();
9108 }
9109
9110 return GetTargetQuantityMax(slot);
9111 }
9112
9113 override int GetTargetQuantityMax(int attSlotID = -1)
9114 {
9115 float quantity_max = 0;
9116
9117 if (IsSplitable()) //only stackable/splitable items can check for stack size
9118 {
9119 if (attSlotID != -1)
9120 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
9121
9122 if (quantity_max <= 0)
9123 quantity_max = m_VarStackMax;
9124 }
9125
9126 if (quantity_max <= 0)
9127 quantity_max = m_VarQuantityMax;
9128
9129 return quantity_max;
9130 }
9131 //----------------------------------------------------------------
9132 override int GetQuantityMin()
9133 {
9134 return m_VarQuantityMin;
9135 }
9136 //----------------------------------------------------------------
9137 int GetQuantityInit()
9138 {
9139 return m_VarQuantityInit;
9140 }
9141
9142 //----------------------------------------------------------------
9143 override bool HasQuantity()
9144 {
9145 return !(GetQuantityMax() - GetQuantityMin() == 0);
9146 }
9147
9148 override float GetQuantity()
9149 {
9150 return m_VarQuantity;
9151 }
9152
9153 bool IsFullQuantity()
9154 {
9155 return GetQuantity() >= GetQuantityMax();
9156 }
9157
9158 //Calculates weight of single item without attachments and cargo
9159 override float GetSingleInventoryItemWeightEx()
9160 {
9161 //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
9162 float weightEx = GetWeightEx();//overall weight of the item
9163 float special = GetInventoryAndCargoWeight();//cargo and attachment weight
9164 return weightEx - special;
9165 }
9166
9167 // Obsolete, use GetSingleInventoryItemWeightEx() instead
9169 {
9171 }
9172
9173 override protected float GetWeightSpecialized(bool forceRecalc = false)
9174 {
9175 if (IsSplitable()) //quantity determines size of the stack
9176 {
9177 #ifdef DEVELOPER
9178 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9179 {
9180 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
9181 data1.SetCalcDetails("TIB1: " + GetConfigWeightModifiedDebugText() +" * " + GetQuantity()+"(quantity)");
9182 }
9183 #endif
9184
9185 return GetQuantity() * GetConfigWeightModified();
9186 }
9187 else if (HasEnergyManager())// items with energy manager
9188 {
9189 #ifdef DEVELOPER
9190 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9191 {
9192 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
9193 data2.SetCalcDetails("TIB2: "+super.GetWeightSpecialized(forceRecalc)+"(contents weight) + " + GetConfigWeightModifiedDebugText() +" + " + GetCompEM().GetEnergy()+"(energy) * " + ConfigGetFloat("weightPerQuantityUnit") +"(weightPerQuantityUnit)");
9194 }
9195 #endif
9196 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified());
9197 }
9198 else//everything else
9199 {
9200 #ifdef DEVELOPER
9201 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9202 {
9203 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
9204 data3.SetCalcDetails("TIB3: "+super.GetWeightSpecialized(forceRecalc)+"(contents weight) + " + GetConfigWeightModifiedDebugText() +" + " + GetQuantity()+"(quantity) * " + ConfigGetFloat("weightPerQuantityUnit") +"(weightPerQuantityUnit))");
9205 }
9206 #endif
9207 return super.GetWeightSpecialized(forceRecalc) + (GetQuantity() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified());
9208 }
9209 }
9210
9212 int GetNumberOfItems()
9213 {
9214 int item_count = 0;
9215 ItemBase item;
9216
9217 if (GetInventory().GetCargo() != NULL)
9218 {
9219 item_count = GetInventory().GetCargo().GetItemCount();
9220 }
9221
9222 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
9223 {
9224 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
9225 if (item)
9226 item_count += item.GetNumberOfItems();
9227 }
9228 return item_count;
9229 }
9230
9232 float GetUnitWeight(bool include_wetness = true)
9233 {
9234 float weight = 0;
9235 float wetness = 1;
9236 if (include_wetness)
9237 wetness += GetWet();
9238 if (IsSplitable()) //quantity determines size of the stack
9239 {
9240 weight = wetness * m_ConfigWeight;
9241 }
9242 else if (IsLiquidContainer()) //is a liquid container, default liquid weight is set to 1. May revisit later?
9243 {
9244 weight = 1;
9245 }
9246 return weight;
9247 }
9248
9249 //-----------------------------------------------------------------
9250
9251 override void ClearInventory()
9252 {
9253 if ((GetGame().IsServer() || !GetGame().IsMultiplayer()) && GetInventory())
9254 {
9255 GameInventory inv = GetInventory();
9256 array<EntityAI> items = new array<EntityAI>;
9257 inv.EnumerateInventory(InventoryTraversalType.INORDER, items);
9258 for (int i = 0; i < items.Count(); i++)
9259 {
9260 ItemBase item = ItemBase.Cast(items.Get(i));
9261 if (item)
9262 {
9263 GetGame().ObjectDelete(item);
9264 }
9265 }
9266 }
9267 }
9268
9269 //------------------------- Energy
9270
9271 //----------------------------------------------------------------
9272 float GetEnergy()
9273 {
9274 float energy = 0;
9275 if (HasEnergyManager())
9276 {
9277 energy = GetCompEM().GetEnergy();
9278 }
9279 return energy;
9280 }
9281
9282
9283 override void OnEnergyConsumed()
9284 {
9285 super.OnEnergyConsumed();
9286
9288 }
9289
9290 override void OnEnergyAdded()
9291 {
9292 super.OnEnergyAdded();
9293
9295 }
9296
9297 // Converts energy (from Energy Manager) to quantity, if enabled.
9299 {
9300 if (GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
9301 {
9302 if (HasQuantity())
9303 {
9304 float energy_0to1 = GetCompEM().GetEnergy0To1();
9305 SetQuantityNormalized(energy_0to1);
9306 }
9307 }
9308 }
9309
9310 //----------------------------------------------------------------
9311 float GetHeatIsolationInit()
9312 {
9313 return ConfigGetFloat("heatIsolation");
9314 }
9315
9316 float GetHeatIsolation()
9317 {
9318 return m_HeatIsolation;
9319 }
9320
9321 float GetDryingIncrement(string pIncrementName)
9322 {
9323 string paramPath = string.Format("CfgVehicles %1 EnvironmentWetnessIncrements Drying %2", GetType(), pIncrementName);
9324 if (GetGame().ConfigIsExisting(paramPath))
9325 return GetGame().ConfigGetFloat(paramPath);
9326
9327 return 0.0;
9328 }
9329
9330 float GetSoakingIncrement(string pIncrementName)
9331 {
9332 string paramPath = string.Format("CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2", GetType(), pIncrementName);
9333 if (GetGame().ConfigIsExisting(paramPath))
9334 return GetGame().ConfigGetFloat(paramPath);
9335
9336 return 0.0;
9337 }
9338 //----------------------------------------------------------------
9339 override void SetWet(float value, bool allow_client = false)
9340 {
9341 if (!IsServerCheck(allow_client))
9342 return;
9343
9344 float min = GetWetMin();
9345 float max = GetWetMax();
9346
9347 float previousValue = m_VarWet;
9348
9349 m_VarWet = Math.Clamp(value, min, max);
9350
9351 if (previousValue != m_VarWet)
9352 {
9353 SetVariableMask(VARIABLE_WET);
9354 OnWetChanged(m_VarWet, previousValue);
9355 }
9356 }
9357 //----------------------------------------------------------------
9358 override void AddWet(float value)
9359 {
9360 SetWet(GetWet() + value);
9361 }
9362 //----------------------------------------------------------------
9363 override void SetWetMax()
9364 {
9366 }
9367 //----------------------------------------------------------------
9368 override float GetWet()
9369 {
9370 return m_VarWet;
9371 }
9372 //----------------------------------------------------------------
9373 override float GetWetMax()
9374 {
9375 return m_VarWetMax;
9376 }
9377 //----------------------------------------------------------------
9378 override float GetWetMin()
9379 {
9380 return m_VarWetMin;
9381 }
9382 //----------------------------------------------------------------
9383 override float GetWetInit()
9384 {
9385 return m_VarWetInit;
9386 }
9387 //----------------------------------------------------------------
9388 override void OnWetChanged(float newVal, float oldVal)
9389 {
9390 EWetnessLevel newLevel = GetWetLevelInternal(newVal);
9391 EWetnessLevel oldLevel = GetWetLevelInternal(oldVal);
9392 if (newLevel != oldLevel)
9393 {
9394 OnWetLevelChanged(newLevel,oldLevel);
9395 }
9396 }
9397
9398 override void OnWetLevelChanged(EWetnessLevel newLevel, EWetnessLevel oldLevel)
9399 {
9400 SetWeightDirty();
9401 }
9402
9403 override EWetnessLevel GetWetLevel()
9404 {
9405 return GetWetLevelInternal(m_VarWet);
9406 }
9407
9408 //----------------------------------------------------------------
9409
9410 override void SetStoreLoad(bool value)
9411 {
9412 m_IsStoreLoad = value;
9413 }
9414
9415 override bool IsStoreLoad()
9416 {
9417 return m_IsStoreLoad;
9418 }
9419
9420 override void SetStoreLoadedQuantity(float value)
9421 {
9422 m_StoreLoadedQuantity = value;
9423 }
9424
9425 override float GetStoreLoadedQuantity()
9426 {
9427 return m_StoreLoadedQuantity;
9428 }
9429
9430 //----------------------------------------------------------------
9431
9432 float GetItemModelLength()
9433 {
9434 if (ConfigIsExisting("itemModelLength"))
9435 {
9436 return ConfigGetFloat("itemModelLength");
9437 }
9438 return 0;
9439 }
9440
9441 float GetItemAttachOffset()
9442 {
9443 if (ConfigIsExisting("itemAttachOffset"))
9444 {
9445 return ConfigGetFloat("itemAttachOffset");
9446 }
9447 return 0;
9448 }
9449
9450 override void SetCleanness(int value, bool allow_client = false)
9451 {
9452 if (!IsServerCheck(allow_client))
9453 return;
9454
9455 int previousValue = m_Cleanness;
9456
9457 m_Cleanness = Math.Clamp(value, m_CleannessMin, m_CleannessMax);
9458
9459 if (previousValue != m_Cleanness)
9460 SetVariableMask(VARIABLE_CLEANNESS);
9461 }
9462
9463 override int GetCleanness()
9464 {
9465 return m_Cleanness;
9466 }
9467
9469 {
9470 return true;
9471 }
9472
9473 //----------------------------------------------------------------
9474 // ATTACHMENT LOCKING
9475 // Getters relevant to generic ActionLockAttachment
9476 int GetLockType()
9477 {
9478 return m_LockType;
9479 }
9480
9481 string GetLockSoundSet()
9482 {
9483 return m_LockSoundSet;
9484 }
9485
9486 //----------------------------------------------------------------
9487 //------------------------- Color
9488 // sets items color variable given color components
9489 override void SetColor(int r, int g, int b, int a)
9490 {
9495 SetVariableMask(VARIABLE_COLOR);
9496 }
9498 override void GetColor(out int r,out int g,out int b,out int a)
9499 {
9504 }
9505
9506 bool IsColorSet()
9507 {
9508 return IsVariableSet(VARIABLE_COLOR);
9509 }
9510
9512 string GetColorString()
9513 {
9514 int r,g,b,a;
9515 GetColor(r,g,b,a);
9516 r = r/255;
9517 g = g/255;
9518 b = b/255;
9519 a = a/255;
9520 return MiscGameplayFunctions.GetColorString(r, g, b, a);
9521 }
9522 //----------------------------------------------------------------
9523 //------------------------- LiquidType
9524
9525 override void SetLiquidType(int value, bool allow_client = false)
9526 {
9527 if (!IsServerCheck(allow_client))
9528 return;
9529
9530 int old = m_VarLiquidType;
9531 m_VarLiquidType = value;
9532 OnLiquidTypeChanged(old,value);
9533 SetVariableMask(VARIABLE_LIQUIDTYPE);
9534 }
9535
9536 int GetLiquidTypeInit()
9537 {
9538 return ConfigGetInt("varLiquidTypeInit");
9539 }
9540
9541 override int GetLiquidType()
9542 {
9543 return m_VarLiquidType;
9544 }
9545
9546 protected void OnLiquidTypeChanged(int oldType, int newType)
9547 {
9548 if (newType == LIQUID_NONE && GetIsFrozen())
9549 SetFrozen(false);
9550 }
9551
9553 void UpdateQuickbarShortcutVisibility(PlayerBase player)
9554 {
9555 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9556 }
9557
9558 // -------------------------------------------------------------------------
9560 void OnInventoryEnter(Man player)
9561 {
9562 PlayerBase nplayer;
9563 if (PlayerBase.CastTo(nplayer, player))
9564 {
9565 m_CanPlayImpactSound = true;
9566 //nplayer.OnItemInventoryEnter(this);
9567 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9568 }
9569 }
9570
9571 // -------------------------------------------------------------------------
9573 void OnInventoryExit(Man player)
9574 {
9575 PlayerBase nplayer;
9576 if (PlayerBase.CastTo(nplayer,player))
9577 {
9578 //nplayer.OnItemInventoryExit(this);
9579 nplayer.SetEnableQuickBarEntityShortcut(this,false);
9580
9581 }
9582
9583 //if (!GetGame().IsDedicatedServer())
9584 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
9585
9586
9587 if (HasEnergyManager())
9588 {
9589 GetCompEM().UpdatePlugState(); // Unplug the el. device if it's necesarry.
9590 }
9591 }
9592
9593 // ADVANCED PLACEMENT EVENTS
9594 override void OnPlacementStarted(Man player)
9595 {
9596 super.OnPlacementStarted(player);
9597
9598 SetTakeable(false);
9599 }
9600
9601 override void OnPlacementComplete(Man player, vector position = "0 0 0", vector orientation = "0 0 0")
9602 {
9603 if (m_AdminLog)
9604 {
9605 m_AdminLog.OnPlacementComplete(player, this);
9606 }
9607
9608 super.OnPlacementComplete(player, position, orientation);
9609 }
9610
9611 //-----------------------------
9612 // AGENT SYSTEM
9613 //-----------------------------
9614 //--------------------------------------------------------------------------
9615 bool ContainsAgent(int agent_id)
9616 {
9617 if (agent_id & m_AttachedAgents)
9618 {
9619 return true;
9620 }
9621 else
9622 {
9623 return false;
9624 }
9625 }
9626
9627 //--------------------------------------------------------------------------
9628 override void RemoveAgent(int agent_id)
9629 {
9630 if (ContainsAgent(agent_id))
9631 {
9632 m_AttachedAgents = ~agent_id & m_AttachedAgents;
9633 }
9634 }
9635
9636 //--------------------------------------------------------------------------
9637 override void RemoveAllAgents()
9638 {
9639 m_AttachedAgents = 0;
9640 }
9641 //--------------------------------------------------------------------------
9642 override void RemoveAllAgentsExcept(int agent_to_keep)
9643 {
9644 m_AttachedAgents = m_AttachedAgents & agent_to_keep;
9645 }
9646 // -------------------------------------------------------------------------
9647 override void InsertAgent(int agent, float count = 1)
9648 {
9649 if (count < 1)
9650 return;
9651 //Debug.Log("Inserting Agent on item: " + agent.ToString() +" count: " + count.ToString());
9653 }
9654
9656 void TransferAgents(int agents)
9657 {
9659 }
9660
9661 // -------------------------------------------------------------------------
9662 override int GetAgents()
9663 {
9664 return m_AttachedAgents;
9665 }
9666 //----------------------------------------------------------------------
9667
9668 /*int GetContaminationType()
9669 {
9670 int contamination_type;
9671
9672 const int CONTAMINATED_MASK = eAgents.CHOLERA | eAgents.INFLUENZA | eAgents.SALMONELLA | eAgents.BRAIN;
9673 const int POISONED_MASK = eAgents.FOOD_POISON | eAgents.CHEMICAL_POISON;
9674 const int NERVE_GAS_MASK = eAgents.CHEMICAL_POISON;
9675 const int DIRTY_MASK = eAgents.WOUND_AGENT;
9676
9677 Edible_Base edible = Edible_Base.Cast(this);
9678 int agents = GetAgents();
9679 if (edible)
9680 {
9681 NutritionalProfile profile = Edible_Base.GetNutritionalProfile(edible);
9682 if (profile)
9683 {
9684 agents = agents | profile.GetAgents();//merge item's agents with nutritional agents
9685 }
9686 }
9687 if (agents & CONTAMINATED_MASK)
9688 {
9689 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_CONTAMINATED;
9690 }
9691 if (agents & POISONED_MASK)
9692 {
9693 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_POISONED;
9694 }
9695 if (agents & NERVE_GAS_MASK)
9696 {
9697 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_NERVE_GAS;
9698 }
9699 if (agents & DIRTY_MASK)
9700 {
9701 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_DIRTY;
9702 }
9703
9704 return agents;
9705 }*/
9706
9707 // -------------------------------------------------------------------------
9708 bool LoadAgents(ParamsReadContext ctx, int version)
9709 {
9710 if (!ctx.Read(m_AttachedAgents))
9711 return false;
9712 return true;
9713 }
9714 // -------------------------------------------------------------------------
9716 {
9717
9719 }
9720 // -------------------------------------------------------------------------
9721
9723 override void CheckForRoofLimited(float timeTresholdMS = 3000)
9724 {
9725 super.CheckForRoofLimited(timeTresholdMS);
9726
9727 float time = GetGame().GetTime();
9728 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
9729 {
9730 m_PreviousRoofTestTime = time;
9731 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
9732 }
9733 }
9734
9735 // returns item's protection level against enviromental hazard, for masks with filters, returns the filters protection for valid filter, otherwise 0
9736 float GetProtectionLevel(int type, bool consider_filter = false, int system = 0)
9737 {
9738 if (IsDamageDestroyed() || (HasQuantity() && GetQuantity() <= 0))
9739 {
9740 return 0;
9741 }
9742
9743 if (GetInventory().GetAttachmentSlotsCount() != 0)//is it an item with attachable filter ?
9744 {
9745 ItemBase filter = ItemBase.Cast(FindAttachmentBySlotName("GasMaskFilter"));
9746 if (filter)
9747 return filter.GetProtectionLevel(type, false, system);//it's a valid filter, return the protection
9748 else
9749 return 0;//otherwise return 0 when no filter attached
9750 }
9751
9752 string subclassPath, entryName;
9753
9754 switch (type)
9755 {
9756 case DEF_BIOLOGICAL:
9757 entryName = "biological";
9758 break;
9759 case DEF_CHEMICAL:
9760 entryName = "chemical";
9761 break;
9762 default:
9763 entryName = "biological";
9764 break;
9765 }
9766
9767 subclassPath = "CfgVehicles " + this.GetType() + " Protection ";
9768
9769 return GetGame().ConfigGetFloat(subclassPath + entryName);
9770 }
9771
9772
9773
9775 override void EEOnCECreate()
9776 {
9777 if (!IsMagazine())
9779
9781 }
9782
9783
9784 //-------------------------
9785 // OPEN/CLOSE USER ACTIONS
9786 //-------------------------
9788 void Open();
9789 void Close();
9790 bool IsOpen()
9791 {
9792 return true;
9793 }
9794
9795 override bool CanDisplayCargo()
9796 {
9797 return IsOpen();
9798 }
9799
9800
9801 // ------------------------------------------------------------
9802 // CONDITIONS
9803 // ------------------------------------------------------------
9804 override bool CanPutInCargo(EntityAI parent)
9805 {
9806 if (parent)
9807 {
9808 if (parent.IsInherited(DayZInfected))
9809 return true;
9810
9811 if (!parent.IsRuined())
9812 return true;
9813 }
9814
9815 return true;
9816 }
9817
9818 override bool CanPutAsAttachment(EntityAI parent)
9819 {
9820 if (!super.CanPutAsAttachment(parent))
9821 {
9822 return false;
9823 }
9824
9825 if (!IsRuined() && !parent.IsRuined())
9826 {
9827 return true;
9828 }
9829
9830 return false;
9831 }
9832
9833 override bool CanReceiveItemIntoCargo(EntityAI item)
9834 {
9835 //removed 15.06. coz of loading from storage -> after load items in cargo was lost -> waiting for proper solution
9836 //if (GetHealthLevel() == GameConstants.STATE_RUINED)
9837 // return false;
9838
9839 return super.CanReceiveItemIntoCargo(item);
9840 }
9841
9842 override bool CanReceiveAttachment(EntityAI attachment, int slotId)
9843 {
9844 //removed 15.06. coz of loading from storage -> after load items in cargo was lost -> waiting for proper solution
9845 //if (GetHealthLevel() == GameConstants.STATE_RUINED)
9846 // return false;
9847
9848 GameInventory attachmentInv = attachment.GetInventory();
9849 if (attachmentInv && attachmentInv.GetCargo() && attachmentInv.GetCargo().GetItemCount() > 0)
9850 {
9851 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
9852 return false;
9853 }
9854
9855 InventoryLocation loc = new InventoryLocation();
9856 attachment.GetInventory().GetCurrentInventoryLocation(loc);
9857 if (loc && loc.IsValid() && !GetInventory().AreChildrenAccessible())
9858 return false;
9859
9860 return super.CanReceiveAttachment(attachment, slotId);
9861 }
9862
9863 override bool CanReleaseAttachment(EntityAI attachment)
9864 {
9865 if (!super.CanReleaseAttachment(attachment))
9866 return false;
9867
9868 return GetInventory().AreChildrenAccessible();
9869 }
9870
9871 /*override bool CanLoadAttachment(EntityAI attachment)
9872 {
9873 //removed 15.06. coz of loading from storage -> after load items in cargo was lost -> waiting for proper solution
9874 //if (GetHealthLevel() == GameConstants.STATE_RUINED)
9875 // return false;
9876
9877 GameInventory attachmentInv = attachment.GetInventory();
9878 if (attachmentInv && attachmentInv.GetCargo() && attachmentInv.GetCargo().GetItemCount() > 0)
9879 {
9880 bool boo = (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase));
9881 ErrorEx("CanLoadAttachment | this: " + this + " | attachment: " + attachment + " | boo: " + boo,ErrorExSeverity.INFO);
9882
9883 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
9884 return false;
9885 }
9886
9887 return super.CanLoadAttachment(attachment);
9888 }*/
9889
9890 // Plays muzzle flash particle effects
9891 static void PlayFireParticles(ItemBase weapon, int muzzle_index, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
9892 {
9893 int id = muzzle_owner.GetMuzzleID();
9894 array<ref WeaponParticlesOnFire> WPOF_array = m_OnFireEffect.Get(id);
9895
9896 if (WPOF_array)
9897 {
9898 for (int i = 0; i < WPOF_array.Count(); i++)
9899 {
9900 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
9901
9902 if (WPOF)
9903 {
9904 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
9905 }
9906 }
9907 }
9908 }
9909
9910 // Plays bullet eject particle effects (usually just smoke, the bullet itself is a 3D model and is not part of this function)
9911 static void PlayBulletCasingEjectParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
9912 {
9913 int id = muzzle_owner.GetMuzzleID();
9914 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = m_OnBulletCasingEjectEffect.Get(id);
9915
9916 if (WPOBE_array)
9917 {
9918 for (int i = 0; i < WPOBE_array.Count(); i++)
9919 {
9920 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
9921
9922 if (WPOBE)
9923 {
9924 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
9925 }
9926 }
9927 }
9928 }
9929
9930 // Plays all weapon overheating particles
9931 static void PlayOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
9932 {
9933 int id = muzzle_owner.GetMuzzleID();
9934 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9935
9936 if (WPOOH_array)
9937 {
9938 for (int i = 0; i < WPOOH_array.Count(); i++)
9939 {
9940 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9941
9942 if (WPOOH)
9943 {
9944 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
9945 }
9946 }
9947 }
9948 }
9949
9950 // Updates all weapon overheating particles
9951 static void UpdateOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
9952 {
9953 int id = muzzle_owner.GetMuzzleID();
9954 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9955
9956 if (WPOOH_array)
9957 {
9958 for (int i = 0; i < WPOOH_array.Count(); i++)
9959 {
9960 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9961
9962 if (WPOOH)
9963 {
9964 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9965 }
9966 }
9967 }
9968 }
9969
9970 // Stops overheating particles
9971 static void StopOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
9972 {
9973 int id = muzzle_owner.GetMuzzleID();
9974 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9975
9976 if (WPOOH_array)
9977 {
9978 for (int i = 0; i < WPOOH_array.Count(); i++)
9979 {
9980 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9981
9982 if (WPOOH)
9983 {
9984 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9985 }
9986 }
9987 }
9988 }
9989
9990 //----------------------------------------------------------------
9991 //Item Behaviour - unified approach
9992 override bool IsHeavyBehaviour()
9993 {
9994 if (m_ItemBehaviour == 0)
9995 {
9996 return true;
9997 }
9998
9999 return false;
10000 }
10001
10002 override bool IsOneHandedBehaviour()
10003 {
10004 if (m_ItemBehaviour == 1)
10005 {
10006 return true;
10007 }
10008
10009 return false;
10010 }
10011
10012 override bool IsTwoHandedBehaviour()
10013 {
10014 if (m_ItemBehaviour == 2)
10015 {
10016 return true;
10017 }
10018
10019 return false;
10020 }
10021
10022 bool IsDeployable()
10023 {
10024 return false;
10025 }
10026
10028 float GetDeployTime()
10029 {
10030 return UATimeSpent.DEFAULT_DEPLOY;
10031 }
10032
10033
10034 //----------------------------------------------------------------
10035 // Item Targeting (User Actions)
10036 override void SetTakeable(bool pState)
10037 {
10038 m_IsTakeable = pState;
10039 SetSynchDirty();
10040 }
10041
10042 override bool IsTakeable()
10043 {
10044 return m_IsTakeable;
10045 }
10046
10047 // For cases where we want to show object widget which cant be taken to hands
10049 {
10050 return false;
10051 }
10052
10054 protected void PreLoadSoundAttachmentType()
10055 {
10056 string att_type = "None";
10057
10058 if (ConfigIsExisting("soundAttType"))
10059 {
10060 att_type = ConfigGetString("soundAttType");
10061 }
10062
10063 m_SoundAttType = att_type;
10064 }
10065
10066 override string GetAttachmentSoundType()
10067 {
10068 return m_SoundAttType;
10069 }
10070
10071 //----------------------------------------------------------------
10072 //SOUNDS - ItemSoundHandler
10073 //----------------------------------------------------------------
10074
10075 string GetPlaceSoundset(); // played when deploy starts
10076 string GetLoopDeploySoundset(); // played when deploy starts and stopped when it finishes
10077 string GetDeploySoundset(); // played when deploy sucessfully finishes
10078
10080 {
10081 if (!m_ItemSoundHandler)
10083
10084 return m_ItemSoundHandler;
10085 }
10086
10087 // override to initialize sounds
10088 protected void InitItemSounds()
10089 {
10090 if (GetPlaceSoundset() == string.Empty && GetDeploySoundset() == string.Empty && GetLoopDeploySoundset() == string.Empty)
10091 return;
10092
10094
10095 if (GetPlaceSoundset() != string.Empty)
10096 handler.AddSound(SoundConstants.ITEM_PLACE, GetPlaceSoundset());
10097
10098 if (GetDeploySoundset() != string.Empty)
10099 handler.AddSound(SoundConstants.ITEM_DEPLOY, GetDeploySoundset());
10100
10101 SoundParameters params = new SoundParameters();
10102 params.m_Loop = true;
10103 if (GetLoopDeploySoundset() != string.Empty)
10104 handler.AddSound(SoundConstants.ITEM_DEPLOY_LOOP, GetLoopDeploySoundset(), params);
10105 }
10106
10107 // Start sound using ItemSoundHandler
10108 void StartItemSoundServer(int id)
10109 {
10110 if (!GetGame().IsServer())
10111 return;
10112
10113 m_SoundSyncPlay = id;
10114 SetSynchDirty();
10115
10116 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).Remove(ClearStartItemSoundServer); // in case one is queued already
10118 }
10119
10120 // Stop sound using ItemSoundHandler
10121 void StopItemSoundServer(int id)
10122 {
10123 if (!GetGame().IsServer())
10124 return;
10125
10126 m_SoundSyncStop = id;
10127 SetSynchDirty();
10128
10129 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).Remove(ClearStopItemSoundServer); // in case one is queued already
10131 }
10132
10133 protected void ClearStartItemSoundServer()
10134 {
10135 m_SoundSyncPlay = 0;
10136 }
10137
10138 protected void ClearStopItemSoundServer()
10139 {
10140 m_SoundSyncStop = 0;
10141 }
10142
10144 void PlayAttachSound(string slot_type)
10145 {
10146 if (!GetGame().IsDedicatedServer())
10147 {
10148 if (ConfigIsExisting("attachSoundSet"))
10149 {
10150 string cfg_path = "";
10151 string soundset = "";
10152 string type_name = GetType();
10153
10154 TStringArray cfg_soundset_array = new TStringArray;
10155 TStringArray cfg_slot_array = new TStringArray;
10156 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
10157 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
10158
10159 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
10160 {
10161 for (int i = 0; i < cfg_soundset_array.Count(); i++)
10162 {
10163 if (cfg_slot_array[i] == slot_type)
10164 {
10165 soundset = cfg_soundset_array[i];
10166 break;
10167 }
10168 }
10169 }
10170
10171 if (soundset != "")
10172 {
10173 EffectSound sound = SEffectManager.PlaySound(soundset, GetPosition());
10174 sound.SetAutodestroy(true);
10175 }
10176 }
10177 }
10178 }
10179
10180 void PlayDetachSound(string slot_type)
10181 {
10182 //TODO - evaluate if needed and devise universal config structure if so
10183 }
10184
10185 void OnApply(PlayerBase player);
10186
10188 {
10189 return 1.0;
10190 };
10191 //returns applicable selection
10192 array<string> GetHeadHidingSelection()
10193 {
10195 }
10196
10198 {
10200 }
10201
10202 WrittenNoteData GetWrittenNoteData() {};
10203
10205 {
10206 SetDynamicPhysicsLifeTime(0.01);
10207 m_ItemBeingDroppedPhys = false;
10208 }
10209
10211 {
10212 array<string> zone_names = new array<string>;
10213 GetDamageZones(zone_names);
10214 for (int i = 0; i < zone_names.Count(); i++)
10215 {
10216 SetHealthMax(zone_names.Get(i),"Health");
10217 }
10218 SetHealthMax("","Health");
10219 }
10220
10222 void SetZoneDamageCEInit()
10223 {
10224 float global_health = GetHealth01("","Health");
10225 array<string> zones = new array<string>;
10226 GetDamageZones(zones);
10227 //set damage of all zones to match global health level
10228 for (int i = 0; i < zones.Count(); i++)
10229 {
10230 SetHealth01(zones.Get(i),"Health",global_health);
10231 }
10232 }
10233
10235 bool IsCoverFaceForShave(string slot_name)
10236 {
10237 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
10238 }
10239
10240 void ProcessItemWetness(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
10241 {
10242 if (!hasRootAsPlayer)
10243 {
10244 if (refParentIB)
10245 {
10246 // parent is wet
10247 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (m_VarWet < m_VarWetMax))
10248 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
10249 // parent has liquid inside
10250 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (m_VarWet < m_VarWetMax))
10251 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
10252 // drying
10253 else if (m_VarWet > m_VarWetMin)
10254 AddWet(-1 * delta * GetDryingIncrement("ground") * 2);
10255 }
10256 else
10257 {
10258 // drying on ground or inside non-itembase (car, ...)
10259 if (m_VarWet > m_VarWetMin)
10260 AddWet(-1 * delta * GetDryingIncrement("ground"));
10261 }
10262 }
10263 }
10264
10265 void ProcessItemTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
10266 {
10268 {
10269 float target = g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(this);
10270 if (GetTemperature() != target || !IsFreezeThawProgressFinished())
10271 {
10272 float heatPermCoef = 1.0;
10273 EntityAI ent = this;
10274 while (ent)
10275 {
10276 heatPermCoef *= ent.GetHeatPermeabilityCoef();
10277 ent = ent.GetHierarchyParent();
10278 }
10279
10280 SetTemperatureEx(new TemperatureDataInterpolated(target,ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
10281 }
10282 }
10283 }
10284
10285 void HierarchyCheck(out bool hasParent, out bool hasRootAsPlayer, out ItemBase refParentIB)
10286 {
10287 // hierarchy check for an item to decide whether it has some parent and it is in some player inventory
10288 EntityAI parent = GetHierarchyParent();
10289 if (!parent)
10290 {
10291 hasParent = false;
10292 hasRootAsPlayer = false;
10293 }
10294 else
10295 {
10296 hasParent = true;
10297 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
10298 refParentIB = ItemBase.Cast(parent);
10299 }
10300 }
10301
10302 protected void ProcessDecay(float delta, bool hasRootAsPlayer)
10303 {
10304 // this is stub, implemented on Edible_Base
10305 }
10306
10307 bool CanDecay()
10308 {
10309 // return true used on selected food clases so they can decay
10310 return false;
10311 }
10312
10313 protected bool CanProcessDecay()
10314 {
10315 // this is stub, implemented on Edible_Base class
10316 // used to determine whether it is still necessary for the food to decay
10317 return false;
10318 }
10319
10320 protected bool CanHaveWetness()
10321 {
10322 // return true used on selected items that have a wetness effect
10323 return false;
10324 }
10325
10327 bool CanBeConsumed(ConsumeConditionData data = null)
10328 {
10329 return !GetIsFrozen() && IsOpen();
10330 }
10331
10332 override void ProcessVariables()
10333 {
10334 bool hasParent = false, hasRootAsPlayer = false;
10335 ItemBase refParentIB;
10336
10337 bool wwtu = g_Game.IsWorldWetTempUpdateEnabled();
10338 bool foodDecay = g_Game.IsFoodDecayEnabled();
10339
10340 if (wwtu || foodDecay)
10341 {
10342 bool processWetness = wwtu && CanHaveWetness();
10343 bool processTemperature = wwtu && CanHaveTemperature();
10344 bool processDecay = foodDecay && CanDecay() && CanProcessDecay();
10345
10346 if (processWetness || processTemperature || processDecay)
10347 {
10348 HierarchyCheck(hasParent, hasRootAsPlayer, refParentIB);
10349
10350 if (processWetness)
10351 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
10352
10353 if (processTemperature)
10354 ProcessItemTemperature(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
10355
10356 if (processDecay)
10357 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
10358 }
10359 }
10360 }
10361
10364 {
10365 return m_TemperaturePerQuantityWeight * GameConstants.ITEM_TEMPERATURE_QUANTITY_WEIGHT_MULTIPLIER;
10366 }
10367
10368 override float GetTemperatureFreezeThreshold()
10369 {
10371 return Liquid.GetFreezeThreshold(GetLiquidType());
10372
10373 return super.GetTemperatureFreezeThreshold();
10374 }
10375
10376 override float GetTemperatureThawThreshold()
10377 {
10379 return Liquid.GetThawThreshold(GetLiquidType());
10380
10381 return super.GetTemperatureThawThreshold();
10382 }
10383
10384 override float GetItemOverheatThreshold()
10385 {
10387 return Liquid.GetBoilThreshold(GetLiquidType());
10388
10389 return super.GetItemOverheatThreshold();
10390 }
10391
10392 override float GetTemperatureFreezeTime()
10393 {
10394 if (HasQuantity())
10395 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),GetQuantityNormalized());
10396
10397 return super.GetTemperatureFreezeTime();
10398 }
10399
10400 override float GetTemperatureThawTime()
10401 {
10402 if (HasQuantity())
10403 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),GetQuantityNormalized());
10404
10405 return super.GetTemperatureThawTime();
10406 }
10407
10409 void AffectLiquidContainerOnFill(int liquid_type, float amount);
10411 void AffectLiquidContainerOnTransfer(int liquidType, float amount, float sourceLiquidTemperature);
10412
10413 bool IsCargoException4x3(EntityAI item)
10414 {
10415 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
10416 }
10417
10419 {
10420 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
10421 }
10422
10424 void AddLightSourceItem(ItemBase lightsource)
10425 {
10426 m_LightSourceItem = lightsource;
10427 }
10428
10430 {
10431 m_LightSourceItem = null;
10432 }
10433
10435 {
10436 return m_LightSourceItem;
10437 }
10438
10440 array<int> GetValidFinishers()
10441 {
10442 return null;
10443 }
10444
10446 bool GetActionWidgetOverride(out typename name)
10447 {
10448 return false;
10449 }
10450
10451 bool PairWithDevice(notnull ItemBase otherDevice)
10452 {
10453 if (GetGame().IsServer())
10454 {
10455 ItemBase explosive = otherDevice;
10457 if (!trg)
10458 {
10459 trg = RemoteDetonatorTrigger.Cast(otherDevice);
10460 explosive = this;
10461 }
10462
10463 explosive.PairRemote(trg);
10464 trg.SetControlledDevice(explosive);
10465
10466 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
10467 trg.SetPersistentPairID(persistentID);
10468 explosive.SetPersistentPairID(persistentID);
10469
10470 return true;
10471 }
10472 return false;
10473 }
10474
10476 float GetBaitEffectivity()
10477 {
10478 float ret = 1.0;
10479 if (HasQuantity())
10480 ret *= GetQuantityNormalized();
10481 ret *= GetHealth01();
10482
10483 return ret;
10484 }
10485
10486 #ifdef DEVELOPER
10487 override void SetDebugItem()
10488 {
10489 super.SetDebugItem();
10490 _itemBase = this;
10491 }
10492
10493 override string GetDebugText()
10494 {
10495 string text = super.GetDebugText();
10496
10497 text += string.Format("Heat isolation(raw): %1\n", GetHeatIsolation());
10498 text += string.Format("Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(this));
10499
10500 return text;
10501 }
10502 #endif
10503
10504 bool CanBeUsedForSuicide()
10505 {
10506 return true;
10507 }
10508
10510 //DEPRECATED BELOW
10512 // Backwards compatibility
10513 void ProcessItemWetnessAndTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
10514 {
10515 ProcessItemWetness(delta, hasParent, hasRootAsPlayer, refParentIB);
10516 ProcessItemTemperature(delta, hasParent, hasRootAsPlayer, refParentIB);
10517 }
10518
10519 // replaced by ItemSoundHandler
10520 protected EffectSound m_SoundDeployFinish;
10521 protected EffectSound m_SoundPlace;
10522 protected EffectSound m_DeployLoopSoundEx;
10523 protected EffectSound m_SoundDeploy;
10524 bool m_IsPlaceSound;
10525 bool m_IsDeploySound;
10527
10528 string GetDeployFinishSoundset();
10529 void PlayDeploySound();
10530 void PlayDeployFinishSound();
10531 void PlayPlaceSound();
10532 void PlayDeployLoopSoundEx();
10533 void StopDeployLoopSoundEx();
10534 void SoundSynchRemoteReset();
10535 void SoundSynchRemote();
10536 bool UsesGlobalDeploy(){return false;}
10537 bool CanPlayDeployLoopSound(){return false;}
10539 bool IsPlaceSound(){return m_IsPlaceSound;}
10540 bool IsDeploySound(){return m_IsDeploySound;}
10541 void SetIsPlaceSound(bool is_place_sound);
10542 void SetIsDeploySound(bool is_deploy_sound);
10543}
10544
10545EntityAI SpawnItemOnLocation(string object_name, notnull InventoryLocation loc, bool full_quantity)
10546{
10547 EntityAI entity = SpawnEntity(object_name, loc, ECE_IN_INVENTORY, RF_DEFAULT);
10548 if (entity)
10549 {
10550 bool is_item = entity.IsInherited(ItemBase);
10551 if (is_item && full_quantity)
10552 {
10553 ItemBase item = ItemBase.Cast(entity);
10554 item.SetQuantity(item.GetQuantityInit());
10555 }
10556 }
10557 else
10558 {
10559 ErrorEx("Cannot spawn entity: " + object_name,ErrorExSeverity.INFO);
10560 return NULL;
10561 }
10562 return entity;
10563}
10564
10565void SetupSpawnedItem(ItemBase item, float health, float quantity)
10566{
10567 if (item)
10568 {
10569 if (health > 0)
10570 item.SetHealth("", "", health);
10571
10572 if (item.CanHaveTemperature())
10573 {
10574 item.SetTemperatureDirect(GameConstants.ITEM_TEMPERATURE_NEUTRAL_ZONE_MIDDLE);
10575 if (item.CanFreeze())
10576 item.SetFrozen(false);
10577 }
10578
10579 if (item.HasEnergyManager())
10580 {
10581 if (quantity >= 0)
10582 {
10583 item.GetCompEM().SetEnergy0To1(quantity);
10584 }
10585 else
10586 {
10587 item.GetCompEM().SetEnergy(Math.AbsFloat(quantity));
10588 }
10589 }
10590 else if (item.IsMagazine())
10591 {
10592 Magazine mag = Magazine.Cast(item);
10593 if (quantity >= 0)
10594 {
10595 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
10596 }
10597 else
10598 {
10599 mag.ServerSetAmmoCount(Math.AbsFloat(quantity));
10600 }
10601
10602 }
10603 else
10604 {
10605 if (quantity >= 0)
10606 {
10607 item.SetQuantityNormalized(quantity, false);
10608 }
10609 else
10610 {
10611 item.SetQuantity(Math.AbsFloat(quantity));
10612 }
10613
10614 }
10615 }
10616}
10617
10618#ifdef DEVELOPER
10619ItemBase _itemBase;//watched item goes here(LCTRL+RMB->Watch)
10620#endif
Param4< int, int, string, int > TSelectableActionInfoWithColor
Определения EntityAI.c:97
Param3 TSelectableActionInfo
EWetnessLevel
Определения EntityAI.c:2
InventoryMode
NOTE: PREDICTIVE is not to be used at all in multiplayer.
Определения Inventory.c:22
const int INPUT_UDT_ITEM_MANIPULATION
Определения _constants.c:8
class LogManager EntityAI
eBleedingSourceType GetType()
Определения BleedingSource.c:63
ItemSuppressor SuppressorBase
Определения InventoryItem.c:7
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
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
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
override bool IsExplosive()
Определения ExplosivesBase.c:59
override bool CanHaveTemperature()
Определения FireplaceBase.c:557
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:6308
static bool HasDebugActionsMask(int mask)
Определения ItemBase.c:5548
bool HidesSelectionBySlot()
Определения ItemBase.c:9203
float m_VarWetMin
Определения ItemBase.c:4809
void SplitItem(PlayerBase player)
Определения ItemBase.c:6739
void CopyScriptPropertiesFrom(EntityAI oldItem)
Определения ItemBase.c:9424
override void InsertAgent(int agent, float count=1)
Определения ItemBase.c:8653
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:8087
static void SetDebugActionsMask(int mask)
Определения ItemBase.c:5553
void SetIsDeploySound(bool is_deploy_sound)
bool IsOpen()
Определения ItemBase.c:8796
void SplitItemToInventoryLocation(notnull InventoryLocation dst)
Определения ItemBase.c:6706
override bool IsHeavyBehaviour()
Определения ItemBase.c:8998
override void SetWetMax()
Определения ItemBase.c:8369
bool IsCoverFaceForShave(string slot_name)
DEPRECATED in use, but returns correct values nontheless. Check performed elsewhere.
Определения ItemBase.c:9241
void ClearStartItemSoundServer()
Определения ItemBase.c:9139
float m_VarWet
Определения ItemBase.c:4806
void ProcessItemTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
Определения ItemBase.c:9271
map< typename, ref ActionOverrideData > TActionAnimOverrideMap
Определения ItemBase.c:2
override void RemoveAllAgentsExcept(int agent_to_keep)
Определения ItemBase.c:8648
static ref map< int, ref array< ref WeaponParticlesOnBulletCasingEject > > m_OnBulletCasingEjectEffect
Определения ItemBase.c:4869
bool CanBeMovedOverride()
Определения ItemBase.c:7380
override void SetWet(float value, bool allow_client=false)
Определения ItemBase.c:8345
ref TIntArray m_SingleUseActions
Определения ItemBase.c:4855
override void ProcessVariables()
Определения ItemBase.c:9338
ref TStringArray m_HeadHidingSelections
Определения ItemBase.c:4883
float GetWeightSpecialized(bool forceRecalc=false)
Определения ItemBase.c:8179
bool LoadAgents(ParamsReadContext ctx, int version)
Определения ItemBase.c:8714
void UpdateQuickbarShortcutVisibility(PlayerBase player)
To be called on moving item within character's inventory; 'player' should never be null.
Определения ItemBase.c:8559
void OverrideActionAnimation(typename action, int commandUID, int stanceMask=-1, int commandUIDProne=-1)
Определения ItemBase.c:5139
ref array< ref OverheatingParticle > m_OverheatingParticles
Определения ItemBase.c:4881
override float GetTemperatureFreezeThreshold()
Определения ItemBase.c:9374
bool m_IsSoundSynchRemote
Определения ItemBase.c:9532
float m_OverheatingShots
Определения ItemBase.c:4876
void StopItemSoundServer(int id)
Определения ItemBase.c:9127
static void ToggleDebugActionsMask(int mask)
Определения ItemBase.c:5568
void IncreaseOverheating(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:5292
override float GetTemperatureFreezeTime()
Определения ItemBase.c:9398
ref array< int > m_CompatibleLocks
Определения ItemBase.c:4893
bool CanBeCooked()
Определения ItemBase.c:7336
override void CombineItemsClient(EntityAI entity2, bool use_stack_max=true)
Определения ItemBase.c:5635
float m_TemperaturePerQuantityWeight
Определения ItemBase.c:4905
bool m_RecipesInitialized
Определения ItemBase.c:4791
void SplitIntoStackMax(EntityAI destination_entity, int slot_id, PlayerBase player)
Определения ItemBase.c:6382
override float GetTemperatureThawThreshold()
Определения ItemBase.c:9382
override void OnEnergyConsumed()
Определения ItemBase.c:8289
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:8078
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:8218
override EWetnessLevel GetWetLevel()
Определения ItemBase.c:8409
float GetSingleInventoryItemWeight()
Определения ItemBase.c:8174
ref TIntArray m_InteractActions
Определения ItemBase.c:4857
void MessageToOwnerStatus(string text)
Send message to owner player in grey color.
Определения ItemBase.c:7400
float m_VarQuantity
Определения ItemBase.c:4797
bool CanPlayDeployLoopSound()
Определения ItemBase.c:9543
override float GetWetMax()
Определения ItemBase.c:8379
bool CanBeUsedForSuicide()
Определения ItemBase.c:9510
override void CombineItemsEx(EntityAI entity2, bool use_stack_max=true)
Определения ItemBase.c:7011
void OnItemInHandsPlayerSwimStart(PlayerBase player)
void SetIsHologram(bool is_hologram)
Определения ItemBase.c:5773
void OnSyncVariables(ParamsReadContext ctx)
DEPRECATED (most likely)
Определения ItemBase.c:7554
void StartItemSoundServer(int id)
Определения ItemBase.c:9114
void DoAmmoExplosion()
Определения ItemBase.c:6243
static ref map< int, ref array< ref WeaponParticlesOnFire > > m_OnFireEffect
Определения ItemBase.c:4868
void SplitIntoStackMaxCargoClient(EntityAI destination_entity, int idx, int row, int col)
Определения ItemBase.c:6557
int GetItemSize()
Определения ItemBase.c:7365
bool m_CanBeMovedOverride
Определения ItemBase.c:4834
override string ChangeIntoOnAttach(string slot)
Определения ItemBase.c:6167
void UpdateOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
Определения ItemBase.c:5360
bool CanDecay()
Определения ItemBase.c:9313
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:8060
void SetQuantityMax()
Определения ItemBase.c:8065
override float GetQuantity()
Определения ItemBase.c:8154
int m_ColorComponentR
Определения ItemBase.c:4846
int m_ShotsToStartOverheating
Определения ItemBase.c:4878
override void OnWetChanged(float newVal, float oldVal)
Определения ItemBase.c:8394
void StopOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
Определения ItemBase.c:5367
static void PlayFireParticles(ItemBase weapon, int muzzle_index, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:8897
void OnOverheatingDecay()
Определения ItemBase.c:5330
float GetDryingIncrement(string pIncrementName)
Определения ItemBase.c:8327
void SoundSynchRemoteReset()
int m_Cleanness
Определения ItemBase.c:4812
bool HasMuzzle()
Returns true if this item has a muzzle (weapons, suppressors)
Определения ItemBase.c:5468
bool UsesGlobalDeploy()
Определения ItemBase.c:9542
int m_ItemBehaviour
Определения ItemBase.c:4827
override bool CanReleaseAttachment(EntityAI attachment)
Определения ItemBase.c:8869
float m_HeatIsolation
Определения ItemBase.c:4822
float m_VarWetInit
Определения ItemBase.c:4808
override void OnMovedInsideCargo(EntityAI container)
Определения ItemBase.c:5813
void SetCEBasedQuantity()
Определения ItemBase.c:5581
bool m_CanPlayImpactSound
Определения ItemBase.c:4818
override string GetAttachmentSoundType()
Определения ItemBase.c:9072
float GetOverheatingCoef()
Определения ItemBase.c:5387
array< string > GetHeadHidingSelection()
Определения ItemBase.c:9198
void PlayAttachSound(string slot_type)
Plays sound on item attach. Be advised, the config structure may slightly change in 1....
Определения ItemBase.c:9150
override bool IsStoreLoad()
Определения ItemBase.c:8421
int ComputeQuantityUsed(ItemBase other_item, bool use_stack_max=true)
Определения ItemBase.c:6987
bool IsLightSource()
Определения ItemBase.c:5709
bool m_HasQuantityBar
Определения ItemBase.c:4840
void SetResultOfSplit(bool value)
Определения ItemBase.c:6982
void SplitIntoStackMaxCargo(EntityAI destination_entity, int idx, int row, int col)
Определения ItemBase.c:6624
void OnAttachmentQuantityChanged(ItemBase item)
Called on server side when some attachment's quantity is changed. Call super.OnAttachmentQuantityChan...
Определения ItemBase.c:6797
void UpdateAllOverheatingParticles()
Определения ItemBase.c:5395
float GetSoakingIncrement(string pIncrementName)
Определения ItemBase.c:8336
static void StopOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:8977
override float GetStoreLoadedQuantity()
Определения ItemBase.c:8431
int m_LockType
Определения ItemBase.c:4894
const int ITEM_SOUNDS_MAX
Определения ItemBase.c:4899
bool m_CanBeDigged
Определения ItemBase.c:4841
float m_ItemAttachOffset
Определения ItemBase.c:4824
float GetItemModelLength()
Определения ItemBase.c:8438
bool m_ThrowItemOnDrop
Определения ItemBase.c:4832
override bool ReadVarsFromCTX(ParamsReadContext ctx, int version=-1)
Определения ItemBase.c:7699
override void CheckForRoofLimited(float timeTresholdMS=3000)
Roof check for entity, limited by time (anti-spam solution)
Определения ItemBase.c:8729
void Close()
float GetHeatIsolation()
Определения ItemBase.c:8322
void CombineItems(ItemBase other_item, bool use_stack_max=true)
Определения ItemBase.c:7016
void TransferModifiers(PlayerBase reciever)
appears to be deprecated, legacy code
float GetTemperaturePerQuantityWeight()
Used in heat comfort calculations only!
Определения ItemBase.c:9369
bool CanHaveWetness()
Определения ItemBase.c:9326
int m_CleannessMin
Определения ItemBase.c:4814
void TransferAgents(int agents)
transfer agents from another item
Определения ItemBase.c:8662
string IDToName(int id)
Определения ItemBase.c:7547
bool CanBeConsumed(ConsumeConditionData data=null)
Items cannot be consumed if frozen by default. Override for exceptions.
Определения ItemBase.c:9333
float GetHeatIsolationInit()
Определения ItemBase.c:8317
void PlayPlaceSound()
void SetCanBeMovedOverride(bool setting)
Определения ItemBase.c:7387
override bool HasQuantity()
Определения ItemBase.c:8149
float m_VarWetPrev
Определения ItemBase.c:4807
int m_SoundSyncStop
Определения ItemBase.c:4901
bool IsCargoException4x3(EntityAI item)
Определения ItemBase.c:9419
ref TIntArray m_ContinuousActions
Определения ItemBase.c:4856
int GetMuzzleID()
Returns global muzzle ID. If not found, then it gets automatically registered.
Определения ItemBase.c:5477
void LoadParticleConfigOnFire(int id)
Определения ItemBase.c:5162
int m_VarLiquidType
Определения ItemBase.c:4826
int m_QuickBarBonus
Определения ItemBase.c:4828
void PreLoadSoundAttachmentType()
Attachment Sound Type getting from config file.
Определения ItemBase.c:9060
override float GetWetInit()
Определения ItemBase.c:8389
int m_ImpactSoundSurfaceHash
Определения ItemBase.c:4820
int m_SoundSyncPlay
Определения ItemBase.c:4900
int m_MaxOverheatingValue
Определения ItemBase.c:4879
void SetupSpawnedItem(ItemBase item, float health, float quantity)
Определения ItemBase.c:4803
bool m_IsTakeable
Определения ItemBase.c:4831
static ref map< string, int > m_WeaponTypeToID
Определения ItemBase.c:4871
string GetLockSoundSet()
Определения ItemBase.c:8487
string GetColorString()
Returns item's PROCEDURAL color as formated string, i.e. "#(argb,8,8,3)color(0.15,...
Определения ItemBase.c:8518
array< int > GetValidFinishers()
returns an array of possible finishers
Определения ItemBase.c:9446
void OnAttachmentQuantityChangedEx(ItemBase item, float delta)
Called on server side when some attachment's quantity is changed. Call super.OnAttachmentQuantityChan...
Определения ItemBase.c:6803
class ItemBase extends InventoryItem SpawnItemOnLocation(string object_name, notnull InventoryLocation loc, bool full_quantity)
Определения ItemBase.c:4783
ItemSoundHandler GetItemSoundHandler()
Определения ItemBase.c:9085
override int GetQuantityMin()
Определения ItemBase.c:8138
void SplitIntoStackMaxToInventoryLocationClient(notnull InventoryLocation dst)
Определения ItemBase.c:6533
override int GetQuickBarBonus()
Определения ItemBase.c:5047
override void SetTakeable(bool pState)
Определения ItemBase.c:9042
float m_OverheatingDecayInterval
Определения ItemBase.c:4880
void SetIsPlaceSound(bool is_place_sound)
override void SplitIntoStackMaxClient(EntityAI destination_entity, int slot_id)
Определения ItemBase.c:6356
void HierarchyCheck(out bool hasParent, out bool hasRootAsPlayer, out ItemBase refParentIB)
Определения ItemBase.c:9291
bool CanProcessDecay()
Определения ItemBase.c:9319
void RemoveAudioVisualsOnClient()
Определения Bottle_Base.c:151
void SoundSynchRemote()
static void AddDebugActionsMask(int mask)
Определения ItemBase.c:5558
void PlayDeployLoopSoundEx()
void RemoveLightSourceItem()
Определения ItemBase.c:9435
bool CanRepair(ItemBase item_repair_kit)
Определения ItemBase.c:7351
bool can_this_be_combined
Определения ItemBase.c:4836
EffectSound m_SoundDeploy
Определения ItemBase.c:9529
int m_Count
Определения ItemBase.c:4802
float GetBaitEffectivity()
generic effectivity as a bait for animal catching
Определения ItemBase.c:9482
float GetDeployTime()
how long it takes to deploy this item in seconds
Определения ItemBase.c:9034
override bool IsSplitable()
Определения ItemBase.c:6343
bool DamageItemAttachments(float damage)
Определения ItemBase.c:6327
override void WriteVarsToCTX(ParamsWriteContext ctx)
Определения ItemBase.c:7663
void ConvertEnergyToQuantity()
Определения ItemBase.c:8304
override void RemoveAllAgents()
Определения ItemBase.c:8643
override void SetQuantityToMinimum()
Определения ItemBase.c:8071
bool m_WantPlayImpactSound
Определения ItemBase.c:4817
override float GetTemperatureThawTime()
Определения ItemBase.c:9406
ref map< int, ref array< ref WeaponParticlesOnOverheating > > m_OnOverheatingEffect
Определения ItemBase.c:4870
int m_ColorComponentG
Определения ItemBase.c:4847
float m_StoreLoadedQuantity
Определения ItemBase.c:4804
void MessageToOwnerAction(string text)
Send message to owner player in yellow color.
Определения ItemBase.c:7418
int m_ColorComponentA
Определения ItemBase.c:4849
int m_VarQuantityInit
Определения ItemBase.c:4799
float GetFilterDamageRatio()
Определения ItemBase.c:5462
override void SetLiquidType(int value, bool allow_client=false)
Определения ItemBase.c:8531
void OnQuantityChanged(float delta)
Called on server side when this item's quantity is changed. Call super.OnQuantityChanged(); first whe...
Определения ItemBase.c:6773
void OnApply(PlayerBase player)
bool m_HideSelectionsBySlot
Определения ItemBase.c:4884
bool IsOverheatingEffectActive()
Определения ItemBase.c:5325
void SetIsBeingPlaced(bool is_being_placed)
Определения ItemBase.c:5742
int GetLiquidContainerMask()
Определения ItemBase.c:5679
ref Timer m_CheckOverheating
Определения ItemBase.c:4877
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:5373
float GetEnergy()
Определения ItemBase.c:8278
bool CanBeDigged()
Определения ItemBase.c:5758
bool GetActionWidgetOverride(out typename name)
If we need a different (handheld)item action widget displayed, the logic goes in here.
Определения ItemBase.c:9452
bool IsNVG()
Определения ItemBase.c:5690
float GetUnitWeight(bool include_wetness=true)
Obsolete, use GetWeightEx instead.
Определения ItemBase.c:8238
void SetZoneDamageCEInit()
Sets zone damages to match randomized global health set by CE (CE spawn only)
Определения ItemBase.c:9228
bool m_IsDeploySound
Определения ItemBase.c:9531
bool CanEat()
Определения ItemBase.c:7311
static void PlayOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:8937
override bool IsOneHandedBehaviour()
Определения ItemBase.c:9008
void AddLightSourceItem(ItemBase lightsource)
Adds a light source child.
Определения ItemBase.c:9430
bool IsLiquidContainer()
Определения ItemBase.c:5674
FoodStage GetFoodStage()
overridden on Edible_Base; so we don't have to parse configs all the time
Определения ItemBase.c:7331
override float GetSingleInventoryItemWeightEx()
Определения ItemBase.c:8165
void SaveAgents(ParamsWriteContext ctx)
Определения ItemBase.c:8721
override int GetTargetQuantityMax(int attSlotID=-1)
Определения ItemBase.c:8119
int m_CleannessInit
Определения ItemBase.c:4813
float GetDisinfectQuantity(int system=0, Param param1=null)
Определения ItemBase.c:5457
override int GetAgents()
Определения ItemBase.c:8668
int m_VarQuantityMax
Определения ItemBase.c:4801
override bool IsHologram()
Определения ItemBase.c:5753
float GetItemAttachOffset()
Определения ItemBase.c:8447
bool IsPlaceSound()
Определения ItemBase.c:9545
static int GetDebugActionsMask()
Определения ItemBase.c:5543
override int GetLiquidType()
Определения ItemBase.c:8547
void ProcessDecay(float delta, bool hasRootAsPlayer)
Определения ItemBase.c:9308
override bool IsItemBase()
Определения ItemBase.c:7464
void PlayDeploySound()
override bool IsTwoHandedBehaviour()
Определения ItemBase.c:9018
void ExplodeAmmo()
Определения ItemBase.c:6230
bool IsCombineAll(ItemBase other_item, bool use_stack_max=false)
Определения ItemBase.c:6972
float GetProtectionLevel(int type, bool consider_filter=false, int system=0)
Определения ItemBase.c:8742
static void PlayBulletCasingEjectParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:8917
override void OnEnergyAdded()
Определения ItemBase.c:8296
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:5702
EffectSound m_DeployLoopSoundEx
Определения ItemBase.c:9528
override void DeSerializeNumericalVars(array< float > floats)
Определения ItemBase.c:7604
void StopItemDynamicPhysics()
Определения ItemBase.c:9210
bool HasFoodStage()
Определения ItemBase.c:7324
override void SetStoreLoad(bool value)
Определения ItemBase.c:8416
float GetOverheatingValue()
Определения ItemBase.c:5287
bool ContainsAgent(int agent_id)
Определения ItemBase.c:8621
override void AddWet(float value)
Определения ItemBase.c:8364
bool IsLiquidPresent()
Определения ItemBase.c:5669
bool IsFullQuantity()
Определения ItemBase.c:8159
override void EOnContact(IEntity other, Contact extra)
Определения ItemBase.c:5943
void SplitIntoStackMaxHands(PlayerBase player)
Определения ItemBase.c:6678
void SplitIntoStackMaxHandsClient(PlayerBase player)
Определения ItemBase.c:6651
int m_CleannessMax
Определения ItemBase.c:4815
float m_VarStackMax
Определения ItemBase.c:4803
ref Timer m_PhysDropTimer
Определения ItemBase.c:4890
void MessageToOwnerFriendly(string text)
Send message to owner player in green color.
Определения ItemBase.c:7436
override void SetStoreLoadedQuantity(float value)
Определения ItemBase.c:8426
bool m_IsResultOfSplit string m_SoundAttType
distinguish if item has been created as new or it came from splitting (server only flag)
Определения ItemBase.c:4844
void CheckOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
Определения ItemBase.c:5308
void UnlockFromParent()
Unlocks this item from its attachment slot of its parent.
Определения ItemBase.c:5623
bool Repair(PlayerBase player, ItemBase item_repair_kit, float specialty_weight)
Определения ItemBase.c:7358
void OnLiquidTypeChanged(int oldType, int newType)
Определения ItemBase.c:8552
void StartOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
Определения ItemBase.c:5354
void PlayDeployFinishSound()
bool AllowFoodConsumption()
Определения ItemBase.c:8474
bool m_IsOverheatingEffectActive
Определения ItemBase.c:4875
int m_LiquidContainerMask
Определения ItemBase.c:4825
void ProcessItemWetness(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
Определения ItemBase.c:9246
override int GetCleanness()
Определения ItemBase.c:8469
bool PairWithDevice(notnull ItemBase otherDevice)
Определения ItemBase.c:9457
bool IsDeploySound()
Определения ItemBase.c:9546
static void RemoveDebugActionsMask(int mask)
Определения ItemBase.c:5563
static void UpdateOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:8957
int m_VarQuantityMin
Определения ItemBase.c:4800
void PerformDamageSystemReinit()
Определения ItemBase.c:9216
override void ClearInventory()
Определения ItemBase.c:8257
static int m_LastRegisteredWeaponID
Определения ItemBase.c:4872
ItemBase GetLightSourceItem()
Определения ItemBase.c:9440
void MessageToOwnerImportant(string text)
Send message to owner player in red color.
Определения ItemBase.c:7454
override float GetItemOverheatThreshold()
Определения ItemBase.c:9390
void StopDeployLoopSoundEx()
bool m_CanThisBeSplit
Определения ItemBase.c:4837
override void SerializeNumericalVars(array< float > floats_out)
Определения ItemBase.c:7568
void Open()
Implementations only.
Определения CannedFood.c:100
ItemBase SplitIntoStackMaxToInventoryLocationEx(notnull InventoryLocation dst)
Определения ItemBase.c:6590
float m_ItemModelLength
Определения ItemBase.c:4823
bool m_IsHologram
Определения ItemBase.c:4830
static int m_DebugActionsMask
Определения ItemBase.c:4790
void KillAllOverheatingParticles()
Определения ItemBase.c:5423
bool CanBeCookedOnStick()
Определения ItemBase.c:7341
override int GetQuantityMax()
Определения ItemBase.c:8106
void GetRecipesActions(Man player, out TSelectableActionInfoArray outputList)
Определения ItemBase.c:7050
void OnActivatedByTripWire()
bool IsColorSet()
Определения ItemBase.c:8512
override void RemoveAgent(int agent_id)
Определения ItemBase.c:8634
bool m_ItemBeingDroppedPhys
Определения ItemBase.c:4833
override bool CanPutAsAttachment(EntityAI parent)
Определения ItemBase.c:8824
void PlayDetachSound(string slot_type)
Определения ItemBase.c:9186
static ref map< typename, ref TInputActionMap > m_ItemTypeActionsMap
Определения ItemBase.c:4784
void ProcessItemWetnessAndTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
Определения ItemBase.c:9519
override bool IsBeingPlaced()
Определения ItemBase.c:5737
int GetQuantityInit()
Определения ItemBase.c:8143
float ComputeQuantityUsedEx(ItemBase other_item, bool use_stack_max=true)
Определения ItemBase.c:6992
bool IsResultOfSplit()
Определения ItemBase.c:6977
bool m_FixDamageSystemInit
Определения ItemBase.c:4835
float m_ImpactSpeed
Определения ItemBase.c:4819
bool m_IsStoreLoad
Определения ItemBase.c:4838
int GetLiquidTypeInit()
Определения ItemBase.c:8542
string GetDeployFinishSoundset()
ItemBase m_LightSourceItem
Определения ItemBase.c:4853
void LockToParent()
Locks this item in it's current attachment slot of its parent. This makes the "locked" icon visible i...
Определения ItemBase.c:5610
override void SplitIntoStackMaxEx(EntityAI destination_entity, int slot_id)
Определения ItemBase.c:6462
int m_AttachedAgents
Определения ItemBase.c:4861
string m_LockSoundSet
Определения ItemBase.c:4896
void LoadParticleConfigOnOverheating(int id)
Определения ItemBase.c:5231
float m_VarQuantityPrev
Определения ItemBase.c:4798
bool IsSoundSynchRemote()
Определения ItemBase.c:9544
bool m_CanShowQuantity
Определения ItemBase.c:4839
override void EEOnCECreate()
Called when entity is being created as new by CE/ Debug.
Определения ItemBase.c:8781
override void OnRightClick()
Определения ItemBase.c:6846
int m_ColorComponentB
Определения ItemBase.c:4848
static ref map< typename, ref TActionAnimOverrideMap > m_ItemActionOverrides
Определения ItemBase.c:4786
bool IsActionTargetVisible()
Определения ItemBase.c:9054
override void OnItemAttachmentSlotChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
Определения ItemBase.c:5978
override void EEHitBy(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
Определения ItemBase.c:6267
bool m_IsBeingPlaced
Определения ItemBase.c:4829
int NameToID(string name)
Определения ItemBase.c:7541
void ~ItemBase()
Определения ItemBase.c:5508
override void OnWetLevelChanged(EWetnessLevel newLevel, EWetnessLevel oldLevel)
Определения ItemBase.c:8404
void ClearStopItemSoundServer()
Определения ItemBase.c:9144
override string ChangeIntoOnDetach()
Определения ItemBase.c:6191
float m_VarWetMax
Определения ItemBase.c:4810
void SplitIntoStackMaxToInventoryLocation(notnull InventoryLocation dst)
Определения ItemBase.c:6585
int GetLockType()
Определения ItemBase.c:8482
EffectSound m_SoundDeployFinish
Определения ItemBase.c:9526
override float GetWet()
Определения ItemBase.c:8374
EffectSound m_SoundPlace
Определения ItemBase.c:9527
float GetQuantityNormalizedScripted()
Определения ItemBase.c:8092
override void SetCleanness(int value, bool allow_client=false)
Определения ItemBase.c:8456
bool m_IsPlaceSound
Определения ItemBase.c:9530
override float GetWetMin()
Определения ItemBase.c:8384
ref ItemSoundHandler m_ItemSoundHandler
Определения ItemBase.c:4902
override bool KindOf(string tag)
Определения ItemBase.c:7470
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:1321
void OnItemLocationChanged(ItemBase item)
Определения ActionBase.c:962
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 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 int GetTime()
returns mission time in milliseconds
proto native int ConfigGetType(string path)
Returns type of config value.
AnalyticsManagerClient GetAnalyticsClient()
Определения Game.c:1513
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()
Определения Man.c:44
Определения Building.c:6
Определения constants.c:659
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
proto native void SetGround(EntityAI e, vector mat[4])
sets current inventory location type to Ground with transformation mat
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 bool CanPutAsAttachment(EntityAI parent)
Определения ItemBase.c:6
override bool CanReceiveItemIntoCargo(EntityAI item)
Определения TentBase.c:913
override bool OnStoreLoad(ParamsReadContext ctx, int version)
Определения GardenBase.c:149
override void OnWasDetached(EntityAI parent, int slot_id)
Определения InventoryItem.c:920
override void EEOnAfterLoad()
Определения GardenBase.c:187
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()
Определения InventoryItem.c:732
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:1218
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:465
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:472
override void OnStoreSave(ParamsWriteContext ctx)
Определения GardenBase.c:206
override void AfterStoreLoad()
Определения GardenBase.c:182
override int GetOnDigWormsAmount()
Определения FieldShovel.c:27
override bool IsSelfAdjustingTemperature()
Определения PortableGasStove.c:287
override bool IsPlayerInside(PlayerBase player, string selection)
Определения BaseBuildingBase.c:1017
override void OnVariablesSynchronized()
Определения GardenBase.c:68
override void RefreshPhysics()
Определения BatteryCharger.c:359
override bool CanObstruct()
Определения BaseBuildingBase.c:84
override void OnWasAttached(EntityAI parent, int slot_id)
Определения InventoryItem.c:912
override bool CanReceiveAttachment(EntityAI attachment, int slotId)
Определения BaseBuildingBase.c:962
override bool CanPutInCargo(EntityAI parent)
Определения GardenBase.c:269
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:988
override bool IsIgnoredByConstruction()
Определения BaseBuildingBase.c:1150
override void InitItemSounds()
Определения TentBase.c:810
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:1012
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()
Определения InventoryItem.c:840
override bool CanBeSplit()
Определения Rag.c:34
override bool IsDeployable()
Определения BaseBuildingBase.c:341
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
Определения InventoryItem.c:731
Определения 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)
Определения 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
Определения constants.c:510
const int DEF_CHEMICAL
Определения constants.c:511
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:685
array< int > TIntArray
Определения EnScript.c:687
EntityEvent
Entity events for event-mask, or throwing event from code.
Определения EnEntity.c:45
static const float ITEM_TEMPERATURE_NEUTRAL_ZONE_MIDDLE
Определения constants.c:806
const int VARIABLE_LIQUIDTYPE
Определения constants.c:630
const int VARIABLE_CLEANNESS
Определения constants.c:633
const int VARIABLE_COLOR
Определения constants.c:632
const int VARIABLE_TEMPERATURE
Определения constants.c:628
const int VARIABLE_QUANTITY
Определения constants.c:626
const int VARIABLE_WET
Определения constants.c:629
const int LIQUID_NONE
Определения constants.c:527
static proto float AbsFloat(float f)
Returns absolute value.
const int MENU_INVENTORY
Определения constants.c:180
proto native bool dBodyIsDynamic(notnull IEntity ent)
const int SAT_CRAFTING
Определения constants.c:451
const int SAT_DEBUG_ACTION
Определения constants.c:452
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
Определения tools.c:10
const int CALL_CATEGORY_SYSTEM
Определения tools.c:8
proto native int GetColor()