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

◆ SplitIntoStackMax()

void SpawnItemOnLocation::SplitIntoStackMax ( EntityAI destination_entity,
int slot_id,
PlayerBase player )
private

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

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