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

◆ SplitIntoStackMaxClient()

override void SpawnItemOnLocation::SplitIntoStackMaxClient ( EntityAI destination_entity,
int slot_id )
private

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

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