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

◆ SplitIntoStackMaxHandsClient()

void SpawnItemOnLocation::SplitIntoStackMaxHandsClient ( PlayerBase player)
protected

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

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