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

◆ SplitIntoStackMaxCargo()

void SpawnItemOnLocation::SplitIntoStackMaxCargo ( EntityAI destination_entity,
int idx,
int row,
int col )
private

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

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