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

◆ SplitIntoStackMaxToInventoryLocationEx()

ItemBase SpawnItemOnLocation::SplitIntoStackMaxToInventoryLocationEx ( notnull InventoryLocation dst)
private

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

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

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