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

◆ DamageItemInCargo()

bool SpawnItemOnLocation::DamageItemInCargo ( float damage)
private

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

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

Используется в InventoryItem::EEHitBy().