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

◆ SplitIntoStackMaxHandsClient()

void SpawnItemOnLocation::SplitIntoStackMaxHandsClient ( PlayerBase player)
private

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

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