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

◆ SplitIntoStackMaxHands()

void SpawnItemOnLocation::SplitIntoStackMaxHands ( PlayerBase player)
protected

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

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

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