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

◆ IsLiquidPresent()

bool SpawnItemOnLocation::IsLiquidPresent ( )
private

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

5673{
5674 override bool CanPutAsAttachment(EntityAI parent)
5675 {
5676 return true;
5677 }
5678};
5679
5680//const bool QUANTITY_DEBUG_REMOVE_ME = false;
5681
5682class ItemBase extends InventoryItem
5683{
5687
5689
5690 static int m_DebugActionsMask;
5692 // ============================================
5693 // Variable Manipulation System
5694 // ============================================
5695 // Quantity
5696
5697 float m_VarQuantity;
5698 float m_VarQuantityPrev;//for client to know quantity changed during synchronization
5700 int m_VarQuantityMin;
5701 int m_VarQuantityMax;
5702 int m_Count;
5703 float m_VarStackMax;
5704 float m_StoreLoadedQuantity = float.LOWEST;
5705 // Wet
5706 float m_VarWet;
5707 float m_VarWetPrev;//for client to know wetness changed during synchronization
5708 float m_VarWetInit;
5709 float m_VarWetMin;
5710 float m_VarWetMax;
5711 // Cleanness
5712 int m_Cleanness;
5713 int m_CleannessInit;
5714 int m_CleannessMin;
5715 int m_CleannessMax;
5716 // impact sounds
5718 bool m_CanPlayImpactSound = true;
5719 float m_ImpactSpeed;
5721 //
5722 float m_HeatIsolation;
5723 float m_ItemModelLength;
5724 float m_ItemAttachOffset; // Offset length for when the item is attached e.g. to weapon
5726 int m_VarLiquidType;
5727 int m_ItemBehaviour; // -1 = not specified; 0 = heavy item; 1= onehanded item; 2 = twohanded item
5728 int m_QuickBarBonus;
5729 bool m_IsBeingPlaced;
5730 bool m_IsHologram;
5731 bool m_IsTakeable;
5732 bool m_ThrowItemOnDrop;
5735 bool m_FixDamageSystemInit = false; //can be changed on storage version check
5736 bool can_this_be_combined; //Check if item can be combined
5737 bool m_CanThisBeSplit; //Check if item can be split
5738 bool m_IsStoreLoad = false;
5739 bool m_CanShowQuantity;
5740 bool m_HasQuantityBar;
5741 protected bool m_CanBeDigged;
5742 protected bool m_IsResultOfSplit
5743
5744 string m_SoundAttType;
5745 // items color variables
5750 //-------------------------------------------------------
5751
5752 // light source managing
5754
5758
5759 //==============================================
5760 // agent system
5761 private int m_AttachedAgents;
5762
5764 void TransferModifiers(PlayerBase reciever);
5765
5766
5767 // Weapons & suppressors particle effects
5772 static int m_LastRegisteredWeaponID = 0;
5773
5774 // Overheating effects
5776 float m_OverheatingShots;
5777 ref Timer m_CheckOverheating;
5778 int m_ShotsToStartOverheating = 0; // After these many shots, the overheating effect begins
5779 int m_MaxOverheatingValue = 0; // Limits the number of shots that will be tracked
5780 float m_OverheatingDecayInterval = 1; // Timer's interval for decrementing overheat effect's lifespan
5781 ref array <ref OverheatingParticle> m_OverheatingParticles;
5782
5784 protected bool m_HideSelectionsBySlot;
5785
5786 // Admin Log
5787 PluginAdminLog m_AdminLog;
5788
5789 // misc
5790 ref Timer m_PhysDropTimer;
5791
5792 // Attachment Locking variables
5793 ref array<int> m_CompatibleLocks;
5794 protected int m_LockType;
5795 protected ref EffectSound m_LockingSound;
5796 protected string m_LockSoundSet;
5797
5798 // ItemSoundHandler
5799 protected const int ITEM_SOUNDS_MAX = 63; // optimize network synch
5800 protected int m_SoundSyncPlay; // id for sound to play
5801 protected int m_SoundSyncStop; // id for sound to stop
5803
5804 //temperature
5805 private float m_TemperaturePerQuantityWeight;
5806
5807 // -------------------------------------------------------------------------
5808 void ItemBase()
5809 {
5810 SetEventMask(EntityEvent.INIT); // Enable EOnInit event
5814
5815 if (!GetGame().IsDedicatedServer())
5816 {
5817 if (HasMuzzle())
5818 {
5820
5822 {
5824 }
5825 }
5826
5828 m_ActionsInitialize = false;
5829 }
5830
5831 m_OldLocation = null;
5832
5833 if (GetGame().IsServer())
5834 {
5835 m_AdminLog = PluginAdminLog.Cast(GetPlugin(PluginAdminLog));
5836 }
5837
5838 if (ConfigIsExisting("headSelectionsToHide"))
5839 {
5841 ConfigGetTextArray("headSelectionsToHide",m_HeadHidingSelections);
5842 }
5843
5844 m_HideSelectionsBySlot = false;
5845 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
5846 {
5847 m_HideSelectionsBySlot = ConfigGetBool("hideSelectionsByinventorySlot");
5848 }
5849
5850 m_QuickBarBonus = Math.Max(0, ConfigGetInt("quickBarBonus"));
5851
5852 m_IsResultOfSplit = false;
5853
5855 }
5856
5857 override void InitItemVariables()
5858 {
5859 super.InitItemVariables();
5860
5861 m_VarQuantityInit = ConfigGetInt("varQuantityInit");
5862 m_VarQuantity = m_VarQuantityInit;//should be by the CE, this is just a precaution
5863 m_VarQuantityMin = ConfigGetInt("varQuantityMin");
5864 m_VarQuantityMax = ConfigGetInt("varQuantityMax");
5865 m_VarStackMax = ConfigGetFloat("varStackMax");
5866 m_Count = ConfigGetInt("count");
5867
5868 m_CanShowQuantity = ConfigGetBool("quantityShow");
5869 m_HasQuantityBar = ConfigGetBool("quantityBar");
5870
5871 m_CleannessInit = ConfigGetInt("varCleannessInit");
5873 m_CleannessMin = ConfigGetInt("varCleannessMin");
5874 m_CleannessMax = ConfigGetInt("varCleannessMax");
5875
5876 m_WantPlayImpactSound = false;
5877 m_ImpactSpeed = 0.0;
5878
5879 m_VarWetInit = ConfigGetFloat("varWetInit");
5881 m_VarWetMin = ConfigGetFloat("varWetMin");
5882 m_VarWetMax = ConfigGetFloat("varWetMax");
5883
5884 m_LiquidContainerMask = ConfigGetInt("liquidContainerType");
5885 if (IsLiquidContainer() && GetQuantity() != 0)
5887 m_IsBeingPlaced = false;
5888 m_IsHologram = false;
5889 m_IsTakeable = true;
5890 m_CanBeMovedOverride = false;
5894 m_CanBeDigged = ConfigGetBool("canBeDigged");
5895
5896 m_CompatibleLocks = new array<int>();
5897 ConfigGetIntArray("compatibleLocks", m_CompatibleLocks);
5898 m_LockType = ConfigGetInt("lockType");
5899
5900 //Define if item can be split and set ability to be combined accordingly
5901 m_CanThisBeSplit = false;
5902 can_this_be_combined = false;
5903 if (ConfigIsExisting("canBeSplit"))
5904 {
5905 can_this_be_combined = ConfigGetBool("canBeSplit");
5907 }
5908
5909 m_ItemBehaviour = -1;
5910 if (ConfigIsExisting("itemBehaviour"))
5911 m_ItemBehaviour = ConfigGetInt("itemBehaviour");
5912
5913 //RegisterNetSyncVariableInt("m_VariablesMask");
5914 if (HasQuantity()) RegisterNetSyncVariableFloat("m_VarQuantity", GetQuantityMin(), m_VarQuantityMax);
5915 RegisterNetSyncVariableFloat("m_VarWet", GetWetMin(), GetWetMax(), 2);
5916 RegisterNetSyncVariableInt("m_VarLiquidType");
5917 RegisterNetSyncVariableInt("m_Cleanness",0,1);
5918
5919 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
5920 RegisterNetSyncVariableFloat("m_ImpactSpeed");
5921 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
5922
5923 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
5924 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
5925 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
5926 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
5927
5928 RegisterNetSyncVariableBool("m_IsBeingPlaced");
5929 RegisterNetSyncVariableBool("m_IsTakeable");
5930 RegisterNetSyncVariableBool("m_IsHologram");
5931
5932 InitItemSounds();
5934 {
5935 RegisterNetSyncVariableInt("m_SoundSyncPlay", 0, ITEM_SOUNDS_MAX);
5936 RegisterNetSyncVariableInt("m_SoundSyncStop", 0, ITEM_SOUNDS_MAX);
5937 }
5938
5939 m_LockSoundSet = ConfigGetString("lockSoundSet");
5940
5942 if (ConfigIsExisting("temperaturePerQuantityWeight"))
5943 m_TemperaturePerQuantityWeight = ConfigGetFloat("temperaturePerQuantityWeight");
5944
5945 }
5946
5947 override int GetQuickBarBonus()
5948 {
5949 return m_QuickBarBonus;
5950 }
5951
5952 void InitializeActions()
5953 {
5955 if (!m_InputActionMap)
5956 {
5958 m_InputActionMap = iam;
5959 SetActions();
5961 }
5962 }
5963
5964 override void GetActions(typename action_input_type, out array<ActionBase_Basic> actions)
5965 {
5967 {
5968 m_ActionsInitialize = true;
5970 }
5971
5972 actions = m_InputActionMap.Get(action_input_type);
5973 }
5974
5975 void SetActions()
5976 {
5977 AddAction(ActionTakeItem);
5978 AddAction(ActionTakeItemToHands);
5979 AddAction(ActionWorldCraft);
5981 AddAction(ActionAttachWithSwitch);
5982 }
5983
5984 void SetActionAnimOverrides(); // Override action animation for specific item
5985
5986 void AddAction(typename actionName)
5987 {
5988 ActionBase action = ActionManagerBase.GetAction(actionName);
5989
5990 if (!action)
5991 {
5992 Debug.LogError("Action " + actionName + " dosn't exist!");
5993 return;
5994 }
5995
5996 typename ai = action.GetInputType();
5997 if (!ai)
5998 {
5999 m_ActionsInitialize = false;
6000 return;
6001 }
6002
6003 array<ActionBase_Basic> action_array = m_InputActionMap.Get(ai);
6004 if (!action_array)
6005 {
6006 action_array = new array<ActionBase_Basic>;
6007 m_InputActionMap.Insert(ai, action_array);
6008 }
6009 if (LogManager.IsActionLogEnable())
6010 {
6011 Debug.ActionLog(action.ToString() + " -> " + ai, this.ToString() , "n/a", "Add action");
6012 }
6013
6014 if (action_array.Find(action) != -1)
6015 {
6016 Debug.Log("Action " + action.Type() + " already added to " + this + ", skipping!");
6017 }
6018 else
6019 {
6020 action_array.Insert(action);
6021 }
6022 }
6023
6024 void RemoveAction(typename actionName)
6025 {
6026 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
6027 ActionBase action = player.GetActionManager().GetAction(actionName);
6028 typename ai = action.GetInputType();
6029 array<ActionBase_Basic> action_array = m_InputActionMap.Get(ai);
6030
6031 if (action_array)
6032 {
6033 action_array.RemoveItem(action);
6034 }
6035 }
6036
6037 // Allows override of default action command per item, defined in the SetActionAnimOverrides() of the item's class
6038 // Set -1 for params which should stay in default state
6039 void OverrideActionAnimation(typename action, int commandUID, int stanceMask = -1, int commandUIDProne = -1)
6040 {
6041 ActionOverrideData overrideData = new ActionOverrideData();
6042 overrideData.m_CommandUID = commandUID;
6043 overrideData.m_CommandUIDProne = commandUIDProne;
6044 overrideData.m_StanceMask = stanceMask;
6045
6046 TActionAnimOverrideMap actionMap = m_ItemActionOverrides.Get(action);
6047 if (!actionMap) // create new map of action > overidables map
6048 {
6049 actionMap = new TActionAnimOverrideMap();
6050 m_ItemActionOverrides.Insert(action, actionMap);
6051 }
6052
6053 actionMap.Insert(this.Type(), overrideData); // insert item -> overrides
6054
6055 }
6056
6057 void OnItemInHandsPlayerSwimStart(PlayerBase player);
6058
6059 ScriptedLightBase GetLight();
6060
6061 // Loads muzzle flash particle configuration from config and saves it to a map for faster access
6062 void LoadParticleConfigOnFire(int id)
6063 {
6064 if (!m_OnFireEffect)
6066
6069
6070 string config_to_search = "CfgVehicles";
6071 string muzzle_owner_config;
6072
6073 if (!m_OnFireEffect.Contains(id))
6074 {
6075 if (IsInherited(Weapon))
6076 config_to_search = "CfgWeapons";
6077
6078 muzzle_owner_config = config_to_search + " " + GetType() + " ";
6079
6080 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
6081
6082 int config_OnFire_subclass_count = GetGame().ConfigGetChildrenCount(config_OnFire_class);
6083
6084 if (config_OnFire_subclass_count > 0)
6085 {
6086 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
6087
6088 for (int i = 0; i < config_OnFire_subclass_count; i++)
6089 {
6090 string particle_class = "";
6091 GetGame().ConfigGetChildName(config_OnFire_class, i, particle_class);
6092 string config_OnFire_entry = config_OnFire_class + particle_class;
6093 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
6094 WPOF_array.Insert(WPOF);
6095 }
6096
6097
6098 m_OnFireEffect.Insert(id, WPOF_array);
6099 }
6100 }
6101
6102 if (!m_OnBulletCasingEjectEffect.Contains(id))
6103 {
6104 config_to_search = "CfgWeapons"; // Bullet Eject efect is supported on weapons only.
6105 muzzle_owner_config = config_to_search + " " + GetType() + " ";
6106
6107 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
6108
6109 int config_OnBulletCasingEject_count = GetGame().ConfigGetChildrenCount(config_OnBulletCasingEject_class);
6110
6111 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
6112 {
6113 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
6114
6115 for (i = 0; i < config_OnBulletCasingEject_count; i++)
6116 {
6117 string particle_class2 = "";
6118 GetGame().ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
6119 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
6120 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
6121 WPOBE_array.Insert(WPOBE);
6122 }
6123
6124
6125 m_OnBulletCasingEjectEffect.Insert(id, WPOBE_array);
6126 }
6127 }
6128 }
6129
6130 // Loads muzzle flash particle configuration from config and saves it to a map for faster access
6132 {
6135
6136 if (!m_OnOverheatingEffect.Contains(id))
6137 {
6138 string config_to_search = "CfgVehicles";
6139
6140 if (IsInherited(Weapon))
6141 config_to_search = "CfgWeapons";
6142
6143 string muzzle_owner_config = config_to_search + " " + GetType() + " ";
6144 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
6145
6146 if (GetGame().ConfigIsExisting(config_OnOverheating_class))
6147 {
6148
6149 m_ShotsToStartOverheating = GetGame().ConfigGetFloat(config_OnOverheating_class + "shotsToStartOverheating");
6150
6152 {
6153 m_ShotsToStartOverheating = -1; // This prevents futher readings from config for future creations of this item
6154 string error = "Error reading config " + GetType() + ">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
6155 Error(error);
6156 return;
6157 }
6158
6159 m_OverheatingDecayInterval = GetGame().ConfigGetFloat(config_OnOverheating_class + "overheatingDecayInterval");
6160 m_MaxOverheatingValue = GetGame().ConfigGetFloat(config_OnOverheating_class + "maxOverheatingValue");
6161
6162
6163
6164 int config_OnOverheating_subclass_count = GetGame().ConfigGetChildrenCount(config_OnOverheating_class);
6165 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
6166
6167 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
6168 {
6169 string particle_class = "";
6170 GetGame().ConfigGetChildName(config_OnOverheating_class, i, particle_class);
6171 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
6172 int entry_type = GetGame().ConfigGetType(config_OnOverheating_entry);
6173
6174 if (entry_type == CT_CLASS)
6175 {
6176 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
6177 WPOOH_array.Insert(WPOF);
6178 }
6179 }
6180
6181
6182 m_OnOverheatingEffect.Insert(id, WPOOH_array);
6183 }
6184 }
6185 }
6186
6187 float GetOverheatingValue()
6188 {
6189 return m_OverheatingShots;
6190 }
6191
6192 void IncreaseOverheating(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
6193 {
6194 if (m_MaxOverheatingValue > 0)
6195 {
6197
6198 if (!m_CheckOverheating)
6200
6202 m_CheckOverheating.Run(m_OverheatingDecayInterval, this, "OnOverheatingDecay");
6203
6204 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6205 }
6206 }
6207
6208 void CheckOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
6209 {
6211 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6212
6214 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6215
6217 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6218
6220 {
6222 }
6223 }
6224
6226 {
6228 }
6229
6230 void OnOverheatingDecay()
6231 {
6232 if (m_MaxOverheatingValue > 0)
6233 m_OverheatingShots -= 1 + m_OverheatingShots / m_MaxOverheatingValue; // The hotter a barrel is, the faster it needs to cool down.
6234 else
6236
6237 if (m_OverheatingShots <= 0)
6238 {
6241 }
6242 else
6243 {
6244 if (!m_CheckOverheating)
6246
6248 m_CheckOverheating.Run(m_OverheatingDecayInterval, this, "OnOverheatingDecay");
6249 }
6250
6251 CheckOverheating(this, "", this);
6252 }
6253
6254 void StartOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
6255 {
6257 ItemBase.PlayOverheatingParticles(this, ammoType, this, suppressor, "CfgWeapons");
6258 }
6259
6260 void UpdateOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
6261 {
6263 ItemBase.UpdateOverheatingParticles(this, ammoType, this, suppressor, "CfgWeapons");
6265 }
6266
6267 void StopOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
6268 {
6270 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6271 }
6272
6273 void RegisterOverheatingParticle(Particle p, float min_heat_coef, float max_heat_coef, int particle_id, Object parent, vector local_pos, vector local_ori)
6274 {
6276 m_OverheatingParticles = new array<ref OverheatingParticle>;
6277
6278 OverheatingParticle OP = new OverheatingParticle();
6279 OP.RegisterParticle(p);
6280 OP.SetOverheatingLimitMin(min_heat_coef);
6281 OP.SetOverheatingLimitMax(max_heat_coef);
6282 OP.SetParticleParams(particle_id, parent, local_pos, local_ori);
6283
6284 m_OverheatingParticles.Insert(OP);
6285 }
6286
6287 float GetOverheatingCoef()
6288 {
6289 if (m_MaxOverheatingValue > 0)
6291
6292 return -1;
6293 }
6294
6296 {
6298 {
6299 float overheat_coef = GetOverheatingCoef();
6300 int count = m_OverheatingParticles.Count();
6301
6302 for (int i = count; i > 0; --i)
6303 {
6304 int id = i - 1;
6305 OverheatingParticle OP = m_OverheatingParticles.Get(id);
6306 Particle p = OP.GetParticle();
6307
6308 float overheat_min = OP.GetOverheatingLimitMin();
6309 float overheat_max = OP.GetOverheatingLimitMax();
6310
6311 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
6312 {
6313 if (p)
6314 {
6315 p.Stop();
6316 OP.RegisterParticle(null);
6317 }
6318 }
6319 }
6320 }
6321 }
6322
6324 {
6326 {
6327 for (int i = m_OverheatingParticles.Count(); i > 0; i--)
6328 {
6329 int id = i - 1;
6330 OverheatingParticle OP = m_OverheatingParticles.Get(id);
6331
6332 if (OP)
6333 {
6334 Particle p = OP.GetParticle();
6335
6336 if (p)
6337 {
6338 p.Stop();
6339 }
6340
6341 delete OP;
6342 }
6343 }
6344
6345 m_OverheatingParticles.Clear();
6347 }
6348 }
6349
6351 float GetInfectionChance(int system = 0, Param param = null)
6352 {
6353 return 0.0;
6354 }
6355
6356
6357 float GetDisinfectQuantity(int system = 0, Param param1 = null)
6358 {
6359 return 250;//default value
6360 }
6361
6362 float GetFilterDamageRatio()
6363 {
6364 return 0;
6365 }
6366
6368 bool HasMuzzle()
6369 {
6370 if (IsInherited(Weapon) || IsInherited(SuppressorBase))
6371 return true;
6372
6373 return false;
6374 }
6375
6377 int GetMuzzleID()
6378 {
6379 if (!m_WeaponTypeToID)
6381
6382 if (m_WeaponTypeToID.Contains(GetType()))
6383 {
6384 return m_WeaponTypeToID.Get(GetType());
6385 }
6386 else
6387 {
6388 // Register new weapon ID
6390 }
6391
6393 }
6394
6401 {
6402 return -1;
6403 }
6404
6405
6406
6407 // -------------------------------------------------------------------------
6408 void ~ItemBase()
6409 {
6410 if (GetGame() && GetGame().GetPlayer() && (!GetGame().IsDedicatedServer()))
6411 {
6412 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
6413 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6414
6415 if (r_index >= 0)
6416 {
6417 InventoryLocation r_il = new InventoryLocation;
6418 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6419
6420 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6421 int r_type = r_il.GetType();
6422 if (r_type == InventoryLocationType.CARGO || r_type == InventoryLocationType.PROXYCARGO)
6423 {
6424 r_il.GetParent().GetOnReleaseLock().Invoke(this);
6425 }
6426 else if (r_type == InventoryLocationType.ATTACHMENT)
6427 {
6428 r_il.GetParent().GetOnAttachmentReleaseLock().Invoke(this, r_il.GetSlot());
6429 }
6430
6431 }
6432
6433 player.GetHumanInventory().ClearUserReservedLocation(this);
6434 }
6435
6436 if (m_LockingSound)
6437 SEffectManager.DestroyEffect(m_LockingSound);
6438 }
6439
6440
6441
6442 // -------------------------------------------------------------------------
6443 static int GetDebugActionsMask()
6444 {
6445 return ItemBase.m_DebugActionsMask;
6446 }
6447
6448 static bool HasDebugActionsMask(int mask)
6449 {
6450 return ItemBase.m_DebugActionsMask & mask;
6451 }
6452
6453 static void SetDebugActionsMask(int mask)
6454 {
6455 ItemBase.m_DebugActionsMask = mask;
6456 }
6457
6458 static void AddDebugActionsMask(int mask)
6459 {
6460 ItemBase.m_DebugActionsMask |= mask;
6461 }
6462
6463 static void RemoveDebugActionsMask(int mask)
6464 {
6465 ItemBase.m_DebugActionsMask &= ~mask;
6466 }
6467
6468 static void ToggleDebugActionsMask(int mask)
6469 {
6470 if (HasDebugActionsMask(mask))
6471 {
6473 }
6474 else
6475 {
6476 AddDebugActionsMask(mask);
6477 }
6478 }
6479
6480 // -------------------------------------------------------------------------
6481 void SetCEBasedQuantity()
6482 {
6483 if (GetEconomyProfile())
6484 {
6485 float q_max = GetEconomyProfile().GetQuantityMax();
6486 if (q_max > 0)
6487 {
6488 float q_min = GetEconomyProfile().GetQuantityMin();
6489 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
6490
6491 if (HasComponent(COMP_TYPE_ENERGY_MANAGER))//more direct access for speed
6492 {
6493 ComponentEnergyManager comp = GetCompEM();
6494 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
6495 {
6496 comp.SetEnergy0To1(quantity_randomized);
6497 }
6498 }
6499 else if (HasQuantity())
6500 {
6501 SetQuantityNormalized(quantity_randomized, false);
6502 //PrintString("<==> Normalized quantity for item: "+ GetType()+", qmin:"+q_min.ToString()+"; qmax:"+q_max.ToString()+";quantity:" +quantity_randomized.ToString());
6503 }
6504
6505 }
6506 }
6507 }
6508
6510 void LockToParent()
6511 {
6512 EntityAI parent = GetHierarchyParent();
6513
6514 if (parent)
6515 {
6516 InventoryLocation inventory_location_to_lock = new InventoryLocation;
6517 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
6518 parent.GetInventory().SetSlotLock(inventory_location_to_lock.GetSlot(), true);
6519 }
6520 }
6521
6523 void UnlockFromParent()
6524 {
6525 EntityAI parent = GetHierarchyParent();
6526
6527 if (parent)
6528 {
6529 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
6530 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
6531 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.GetSlot(), false);
6532 }
6533 }
6534
6535 override void CombineItemsClient(EntityAI entity2, bool use_stack_max = true)
6536 {
6537 /*
6538 ref Param1<EntityAI> item = new Param1<EntityAI>(entity2);
6539 RPCSingleParam(ERPCs.RPC_ITEM_COMBINE, item, GetGame().GetPlayer());
6540 */
6541 ItemBase item2 = ItemBase.Cast(entity2);
6542
6543 if (GetGame().IsClient())
6544 {
6545 if (ScriptInputUserData.CanStoreInputUserData())
6546 {
6547 ScriptInputUserData ctx = new ScriptInputUserData;
6549 ctx.Write(-1);
6550 ItemBase i1 = this; // @NOTE: workaround for correct serialization
6551 ctx.Write(i1);
6552 ctx.Write(item2);
6553 ctx.Write(use_stack_max);
6554 ctx.Write(-1);
6555 ctx.Send();
6556
6557 if (IsCombineAll(item2, use_stack_max))
6558 {
6559 GetGame().GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
6560 }
6561 }
6562 }
6563 else if (!GetGame().IsMultiplayer())
6564 {
6565 CombineItems(item2, use_stack_max);
6566 }
6567 }
6568
6569 bool IsLiquidPresent()
6570 {
6571 return (GetLiquidType() != 0 && HasQuantity());
6572 }
6573
6574 bool IsLiquidContainer()
6575 {
6576 return m_LiquidContainerMask != 0;
6577 }
6578
6580 {
6581 return m_LiquidContainerMask;
6582 }
6583
6584 bool IsBloodContainer()
6585 {
6586 //m_LiquidContainerMask & GROUP_LIQUID_BLOOD ???
6587 return false;
6588 }
6589
6590 bool IsNVG()
6591 {
6592 return false;
6593 }
6594
6597 bool IsExplosive()
6598 {
6599 return false;
6600 }
6601
6603 {
6604 return "";
6605 }
6606
6608
6609 bool IsLightSource()
6610 {
6611 return false;
6612 }
6613
6615 {
6616 return true;
6617 }
6618
6619 //--- ACTION CONDITIONS
6620 //direction
6621 bool IsFacingPlayer(PlayerBase player, string selection)
6622 {
6623 return true;
6624 }
6625
6626 bool IsPlayerInside(PlayerBase player, string selection)
6627 {
6628 return true;
6629 }
6630
6631 override bool CanObstruct()
6632 {
6633 PlayerBase player = PlayerBase.Cast(g_Game.GetPlayer());
6634 return !player || !IsPlayerInside(player, "");
6635 }
6636
6637 override bool IsBeingPlaced()
6638 {
6639 return m_IsBeingPlaced;
6640 }
6641
6642 void SetIsBeingPlaced(bool is_being_placed)
6643 {
6644 m_IsBeingPlaced = is_being_placed;
6645 if (!is_being_placed)
6647 SetSynchDirty();
6648 }
6649
6650 //server-side
6651 void OnEndPlacement() {}
6652
6653 override bool IsHologram()
6654 {
6655 return m_IsHologram;
6656 }
6657
6658 bool CanBeDigged()
6659 {
6660 return m_CanBeDigged;
6661 }
6662
6664 {
6665 return 1;
6666 }
6667
6668 bool CanMakeGardenplot()
6669 {
6670 return false;
6671 }
6672
6673 void SetIsHologram(bool is_hologram)
6674 {
6675 m_IsHologram = is_hologram;
6676 SetSynchDirty();
6677 }
6678 /*
6679 protected float GetNutritionalEnergy()
6680 {
6681 Edible_Base edible = Edible_Base.Cast(this);
6682 return edible.GetFoodEnergy();
6683 }
6684
6685 protected float GetNutritionalWaterContent()
6686 {
6687 Edible_Base edible = Edible_Base.Cast(this);
6688 return edible.GetFoodWater();
6689 }
6690
6691 protected float GetNutritionalIndex()
6692 {
6693 Edible_Base edible = Edible_Base.Cast(this);
6694 return edible.GetFoodNutritionalIndex();
6695 }
6696
6697 protected float GetNutritionalFullnessIndex()
6698 {
6699 Edible_Base edible = Edible_Base.Cast(this);
6700 return edible.GetFoodTotalVolume();
6701 }
6702
6703 protected float GetNutritionalToxicity()
6704 {
6705 Edible_Base edible = Edible_Base.Cast(this);
6706 return edible.GetFoodToxicity();
6707
6708 }
6709 */
6710
6711
6712 // -------------------------------------------------------------------------
6713 override void OnMovedInsideCargo(EntityAI container)
6714 {
6715 super.OnMovedInsideCargo(container);
6716
6717 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6718 }
6719
6720 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
6721 {
6722 super.EEItemLocationChanged(oldLoc,newLoc);
6723
6724 PlayerBase new_player = null;
6725 PlayerBase old_player = null;
6726
6727 if (newLoc.GetParent())
6728 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
6729
6730 if (oldLoc.GetParent())
6731 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
6732
6733 if (old_player && oldLoc.GetType() == InventoryLocationType.HANDS)
6734 {
6735 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
6736
6737 if (r_index >= 0)
6738 {
6739 InventoryLocation r_il = new InventoryLocation;
6740 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6741
6742 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6743 int r_type = r_il.GetType();
6744 if (r_type == InventoryLocationType.CARGO || r_type == InventoryLocationType.PROXYCARGO)
6745 {
6746 r_il.GetParent().GetOnReleaseLock().Invoke(this);
6747 }
6748 else if (r_type == InventoryLocationType.ATTACHMENT)
6749 {
6750 r_il.GetParent().GetOnAttachmentReleaseLock().Invoke(this, r_il.GetSlot());
6751 }
6752
6753 }
6754 }
6755
6756 if (newLoc.GetType() == InventoryLocationType.HANDS)
6757 {
6758 if (new_player)
6759 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
6760
6761 if (new_player == old_player)
6762 {
6763
6764 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
6765 {
6766 if (oldLoc.GetType() == InventoryLocationType.CARGO)
6767 {
6768 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
6769 {
6770 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6771 }
6772 }
6773 else
6774 {
6775 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6776 }
6777 }
6778
6779 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
6780 {
6781 int type = oldLoc.GetType();
6782 if (type == InventoryLocationType.CARGO || type == InventoryLocationType.PROXYCARGO)
6783 {
6784 oldLoc.GetParent().GetOnSetLock().Invoke(this);
6785 }
6786 else if (type == InventoryLocationType.ATTACHMENT)
6787 {
6788 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
6789 }
6790 }
6791 if (!m_OldLocation)
6792 {
6793 m_OldLocation = new InventoryLocation;
6794 }
6795 m_OldLocation.Copy(oldLoc);
6796 }
6797 else
6798 {
6799 if (m_OldLocation)
6800 {
6801 m_OldLocation.Reset();
6802 }
6803 }
6804
6806 }
6807 else
6808 {
6809 if (new_player)
6810 {
6811 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
6812 if (res_index >= 0)
6813 {
6814 InventoryLocation il = new InventoryLocation;
6815 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
6816 ItemBase it = ItemBase.Cast(il.GetItem());
6817 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
6818 int rel_type = il.GetType();
6819 if (rel_type == InventoryLocationType.CARGO || rel_type == InventoryLocationType.PROXYCARGO)
6820 {
6821 il.GetParent().GetOnReleaseLock().Invoke(it);
6822 }
6823 else if (rel_type == InventoryLocationType.ATTACHMENT)
6824 {
6825 il.GetParent().GetOnAttachmentReleaseLock().Invoke(it, il.GetSlot());
6826 }
6827 //it.GetOnReleaseLock().Invoke(it);
6828 }
6829 }
6830 else if (old_player && newLoc.GetType() == InventoryLocationType.GROUND && m_ThrowItemOnDrop)
6831 {
6832 //ThrowPhysically(old_player, vector.Zero);
6833 m_ThrowItemOnDrop = false;
6834 }
6835
6836 if (m_OldLocation)
6837 {
6838 m_OldLocation.Reset();
6839 }
6840 }
6841 }
6842
6843 override void EOnContact(IEntity other, Contact extra)
6844 {
6846 {
6847 int liquidType = -1;
6848 float impactSpeed = ProcessImpactSoundEx(other, extra, m_ConfigWeight, m_ImpactSoundSurfaceHash, liquidType);
6849 if (impactSpeed > 0.0)
6850 {
6851 m_ImpactSpeed = impactSpeed;
6852 #ifndef SERVER
6853 PlayImpactSound(m_ConfigWeight, m_ImpactSpeed, m_ImpactSoundSurfaceHash);
6854 #else
6855 m_WantPlayImpactSound = true;
6856 SetSynchDirty();
6857 #endif
6858 m_CanPlayImpactSound = (liquidType == -1);// prevents further playing of the sound when the surface is a liquid type
6859 }
6860 }
6861
6862 #ifdef SERVER
6863 if (GetCompEM() && GetCompEM().IsPlugged())
6864 {
6865 if (GetCompEM().GetCordLength() < vector.Distance(GetPosition(), GetCompEM().GetEnergySource().GetPosition()))
6866 GetCompEM().UnplugThis();
6867 }
6868 #endif
6869 }
6870
6871 void RefreshPhysics();
6872
6873 override void OnCreatePhysics()
6874 {
6876 }
6877
6878 override void OnItemAttachmentSlotChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
6879 {
6880
6881 }
6882 // -------------------------------------------------------------------------
6883 override void OnItemLocationChanged(EntityAI old_owner, EntityAI new_owner)
6884 {
6885 super.OnItemLocationChanged(old_owner, new_owner);
6886
6887 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
6888 PlayerBase playerNew = PlayerBase.Cast(new_owner);
6889
6890 if (!relatedPlayer && playerNew)
6891 relatedPlayer = playerNew;
6892
6893 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
6894 {
6895 ActionManagerBase actionMgr = relatedPlayer.GetActionManager();
6896 if (actionMgr)
6897 {
6898 ActionBase currentAction = actionMgr.GetRunningAction();
6899 if (currentAction)
6900 currentAction.OnItemLocationChanged(this);
6901 }
6902 }
6903
6904 Man ownerPlayerOld = null;
6905 Man ownerPlayerNew = null;
6906
6907 if (old_owner)
6908 {
6909 if (old_owner.IsMan())
6910 {
6911 ownerPlayerOld = Man.Cast(old_owner);
6912 }
6913 else
6914 {
6915 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
6916 }
6917 }
6918 else
6919 {
6920 if (new_owner && IsElectricAppliance() && GetCompEM() && GetCompEM().IsPlugged())
6921 {
6922 ActionBase action = ActionManagerBase.GetAction(ActionRepositionPluggedItem);
6923
6924 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.GetID())
6925 {
6926 GetCompEM().UnplugThis();
6927 }
6928 }
6929 }
6930
6931 if (new_owner)
6932 {
6933 if (new_owner.IsMan())
6934 {
6935 ownerPlayerNew = Man.Cast(new_owner);
6936 }
6937 else
6938 {
6939 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
6940 }
6941 }
6942
6943 if (ownerPlayerOld != ownerPlayerNew)
6944 {
6945 if (ownerPlayerOld)
6946 {
6947 array<EntityAI> subItemsExit = new array<EntityAI>;
6948 GetInventory().EnumerateInventory(InventoryTraversalType.PREORDER,subItemsExit);
6949 for (int i = 0; i < subItemsExit.Count(); i++)
6950 {
6951 ItemBase itemExit = ItemBase.Cast(subItemsExit.Get(i));
6952 itemExit.OnInventoryExit(ownerPlayerOld);
6953 }
6954 }
6955
6956 if (ownerPlayerNew)
6957 {
6958 array<EntityAI> subItemsEnter = new array<EntityAI>;
6959 GetInventory().EnumerateInventory(InventoryTraversalType.PREORDER,subItemsEnter);
6960 for (int j = 0; j < subItemsEnter.Count(); j++)
6961 {
6962 ItemBase itemEnter = ItemBase.Cast(subItemsEnter.Get(j));
6963 itemEnter.OnInventoryEnter(ownerPlayerNew);
6964 }
6965 }
6966 }
6967 else if (ownerPlayerNew != null)
6968 {
6969 PlayerBase nplayer;
6970 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
6971 {
6972 array<EntityAI> subItemsUpdate = new array<EntityAI>;
6973 GetInventory().EnumerateInventory(InventoryTraversalType.PREORDER,subItemsUpdate);
6974 for (int k = 0; k < subItemsUpdate.Count(); k++)
6975 {
6976 ItemBase itemUpdate = ItemBase.Cast(subItemsUpdate.Get(k));
6977 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
6978 }
6979 }
6980 }
6981
6982 if (old_owner)
6983 old_owner.OnChildItemRemoved(this);
6984 if (new_owner)
6985 new_owner.OnChildItemReceived(this);
6986 }
6987
6988 // -------------------------------------------------------------------------------
6989 override void EEDelete(EntityAI parent)
6990 {
6991 super.EEDelete(parent);
6992 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
6993 if (player)
6994 {
6995 OnInventoryExit(player);
6996
6997 if (player.IsAlive())
6998 {
6999 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7000 if (r_index >= 0)
7001 {
7002 InventoryLocation r_il = new InventoryLocation;
7003 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7004
7005 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7006 int r_type = r_il.GetType();
7007 if (r_type == InventoryLocationType.CARGO || r_type == InventoryLocationType.PROXYCARGO)
7008 {
7009 r_il.GetParent().GetOnReleaseLock().Invoke(this);
7010 }
7011 else if (r_type == InventoryLocationType.ATTACHMENT)
7012 {
7013 r_il.GetParent().GetOnAttachmentReleaseLock().Invoke(this, r_il.GetSlot());
7014 }
7015
7016 }
7017
7018 player.RemoveQuickBarEntityShortcut(this);
7019 }
7020 }
7021 }
7022 // -------------------------------------------------------------------------------
7023 override void EEKilled(Object killer)
7024 {
7025 super.EEKilled(killer);
7026
7028 if (killer && killer.IsFireplace() && CanExplodeInFire())
7029 {
7030 if (GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
7031 {
7032 if (IsMagazine())
7033 {
7034 if (Magazine.Cast(this).GetAmmoCount() > 0)
7035 {
7036 ExplodeAmmo();
7037 }
7038 }
7039 else
7040 {
7041 Explode(DamageType.EXPLOSION);
7042 }
7043 }
7044 }
7045 }
7046
7047 override void OnWasAttached(EntityAI parent, int slot_id)
7048 {
7049 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7050
7051 super.OnWasAttached(parent, slot_id);
7052
7053 if (HasQuantity())
7054 UpdateNetSyncVariableFloat("m_VarQuantity", GetQuantityMin(), m_VarQuantityMax);
7055
7056 PlayAttachSound(InventorySlots.GetSlotName(slot_id));
7057 }
7058
7059 override void OnWasDetached(EntityAI parent, int slot_id)
7060 {
7061 super.OnWasDetached(parent, slot_id);
7062
7063 if (HasQuantity())
7064 UpdateNetSyncVariableFloat("m_VarQuantity", GetQuantityMin(), m_VarQuantityMax);
7065 }
7066
7067 override string ChangeIntoOnAttach(string slot)
7068 {
7069 int idx;
7070 TStringArray inventory_slots = new TStringArray;
7071 TStringArray attach_types = new TStringArray;
7072
7073 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7074 if (inventory_slots.Count() < 1) //is string
7075 {
7076 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
7077 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
7078 }
7079 else //is array
7080 {
7081 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
7082 }
7083
7084 idx = inventory_slots.Find(slot);
7085 if (idx < 0)
7086 return "";
7087
7088 return attach_types.Get(idx);
7089 }
7090
7091 override string ChangeIntoOnDetach()
7092 {
7093 int idx = -1;
7094 string slot;
7095
7096 TStringArray inventory_slots = new TStringArray;
7097 TStringArray detach_types = new TStringArray;
7098
7099 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7100 if (inventory_slots.Count() < 1) //is string
7101 {
7102 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
7103 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7104 }
7105 else //is array
7106 {
7107 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
7108 if (detach_types.Count() < 1)
7109 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7110 }
7111
7112 for (int i = 0; i < inventory_slots.Count(); i++)
7113 {
7114 slot = inventory_slots.Get(i);
7115 }
7116
7117 if (slot != "")
7118 {
7119 if (detach_types.Count() == 1)
7120 idx = 0;
7121 else
7122 idx = inventory_slots.Find(slot);
7123 }
7124 if (idx < 0)
7125 return "";
7126
7127 return detach_types.Get(idx);
7128 }
7129
7130 void ExplodeAmmo()
7131 {
7132 //timer
7133 ref Timer explode_timer = new Timer(CALL_CATEGORY_SYSTEM);
7134
7135 //min/max time
7136 float min_time = 1;
7137 float max_time = 3;
7138 float delay = Math.RandomFloat(min_time, max_time);
7139
7140 explode_timer.Run(delay, this, "DoAmmoExplosion");
7141 }
7142
7143 void DoAmmoExplosion()
7144 {
7145 Magazine magazine = Magazine.Cast(this);
7146 int pop_sounds_count = 6;
7147 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
7148
7149 //play sound
7150 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
7151 string sound_name = pop_sounds[ sound_idx ];
7152 GetGame().CreateSoundOnObject(this, sound_name, 20, false);
7153
7154 //remove ammo count
7155 magazine.ServerAddAmmoCount(-1);
7156
7157 //if condition then repeat -> ExplodeAmmo
7158 float min_temp_to_explode = 100; //min temperature for item to explode
7159
7160 if (magazine.GetAmmoCount() > 0 && GetTemperature() >= min_temp_to_explode) //TODO ? add check for parent -> fireplace
7161 {
7162 ExplodeAmmo();
7163 }
7164 }
7165
7166 // -------------------------------------------------------------------------------
7167 override void EEHitBy(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
7168 {
7169 super.EEHitBy(damageResult, damageType, source, component, dmgZone, ammo, modelPos, speedCoef);
7170
7171 const int CHANCE_DAMAGE_CARGO = 4;
7172 const int CHANCE_DAMAGE_ATTACHMENT = 1;
7173 const int CHANCE_DAMAGE_NOTHING = 2;
7174
7175 if (IsClothing() || IsContainer() || IsItemTent())
7176 {
7177 float dmg = damageResult.GetDamage("","Health") * -0.5;
7178 int chances;
7179 int rnd;
7180
7181 if (GetInventory().GetCargo())
7182 {
7183 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7184 rnd = Math.RandomInt(0,chances);
7185
7186 if (rnd < CHANCE_DAMAGE_CARGO)
7187 {
7188 DamageItemInCargo(dmg);
7189 }
7190 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
7191 {
7193 }
7194 }
7195 else
7196 {
7197 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7198 rnd = Math.RandomInt(0,chances);
7199
7200 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
7201 {
7203 }
7204 }
7205 }
7206 }
7207
7208 bool DamageItemInCargo(float damage)
7209 {
7210 if (GetInventory().GetCargo())
7211 {
7212 int item_count = GetInventory().GetCargo().GetItemCount();
7213 if (item_count > 0)
7214 {
7215 int random_pick = Math.RandomInt(0, item_count);
7216 ItemBase item = ItemBase.Cast(GetInventory().GetCargo().GetItem(random_pick));
7217 if (!item.IsExplosive())
7218 {
7219 item.AddHealth("","",damage);
7220 return true;
7221 }
7222 }
7223 }
7224 return false;
7225 }
7226
7227 bool DamageItemAttachments(float damage)
7228 {
7229 int attachment_count = GetInventory().AttachmentCount();
7230 if (attachment_count > 0)
7231 {
7232 int random_pick = Math.RandomInt(0, attachment_count);
7233 ItemBase attachment = ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
7234 if (!attachment.IsExplosive())
7235 {
7236 attachment.AddHealth("","",damage);
7237 return true;
7238 }
7239 }
7240 return false;
7241 }
7242
7243 override bool IsSplitable()
7244 {
7245 return m_CanThisBeSplit;
7246 }
7247 //----------------
7248 override bool CanBeSplit()
7249 {
7250 if (IsSplitable() && (GetQuantity() > 1))
7251 return GetInventory().CanRemoveEntity();
7252
7253 return false;
7254 }
7255
7256 override void SplitIntoStackMaxClient(EntityAI destination_entity, int slot_id )
7257 {
7258 if (!CanBeSplit())
7259 return;
7260
7261 if (GetGame().IsClient())
7262 {
7263 if (ScriptInputUserData.CanStoreInputUserData())
7264 {
7265 ScriptInputUserData ctx = new ScriptInputUserData;
7267 ctx.Write(1);
7268 ItemBase i1 = this; // @NOTE: workaround for correct serialization
7269 ctx.Write(i1);
7270 ctx.Write(destination_entity);
7271 ctx.Write(true);
7272 ctx.Write(slot_id);
7273 ctx.Send();
7274 }
7275 }
7276 else if (!GetGame().IsMultiplayer())
7277 {
7278 SplitIntoStackMax(destination_entity, slot_id, PlayerBase.Cast(GetGame().GetPlayer()));
7279 }
7280 }
7281
7282 void SplitIntoStackMax(EntityAI destination_entity, int slot_id, PlayerBase player)
7283 {
7284 if (!CanBeSplit())
7285 return;
7286
7287 float split_quantity_new;
7288 ref ItemBase new_item;
7289 float quantity = GetQuantity();
7290 float stack_max = GetTargetQuantityMax(slot_id);
7291 InventoryLocation loc = new InventoryLocation;
7292
7293 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7294 {
7295 if (stack_max <= GetQuantity())
7296 split_quantity_new = stack_max;
7297 else
7298 split_quantity_new = GetQuantity();
7299
7300 new_item = ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(this.GetType(), slot_id));
7301 if (new_item)
7302 {
7303 new_item.SetResultOfSplit(true);
7304 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7305 AddQuantity(-split_quantity_new);
7306 new_item.SetQuantity(split_quantity_new);
7307 }
7308 }
7309 else if (destination_entity && slot_id == -1)
7310 {
7311 if (quantity > stack_max)
7312 split_quantity_new = stack_max;
7313 else
7314 split_quantity_new = quantity;
7315
7316 if (destination_entity.GetInventory().FindFreeLocationFor(this, FindInventoryLocationType.ANY, loc))
7317 {
7318 Object o = destination_entity.GetInventory().LocationCreateEntity(loc, GetType(), ECE_IN_INVENTORY, RF_DEFAULT);
7319 new_item = ItemBase.Cast(o);
7320 }
7321
7322 if (new_item)
7323 {
7324 new_item.SetResultOfSplit(true);
7325 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7326 AddQuantity(-split_quantity_new);
7327 new_item.SetQuantity(split_quantity_new);
7328 }
7329 }
7330 else
7331 {
7332 if (stack_max != 0)
7333 {
7334 if (stack_max < GetQuantity())
7335 {
7336 split_quantity_new = GetQuantity() - stack_max;
7337 }
7338
7339 if (split_quantity_new == 0)
7340 {
7341 if (!GetGame().IsMultiplayer())
7342 player.PhysicalPredictiveDropItem(this);
7343 else
7344 player.ServerDropEntity(this);
7345 return;
7346 }
7347
7348 new_item = ItemBase.Cast(GetGame().CreateObjectEx(GetType(), player.GetWorldPosition(), ECE_PLACE_ON_SURFACE));
7349
7350 if (new_item)
7351 {
7352 new_item.SetResultOfSplit(true);
7353 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7354 SetQuantity(split_quantity_new);
7355 new_item.SetQuantity(stack_max);
7356 new_item.PlaceOnSurface();
7357 }
7358 }
7359 }
7360 }
7361
7362 override void SplitIntoStackMaxEx(EntityAI destination_entity, int slot_id)
7363 {
7364 if (!CanBeSplit())
7365 return;
7366
7367 float split_quantity_new;
7368 ref ItemBase new_item;
7369 float quantity = GetQuantity();
7370 float stack_max = GetTargetQuantityMax(slot_id);
7371 InventoryLocation loc = new InventoryLocation;
7372
7373 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7374 {
7375 if (stack_max <= GetQuantity())
7376 split_quantity_new = stack_max;
7377 else
7378 split_quantity_new = GetQuantity();
7379
7380 new_item = ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(this.GetType(), slot_id));
7381 if (new_item)
7382 {
7383 new_item.SetResultOfSplit(true);
7384 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7385 AddQuantity(-split_quantity_new);
7386 new_item.SetQuantity(split_quantity_new);
7387 }
7388 }
7389 else if (destination_entity && slot_id == -1)
7390 {
7391 if (quantity > stack_max)
7392 split_quantity_new = stack_max;
7393 else
7394 split_quantity_new = quantity;
7395
7396 if (destination_entity.GetInventory().FindFreeLocationFor(this, FindInventoryLocationType.ANY, loc))
7397 {
7398 Object o = destination_entity.GetInventory().LocationCreateEntity(loc, GetType(), ECE_IN_INVENTORY, RF_DEFAULT);
7399 new_item = ItemBase.Cast(o);
7400 }
7401
7402 if (new_item)
7403 {
7404 new_item.SetResultOfSplit(true);
7405 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7406 AddQuantity(-split_quantity_new);
7407 new_item.SetQuantity(split_quantity_new);
7408 }
7409 }
7410 else
7411 {
7412 if (stack_max != 0)
7413 {
7414 if (stack_max < GetQuantity())
7415 {
7416 split_quantity_new = GetQuantity() - stack_max;
7417 }
7418
7419 new_item = ItemBase.Cast(GetGame().CreateObjectEx(GetType(),GetWorldPosition(), ECE_PLACE_ON_SURFACE));
7420
7421 if (new_item)
7422 {
7423 new_item.SetResultOfSplit(true);
7424 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7425 SetQuantity(split_quantity_new);
7426 new_item.SetQuantity(stack_max);
7427 new_item.PlaceOnSurface();
7428 }
7429 }
7430 }
7431 }
7432
7433 void SplitIntoStackMaxToInventoryLocationClient(notnull InventoryLocation dst)
7434 {
7435 if (!CanBeSplit())
7436 return;
7437
7438 if (GetGame().IsClient())
7439 {
7440 if (ScriptInputUserData.CanStoreInputUserData())
7441 {
7442 ScriptInputUserData ctx = new ScriptInputUserData;
7444 ctx.Write(4);
7445 ItemBase thiz = this; // @NOTE: workaround for correct serialization
7446 ctx.Write(thiz);
7447 dst.WriteToContext(ctx);
7448 ctx.Send();
7449 }
7450 }
7451 else if (!GetGame().IsMultiplayer())
7452 {
7454 }
7455 }
7456
7457 void SplitIntoStackMaxCargoClient(EntityAI destination_entity, int idx, int row, int col)
7458 {
7459 if (!CanBeSplit())
7460 return;
7461
7462 if (GetGame().IsClient())
7463 {
7464 if (ScriptInputUserData.CanStoreInputUserData())
7465 {
7466 ScriptInputUserData ctx = new ScriptInputUserData;
7468 ctx.Write(2);
7469 ItemBase dummy = this; // @NOTE: workaround for correct serialization
7470 ctx.Write(dummy);
7471 ctx.Write(destination_entity);
7472 ctx.Write(true);
7473 ctx.Write(idx);
7474 ctx.Write(row);
7475 ctx.Write(col);
7476 ctx.Send();
7477 }
7478 }
7479 else if (!GetGame().IsMultiplayer())
7480 {
7481 SplitIntoStackMaxCargo(destination_entity, idx, row, col);
7482 }
7483 }
7484
7485 void SplitIntoStackMaxToInventoryLocation(notnull InventoryLocation dst)
7486 {
7488 }
7489
7490 ItemBase SplitIntoStackMaxToInventoryLocationEx(notnull InventoryLocation dst)
7491 {
7492 if (!CanBeSplit())
7493 return this;
7494
7495 float quantity = GetQuantity();
7496 float split_quantity_new;
7497 ItemBase new_item;
7498 if (dst.IsValid())
7499 {
7500 int slot_id = dst.GetSlot();
7501 float stack_max = GetTargetQuantityMax(slot_id);
7502
7503 if (quantity > stack_max)
7504 split_quantity_new = stack_max;
7505 else
7506 split_quantity_new = quantity;
7507
7508 new_item = ItemBase.Cast(GameInventory.LocationCreateEntity(dst, this.GetType(), ECE_IN_INVENTORY, RF_DEFAULT));
7509
7510 if (new_item)
7511 {
7512 new_item.SetResultOfSplit(true);
7513 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7514 AddQuantity(-split_quantity_new);
7515 new_item.SetQuantity(split_quantity_new);
7516 }
7517
7518 return new_item;
7519 }
7520
7521 return null;
7522 }
7523
7524 void SplitIntoStackMaxCargo(EntityAI destination_entity, int idx, int row, int col)
7525 {
7526 if (!CanBeSplit())
7527 return;
7528
7529 float quantity = GetQuantity();
7530 float split_quantity_new;
7531 ref ItemBase new_item;
7532 if (destination_entity)
7533 {
7534 float stackable = GetTargetQuantityMax();
7535 if (quantity > stackable)
7536 split_quantity_new = stackable;
7537 else
7538 split_quantity_new = quantity;
7539
7540 new_item = ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(this.GetType(), idx, row, col, false));
7541 if (new_item)
7542 {
7543 new_item.SetResultOfSplit(true);
7544 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7545 AddQuantity(-split_quantity_new);
7546 new_item.SetQuantity(split_quantity_new);
7547 }
7548 }
7549 }
7550
7551 void SplitIntoStackMaxHandsClient(PlayerBase player)
7552 {
7553 if (!CanBeSplit())
7554 return;
7555
7556 if (GetGame().IsClient())
7557 {
7558 if (ScriptInputUserData.CanStoreInputUserData())
7559 {
7560 ScriptInputUserData ctx = new ScriptInputUserData;
7562 ctx.Write(3);
7563 ItemBase i1 = this; // @NOTE: workaround for correct serialization
7564 ctx.Write(i1);
7565 ItemBase destination_entity = this;
7566 ctx.Write(destination_entity);
7567 ctx.Write(true);
7568 ctx.Write(0);
7569 ctx.Send();
7570 }
7571 }
7572 else if (!GetGame().IsMultiplayer())
7573 {
7574 SplitIntoStackMaxHands(player);
7575 }
7576 }
7577
7578 void SplitIntoStackMaxHands(PlayerBase player)
7579 {
7580 if (!CanBeSplit())
7581 return;
7582
7583 float quantity = GetQuantity();
7584 float split_quantity_new;
7585 ref ItemBase new_item;
7586 if (player)
7587 {
7588 float stackable = GetTargetQuantityMax();
7589 if (quantity > stackable)
7590 split_quantity_new = stackable;
7591 else
7592 split_quantity_new = quantity;
7593
7594 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.GetType());
7595 new_item = ItemBase.Cast(in_hands);
7596 if (new_item)
7597 {
7598 new_item.SetResultOfSplit(true);
7599 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7600 AddQuantity(-split_quantity_new);
7601 new_item.SetQuantity(split_quantity_new);
7602 }
7603 }
7604 }
7605
7606 void SplitItemToInventoryLocation(notnull InventoryLocation dst)
7607 {
7608 if (!CanBeSplit())
7609 return;
7610
7611 float quantity = GetQuantity();
7612 float split_quantity_new = Math.Floor(quantity * 0.5);
7613
7614 ItemBase new_item = ItemBase.Cast(GameInventory.LocationCreateEntity(dst, GetType(), ECE_IN_INVENTORY, RF_DEFAULT));
7615
7616 if (new_item)
7617 {
7618 if (new_item.GetQuantityMax() < split_quantity_new)
7619 {
7620 split_quantity_new = new_item.GetQuantityMax();
7621 }
7622
7623 new_item.SetResultOfSplit(true);
7624 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7625
7626 if (dst.IsValid() && dst.GetType() == InventoryLocationType.ATTACHMENT && split_quantity_new > 1)
7627 {
7628 AddQuantity(-1);
7629 new_item.SetQuantity(1);
7630 }
7631 else
7632 {
7633 AddQuantity(-split_quantity_new);
7634 new_item.SetQuantity(split_quantity_new);
7635 }
7636 }
7637 }
7638
7639 void SplitItem(PlayerBase player)
7640 {
7641 if (!CanBeSplit())
7642 return;
7643
7644 float quantity = GetQuantity();
7645 float split_quantity_new = Math.Floor(quantity / 2);
7646
7647 InventoryLocation invloc = new InventoryLocation;
7648 bool found = player.GetInventory().FindFirstFreeLocationForNewEntity(GetType(), FindInventoryLocationType.ATTACHMENT, invloc);
7649
7650 ItemBase new_item;
7651 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
7652
7653 if (new_item)
7654 {
7655 if (new_item.GetQuantityMax() < split_quantity_new)
7656 {
7657 split_quantity_new = new_item.GetQuantityMax();
7658 }
7659 if (found && invloc.IsValid() && invloc.GetType() == InventoryLocationType.ATTACHMENT && split_quantity_new > 1)
7660 {
7661 AddQuantity(-1);
7662 new_item.SetQuantity(1);
7663 }
7664 else
7665 {
7666 AddQuantity(-split_quantity_new);
7667 new_item.SetQuantity(split_quantity_new);
7668 }
7669 }
7670 }
7671
7673 void OnQuantityChanged(float delta)
7674 {
7675 SetWeightDirty();
7676 ItemBase parent = ItemBase.Cast(GetHierarchyParent());
7677
7678 if (parent)
7679 parent.OnAttachmentQuantityChangedEx(this, delta);
7680
7681 if (IsLiquidContainer())
7682 {
7683 if (GetQuantityNormalized() <= 0.0)
7684 {
7686 }
7687 else if (GetLiquidType() == LIQUID_NONE)
7688 {
7689 ErrorEx("Undefined liquid type quantity changed, please define liquid type first! Using init value.",ErrorExSeverity.INFO);
7691 }
7692 }
7693
7694 }
7695
7698 {
7699 // insert code here
7700 }
7701
7703 void OnAttachmentQuantityChangedEx(ItemBase item , float delta)
7704 {
7706 }
7707
7708 override void EEHealthLevelChanged(int oldLevel, int newLevel, string zone)
7709 {
7710 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
7711
7712 if (GetGame().IsServer())
7713 {
7714 if (newLevel == GameConstants.STATE_RUINED)
7715 {
7717 EntityAI parent = GetHierarchyParent();
7718 if (parent && parent.IsFireplace())
7719 {
7720 CargoBase cargo = GetInventory().GetCargo();
7721 if (cargo)
7722 {
7723 for (int i = 0; i < cargo.GetItemCount(); ++i)
7724 {
7725 parent.GetInventory().TakeEntityToInventory(InventoryMode.SERVER, FindInventoryLocationType.CARGO, cargo.GetItem(i));
7726 }
7727 }
7728 }
7729 }
7730
7731 if (IsResultOfSplit())
7732 {
7733 // reset the splitting result flag, return to normal item behavior
7734 SetResultOfSplit(false);
7735 return;
7736 }
7737
7738 if (m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
7739 {
7740 SetCleanness(0);//unclean the item upon damage dealt
7741 }
7742 }
7743 }
7744
7745 // just the split? TODO: verify
7746 override void OnRightClick()
7747 {
7748 super.OnRightClick();
7749
7750 if (CanBeSplit() && !GetDayZGame().IsLeftCtrlDown() && !GetGame().GetPlayer().GetInventory().HasInventoryReservation(this,null))
7751 {
7752 if (GetGame().IsClient())
7753 {
7754 if (ScriptInputUserData.CanStoreInputUserData())
7755 {
7756 vector m4[4];
7757 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
7758
7759 EntityAI root = GetHierarchyRoot();
7760
7761 InventoryLocation dst = new InventoryLocation;
7762 if (!player.GetInventory().FindFirstFreeLocationForNewEntity(GetType(), FindInventoryLocationType.CARGO, dst))
7763 {
7764 if (root)
7765 {
7766 root.GetTransform(m4);
7767 dst.SetGround(this, m4);
7768 }
7769 else
7770 GetInventory().GetCurrentInventoryLocation(dst);
7771 }
7772 else
7773 {
7774 dst.SetCargo(dst.GetParent(), this, dst.GetIdx(), dst.GetRow(), dst.GetCol(), dst.GetFlip());
7775 /* hacky solution to check reservation of "this" item instead of null since the gamecode is checking null against null and returning reservation=true incorrectly
7776 this shouldnt cause issues within this scope*/
7777 if (GetGame().GetPlayer().GetInventory().HasInventoryReservation(this, dst))
7778 {
7779 if (root)
7780 {
7781 root.GetTransform(m4);
7782 dst.SetGround(this, m4);
7783 }
7784 else
7785 GetInventory().GetCurrentInventoryLocation(dst);
7786 }
7787 else
7788 {
7789 GetGame().GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
7790 }
7791 }
7792
7793 ScriptInputUserData ctx = new ScriptInputUserData;
7795 ctx.Write(4);
7796 ItemBase thiz = this; // @NOTE: workaround for correct serialization
7797 ctx.Write(thiz);
7798 dst.WriteToContext(ctx);
7799 ctx.Write(true); // dummy
7800 ctx.Send();
7801 }
7802 }
7803 else if (!GetGame().IsMultiplayer())
7804 {
7805 SplitItem(PlayerBase.Cast(GetGame().GetPlayer()));
7806 }
7807 }
7808 }
7809
7810 override bool CanBeCombined(EntityAI other_item, bool reservation_check = true, bool stack_max_limit = false)
7811 {
7812 //TODO: delete check zero quantity check after fix double posts hands fsm events
7813 if (!other_item || GetType() != other_item.GetType() || (IsFullQuantity() && other_item.GetQuantity() > 0) || other_item == this)
7814 return false;
7815
7816 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
7817 return false;
7818
7819 //can_this_be_combined = ConfigGetBool("canBeSplit");
7821 return false;
7822
7823
7824 Magazine mag = Magazine.Cast(this);
7825 if (mag)
7826 {
7827 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
7828 return false;
7829
7830 if (stack_max_limit)
7831 {
7832 Magazine other_mag = Magazine.Cast(other_item);
7833 if (other_item)
7834 {
7835 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
7836 return false;
7837 }
7838
7839 }
7840 }
7841 else
7842 {
7843 //TODO: delete check zero quantity check after fix double posts hands fsm events
7844 if (GetQuantity() >= GetQuantityMax() && other_item.GetQuantity() > 0 )
7845 return false;
7846
7847 if (stack_max_limit && (GetQuantity() + other_item.GetQuantity() > GetQuantityMax()))
7848 return false;
7849 }
7850
7851 PlayerBase player = null;
7852 if (CastTo(player, GetHierarchyRootPlayer())) //false when attached to player's attachment slot
7853 {
7854 if (player.GetInventory().HasAttachment(this))
7855 return false;
7856
7857 if (player.IsItemsToDelete())
7858 return false;
7859 }
7860
7861 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
7862 return false;
7863
7864 int slotID;
7865 string slotName;
7866 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
7867 return false;
7868
7869 return true;
7870 }
7871
7872 bool IsCombineAll(ItemBase other_item, bool use_stack_max = false)
7873 {
7874 return ComputeQuantityUsed(other_item, use_stack_max) == other_item.GetQuantity();
7875 }
7876
7877 bool IsResultOfSplit()
7878 {
7879 return m_IsResultOfSplit;
7880 }
7881
7882 void SetResultOfSplit(bool value)
7883 {
7884 m_IsResultOfSplit = value;
7885 }
7886
7887 int ComputeQuantityUsed(ItemBase other_item, bool use_stack_max = true)
7888 {
7889 return ComputeQuantityUsedEx(other_item, use_stack_max);
7890 }
7891
7892 float ComputeQuantityUsedEx(ItemBase other_item, bool use_stack_max = true)
7893 {
7894 float other_item_quantity = other_item.GetQuantity();
7895 float this_free_space;
7896
7897 float stack_max = GetQuantityMax();
7898
7899 this_free_space = stack_max - GetQuantity();
7900
7901 if (other_item_quantity > this_free_space)
7902 {
7903 return this_free_space;
7904 }
7905 else
7906 {
7907 return other_item_quantity;
7908 }
7909 }
7910
7911 override void CombineItemsEx(EntityAI entity2, bool use_stack_max = true)
7912 {
7913 CombineItems(ItemBase.Cast(entity2),use_stack_max);
7914 }
7915
7916 void CombineItems(ItemBase other_item, bool use_stack_max = true)
7917 {
7918 if (!CanBeCombined(other_item, false))
7919 return;
7920
7921 if (!IsMagazine() && other_item)
7922 {
7923 float quantity_used = ComputeQuantityUsedEx(other_item,use_stack_max);
7924 if (quantity_used != 0)
7925 {
7926 float hp1 = GetHealth01("","");
7927 float hp2 = other_item.GetHealth01("","");
7928 float hpResult = ((hp1*GetQuantity()) + (hp2*quantity_used));
7929 hpResult = hpResult / (GetQuantity() + quantity_used);
7930
7931 hpResult *= GetMaxHealth();
7932 Math.Round(hpResult);
7933 SetHealth("", "Health", hpResult);
7934
7935 AddQuantity(quantity_used);
7936 other_item.AddQuantity(-quantity_used);
7937 }
7938 }
7939 OnCombine(other_item);
7940 }
7941
7942 void OnCombine(ItemBase other_item)
7943 {
7944 #ifdef SERVER
7945 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
7946 GetHierarchyParent().IncreaseLifetimeUp();
7947 #endif
7948 };
7949
7950 void GetRecipesActions(Man player, out TSelectableActionInfoArray outputList)
7951 {
7952 PlayerBase p = PlayerBase.Cast(player);
7953
7954 array<int> recipesIds = p.m_Recipes;
7955 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(GetPlugin(PluginRecipesManager));
7956 if (moduleRecipesManager)
7957 {
7958 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
7959 moduleRecipesManager.GetValidRecipes(ItemBase.Cast(this), ItemBase.Cast(itemInHands), recipesIds, p);
7960 }
7961
7962 for (int i = 0;i < recipesIds.Count(); i++)
7963 {
7964 int key = recipesIds.Get(i);
7965 string recipeName = moduleRecipesManager.GetRecipeName(key);
7966 outputList.Insert(new TSelectableActionInfo(SAT_CRAFTING, key, recipeName));
7967 }
7968 }
7969
7970 // -------------------------------------------------------------------------
7971 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
7972 {
7973 super.GetDebugActions(outputList);
7974
7975 //quantity
7976 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_QUANTITY, "Quantity +20%", FadeColors.LIGHT_GREY));
7977 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_QUANTITY, "Quantity -20%", FadeColors.LIGHT_GREY));
7978 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SET_QUANTITY_0, "Set Quantity 0", FadeColors.LIGHT_GREY));
7979 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SET_MAX_QUANTITY, "Set Quantity Max", FadeColors.LIGHT_GREY));
7980
7981 //health
7982 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_HEALTH, "Health +20%", FadeColors.LIGHT_GREY));
7983 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_HEALTH, "Health -20%", FadeColors.LIGHT_GREY));
7984 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.DESTROY_HEALTH, "Health 0", FadeColors.LIGHT_GREY));
7985 //temperature
7986 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_TEMPERATURE, "Temperature +20", FadeColors.LIGHT_GREY));
7987 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_TEMPERATURE, "Temperature -20", FadeColors.LIGHT_GREY));
7988 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.FLIP_FROZEN, "Toggle Frozen", FadeColors.LIGHT_GREY));
7989
7990 //wet
7991 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_WETNESS, "Wetness +20", FadeColors.LIGHT_GREY));
7992 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_WETNESS, "Wetness -20", FadeColors.LIGHT_GREY));
7993
7994 //liquidtype
7995 if (IsLiquidContainer())
7996 {
7997 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.LIQUIDTYPE_UP, "LiquidType Next", FadeColors.LIGHT_GREY));
7998 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.LIQUIDTYPE_DOWN, "LiquidType Previous", FadeColors.LIGHT_GREY));
7999 }
8000
8001 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.MAKE_SPECIAL, "Make Special", FadeColors.LIGHT_GREY));
8002 // watch
8003 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.WATCH_ITEM, "Watch (CTRL-Z)", FadeColors.LIGHT_GREY));
8004 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.WATCH_PLAYER, "Watch Player", FadeColors.LIGHT_GREY));
8005
8006 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "", FadeColors.RED));
8007 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.DELETE, "Delete", FadeColors.RED));
8008 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "", FadeColors.RED));
8009 }
8010
8011 // -------------------------------------------------------------------------
8012 // -------------------------------------------------------------------------
8013 // -------------------------------------------------------------------------
8014 override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
8015 {
8016 super.OnAction(action_id, player, ctx);
8017 if (action_id >= EActions.RECIPES_RANGE_START && action_id < EActions.RECIPES_RANGE_END)
8018 {
8019 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(GetPlugin(PluginRecipesManager));
8020 int idWithoutOffset = action_id - EActions.RECIPES_RANGE_START;
8021 PlayerBase p = PlayerBase.Cast(player);
8022 if (EActions.RECIPES_RANGE_START < 1000)
8023 {
8024 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
8025 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
8026 }
8027 }
8028 #ifndef SERVER
8029 else if (action_id == EActions.WATCH_PLAYER)
8030 {
8031 PluginDeveloper.SetDeveloperItemClientEx(player);
8032 }
8033 #endif
8034 if (GetGame().IsServer())
8035 {
8036 if (action_id >= EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id < EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
8037 {
8038 int id = action_id - EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
8039 OnDebugButtonPressServer(id + 1);
8040 }
8041
8042 else if (action_id >= EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id < EActions.DEBUG_AGENTS_RANGE_INJECT_END)
8043 {
8044 int agent_id = action_id - EActions.DEBUG_AGENTS_RANGE_INJECT_START;
8045 InsertAgent(agent_id,100);
8046 }
8047
8048 else if (action_id >= EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id < EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
8049 {
8050 int agent_id2 = action_id - EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
8051 RemoveAgent(agent_id2);
8052 }
8053
8054 else if (action_id == EActions.ADD_QUANTITY)
8055 {
8056 if (IsMagazine())
8057 {
8058 Magazine mag = Magazine.Cast(this);
8059 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
8060 }
8061 else
8062 {
8063 AddQuantity(GetQuantityMax() * 0.2);
8064 }
8065
8066 if (m_EM)
8067 {
8068 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
8069 }
8070 //PrintVariables();
8071 }
8072
8073 else if (action_id == EActions.REMOVE_QUANTITY) //Quantity -20%
8074 {
8075 if (IsMagazine())
8076 {
8077 Magazine mag2 = Magazine.Cast(this);
8078 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
8079 }
8080 else
8081 {
8082 AddQuantity(- GetQuantityMax() * 0.2);
8083 }
8084 if (m_EM)
8085 {
8086 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
8087 }
8088 //PrintVariables();
8089 }
8090
8091 else if (action_id == EActions.SET_QUANTITY_0) //SetMaxQuantity
8092 {
8093 SetQuantity(0);
8094
8095 if (m_EM)
8096 {
8097 m_EM.SetEnergy(0);
8098 }
8099 }
8100
8101 else if (action_id == EActions.SET_MAX_QUANTITY) //SetMaxQuantity
8102 {
8104
8105 if (m_EM)
8106 {
8107 m_EM.SetEnergy(m_EM.GetEnergyMax());
8108 }
8109 }
8110
8111 else if (action_id == EActions.ADD_HEALTH)
8112 {
8113 AddHealth("","",GetMaxHealth("","Health")/5);
8114 }
8115 else if (action_id == EActions.REMOVE_HEALTH)
8116 {
8117 AddHealth("","",-GetMaxHealth("","Health")/5);
8118 }
8119 else if (action_id == EActions.DESTROY_HEALTH)
8120 {
8121 SetHealth01("","",0);
8122 }
8123 else if (action_id == EActions.WATCH_ITEM)
8124 {
8126 mid.RegisterDebugItem(ItemBase.Cast(this), PlayerBase.Cast(player));
8127 #ifdef DEVELOPER
8128 SetDebugDeveloper_item(this);
8129 #endif
8130 }
8131
8132 else if (action_id == EActions.ADD_TEMPERATURE)
8133 {
8134 AddTemperature(20);
8135 //PrintVariables();
8136 }
8137
8138 else if (action_id == EActions.REMOVE_TEMPERATURE)
8139 {
8140 AddTemperature(-20);
8141 //PrintVariables();
8142 }
8143
8144 else if (action_id == EActions.FLIP_FROZEN)
8145 {
8146 SetFrozen(!GetIsFrozen());
8147 //PrintVariables();
8148 }
8149
8150 else if (action_id == EActions.ADD_WETNESS)
8151 {
8152 AddWet(GetWetMax()/5);
8153 //PrintVariables();
8154 }
8155
8156 else if (action_id == EActions.REMOVE_WETNESS)
8157 {
8158 AddWet(-GetWetMax()/5);
8159 //PrintVariables();
8160 }
8161
8162 else if (action_id == EActions.LIQUIDTYPE_UP)
8163 {
8164 int curr_type = GetLiquidType();
8165 SetLiquidType(curr_type * 2);
8166 //AddWet(1);
8167 //PrintVariables();
8168 }
8169
8170 else if (action_id == EActions.LIQUIDTYPE_DOWN)
8171 {
8172 int curr_type2 = GetLiquidType();
8173 SetLiquidType(curr_type2 / 2);
8174 }
8175
8176 else if (action_id == EActions.MAKE_SPECIAL)
8177 {
8178 auto debugParams = DebugSpawnParams.WithPlayer(player);
8179 OnDebugSpawnEx(debugParams);
8180 }
8181
8182 else if (action_id == EActions.DELETE)
8183 {
8184 Delete();
8185 }
8186
8187 }
8188
8189
8190 return false;
8191 }
8192
8193 // -------------------------------------------------------------------------
8194
8195
8198 void OnActivatedByTripWire();
8199
8201 void OnActivatedByItem(notnull ItemBase item);
8202
8203 //----------------------------------------------------------------
8204 //returns true if item is able to explode when put in fire
8205 bool CanExplodeInFire()
8206 {
8207 return false;
8208 }
8209
8210 //----------------------------------------------------------------
8211 bool CanEat()
8212 {
8213 return true;
8214 }
8215
8216 //----------------------------------------------------------------
8217 override bool IsIgnoredByConstruction()
8218 {
8219 return true;
8220 }
8221
8222 //----------------------------------------------------------------
8223 //has FoodStages in config?
8224 bool HasFoodStage()
8225 {
8226 string config_path = string.Format("CfgVehicles %1 Food FoodStages", GetType());
8227 return GetGame().ConfigIsExisting(config_path);
8228 }
8229
8231 FoodStage GetFoodStage()
8232 {
8233 return null;
8234 }
8235
8236 bool CanBeCooked()
8237 {
8238 return false;
8239 }
8240
8241 bool CanBeCookedOnStick()
8242 {
8243 return false;
8244 }
8245
8247 void RefreshAudioVisualsOnClient( CookingMethodType cooking_method, bool is_done, bool is_empty, bool is_burned );
8249
8250 //----------------------------------------------------------------
8251 bool CanRepair(ItemBase item_repair_kit)
8252 {
8253 PluginRepairing module_repairing = PluginRepairing.Cast(GetPlugin(PluginRepairing));
8254 return module_repairing.CanRepair(this, item_repair_kit);
8255 }
8256
8257 //----------------------------------------------------------------
8258 bool Repair(PlayerBase player, ItemBase item_repair_kit, float specialty_weight)
8259 {
8260 PluginRepairing module_repairing = PluginRepairing.Cast(GetPlugin(PluginRepairing));
8261 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
8262 }
8263
8264 //----------------------------------------------------------------
8265 int GetItemSize()
8266 {
8267 /*
8268 vector v_size = this.ConfigGetVector("itemSize");
8269 int v_size_x = v_size[0];
8270 int v_size_y = v_size[1];
8271 int size = v_size_x * v_size_y;
8272 return size;
8273 */
8274
8275 return 1;
8276 }
8277
8278 //----------------------------------------------------------------
8279 //Override for allowing seemingly unallowed moves when two clients send a conflicting message simultaneously
8280 bool CanBeMovedOverride()
8281 {
8282 return m_CanBeMovedOverride;
8283 }
8284
8285 //----------------------------------------------------------------
8286 //Override for allowing seemingly unallowed moves when two clients send a conflicting message simultaneously
8287 void SetCanBeMovedOverride(bool setting)
8288 {
8289 m_CanBeMovedOverride = setting;
8290 }
8291
8292 //----------------------------------------------------------------
8300 void MessageToOwnerStatus(string text)
8301 {
8302 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8303
8304 if (player)
8305 {
8306 player.MessageStatus(text);
8307 }
8308 }
8309
8310 //----------------------------------------------------------------
8318 void MessageToOwnerAction(string text)
8319 {
8320 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8321
8322 if (player)
8323 {
8324 player.MessageAction(text);
8325 }
8326 }
8327
8328 //----------------------------------------------------------------
8336 void MessageToOwnerFriendly(string text)
8337 {
8338 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8339
8340 if (player)
8341 {
8342 player.MessageFriendly(text);
8343 }
8344 }
8345
8346 //----------------------------------------------------------------
8354 void MessageToOwnerImportant(string text)
8355 {
8356 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8357
8358 if (player)
8359 {
8360 player.MessageImportant(text);
8361 }
8362 }
8363
8364 override bool IsItemBase()
8365 {
8366 return true;
8367 }
8368
8369 // Checks if item is of questioned kind
8370 override bool KindOf(string tag)
8371 {
8372 bool found = false;
8373 string item_name = this.GetType();
8374 ref TStringArray item_tag_array = new TStringArray;
8375 GetGame().ConfigGetTextArray("cfgVehicles " + item_name + " itemInfo", item_tag_array);
8376
8377 int array_size = item_tag_array.Count();
8378 for (int i = 0; i < array_size; i++)
8379 {
8380 if (item_tag_array.Get(i) == tag)
8381 {
8382 found = true;
8383 break;
8384 }
8385 }
8386 return found;
8387 }
8388
8389
8390 override void OnRPC(PlayerIdentity sender, int rpc_type,ParamsReadContext ctx)
8391 {
8392 //Debug.Log("OnRPC called");
8393 super.OnRPC(sender, rpc_type,ctx);
8394
8395 //Play soundset for attachment locking (ActionLockAttachment.c)
8396 switch (rpc_type)
8397 {
8398 #ifndef SERVER
8399 case ERPCs.RPC_SOUND_LOCK_ATTACH:
8400 Param2<bool, string> p = new Param2<bool, string>(false, "");
8401
8402 if (!ctx.Read(p))
8403 return;
8404
8405 bool play = p.param1;
8406 string soundSet = p.param2;
8407
8408 if (play)
8409 {
8410 if (m_LockingSound)
8411 {
8413 {
8414 m_LockingSound = SEffectManager.PlaySound(soundSet, GetPosition(), 0, 0, true);
8415 }
8416 }
8417 else
8418 {
8419 m_LockingSound = SEffectManager.PlaySound(soundSet, GetPosition(), 0, 0, true);
8420 }
8421 }
8422 else
8423 {
8424 SEffectManager.DestroyEffect(m_LockingSound);
8425 }
8426
8427 break;
8428 #endif
8429
8430 }
8431
8432 if (GetWrittenNoteData())
8433 {
8434 GetWrittenNoteData().OnRPC(sender, rpc_type,ctx);
8435 }
8436 }
8437
8438 //-----------------------------
8439 // VARIABLE MANIPULATION SYSTEM
8440 //-----------------------------
8441 int NameToID(string name)
8442 {
8443 PluginVariables plugin = PluginVariables.Cast(GetPlugin(PluginVariables));
8444 return plugin.GetID(name);
8445 }
8446
8447 string IDToName(int id)
8448 {
8449 PluginVariables plugin = PluginVariables.Cast(GetPlugin(PluginVariables));
8450 return plugin.GetName(id);
8451 }
8452
8454 void OnSyncVariables(ParamsReadContext ctx)//with ID optimization
8455 {
8456 //Debug.Log("OnSyncVariables called for item: "+ ToString(this.GetType()),"varSync");
8457 //read the flags
8458 int varFlags;
8459 if (!ctx.Read(varFlags))
8460 return;
8461
8462 if (varFlags & ItemVariableFlags.FLOAT)
8463 {
8464 ReadVarsFromCTX(ctx);
8465 }
8466 }
8467
8468 override void SerializeNumericalVars(array<float> floats_out)
8469 {
8470 //some variables handled on EntityAI level already!
8471 super.SerializeNumericalVars(floats_out);
8472
8473 // the order of serialization must be the same as the order of de-serialization
8474 //--------------------------------------------
8475 if (IsVariableSet(VARIABLE_QUANTITY))
8476 {
8477 floats_out.Insert(m_VarQuantity);
8478 }
8479 //--------------------------------------------
8480 if (IsVariableSet(VARIABLE_WET))
8481 {
8482 floats_out.Insert(m_VarWet);
8483 }
8484 //--------------------------------------------
8485 if (IsVariableSet(VARIABLE_LIQUIDTYPE))
8486 {
8487 floats_out.Insert(m_VarLiquidType);
8488 }
8489 //--------------------------------------------
8490 if (IsVariableSet(VARIABLE_COLOR))
8491 {
8492 floats_out.Insert(m_ColorComponentR);
8493 floats_out.Insert(m_ColorComponentG);
8494 floats_out.Insert(m_ColorComponentB);
8495 floats_out.Insert(m_ColorComponentA);
8496 }
8497 //--------------------------------------------
8498 if (IsVariableSet(VARIABLE_CLEANNESS))
8499 {
8500 floats_out.Insert(m_Cleanness);
8501 }
8502 }
8503
8504 override void DeSerializeNumericalVars(array<float> floats)
8505 {
8506 //some variables handled on EntityAI level already!
8507 super.DeSerializeNumericalVars(floats);
8508
8509 // the order of serialization must be the same as the order of de-serialization
8510 int index = 0;
8511 int mask = Math.Round(floats.Get(index));
8512
8513 index++;
8514 //--------------------------------------------
8515 if (mask & VARIABLE_QUANTITY)
8516 {
8517 if (m_IsStoreLoad)
8518 {
8519 SetStoreLoadedQuantity(floats.Get(index));
8520 }
8521 else
8522 {
8523 float quantity = floats.Get(index);
8524 SetQuantity(quantity, true, false, false, false);
8525 }
8526 index++;
8527 }
8528 //--------------------------------------------
8529 if (mask & VARIABLE_WET)
8530 {
8531 float wet = floats.Get(index);
8532 SetWet(wet);
8533 index++;
8534 }
8535 //--------------------------------------------
8536 if (mask & VARIABLE_LIQUIDTYPE)
8537 {
8538 int liquidtype = Math.Round(floats.Get(index));
8539 SetLiquidType(liquidtype);
8540 index++;
8541 }
8542 //--------------------------------------------
8543 if (mask & VARIABLE_COLOR)
8544 {
8545 m_ColorComponentR = Math.Round(floats.Get(index));
8546 index++;
8547 m_ColorComponentG = Math.Round(floats.Get(index));
8548 index++;
8549 m_ColorComponentB = Math.Round(floats.Get(index));
8550 index++;
8551 m_ColorComponentA = Math.Round(floats.Get(index));
8552 index++;
8553 }
8554 //--------------------------------------------
8555 if (mask & VARIABLE_CLEANNESS)
8556 {
8557 int cleanness = Math.Round(floats.Get(index));
8558 SetCleanness(cleanness);
8559 index++;
8560 }
8561 }
8562
8563 override void WriteVarsToCTX(ParamsWriteContext ctx)
8564 {
8565 super.WriteVarsToCTX(ctx);
8566
8567 //--------------------------------------------
8568 if (IsVariableSet(VARIABLE_QUANTITY))
8569 {
8570 ctx.Write(GetQuantity());
8571 }
8572 //--------------------------------------------
8573 if (IsVariableSet(VARIABLE_WET))
8574 {
8575 ctx.Write(GetWet());
8576 }
8577 //--------------------------------------------
8578 if (IsVariableSet(VARIABLE_LIQUIDTYPE))
8579 {
8580 ctx.Write(GetLiquidType());
8581 }
8582 //--------------------------------------------
8583 if (IsVariableSet(VARIABLE_COLOR))
8584 {
8585 int r,g,b,a;
8586 GetColor(r,g,b,a);
8587 ctx.Write(r);
8588 ctx.Write(g);
8589 ctx.Write(b);
8590 ctx.Write(a);
8591 }
8592 //--------------------------------------------
8593 if (IsVariableSet(VARIABLE_CLEANNESS))
8594 {
8595 ctx.Write(GetCleanness());
8596 }
8597 }
8598
8599 override bool ReadVarsFromCTX(ParamsReadContext ctx, int version = -1)//with ID optimization
8600 {
8601 if (!super.ReadVarsFromCTX(ctx,version))
8602 return false;
8603
8604 int intValue;
8605 float value;
8606
8607 if (version < 140)
8608 {
8609 if (!ctx.Read(intValue))
8610 return false;
8611
8612 m_VariablesMask = intValue;
8613 }
8614
8615 if (m_VariablesMask & VARIABLE_QUANTITY)
8616 {
8617 if (!ctx.Read(value))
8618 return false;
8619
8620 if (IsStoreLoad())
8621 {
8623 }
8624 else
8625 {
8626 SetQuantity(value, true, false, false, false);
8627 }
8628 }
8629 //--------------------------------------------
8630 if (version < 140)
8631 {
8632 if (m_VariablesMask & VARIABLE_TEMPERATURE)
8633 {
8634 if (!ctx.Read(value))
8635 return false;
8636 SetTemperatureDirect(value);
8637 }
8638 }
8639 //--------------------------------------------
8640 if (m_VariablesMask & VARIABLE_WET)
8641 {
8642 if (!ctx.Read(value))
8643 return false;
8644 SetWet(value);
8645 }
8646 //--------------------------------------------
8647 if (m_VariablesMask & VARIABLE_LIQUIDTYPE)
8648 {
8649 if (!ctx.Read(intValue))
8650 return false;
8651 SetLiquidType(intValue);
8652 }
8653 //--------------------------------------------
8654 if (m_VariablesMask & VARIABLE_COLOR)
8655 {
8656 int r,g,b,a;
8657 if (!ctx.Read(r))
8658 return false;
8659 if (!ctx.Read(g))
8660 return false;
8661 if (!ctx.Read(b))
8662 return false;
8663 if (!ctx.Read(a))
8664 return false;
8665
8666 SetColor(r,g,b,a);
8667 }
8668 //--------------------------------------------
8669 if (m_VariablesMask & VARIABLE_CLEANNESS)
8670 {
8671 if (!ctx.Read(intValue))
8672 return false;
8673 SetCleanness(intValue);
8674 }
8675 //--------------------------------------------
8676 if (version >= 138 && version < 140)
8677 {
8678 if (m_VariablesMask & VARIABLE_TEMPERATURE)
8679 {
8680 if (!ctx.Read(intValue))
8681 return false;
8682 SetFrozen(intValue);
8683 }
8684 }
8685
8686 return true;
8687 }
8688
8689 //----------------------------------------------------------------
8690 override bool OnStoreLoad(ParamsReadContext ctx, int version)
8691 {
8692 m_IsStoreLoad = true;
8694 {
8695 m_FixDamageSystemInit = true;
8696 }
8697
8698 if (!super.OnStoreLoad(ctx, version))
8699 {
8700 m_IsStoreLoad = false;
8701 return false;
8702 }
8703
8704 if (version >= 114)
8705 {
8706 bool hasQuickBarIndexSaved;
8707
8708 if (!ctx.Read(hasQuickBarIndexSaved))
8709 {
8710 m_IsStoreLoad = false;
8711 return false;
8712 }
8713
8714 if (hasQuickBarIndexSaved)
8715 {
8716 int itmQBIndex;
8717
8718 //Load quickbar item bind
8719 if (!ctx.Read(itmQBIndex))
8720 {
8721 m_IsStoreLoad = false;
8722 return false;
8723 }
8724
8725 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
8726 if (itmQBIndex != -1 && parentPlayer)
8727 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
8728 }
8729 }
8730 else
8731 {
8732 // Backup of how it used to be
8733 PlayerBase player;
8734 int itemQBIndex;
8735 if (version == int.MAX)
8736 {
8737 if (!ctx.Read(itemQBIndex))
8738 {
8739 m_IsStoreLoad = false;
8740 return false;
8741 }
8742 }
8743 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
8744 {
8745 //Load quickbar item bind
8746 if (!ctx.Read(itemQBIndex))
8747 {
8748 m_IsStoreLoad = false;
8749 return false;
8750 }
8751 if (itemQBIndex != -1 && player)
8752 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
8753 }
8754 }
8755
8756 if (version < 140)
8757 {
8758 // variable management system
8759 if (!LoadVariables(ctx, version))
8760 {
8761 m_IsStoreLoad = false;
8762 return false;
8763 }
8764 }
8765
8766 //agent trasmission system
8767 if (!LoadAgents(ctx, version))
8768 {
8769 m_IsStoreLoad = false;
8770 return false;
8771 }
8772 if (version >= 132)
8773 {
8774 RemotelyActivatedItemBehaviour raib = GetRemotelyActivatedItemBehaviour();
8775 if (raib)
8776 {
8777 if (!raib.OnStoreLoad(ctx,version))
8778 {
8779 m_IsStoreLoad = false;
8780 return false;
8781 }
8782 }
8783 }
8784
8785 m_IsStoreLoad = false;
8786 return true;
8787 }
8788
8789 //----------------------------------------------------------------
8790
8791 override void OnStoreSave(ParamsWriteContext ctx)
8792 {
8793 super.OnStoreSave(ctx);
8794
8795 PlayerBase player;
8796 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
8797 {
8798 ctx.Write(true); // Keep track of if we should actually read this in or not
8799 //Save quickbar item bind
8800 int itemQBIndex = -1;
8801 itemQBIndex = player.FindQuickBarEntityIndex(this);
8802 ctx.Write(itemQBIndex);
8803 }
8804 else
8805 {
8806 ctx.Write(false); // Keep track of if we should actually read this in or not
8807 }
8808
8809 SaveAgents(ctx);//agent trasmission system
8810
8811 RemotelyActivatedItemBehaviour raib = GetRemotelyActivatedItemBehaviour();
8812 if (raib)
8813 {
8814 raib.OnStoreSave(ctx);
8815 }
8816 }
8817 //----------------------------------------------------------------
8818
8819 override void AfterStoreLoad()
8820 {
8821 super.AfterStoreLoad();
8822
8824 {
8826 }
8827
8828 if (GetStoreLoadedQuantity() != float.LOWEST)
8829 {
8831 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
8832 }
8833 }
8834
8835 override void EEOnAfterLoad()
8836 {
8837 super.EEOnAfterLoad();
8838
8840 {
8841 m_FixDamageSystemInit = false;
8842 }
8843
8846 }
8847
8848 bool CanBeDisinfected()
8849 {
8850 return false;
8851 }
8852
8853
8854 //----------------------------------------------------------------
8855 override void OnVariablesSynchronized()
8856 {
8857 if (m_Initialized)
8858 {
8859 #ifdef PLATFORM_CONSOLE
8860 //bruteforce it is
8861 if (IsSplitable())
8862 {
8863 UIScriptedMenu menu = GetGame().GetUIManager().FindMenu(MENU_INVENTORY);
8864 if (menu)
8865 {
8866 menu.Refresh();
8867 }
8868 }
8869 #endif
8870 }
8871
8873 {
8874 PlayImpactSound(m_ConfigWeight, m_ImpactSpeed, m_ImpactSoundSurfaceHash);
8875 m_WantPlayImpactSound = false;
8876 }
8877
8879 {
8880 SetWeightDirty();
8882 }
8883 if (m_VarWet != m_VarWetPrev)
8884 {
8887 }
8888
8889 if (m_SoundSyncPlay != 0)
8890 {
8891 m_ItemSoundHandler.PlayItemSoundClient(m_SoundSyncPlay);
8892 m_SoundSyncPlay = 0;
8893 }
8894 if (m_SoundSyncStop != 0)
8895 {
8896 m_ItemSoundHandler.StopItemSoundClient(m_SoundSyncStop);
8897 m_SoundSyncStop = 0;
8898 }
8899
8900 super.OnVariablesSynchronized();
8901 }
8902
8903 //------------------------- Quantity
8904 //----------------------------------------------------------------
8906 override bool SetQuantity(float value, bool destroy_config = true, bool destroy_forced = false, bool allow_client = false, bool clamp_to_stack_max = true)
8907 {
8908 if (!IsServerCheck(allow_client))
8909 return false;
8910
8911 if (!HasQuantity())
8912 return false;
8913
8914 float min = GetQuantityMin();
8915 float max = GetQuantityMax();
8916
8917 if (value <= (min + 0.001))
8918 value = min;
8919
8920 if (value == min)
8921 {
8922 if (destroy_config)
8923 {
8924 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
8925 if (dstr)
8926 {
8927 m_VarQuantity = Math.Clamp(value, min, max);
8928 this.Delete();
8929 return true;
8930 }
8931 }
8932 else if (destroy_forced)
8933 {
8934 m_VarQuantity = Math.Clamp(value, min, max);
8935 this.Delete();
8936 return true;
8937 }
8938 // we get here if destroy_config IS true AND dstr(config destroy param) IS false;
8939 RemoveAllAgents();//we remove all agents when we got to the min value, but the item is not getting deleted
8940 }
8941
8942 float delta = m_VarQuantity;
8943 m_VarQuantity = Math.Clamp(value, min, max);
8944
8945 if (GetStoreLoadedQuantity() == float.LOWEST)//any other value means we are setting quantity from storage
8946 {
8947 delta = m_VarQuantity - delta;
8948
8949 if (delta)
8950 OnQuantityChanged(delta);
8951 }
8952
8953 SetVariableMask(VARIABLE_QUANTITY);
8954
8955 return false;
8956 }
8957
8958 //----------------------------------------------------------------
8960 bool AddQuantity(float value, bool destroy_config = true, bool destroy_forced = false)
8961 {
8962 return SetQuantity(GetQuantity() + value, destroy_config, destroy_forced);
8963 }
8964 //----------------------------------------------------------------
8965 void SetQuantityMax()
8966 {
8967 float max = GetQuantityMax();
8968 SetQuantity(max);
8969 }
8970
8971 override void SetQuantityToMinimum()
8972 {
8973 float min = GetQuantityMin();
8974 SetQuantity(min);
8975 }
8976 //----------------------------------------------------------------
8978 void SetQuantityNormalized(float value, bool destroy_config = true, bool destroy_forced = false)
8979 {
8980 float value_clamped = Math.Clamp(value, 0, 1);//just to make sure
8981 int result = Math.Round(Math.Lerp(GetQuantityMin(), GetQuantityMax(), value_clamped));
8982 SetQuantity(result, destroy_config, destroy_forced);
8983 }
8984
8985 //----------------------------------------------------------------
8987 override float GetQuantityNormalized()
8988 {
8989 return Math.InverseLerp(GetQuantityMin(), GetQuantityMax(),m_VarQuantity);
8990 }
8991
8993 {
8994 return GetQuantityNormalized();
8995 }
8996
8997 /*void SetAmmoNormalized(float value)
8998 {
8999 float value_clamped = Math.Clamp(value, 0, 1);
9000 Magazine this_mag = Magazine.Cast(this);
9001 int max_rounds = this_mag.GetAmmoMax();
9002 int result = value * max_rounds;//can the rounded if higher precision is required
9003 this_mag.SetAmmoCount(result);
9004 }*/
9005 //----------------------------------------------------------------
9006 override int GetQuantityMax()
9007 {
9008 int slot = -1;
9009 if (GetInventory())
9010 {
9011 InventoryLocation il = new InventoryLocation;
9012 GetInventory().GetCurrentInventoryLocation(il);
9013 slot = il.GetSlot();
9014 }
9015
9016 return GetTargetQuantityMax(slot);
9017 }
9018
9019 override int GetTargetQuantityMax(int attSlotID = -1)
9020 {
9021 float quantity_max = 0;
9022
9023 if (IsSplitable()) //only stackable/splitable items can check for stack size
9024 {
9025 if (attSlotID != -1)
9026 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
9027
9028 if (quantity_max <= 0)
9029 quantity_max = m_VarStackMax;
9030 }
9031
9032 if (quantity_max <= 0)
9033 quantity_max = m_VarQuantityMax;
9034
9035 return quantity_max;
9036 }
9037 //----------------------------------------------------------------
9038 override int GetQuantityMin()
9039 {
9040 return m_VarQuantityMin;
9041 }
9042 //----------------------------------------------------------------
9043 int GetQuantityInit()
9044 {
9045 return m_VarQuantityInit;
9046 }
9047
9048 //----------------------------------------------------------------
9049 override bool HasQuantity()
9050 {
9051 return !(GetQuantityMax() - GetQuantityMin() == 0);
9052 }
9053
9054 override float GetQuantity()
9055 {
9056 return m_VarQuantity;
9057 }
9058
9059 bool IsFullQuantity()
9060 {
9061 return GetQuantity() >= GetQuantityMax();
9062 }
9063
9064 //Calculates weight of single item without attachments and cargo
9065 override float GetSingleInventoryItemWeightEx()
9066 {
9067 //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
9068 float weightEx = GetWeightEx();//overall weight of the item
9069 float special = GetInventoryAndCargoWeight();//cargo and attachment weight
9070 return weightEx - special;
9071 }
9072
9073 // Obsolete, use GetSingleInventoryItemWeightEx() instead
9075 {
9077 }
9078
9079 override protected float GetWeightSpecialized(bool forceRecalc = false)
9080 {
9081 if (IsSplitable()) //quantity determines size of the stack
9082 {
9083 #ifdef DEVELOPER
9084 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9085 {
9086 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
9087 data1.SetCalcDetails("TIB1: " + GetConfigWeightModifiedDebugText() +" * " + GetQuantity()+"(quantity)");
9088 }
9089 #endif
9090
9091 return GetQuantity() * GetConfigWeightModified();
9092 }
9093 else if (HasEnergyManager())// items with energy manager
9094 {
9095 #ifdef DEVELOPER
9096 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9097 {
9098 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
9099 data2.SetCalcDetails("TIB2: "+super.GetWeightSpecialized(forceRecalc)+"(contents weight) + " + GetConfigWeightModifiedDebugText() +" + " + GetCompEM().GetEnergy()+"(energy) * " + ConfigGetFloat("weightPerQuantityUnit") +"(weightPerQuantityUnit)");
9100 }
9101 #endif
9102 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified());
9103 }
9104 else//everything else
9105 {
9106 #ifdef DEVELOPER
9107 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9108 {
9109 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
9110 data3.SetCalcDetails("TIB3: "+super.GetWeightSpecialized(forceRecalc)+"(contents weight) + " + GetConfigWeightModifiedDebugText() +" + " + GetQuantity()+"(quantity) * " + ConfigGetFloat("weightPerQuantityUnit") +"(weightPerQuantityUnit))");
9111 }
9112 #endif
9113 return super.GetWeightSpecialized(forceRecalc) + (GetQuantity() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified());
9114 }
9115 }
9116
9118 int GetNumberOfItems()
9119 {
9120 int item_count = 0;
9121 ItemBase item;
9122
9123 if (GetInventory().GetCargo() != NULL)
9124 {
9125 item_count = GetInventory().GetCargo().GetItemCount();
9126 }
9127
9128 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
9129 {
9130 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
9131 if (item)
9132 item_count += item.GetNumberOfItems();
9133 }
9134 return item_count;
9135 }
9136
9138 float GetUnitWeight(bool include_wetness = true)
9139 {
9140 float weight = 0;
9141 float wetness = 1;
9142 if (include_wetness)
9143 wetness += GetWet();
9144 if (IsSplitable()) //quantity determines size of the stack
9145 {
9146 weight = wetness * m_ConfigWeight;
9147 }
9148 else if (IsLiquidContainer()) //is a liquid container, default liquid weight is set to 1. May revisit later?
9149 {
9150 weight = 1;
9151 }
9152 return weight;
9153 }
9154
9155 //-----------------------------------------------------------------
9156
9157 override void ClearInventory()
9158 {
9159 if ((GetGame().IsServer() || !GetGame().IsMultiplayer()) && GetInventory())
9160 {
9161 GameInventory inv = GetInventory();
9162 array<EntityAI> items = new array<EntityAI>;
9163 inv.EnumerateInventory(InventoryTraversalType.INORDER, items);
9164 for (int i = 0; i < items.Count(); i++)
9165 {
9166 ItemBase item = ItemBase.Cast(items.Get(i));
9167 if (item)
9168 {
9169 GetGame().ObjectDelete(item);
9170 }
9171 }
9172 }
9173 }
9174
9175 //------------------------- Energy
9176
9177 //----------------------------------------------------------------
9178 float GetEnergy()
9179 {
9180 float energy = 0;
9181 if (HasEnergyManager())
9182 {
9183 energy = GetCompEM().GetEnergy();
9184 }
9185 return energy;
9186 }
9187
9188
9189 override void OnEnergyConsumed()
9190 {
9191 super.OnEnergyConsumed();
9192
9194 }
9195
9196 override void OnEnergyAdded()
9197 {
9198 super.OnEnergyAdded();
9199
9201 }
9202
9203 // Converts energy (from Energy Manager) to quantity, if enabled.
9205 {
9206 if (GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
9207 {
9208 if (HasQuantity())
9209 {
9210 float energy_0to1 = GetCompEM().GetEnergy0To1();
9211 SetQuantityNormalized(energy_0to1);
9212 }
9213 }
9214 }
9215
9216 //----------------------------------------------------------------
9217 float GetHeatIsolationInit()
9218 {
9219 return ConfigGetFloat("heatIsolation");
9220 }
9221
9222 float GetHeatIsolation()
9223 {
9224 return m_HeatIsolation;
9225 }
9226
9227 float GetDryingIncrement(string pIncrementName)
9228 {
9229 string paramPath = string.Format("CfgVehicles %1 EnvironmentWetnessIncrements Drying %2", GetType(), pIncrementName);
9230 if (GetGame().ConfigIsExisting(paramPath))
9231 return GetGame().ConfigGetFloat(paramPath);
9232
9233 return 0.0;
9234 }
9235
9236 float GetSoakingIncrement(string pIncrementName)
9237 {
9238 string paramPath = string.Format("CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2", GetType(), pIncrementName);
9239 if (GetGame().ConfigIsExisting(paramPath))
9240 return GetGame().ConfigGetFloat(paramPath);
9241
9242 return 0.0;
9243 }
9244 //----------------------------------------------------------------
9245 override void SetWet(float value, bool allow_client = false)
9246 {
9247 if (!IsServerCheck(allow_client))
9248 return;
9249
9250 float min = GetWetMin();
9251 float max = GetWetMax();
9252
9253 float previousValue = m_VarWet;
9254
9255 m_VarWet = Math.Clamp(value, min, max);
9256
9257 if (previousValue != m_VarWet)
9258 {
9259 SetVariableMask(VARIABLE_WET);
9260 OnWetChanged(m_VarWet, previousValue);
9261 }
9262 }
9263 //----------------------------------------------------------------
9264 override void AddWet(float value)
9265 {
9266 SetWet(GetWet() + value);
9267 }
9268 //----------------------------------------------------------------
9269 override void SetWetMax()
9270 {
9272 }
9273 //----------------------------------------------------------------
9274 override float GetWet()
9275 {
9276 return m_VarWet;
9277 }
9278 //----------------------------------------------------------------
9279 override float GetWetMax()
9280 {
9281 return m_VarWetMax;
9282 }
9283 //----------------------------------------------------------------
9284 override float GetWetMin()
9285 {
9286 return m_VarWetMin;
9287 }
9288 //----------------------------------------------------------------
9289 override float GetWetInit()
9290 {
9291 return m_VarWetInit;
9292 }
9293 //----------------------------------------------------------------
9294 override void OnWetChanged(float newVal, float oldVal)
9295 {
9296 EWetnessLevel newLevel = GetWetLevelInternal(newVal);
9297 EWetnessLevel oldLevel = GetWetLevelInternal(oldVal);
9298 if (newLevel != oldLevel)
9299 {
9300 OnWetLevelChanged(newLevel,oldLevel);
9301 }
9302 }
9303
9304 override void OnWetLevelChanged(EWetnessLevel newLevel, EWetnessLevel oldLevel)
9305 {
9306 SetWeightDirty();
9307 }
9308
9309 override EWetnessLevel GetWetLevel()
9310 {
9311 return GetWetLevelInternal(m_VarWet);
9312 }
9313
9314 //----------------------------------------------------------------
9315
9316 override void SetStoreLoad(bool value)
9317 {
9318 m_IsStoreLoad = value;
9319 }
9320
9321 override bool IsStoreLoad()
9322 {
9323 return m_IsStoreLoad;
9324 }
9325
9326 override void SetStoreLoadedQuantity(float value)
9327 {
9328 m_StoreLoadedQuantity = value;
9329 }
9330
9331 override float GetStoreLoadedQuantity()
9332 {
9333 return m_StoreLoadedQuantity;
9334 }
9335
9336 //----------------------------------------------------------------
9337
9338 float GetItemModelLength()
9339 {
9340 if (ConfigIsExisting("itemModelLength"))
9341 {
9342 return ConfigGetFloat("itemModelLength");
9343 }
9344 return 0;
9345 }
9346
9347 float GetItemAttachOffset()
9348 {
9349 if (ConfigIsExisting("itemAttachOffset"))
9350 {
9351 return ConfigGetFloat("itemAttachOffset");
9352 }
9353 return 0;
9354 }
9355
9356 override void SetCleanness(int value, bool allow_client = false)
9357 {
9358 if (!IsServerCheck(allow_client))
9359 return;
9360
9361 int previousValue = m_Cleanness;
9362
9363 m_Cleanness = Math.Clamp(value, m_CleannessMin, m_CleannessMax);
9364
9365 if (previousValue != m_Cleanness)
9366 SetVariableMask(VARIABLE_CLEANNESS);
9367 }
9368
9369 override int GetCleanness()
9370 {
9371 return m_Cleanness;
9372 }
9373
9375 {
9376 return true;
9377 }
9378
9379 //----------------------------------------------------------------
9380 // ATTACHMENT LOCKING
9381 // Getters relevant to generic ActionLockAttachment
9382 int GetLockType()
9383 {
9384 return m_LockType;
9385 }
9386
9387 string GetLockSoundSet()
9388 {
9389 return m_LockSoundSet;
9390 }
9391
9392 //----------------------------------------------------------------
9393 //------------------------- Color
9394 // sets items color variable given color components
9395 override void SetColor(int r, int g, int b, int a)
9396 {
9401 SetVariableMask(VARIABLE_COLOR);
9402 }
9404 override void GetColor(out int r,out int g,out int b,out int a)
9405 {
9410 }
9411
9412 bool IsColorSet()
9413 {
9414 return IsVariableSet(VARIABLE_COLOR);
9415 }
9416
9418 string GetColorString()
9419 {
9420 int r,g,b,a;
9421 GetColor(r,g,b,a);
9422 r = r/255;
9423 g = g/255;
9424 b = b/255;
9425 a = a/255;
9426 return MiscGameplayFunctions.GetColorString(r, g, b, a);
9427 }
9428 //----------------------------------------------------------------
9429 //------------------------- LiquidType
9430
9431 override void SetLiquidType(int value, bool allow_client = false)
9432 {
9433 if (!IsServerCheck(allow_client))
9434 return;
9435
9436 int old = m_VarLiquidType;
9437 m_VarLiquidType = value;
9438 OnLiquidTypeChanged(old,value);
9439 SetVariableMask(VARIABLE_LIQUIDTYPE);
9440 }
9441
9442 int GetLiquidTypeInit()
9443 {
9444 return ConfigGetInt("varLiquidTypeInit");
9445 }
9446
9447 override int GetLiquidType()
9448 {
9449 return m_VarLiquidType;
9450 }
9451
9452 protected void OnLiquidTypeChanged(int oldType, int newType)
9453 {
9454 if (newType == LIQUID_NONE && GetIsFrozen())
9455 SetFrozen(false);
9456 }
9457
9459 void UpdateQuickbarShortcutVisibility(PlayerBase player)
9460 {
9461 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9462 }
9463
9464 // -------------------------------------------------------------------------
9466 void OnInventoryEnter(Man player)
9467 {
9468 PlayerBase nplayer;
9469 if (PlayerBase.CastTo(nplayer, player))
9470 {
9471 m_CanPlayImpactSound = true;
9472 //nplayer.OnItemInventoryEnter(this);
9473 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9474 }
9475 }
9476
9477 // -------------------------------------------------------------------------
9479 void OnInventoryExit(Man player)
9480 {
9481 PlayerBase nplayer;
9482 if (PlayerBase.CastTo(nplayer,player))
9483 {
9484 //nplayer.OnItemInventoryExit(this);
9485 nplayer.SetEnableQuickBarEntityShortcut(this,false);
9486
9487 }
9488
9489 //if (!GetGame().IsDedicatedServer())
9490 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
9491
9492
9493 if (HasEnergyManager())
9494 {
9495 GetCompEM().UpdatePlugState(); // Unplug the el. device if it's necesarry.
9496 }
9497 }
9498
9499 // ADVANCED PLACEMENT EVENTS
9500 override void OnPlacementStarted(Man player)
9501 {
9502 super.OnPlacementStarted(player);
9503
9504 SetTakeable(false);
9505 }
9506
9507 override void OnPlacementComplete(Man player, vector position = "0 0 0", vector orientation = "0 0 0")
9508 {
9509 if (m_AdminLog)
9510 {
9511 m_AdminLog.OnPlacementComplete(player, this);
9512 }
9513
9514 super.OnPlacementComplete(player, position, orientation);
9515 }
9516
9517 //-----------------------------
9518 // AGENT SYSTEM
9519 //-----------------------------
9520 //--------------------------------------------------------------------------
9521 bool ContainsAgent(int agent_id)
9522 {
9523 if (agent_id & m_AttachedAgents)
9524 {
9525 return true;
9526 }
9527 else
9528 {
9529 return false;
9530 }
9531 }
9532
9533 //--------------------------------------------------------------------------
9534 override void RemoveAgent(int agent_id)
9535 {
9536 if (ContainsAgent(agent_id))
9537 {
9538 m_AttachedAgents = ~agent_id & m_AttachedAgents;
9539 }
9540 }
9541
9542 //--------------------------------------------------------------------------
9543 override void RemoveAllAgents()
9544 {
9545 m_AttachedAgents = 0;
9546 }
9547 //--------------------------------------------------------------------------
9548 override void RemoveAllAgentsExcept(int agent_to_keep)
9549 {
9550 m_AttachedAgents = m_AttachedAgents & agent_to_keep;
9551 }
9552 // -------------------------------------------------------------------------
9553 override void InsertAgent(int agent, float count = 1)
9554 {
9555 if (count < 1)
9556 return;
9557 //Debug.Log("Inserting Agent on item: " + agent.ToString() +" count: " + count.ToString());
9559 }
9560
9562 void TransferAgents(int agents)
9563 {
9565 }
9566
9567 // -------------------------------------------------------------------------
9568 override int GetAgents()
9569 {
9570 return m_AttachedAgents;
9571 }
9572 //----------------------------------------------------------------------
9573
9574 /*int GetContaminationType()
9575 {
9576 int contamination_type;
9577
9578 const int CONTAMINATED_MASK = eAgents.CHOLERA | eAgents.INFLUENZA | eAgents.SALMONELLA | eAgents.BRAIN;
9579 const int POISONED_MASK = eAgents.FOOD_POISON | eAgents.CHEMICAL_POISON;
9580 const int NERVE_GAS_MASK = eAgents.CHEMICAL_POISON;
9581 const int DIRTY_MASK = eAgents.WOUND_AGENT;
9582
9583 Edible_Base edible = Edible_Base.Cast(this);
9584 int agents = GetAgents();
9585 if (edible)
9586 {
9587 NutritionalProfile profile = Edible_Base.GetNutritionalProfile(edible);
9588 if (profile)
9589 {
9590 agents = agents | profile.GetAgents();//merge item's agents with nutritional agents
9591 }
9592 }
9593 if (agents & CONTAMINATED_MASK)
9594 {
9595 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_CONTAMINATED;
9596 }
9597 if (agents & POISONED_MASK)
9598 {
9599 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_POISONED;
9600 }
9601 if (agents & NERVE_GAS_MASK)
9602 {
9603 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_NERVE_GAS;
9604 }
9605 if (agents & DIRTY_MASK)
9606 {
9607 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_DIRTY;
9608 }
9609
9610 return agents;
9611 }*/
9612
9613 // -------------------------------------------------------------------------
9614 bool LoadAgents(ParamsReadContext ctx, int version)
9615 {
9616 if (!ctx.Read(m_AttachedAgents))
9617 return false;
9618 return true;
9619 }
9620 // -------------------------------------------------------------------------
9622 {
9623
9625 }
9626 // -------------------------------------------------------------------------
9627
9629 override void CheckForRoofLimited(float timeTresholdMS = 3000)
9630 {
9631 super.CheckForRoofLimited(timeTresholdMS);
9632
9633 float time = GetGame().GetTime();
9634 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
9635 {
9636 m_PreviousRoofTestTime = time;
9637 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
9638 }
9639 }
9640
9641 // returns item's protection level against enviromental hazard, for masks with filters, returns the filters protection for valid filter, otherwise 0
9642 float GetProtectionLevel(int type, bool consider_filter = false, int system = 0)
9643 {
9644 if (IsDamageDestroyed() || (HasQuantity() && GetQuantity() <= 0))
9645 {
9646 return 0;
9647 }
9648
9649 if (GetInventory().GetAttachmentSlotsCount() != 0)//is it an item with attachable filter ?
9650 {
9651 ItemBase filter = ItemBase.Cast(FindAttachmentBySlotName("GasMaskFilter"));
9652 if (filter)
9653 return filter.GetProtectionLevel(type, false, system);//it's a valid filter, return the protection
9654 else
9655 return 0;//otherwise return 0 when no filter attached
9656 }
9657
9658 string subclassPath, entryName;
9659
9660 switch (type)
9661 {
9662 case DEF_BIOLOGICAL:
9663 entryName = "biological";
9664 break;
9665 case DEF_CHEMICAL:
9666 entryName = "chemical";
9667 break;
9668 default:
9669 entryName = "biological";
9670 break;
9671 }
9672
9673 subclassPath = "CfgVehicles " + this.GetType() + " Protection ";
9674
9675 return GetGame().ConfigGetFloat(subclassPath + entryName);
9676 }
9677
9678
9679
9681 override void EEOnCECreate()
9682 {
9683 if (!IsMagazine())
9685
9687 }
9688
9689
9690 //-------------------------
9691 // OPEN/CLOSE USER ACTIONS
9692 //-------------------------
9694 void Open();
9695 void Close();
9696 bool IsOpen()
9697 {
9698 return true;
9699 }
9700
9701 override bool CanDisplayCargo()
9702 {
9703 return IsOpen();
9704 }
9705
9706
9707 // ------------------------------------------------------------
9708 // CONDITIONS
9709 // ------------------------------------------------------------
9710 override bool CanPutInCargo(EntityAI parent)
9711 {
9712 if (parent)
9713 {
9714 if (parent.IsInherited(DayZInfected))
9715 return true;
9716
9717 if (!parent.IsRuined())
9718 return true;
9719 }
9720
9721 return true;
9722 }
9723
9724 override bool CanPutAsAttachment(EntityAI parent)
9725 {
9726 if (!super.CanPutAsAttachment(parent))
9727 {
9728 return false;
9729 }
9730
9731 if (!IsRuined() && !parent.IsRuined())
9732 {
9733 return true;
9734 }
9735
9736 return false;
9737 }
9738
9739 override bool CanReceiveItemIntoCargo(EntityAI item)
9740 {
9741 //removed 15.06. coz of loading from storage -> after load items in cargo was lost -> waiting for proper solution
9742 //if (GetHealthLevel() == GameConstants.STATE_RUINED)
9743 // return false;
9744
9745 return super.CanReceiveItemIntoCargo(item);
9746 }
9747
9748 override bool CanReceiveAttachment(EntityAI attachment, int slotId)
9749 {
9750 //removed 15.06. coz of loading from storage -> after load items in cargo was lost -> waiting for proper solution
9751 //if (GetHealthLevel() == GameConstants.STATE_RUINED)
9752 // return false;
9753
9754 GameInventory attachmentInv = attachment.GetInventory();
9755 if (attachmentInv && attachmentInv.GetCargo() && attachmentInv.GetCargo().GetItemCount() > 0)
9756 {
9757 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
9758 return false;
9759 }
9760
9761 InventoryLocation loc = new InventoryLocation();
9762 attachment.GetInventory().GetCurrentInventoryLocation(loc);
9763 if (loc && loc.IsValid() && !GetInventory().AreChildrenAccessible())
9764 return false;
9765
9766 return super.CanReceiveAttachment(attachment, slotId);
9767 }
9768
9769 override bool CanReleaseAttachment(EntityAI attachment)
9770 {
9771 if (!super.CanReleaseAttachment(attachment))
9772 return false;
9773
9774 return GetInventory().AreChildrenAccessible();
9775 }
9776
9777 /*override bool CanLoadAttachment(EntityAI attachment)
9778 {
9779 //removed 15.06. coz of loading from storage -> after load items in cargo was lost -> waiting for proper solution
9780 //if (GetHealthLevel() == GameConstants.STATE_RUINED)
9781 // return false;
9782
9783 GameInventory attachmentInv = attachment.GetInventory();
9784 if (attachmentInv && attachmentInv.GetCargo() && attachmentInv.GetCargo().GetItemCount() > 0)
9785 {
9786 bool boo = (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase));
9787 ErrorEx("CanLoadAttachment | this: " + this + " | attachment: " + attachment + " | boo: " + boo,ErrorExSeverity.INFO);
9788
9789 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
9790 return false;
9791 }
9792
9793 return super.CanLoadAttachment(attachment);
9794 }*/
9795
9796 // Plays muzzle flash particle effects
9797 static void PlayFireParticles(ItemBase weapon, int muzzle_index, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
9798 {
9799 int id = muzzle_owner.GetMuzzleID();
9800 array<ref WeaponParticlesOnFire> WPOF_array = m_OnFireEffect.Get(id);
9801
9802 if (WPOF_array)
9803 {
9804 for (int i = 0; i < WPOF_array.Count(); i++)
9805 {
9806 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
9807
9808 if (WPOF)
9809 {
9810 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
9811 }
9812 }
9813 }
9814 }
9815
9816 // Plays bullet eject particle effects (usually just smoke, the bullet itself is a 3D model and is not part of this function)
9817 static void PlayBulletCasingEjectParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
9818 {
9819 int id = muzzle_owner.GetMuzzleID();
9820 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = m_OnBulletCasingEjectEffect.Get(id);
9821
9822 if (WPOBE_array)
9823 {
9824 for (int i = 0; i < WPOBE_array.Count(); i++)
9825 {
9826 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
9827
9828 if (WPOBE)
9829 {
9830 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
9831 }
9832 }
9833 }
9834 }
9835
9836 // Plays all weapon overheating particles
9837 static void PlayOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
9838 {
9839 int id = muzzle_owner.GetMuzzleID();
9840 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9841
9842 if (WPOOH_array)
9843 {
9844 for (int i = 0; i < WPOOH_array.Count(); i++)
9845 {
9846 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9847
9848 if (WPOOH)
9849 {
9850 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
9851 }
9852 }
9853 }
9854 }
9855
9856 // Updates all weapon overheating particles
9857 static void UpdateOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
9858 {
9859 int id = muzzle_owner.GetMuzzleID();
9860 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9861
9862 if (WPOOH_array)
9863 {
9864 for (int i = 0; i < WPOOH_array.Count(); i++)
9865 {
9866 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9867
9868 if (WPOOH)
9869 {
9870 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9871 }
9872 }
9873 }
9874 }
9875
9876 // Stops overheating particles
9877 static void StopOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
9878 {
9879 int id = muzzle_owner.GetMuzzleID();
9880 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9881
9882 if (WPOOH_array)
9883 {
9884 for (int i = 0; i < WPOOH_array.Count(); i++)
9885 {
9886 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9887
9888 if (WPOOH)
9889 {
9890 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9891 }
9892 }
9893 }
9894 }
9895
9896 //----------------------------------------------------------------
9897 //Item Behaviour - unified approach
9898 override bool IsHeavyBehaviour()
9899 {
9900 if (m_ItemBehaviour == 0)
9901 {
9902 return true;
9903 }
9904
9905 return false;
9906 }
9907
9908 override bool IsOneHandedBehaviour()
9909 {
9910 if (m_ItemBehaviour == 1)
9911 {
9912 return true;
9913 }
9914
9915 return false;
9916 }
9917
9918 override bool IsTwoHandedBehaviour()
9919 {
9920 if (m_ItemBehaviour == 2)
9921 {
9922 return true;
9923 }
9924
9925 return false;
9926 }
9927
9928 bool IsDeployable()
9929 {
9930 return false;
9931 }
9932
9934 float GetDeployTime()
9935 {
9936 return UATimeSpent.DEFAULT_DEPLOY;
9937 }
9938
9939
9940 //----------------------------------------------------------------
9941 // Item Targeting (User Actions)
9942 override void SetTakeable(bool pState)
9943 {
9944 m_IsTakeable = pState;
9945 SetSynchDirty();
9946 }
9947
9948 override bool IsTakeable()
9949 {
9950 return m_IsTakeable;
9951 }
9952
9953 // For cases where we want to show object widget which cant be taken to hands
9955 {
9956 return false;
9957 }
9958
9960 protected void PreLoadSoundAttachmentType()
9961 {
9962 string att_type = "None";
9963
9964 if (ConfigIsExisting("soundAttType"))
9965 {
9966 att_type = ConfigGetString("soundAttType");
9967 }
9968
9969 m_SoundAttType = att_type;
9970 }
9971
9972 override string GetAttachmentSoundType()
9973 {
9974 return m_SoundAttType;
9975 }
9976
9977 //----------------------------------------------------------------
9978 //SOUNDS - ItemSoundHandler
9979 //----------------------------------------------------------------
9980
9981 string GetPlaceSoundset(); // played when deploy starts
9982 string GetLoopDeploySoundset(); // played when deploy starts and stopped when it finishes
9983 string GetDeploySoundset(); // played when deploy sucessfully finishes
9984
9986 {
9987 if (!m_ItemSoundHandler)
9989
9990 return m_ItemSoundHandler;
9991 }
9992
9993 // override to initialize sounds
9994 protected void InitItemSounds()
9995 {
9996 if (GetPlaceSoundset() == string.Empty && GetDeploySoundset() == string.Empty && GetLoopDeploySoundset() == string.Empty)
9997 return;
9998
10000
10001 if (GetPlaceSoundset() != string.Empty)
10002 handler.AddSound(SoundConstants.ITEM_PLACE, GetPlaceSoundset());
10003
10004 if (GetDeploySoundset() != string.Empty)
10005 handler.AddSound(SoundConstants.ITEM_DEPLOY, GetDeploySoundset());
10006
10007 SoundParameters params = new SoundParameters();
10008 params.m_Loop = true;
10009 if (GetLoopDeploySoundset() != string.Empty)
10010 handler.AddSound(SoundConstants.ITEM_DEPLOY_LOOP, GetLoopDeploySoundset(), params);
10011 }
10012
10013 // Start sound using ItemSoundHandler
10014 void StartItemSoundServer(int id)
10015 {
10016 if (!GetGame().IsServer())
10017 return;
10018
10019 m_SoundSyncPlay = id;
10020 SetSynchDirty();
10021
10022 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).Remove(ClearStartItemSoundServer); // in case one is queued already
10024 }
10025
10026 // Stop sound using ItemSoundHandler
10027 void StopItemSoundServer(int id)
10028 {
10029 if (!GetGame().IsServer())
10030 return;
10031
10032 m_SoundSyncStop = id;
10033 SetSynchDirty();
10034
10035 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).Remove(ClearStopItemSoundServer); // in case one is queued already
10037 }
10038
10039 protected void ClearStartItemSoundServer()
10040 {
10041 m_SoundSyncPlay = 0;
10042 }
10043
10044 protected void ClearStopItemSoundServer()
10045 {
10046 m_SoundSyncStop = 0;
10047 }
10048
10050 void PlayAttachSound(string slot_type)
10051 {
10052 if (!GetGame().IsDedicatedServer())
10053 {
10054 if (ConfigIsExisting("attachSoundSet"))
10055 {
10056 string cfg_path = "";
10057 string soundset = "";
10058 string type_name = GetType();
10059
10060 TStringArray cfg_soundset_array = new TStringArray;
10061 TStringArray cfg_slot_array = new TStringArray;
10062 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
10063 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
10064
10065 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
10066 {
10067 for (int i = 0; i < cfg_soundset_array.Count(); i++)
10068 {
10069 if (cfg_slot_array[i] == slot_type)
10070 {
10071 soundset = cfg_soundset_array[i];
10072 break;
10073 }
10074 }
10075 }
10076
10077 if (soundset != "")
10078 {
10079 EffectSound sound = SEffectManager.PlaySound(soundset, GetPosition());
10080 sound.SetAutodestroy(true);
10081 }
10082 }
10083 }
10084 }
10085
10086 void PlayDetachSound(string slot_type)
10087 {
10088 //TODO - evaluate if needed and devise universal config structure if so
10089 }
10090
10091 void OnApply(PlayerBase player);
10092
10094 {
10095 return 1.0;
10096 };
10097 //returns applicable selection
10098 array<string> GetHeadHidingSelection()
10099 {
10101 }
10102
10104 {
10106 }
10107
10108 WrittenNoteData GetWrittenNoteData() {};
10109
10111 {
10112 SetDynamicPhysicsLifeTime(0.01);
10113 m_ItemBeingDroppedPhys = false;
10114 }
10115
10117 {
10118 array<string> zone_names = new array<string>;
10119 GetDamageZones(zone_names);
10120 for (int i = 0; i < zone_names.Count(); i++)
10121 {
10122 SetHealthMax(zone_names.Get(i),"Health");
10123 }
10124 SetHealthMax("","Health");
10125 }
10126
10128 void SetZoneDamageCEInit()
10129 {
10130 float global_health = GetHealth01("","Health");
10131 array<string> zones = new array<string>;
10132 GetDamageZones(zones);
10133 //set damage of all zones to match global health level
10134 for (int i = 0; i < zones.Count(); i++)
10135 {
10136 SetHealth01(zones.Get(i),"Health",global_health);
10137 }
10138 }
10139
10141 bool IsCoverFaceForShave(string slot_name)
10142 {
10143 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
10144 }
10145
10146 void ProcessItemWetness(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
10147 {
10148 if (!hasRootAsPlayer)
10149 {
10150 if (refParentIB)
10151 {
10152 // parent is wet
10153 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (m_VarWet < m_VarWetMax))
10154 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
10155 // parent has liquid inside
10156 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (m_VarWet < m_VarWetMax))
10157 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
10158 // drying
10159 else if (m_VarWet > m_VarWetMin)
10160 AddWet(-1 * delta * GetDryingIncrement("ground") * 2);
10161 }
10162 else
10163 {
10164 // drying on ground or inside non-itembase (car, ...)
10165 if (m_VarWet > m_VarWetMin)
10166 AddWet(-1 * delta * GetDryingIncrement("ground"));
10167 }
10168 }
10169 }
10170
10171 void ProcessItemTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
10172 {
10174 {
10175 float target = g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(this);
10176 if (GetTemperature() != target || !IsFreezeThawProgressFinished())
10177 {
10178 float heatPermCoef = 1.0;
10179 EntityAI ent = this;
10180 while (ent)
10181 {
10182 heatPermCoef *= ent.GetHeatPermeabilityCoef();
10183 ent = ent.GetHierarchyParent();
10184 }
10185
10186 SetTemperatureEx(new TemperatureDataInterpolated(target,ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
10187 }
10188 }
10189 }
10190
10191 void HierarchyCheck(out bool hasParent, out bool hasRootAsPlayer, out ItemBase refParentIB)
10192 {
10193 // hierarchy check for an item to decide whether it has some parent and it is in some player inventory
10194 EntityAI parent = GetHierarchyParent();
10195 if (!parent)
10196 {
10197 hasParent = false;
10198 hasRootAsPlayer = false;
10199 }
10200 else
10201 {
10202 hasParent = true;
10203 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
10204 refParentIB = ItemBase.Cast(parent);
10205 }
10206 }
10207
10208 protected void ProcessDecay(float delta, bool hasRootAsPlayer)
10209 {
10210 // this is stub, implemented on Edible_Base
10211 }
10212
10213 bool CanDecay()
10214 {
10215 // return true used on selected food clases so they can decay
10216 return false;
10217 }
10218
10219 protected bool CanProcessDecay()
10220 {
10221 // this is stub, implemented on Edible_Base class
10222 // used to determine whether it is still necessary for the food to decay
10223 return false;
10224 }
10225
10226 protected bool CanHaveWetness()
10227 {
10228 // return true used on selected items that have a wetness effect
10229 return false;
10230 }
10231
10233 bool CanBeConsumed(ConsumeConditionData data = null)
10234 {
10235 return !GetIsFrozen() && IsOpen();
10236 }
10237
10238 override void ProcessVariables()
10239 {
10240 bool hasParent = false, hasRootAsPlayer = false;
10241 ItemBase refParentIB;
10242
10243 bool wwtu = g_Game.IsWorldWetTempUpdateEnabled();
10244 bool foodDecay = g_Game.IsFoodDecayEnabled();
10245
10246 if (wwtu || foodDecay)
10247 {
10248 bool processWetness = wwtu && CanHaveWetness();
10249 bool processTemperature = wwtu && CanHaveTemperature();
10250 bool processDecay = foodDecay && CanDecay() && CanProcessDecay();
10251
10252 if (processWetness || processTemperature || processDecay)
10253 {
10254 HierarchyCheck(hasParent, hasRootAsPlayer, refParentIB);
10255
10256 if (processWetness)
10257 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
10258
10259 if (processTemperature)
10260 ProcessItemTemperature(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
10261
10262 if (processDecay)
10263 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
10264 }
10265 }
10266 }
10267
10270 {
10271 return m_TemperaturePerQuantityWeight * GameConstants.ITEM_TEMPERATURE_QUANTITY_WEIGHT_MULTIPLIER;
10272 }
10273
10274 override float GetTemperatureFreezeThreshold()
10275 {
10277 return Liquid.GetFreezeThreshold(GetLiquidType());
10278
10279 return super.GetTemperatureFreezeThreshold();
10280 }
10281
10282 override float GetTemperatureThawThreshold()
10283 {
10285 return Liquid.GetThawThreshold(GetLiquidType());
10286
10287 return super.GetTemperatureThawThreshold();
10288 }
10289
10290 override float GetItemOverheatThreshold()
10291 {
10293 return Liquid.GetBoilThreshold(GetLiquidType());
10294
10295 return super.GetItemOverheatThreshold();
10296 }
10297
10298 override float GetTemperatureFreezeTime()
10299 {
10300 if (HasQuantity())
10301 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),GetQuantityNormalized());
10302
10303 return super.GetTemperatureFreezeTime();
10304 }
10305
10306 override float GetTemperatureThawTime()
10307 {
10308 if (HasQuantity())
10309 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),GetQuantityNormalized());
10310
10311 return super.GetTemperatureThawTime();
10312 }
10313
10315 void AffectLiquidContainerOnFill(int liquid_type, float amount);
10317 void AffectLiquidContainerOnTransfer(int liquidType, float amount, float sourceLiquidTemperature);
10318
10319 bool IsCargoException4x3(EntityAI item)
10320 {
10321 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
10322 }
10323
10325 {
10326 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
10327 }
10328
10330 void AddLightSourceItem(ItemBase lightsource)
10331 {
10332 m_LightSourceItem = lightsource;
10333 }
10334
10336 {
10337 m_LightSourceItem = null;
10338 }
10339
10341 {
10342 return m_LightSourceItem;
10343 }
10344
10346 array<int> GetValidFinishers()
10347 {
10348 return null;
10349 }
10350
10352 bool GetActionWidgetOverride(out typename name)
10353 {
10354 return false;
10355 }
10356
10357 bool PairWithDevice(notnull ItemBase otherDevice)
10358 {
10359 if (GetGame().IsServer())
10360 {
10361 ItemBase explosive = otherDevice;
10363 if (!trg)
10364 {
10365 trg = RemoteDetonatorTrigger.Cast(otherDevice);
10366 explosive = this;
10367 }
10368
10369 explosive.PairRemote(trg);
10370 trg.SetControlledDevice(explosive);
10371
10372 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
10373 trg.SetPersistentPairID(persistentID);
10374 explosive.SetPersistentPairID(persistentID);
10375
10376 return true;
10377 }
10378 return false;
10379 }
10380
10382 float GetBaitEffectivity()
10383 {
10384 float ret = 1.0;
10385 if (HasQuantity())
10386 ret *= GetQuantityNormalized();
10387 ret *= GetHealth01();
10388
10389 return ret;
10390 }
10391
10392 #ifdef DEVELOPER
10393 override void SetDebugItem()
10394 {
10395 super.SetDebugItem();
10396 _itemBase = this;
10397 }
10398
10399 override string GetDebugText()
10400 {
10401 string text = super.GetDebugText();
10402
10403 text += string.Format("Heat isolation(raw): %1\n", GetHeatIsolation());
10404 text += string.Format("Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(this));
10405
10406 return text;
10407 }
10408 #endif
10409
10410 bool CanBeUsedForSuicide()
10411 {
10412 return true;
10413 }
10414
10416 //DEPRECATED BELOW
10418 // Backwards compatibility
10419 void ProcessItemWetnessAndTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
10420 {
10421 ProcessItemWetness(delta, hasParent, hasRootAsPlayer, refParentIB);
10422 ProcessItemTemperature(delta, hasParent, hasRootAsPlayer, refParentIB);
10423 }
10424
10425 // replaced by ItemSoundHandler
10426 protected EffectSound m_SoundDeployFinish;
10427 protected EffectSound m_SoundPlace;
10428 protected EffectSound m_DeployLoopSoundEx;
10429 protected EffectSound m_SoundDeploy;
10430 bool m_IsPlaceSound;
10431 bool m_IsDeploySound;
10433
10434 string GetDeployFinishSoundset();
10435 void PlayDeploySound();
10436 void PlayDeployFinishSound();
10437 void PlayPlaceSound();
10438 void PlayDeployLoopSoundEx();
10439 void StopDeployLoopSoundEx();
10440 void SoundSynchRemoteReset();
10441 void SoundSynchRemote();
10442 bool UsesGlobalDeploy(){return false;}
10443 bool CanPlayDeployLoopSound(){return false;}
10445 bool IsPlaceSound(){return m_IsPlaceSound;}
10446 bool IsDeploySound(){return m_IsDeploySound;}
10447 void SetIsPlaceSound(bool is_place_sound);
10448 void SetIsDeploySound(bool is_deploy_sound);
10449}
10450
10451EntityAI SpawnItemOnLocation(string object_name, notnull InventoryLocation loc, bool full_quantity)
10452{
10453 EntityAI entity = SpawnEntity(object_name, loc, ECE_IN_INVENTORY, RF_DEFAULT);
10454 if (entity)
10455 {
10456 bool is_item = entity.IsInherited(ItemBase);
10457 if (is_item && full_quantity)
10458 {
10459 ItemBase item = ItemBase.Cast(entity);
10460 item.SetQuantity(item.GetQuantityInit());
10461 }
10462 }
10463 else
10464 {
10465 ErrorEx("Cannot spawn entity: " + object_name,ErrorExSeverity.INFO);
10466 return NULL;
10467 }
10468 return entity;
10469}
10470
10471void SetupSpawnedItem(ItemBase item, float health, float quantity)
10472{
10473 if (item)
10474 {
10475 if (health > 0)
10476 item.SetHealth("", "", health);
10477
10478 if (item.CanHaveTemperature())
10479 {
10480 item.SetTemperatureDirect(GameConstants.ITEM_TEMPERATURE_NEUTRAL_ZONE_MIDDLE);
10481 if (item.CanFreeze())
10482 item.SetFrozen(false);
10483 }
10484
10485 if (item.HasEnergyManager())
10486 {
10487 if (quantity >= 0)
10488 {
10489 item.GetCompEM().SetEnergy0To1(quantity);
10490 }
10491 else
10492 {
10493 item.GetCompEM().SetEnergy(Math.AbsFloat(quantity));
10494 }
10495 }
10496 else if (item.IsMagazine())
10497 {
10498 Magazine mag = Magazine.Cast(item);
10499 if (quantity >= 0)
10500 {
10501 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
10502 }
10503 else
10504 {
10505 mag.ServerSetAmmoCount(Math.AbsFloat(quantity));
10506 }
10507
10508 }
10509 else
10510 {
10511 if (quantity >= 0)
10512 {
10513 item.SetQuantityNormalized(quantity, false);
10514 }
10515 else
10516 {
10517 item.SetQuantity(Math.AbsFloat(quantity));
10518 }
10519
10520 }
10521 }
10522}
10523
10524#ifdef DEVELOPER
10525ItemBase _itemBase;//watched item goes here(LCTRL+RMB->Watch)
10526#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()