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

◆ SplitIntoStackMaxCargoClient()

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

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

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