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

◆ SplitIntoStackMaxHands()

void SpawnItemOnLocation::SplitIntoStackMaxHands ( PlayerBase player)
private

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

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

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