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

◆ DamageItemAttachments()

bool SpawnItemOnLocation::DamageItemAttachments ( float damage)
private

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

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

Используется в InventoryItem::EEHitBy().