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

◆ IsSplitable()

override bool SpawnItemOnLocation::IsSplitable ( )
private

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

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

Используется в InventoryItem::CanBeSplit(), InventoryItem::GetTargetQuantityMax(), InventoryItem::GetUnitWeight(), InventoryItem::GetWeightSpecialized() и InventoryItem::OnVariablesSynchronized().