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

◆ SplitIntoStackMaxToInventoryLocation()

void SpawnItemOnLocation::SplitIntoStackMaxToInventoryLocation ( notnull InventoryLocation dst)
private

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

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