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

◆ SplitItemToInventoryLocation()

void SpawnItemOnLocation::SplitItemToInventoryLocation ( notnull InventoryLocation dst)
private

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

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