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

◆ CanObstruct()

override bool SpawnItemOnLocation::CanObstruct ( )
private

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

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