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

◆ CanMakeGardenplot()

bool SpawnItemOnLocation::CanMakeGardenplot ( )
private

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

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