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

◆ ChangeIntoOnDetach()

override string SpawnItemOnLocation::ChangeIntoOnDetach ( )
private

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

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