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

◆ CanBeSplit()

override bool SpawnItemOnLocation::CanBeSplit ( )
private

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

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