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

◆ SplitIntoStackMaxToInventoryLocationClient()

void SpawnItemOnLocation::SplitIntoStackMaxToInventoryLocationClient ( notnull InventoryLocation dst)
private

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

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