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

◆ SplitIntoStackMaxEx()

override void SpawnItemOnLocation::SplitIntoStackMaxEx ( EntityAI destination_entity,
int slot_id )
private

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

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