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

◆ EEKilled()

override void SpawnItemOnLocation::EEKilled ( Object killer)
private

item is able to explode in fire

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

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