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

◆ GetOverheatingValue()

float SpawnItemOnLocation::GetOverheatingValue ( )
private

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

5363{
5364 override bool CanPutAsAttachment(EntityAI parent)
5365 {
5366 return true;
5367 }
5368};
5369
5370//const bool QUANTITY_DEBUG_REMOVE_ME = false;
5371
5372class ItemBase extends InventoryItem
5373{
5377
5379
5380 static int m_DebugActionsMask;
5382 // ============================================
5383 // Variable Manipulation System
5384 // ============================================
5385 // Quantity
5386
5387 float m_VarQuantity;
5388 float m_VarQuantityPrev;//for client to know quantity changed during synchronization
5390 int m_VarQuantityMin;
5391 int m_VarQuantityMax;
5392 int m_Count;
5393 float m_VarStackMax;
5394 float m_StoreLoadedQuantity = float.LOWEST;
5395 // Wet
5396 float m_VarWet;
5397 float m_VarWetPrev;//for client to know wetness changed during synchronization
5398 float m_VarWetInit;
5399 float m_VarWetMin;
5400 float m_VarWetMax;
5401 // Cleanness
5402 int m_Cleanness;
5403 int m_CleannessInit;
5404 int m_CleannessMin;
5405 int m_CleannessMax;
5406 // impact sounds
5408 bool m_CanPlayImpactSound = true;
5409 float m_ImpactSpeed;
5411 //
5412 float m_HeatIsolation;
5413 float m_ItemModelLength;
5414 float m_ItemAttachOffset; // Offset length for when the item is attached e.g. to weapon
5416 int m_VarLiquidType;
5417 int m_ItemBehaviour; // -1 = not specified; 0 = heavy item; 1= onehanded item; 2 = twohanded item
5418 int m_QuickBarBonus;
5419 bool m_IsBeingPlaced;
5420 bool m_IsHologram;
5421 bool m_IsTakeable;
5422 bool m_ThrowItemOnDrop;
5425 bool m_FixDamageSystemInit = false; //can be changed on storage version check
5426 bool can_this_be_combined; //Check if item can be combined
5427 bool m_CanThisBeSplit; //Check if item can be split
5428 bool m_IsStoreLoad = false;
5429 bool m_CanShowQuantity;
5430 bool m_HasQuantityBar;
5431 protected bool m_CanBeDigged;
5432 protected bool m_IsResultOfSplit
5433
5434 string m_SoundAttType;
5435 // items color variables
5440 //-------------------------------------------------------
5441
5442 // light source managing
5444
5448
5449 //==============================================
5450 // agent system
5451 private int m_AttachedAgents;
5452
5454 void TransferModifiers(PlayerBase reciever);
5455
5456
5457 // Weapons & suppressors particle effects
5462 static int m_LastRegisteredWeaponID = 0;
5463
5464 // Overheating effects
5466 float m_OverheatingShots;
5467 ref Timer m_CheckOverheating;
5468 int m_ShotsToStartOverheating = 0; // After these many shots, the overheating effect begins
5469 int m_MaxOverheatingValue = 0; // Limits the number of shots that will be tracked
5470 float m_OverheatingDecayInterval = 1; // Timer's interval for decrementing overheat effect's lifespan
5471 ref array <ref OverheatingParticle> m_OverheatingParticles;
5472
5474 protected bool m_HideSelectionsBySlot;
5475
5476 // Admin Log
5477 PluginAdminLog m_AdminLog;
5478
5479 // misc
5480 ref Timer m_PhysDropTimer;
5481
5482 // Attachment Locking variables
5483 ref array<int> m_CompatibleLocks;
5484 protected int m_LockType;
5485 protected ref EffectSound m_LockingSound;
5486 protected string m_LockSoundSet;
5487
5488 // ItemSoundHandler
5489 protected const int ITEM_SOUNDS_MAX = 63; // optimize network synch
5490 protected int m_SoundSyncPlay; // id for sound to play
5491 protected int m_SoundSyncStop; // id for sound to stop
5493
5494 //temperature
5495 private float m_TemperaturePerQuantityWeight;
5496
5497 // -------------------------------------------------------------------------
5498 void ItemBase()
5499 {
5500 SetEventMask(EntityEvent.INIT); // Enable EOnInit event
5504
5505 if (!GetGame().IsDedicatedServer())
5506 {
5507 if (HasMuzzle())
5508 {
5510
5512 {
5514 }
5515 }
5516
5518 m_ActionsInitialize = false;
5519 }
5520
5521 m_OldLocation = null;
5522
5523 if (GetGame().IsServer())
5524 {
5525 m_AdminLog = PluginAdminLog.Cast(GetPlugin(PluginAdminLog));
5526 }
5527
5528 if (ConfigIsExisting("headSelectionsToHide"))
5529 {
5531 ConfigGetTextArray("headSelectionsToHide",m_HeadHidingSelections);
5532 }
5533
5534 m_HideSelectionsBySlot = false;
5535 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
5536 {
5537 m_HideSelectionsBySlot = ConfigGetBool("hideSelectionsByinventorySlot");
5538 }
5539
5540 m_QuickBarBonus = Math.Max(0, ConfigGetInt("quickBarBonus"));
5541
5542 m_IsResultOfSplit = false;
5543
5545 }
5546
5547 override void InitItemVariables()
5548 {
5549 super.InitItemVariables();
5550
5551 m_VarQuantityInit = ConfigGetInt("varQuantityInit");
5552 m_VarQuantity = m_VarQuantityInit;//should be by the CE, this is just a precaution
5553 m_VarQuantityMin = ConfigGetInt("varQuantityMin");
5554 m_VarQuantityMax = ConfigGetInt("varQuantityMax");
5555 m_VarStackMax = ConfigGetFloat("varStackMax");
5556 m_Count = ConfigGetInt("count");
5557
5558 m_CanShowQuantity = ConfigGetBool("quantityShow");
5559 m_HasQuantityBar = ConfigGetBool("quantityBar");
5560
5561 m_CleannessInit = ConfigGetInt("varCleannessInit");
5563 m_CleannessMin = ConfigGetInt("varCleannessMin");
5564 m_CleannessMax = ConfigGetInt("varCleannessMax");
5565
5566 m_WantPlayImpactSound = false;
5567 m_ImpactSpeed = 0.0;
5568
5569 m_VarWetInit = ConfigGetFloat("varWetInit");
5571 m_VarWetMin = ConfigGetFloat("varWetMin");
5572 m_VarWetMax = ConfigGetFloat("varWetMax");
5573
5574 m_LiquidContainerMask = ConfigGetInt("liquidContainerType");
5575 if (IsLiquidContainer() && GetQuantity() != 0)
5577 m_IsBeingPlaced = false;
5578 m_IsHologram = false;
5579 m_IsTakeable = true;
5580 m_CanBeMovedOverride = false;
5584 m_CanBeDigged = ConfigGetBool("canBeDigged");
5585
5586 m_CompatibleLocks = new array<int>();
5587 ConfigGetIntArray("compatibleLocks", m_CompatibleLocks);
5588 m_LockType = ConfigGetInt("lockType");
5589
5590 //Define if item can be split and set ability to be combined accordingly
5591 m_CanThisBeSplit = false;
5592 can_this_be_combined = false;
5593 if (ConfigIsExisting("canBeSplit"))
5594 {
5595 can_this_be_combined = ConfigGetBool("canBeSplit");
5597 }
5598
5599 m_ItemBehaviour = -1;
5600 if (ConfigIsExisting("itemBehaviour"))
5601 m_ItemBehaviour = ConfigGetInt("itemBehaviour");
5602
5603 //RegisterNetSyncVariableInt("m_VariablesMask");
5604 if (HasQuantity()) RegisterNetSyncVariableFloat("m_VarQuantity", GetQuantityMin(), m_VarQuantityMax);
5605 RegisterNetSyncVariableFloat("m_VarWet", GetWetMin(), GetWetMax(), 2);
5606 RegisterNetSyncVariableInt("m_VarLiquidType");
5607 RegisterNetSyncVariableInt("m_Cleanness",0,1);
5608
5609 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
5610 RegisterNetSyncVariableFloat("m_ImpactSpeed");
5611 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
5612
5613 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
5614 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
5615 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
5616 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
5617
5618 RegisterNetSyncVariableBool("m_IsBeingPlaced");
5619 RegisterNetSyncVariableBool("m_IsTakeable");
5620 RegisterNetSyncVariableBool("m_IsHologram");
5621
5622 InitItemSounds();
5624 {
5625 RegisterNetSyncVariableInt("m_SoundSyncPlay", 0, ITEM_SOUNDS_MAX);
5626 RegisterNetSyncVariableInt("m_SoundSyncStop", 0, ITEM_SOUNDS_MAX);
5627 }
5628
5629 m_LockSoundSet = ConfigGetString("lockSoundSet");
5630
5632 if (ConfigIsExisting("temperaturePerQuantityWeight"))
5633 m_TemperaturePerQuantityWeight = ConfigGetFloat("temperaturePerQuantityWeight");
5634
5635 }
5636
5637 override int GetQuickBarBonus()
5638 {
5639 return m_QuickBarBonus;
5640 }
5641
5642 void InitializeActions()
5643 {
5645 if (!m_InputActionMap)
5646 {
5648 m_InputActionMap = iam;
5649 SetActions();
5651 }
5652 }
5653
5654 override void GetActions(typename action_input_type, out array<ActionBase_Basic> actions)
5655 {
5657 {
5658 m_ActionsInitialize = true;
5660 }
5661
5662 actions = m_InputActionMap.Get(action_input_type);
5663 }
5664
5665 void SetActions()
5666 {
5667 AddAction(ActionTakeItem);
5668 AddAction(ActionTakeItemToHands);
5669 AddAction(ActionWorldCraft);
5671 AddAction(ActionAttachWithSwitch);
5672 }
5673
5674 void SetActionAnimOverrides(); // Override action animation for specific item
5675
5676 void AddAction(typename actionName)
5677 {
5678 ActionBase action = ActionManagerBase.GetAction(actionName);
5679
5680 if (!action)
5681 {
5682 Debug.LogError("Action " + actionName + " dosn't exist!");
5683 return;
5684 }
5685
5686 typename ai = action.GetInputType();
5687 if (!ai)
5688 {
5689 m_ActionsInitialize = false;
5690 return;
5691 }
5692
5693 array<ActionBase_Basic> action_array = m_InputActionMap.Get(ai);
5694 if (!action_array)
5695 {
5696 action_array = new array<ActionBase_Basic>;
5697 m_InputActionMap.Insert(ai, action_array);
5698 }
5699 if (LogManager.IsActionLogEnable())
5700 {
5701 Debug.ActionLog(action.ToString() + " -> " + ai, this.ToString() , "n/a", "Add action");
5702 }
5703
5704 if (action_array.Find(action) != -1)
5705 {
5706 Debug.Log("Action " + action.Type() + " already added to " + this + ", skipping!");
5707 }
5708 else
5709 {
5710 action_array.Insert(action);
5711 }
5712 }
5713
5714 void RemoveAction(typename actionName)
5715 {
5716 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
5717 ActionBase action = player.GetActionManager().GetAction(actionName);
5718 typename ai = action.GetInputType();
5719 array<ActionBase_Basic> action_array = m_InputActionMap.Get(ai);
5720
5721 if (action_array)
5722 {
5723 action_array.RemoveItem(action);
5724 }
5725 }
5726
5727 // Allows override of default action command per item, defined in the SetActionAnimOverrides() of the item's class
5728 // Set -1 for params which should stay in default state
5729 void OverrideActionAnimation(typename action, int commandUID, int stanceMask = -1, int commandUIDProne = -1)
5730 {
5731 ActionOverrideData overrideData = new ActionOverrideData();
5732 overrideData.m_CommandUID = commandUID;
5733 overrideData.m_CommandUIDProne = commandUIDProne;
5734 overrideData.m_StanceMask = stanceMask;
5735
5736 TActionAnimOverrideMap actionMap = m_ItemActionOverrides.Get(action);
5737 if (!actionMap) // create new map of action > overidables map
5738 {
5739 actionMap = new TActionAnimOverrideMap();
5740 m_ItemActionOverrides.Insert(action, actionMap);
5741 }
5742
5743 actionMap.Insert(this.Type(), overrideData); // insert item -> overrides
5744
5745 }
5746
5747 void OnItemInHandsPlayerSwimStart(PlayerBase player);
5748
5749 ScriptedLightBase GetLight();
5750
5751 // Loads muzzle flash particle configuration from config and saves it to a map for faster access
5752 void LoadParticleConfigOnFire(int id)
5753 {
5754 if (!m_OnFireEffect)
5756
5759
5760 string config_to_search = "CfgVehicles";
5761 string muzzle_owner_config;
5762
5763 if (!m_OnFireEffect.Contains(id))
5764 {
5765 if (IsInherited(Weapon))
5766 config_to_search = "CfgWeapons";
5767
5768 muzzle_owner_config = config_to_search + " " + GetType() + " ";
5769
5770 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
5771
5772 int config_OnFire_subclass_count = GetGame().ConfigGetChildrenCount(config_OnFire_class);
5773
5774 if (config_OnFire_subclass_count > 0)
5775 {
5776 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
5777
5778 for (int i = 0; i < config_OnFire_subclass_count; i++)
5779 {
5780 string particle_class = "";
5781 GetGame().ConfigGetChildName(config_OnFire_class, i, particle_class);
5782 string config_OnFire_entry = config_OnFire_class + particle_class;
5783 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
5784 WPOF_array.Insert(WPOF);
5785 }
5786
5787
5788 m_OnFireEffect.Insert(id, WPOF_array);
5789 }
5790 }
5791
5792 if (!m_OnBulletCasingEjectEffect.Contains(id))
5793 {
5794 config_to_search = "CfgWeapons"; // Bullet Eject efect is supported on weapons only.
5795 muzzle_owner_config = config_to_search + " " + GetType() + " ";
5796
5797 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
5798
5799 int config_OnBulletCasingEject_count = GetGame().ConfigGetChildrenCount(config_OnBulletCasingEject_class);
5800
5801 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
5802 {
5803 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
5804
5805 for (i = 0; i < config_OnBulletCasingEject_count; i++)
5806 {
5807 string particle_class2 = "";
5808 GetGame().ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
5809 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
5810 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
5811 WPOBE_array.Insert(WPOBE);
5812 }
5813
5814
5815 m_OnBulletCasingEjectEffect.Insert(id, WPOBE_array);
5816 }
5817 }
5818 }
5819
5820 // Loads muzzle flash particle configuration from config and saves it to a map for faster access
5822 {
5825
5826 if (!m_OnOverheatingEffect.Contains(id))
5827 {
5828 string config_to_search = "CfgVehicles";
5829
5830 if (IsInherited(Weapon))
5831 config_to_search = "CfgWeapons";
5832
5833 string muzzle_owner_config = config_to_search + " " + GetType() + " ";
5834 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
5835
5836 if (GetGame().ConfigIsExisting(config_OnOverheating_class))
5837 {
5838
5839 m_ShotsToStartOverheating = GetGame().ConfigGetFloat(config_OnOverheating_class + "shotsToStartOverheating");
5840
5842 {
5843 m_ShotsToStartOverheating = -1; // This prevents futher readings from config for future creations of this item
5844 string error = "Error reading config " + GetType() + ">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
5845 Error(error);
5846 return;
5847 }
5848
5849 m_OverheatingDecayInterval = GetGame().ConfigGetFloat(config_OnOverheating_class + "overheatingDecayInterval");
5850 m_MaxOverheatingValue = GetGame().ConfigGetFloat(config_OnOverheating_class + "maxOverheatingValue");
5851
5852
5853
5854 int config_OnOverheating_subclass_count = GetGame().ConfigGetChildrenCount(config_OnOverheating_class);
5855 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
5856
5857 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
5858 {
5859 string particle_class = "";
5860 GetGame().ConfigGetChildName(config_OnOverheating_class, i, particle_class);
5861 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
5862 int entry_type = GetGame().ConfigGetType(config_OnOverheating_entry);
5863
5864 if (entry_type == CT_CLASS)
5865 {
5866 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
5867 WPOOH_array.Insert(WPOF);
5868 }
5869 }
5870
5871
5872 m_OnOverheatingEffect.Insert(id, WPOOH_array);
5873 }
5874 }
5875 }
5876
5877 float GetOverheatingValue()
5878 {
5879 return m_OverheatingShots;
5880 }
5881
5882 void IncreaseOverheating(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
5883 {
5884 if (m_MaxOverheatingValue > 0)
5885 {
5887
5888 if (!m_CheckOverheating)
5890
5892 m_CheckOverheating.Run(m_OverheatingDecayInterval, this, "OnOverheatingDecay");
5893
5894 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
5895 }
5896 }
5897
5898 void CheckOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
5899 {
5901 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
5902
5904 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
5905
5907 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
5908
5910 {
5912 }
5913 }
5914
5916 {
5918 }
5919
5920 void OnOverheatingDecay()
5921 {
5922 if (m_MaxOverheatingValue > 0)
5923 m_OverheatingShots -= 1 + m_OverheatingShots / m_MaxOverheatingValue; // The hotter a barrel is, the faster it needs to cool down.
5924 else
5926
5927 if (m_OverheatingShots <= 0)
5928 {
5931 }
5932 else
5933 {
5934 if (!m_CheckOverheating)
5936
5938 m_CheckOverheating.Run(m_OverheatingDecayInterval, this, "OnOverheatingDecay");
5939 }
5940
5941 CheckOverheating(this, "", this);
5942 }
5943
5944 void StartOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
5945 {
5947 ItemBase.PlayOverheatingParticles(this, ammoType, this, suppressor, "CfgWeapons");
5948 }
5949
5950 void UpdateOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
5951 {
5953 ItemBase.UpdateOverheatingParticles(this, ammoType, this, suppressor, "CfgWeapons");
5955 }
5956
5957 void StopOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
5958 {
5960 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
5961 }
5962
5963 void RegisterOverheatingParticle(Particle p, float min_heat_coef, float max_heat_coef, int particle_id, Object parent, vector local_pos, vector local_ori)
5964 {
5966 m_OverheatingParticles = new array<ref OverheatingParticle>;
5967
5968 OverheatingParticle OP = new OverheatingParticle();
5969 OP.RegisterParticle(p);
5970 OP.SetOverheatingLimitMin(min_heat_coef);
5971 OP.SetOverheatingLimitMax(max_heat_coef);
5972 OP.SetParticleParams(particle_id, parent, local_pos, local_ori);
5973
5974 m_OverheatingParticles.Insert(OP);
5975 }
5976
5977 float GetOverheatingCoef()
5978 {
5979 if (m_MaxOverheatingValue > 0)
5981
5982 return -1;
5983 }
5984
5986 {
5988 {
5989 float overheat_coef = GetOverheatingCoef();
5990 int count = m_OverheatingParticles.Count();
5991
5992 for (int i = count; i > 0; --i)
5993 {
5994 int id = i - 1;
5995 OverheatingParticle OP = m_OverheatingParticles.Get(id);
5996 Particle p = OP.GetParticle();
5997
5998 float overheat_min = OP.GetOverheatingLimitMin();
5999 float overheat_max = OP.GetOverheatingLimitMax();
6000
6001 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
6002 {
6003 if (p)
6004 {
6005 p.Stop();
6006 OP.RegisterParticle(null);
6007 }
6008 }
6009 }
6010 }
6011 }
6012
6014 {
6016 {
6017 for (int i = m_OverheatingParticles.Count(); i > 0; i--)
6018 {
6019 int id = i - 1;
6020 OverheatingParticle OP = m_OverheatingParticles.Get(id);
6021
6022 if (OP)
6023 {
6024 Particle p = OP.GetParticle();
6025
6026 if (p)
6027 {
6028 p.Stop();
6029 }
6030
6031 delete OP;
6032 }
6033 }
6034
6035 m_OverheatingParticles.Clear();
6037 }
6038 }
6039
6041 float GetInfectionChance(int system = 0, Param param = null)
6042 {
6043 return 0.0;
6044 }
6045
6046
6047 float GetDisinfectQuantity(int system = 0, Param param1 = null)
6048 {
6049 return 250;//default value
6050 }
6051
6052 float GetFilterDamageRatio()
6053 {
6054 return 0;
6055 }
6056
6058 bool HasMuzzle()
6059 {
6060 if (IsInherited(Weapon) || IsInherited(SuppressorBase))
6061 return true;
6062
6063 return false;
6064 }
6065
6067 int GetMuzzleID()
6068 {
6069 if (!m_WeaponTypeToID)
6071
6072 if (m_WeaponTypeToID.Contains(GetType()))
6073 {
6074 return m_WeaponTypeToID.Get(GetType());
6075 }
6076 else
6077 {
6078 // Register new weapon ID
6080 }
6081
6083 }
6084
6091 {
6092 return -1;
6093 }
6094
6095
6096
6097 // -------------------------------------------------------------------------
6098 void ~ItemBase()
6099 {
6100 if (GetGame() && GetGame().GetPlayer() && (!GetGame().IsDedicatedServer()))
6101 {
6102 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
6103 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6104
6105 if (r_index >= 0)
6106 {
6107 InventoryLocation r_il = new InventoryLocation;
6108 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6109
6110 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6111 int r_type = r_il.GetType();
6112 if (r_type == InventoryLocationType.CARGO || r_type == InventoryLocationType.PROXYCARGO)
6113 {
6114 r_il.GetParent().GetOnReleaseLock().Invoke(this);
6115 }
6116 else if (r_type == InventoryLocationType.ATTACHMENT)
6117 {
6118 r_il.GetParent().GetOnAttachmentReleaseLock().Invoke(this, r_il.GetSlot());
6119 }
6120
6121 }
6122
6123 player.GetHumanInventory().ClearUserReservedLocation(this);
6124 }
6125
6126 if (m_LockingSound)
6127 SEffectManager.DestroyEffect(m_LockingSound);
6128 }
6129
6130
6131
6132 // -------------------------------------------------------------------------
6133 static int GetDebugActionsMask()
6134 {
6135 return ItemBase.m_DebugActionsMask;
6136 }
6137
6138 static bool HasDebugActionsMask(int mask)
6139 {
6140 return ItemBase.m_DebugActionsMask & mask;
6141 }
6142
6143 static void SetDebugActionsMask(int mask)
6144 {
6145 ItemBase.m_DebugActionsMask = mask;
6146 }
6147
6148 static void AddDebugActionsMask(int mask)
6149 {
6150 ItemBase.m_DebugActionsMask |= mask;
6151 }
6152
6153 static void RemoveDebugActionsMask(int mask)
6154 {
6155 ItemBase.m_DebugActionsMask &= ~mask;
6156 }
6157
6158 static void ToggleDebugActionsMask(int mask)
6159 {
6160 if (HasDebugActionsMask(mask))
6161 {
6163 }
6164 else
6165 {
6166 AddDebugActionsMask(mask);
6167 }
6168 }
6169
6170 // -------------------------------------------------------------------------
6171 void SetCEBasedQuantity()
6172 {
6173 if (GetEconomyProfile())
6174 {
6175 float q_max = GetEconomyProfile().GetQuantityMax();
6176 if (q_max > 0)
6177 {
6178 float q_min = GetEconomyProfile().GetQuantityMin();
6179 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
6180
6181 if (HasComponent(COMP_TYPE_ENERGY_MANAGER))//more direct access for speed
6182 {
6183 ComponentEnergyManager comp = GetCompEM();
6184 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
6185 {
6186 comp.SetEnergy0To1(quantity_randomized);
6187 }
6188 }
6189 else if (HasQuantity())
6190 {
6191 SetQuantityNormalized(quantity_randomized, false);
6192 //PrintString("<==> Normalized quantity for item: "+ GetType()+", qmin:"+q_min.ToString()+"; qmax:"+q_max.ToString()+";quantity:" +quantity_randomized.ToString());
6193 }
6194
6195 }
6196 }
6197 }
6198
6200 void LockToParent()
6201 {
6202 EntityAI parent = GetHierarchyParent();
6203
6204 if (parent)
6205 {
6206 InventoryLocation inventory_location_to_lock = new InventoryLocation;
6207 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
6208 parent.GetInventory().SetSlotLock(inventory_location_to_lock.GetSlot(), true);
6209 }
6210 }
6211
6213 void UnlockFromParent()
6214 {
6215 EntityAI parent = GetHierarchyParent();
6216
6217 if (parent)
6218 {
6219 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
6220 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
6221 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.GetSlot(), false);
6222 }
6223 }
6224
6225 override void CombineItemsClient(EntityAI entity2, bool use_stack_max = true)
6226 {
6227 /*
6228 ref Param1<EntityAI> item = new Param1<EntityAI>(entity2);
6229 RPCSingleParam(ERPCs.RPC_ITEM_COMBINE, item, GetGame().GetPlayer());
6230 */
6231 ItemBase item2 = ItemBase.Cast(entity2);
6232
6233 if (GetGame().IsClient())
6234 {
6235 if (ScriptInputUserData.CanStoreInputUserData())
6236 {
6237 ScriptInputUserData ctx = new ScriptInputUserData;
6239 ctx.Write(-1);
6240 ItemBase i1 = this; // @NOTE: workaround for correct serialization
6241 ctx.Write(i1);
6242 ctx.Write(item2);
6243 ctx.Write(use_stack_max);
6244 ctx.Write(-1);
6245 ctx.Send();
6246
6247 if (IsCombineAll(item2, use_stack_max))
6248 {
6249 GetGame().GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
6250 }
6251 }
6252 }
6253 else if (!GetGame().IsMultiplayer())
6254 {
6255 CombineItems(item2, use_stack_max);
6256 }
6257 }
6258
6259 bool IsLiquidPresent()
6260 {
6261 return (GetLiquidType() != 0 && HasQuantity());
6262 }
6263
6264 bool IsLiquidContainer()
6265 {
6266 return m_LiquidContainerMask != 0;
6267 }
6268
6270 {
6271 return m_LiquidContainerMask;
6272 }
6273
6274 bool IsBloodContainer()
6275 {
6276 //m_LiquidContainerMask & GROUP_LIQUID_BLOOD ???
6277 return false;
6278 }
6279
6280 bool IsNVG()
6281 {
6282 return false;
6283 }
6284
6287 bool IsExplosive()
6288 {
6289 return false;
6290 }
6291
6293 {
6294 return "";
6295 }
6296
6298
6299 bool IsLightSource()
6300 {
6301 return false;
6302 }
6303
6305 {
6306 return true;
6307 }
6308
6309 //--- ACTION CONDITIONS
6310 //direction
6311 bool IsFacingPlayer(PlayerBase player, string selection)
6312 {
6313 return true;
6314 }
6315
6316 bool IsPlayerInside(PlayerBase player, string selection)
6317 {
6318 return true;
6319 }
6320
6321 override bool CanObstruct()
6322 {
6323 PlayerBase player = PlayerBase.Cast(g_Game.GetPlayer());
6324 return !player || !IsPlayerInside(player, "");
6325 }
6326
6327 override bool IsBeingPlaced()
6328 {
6329 return m_IsBeingPlaced;
6330 }
6331
6332 void SetIsBeingPlaced(bool is_being_placed)
6333 {
6334 m_IsBeingPlaced = is_being_placed;
6335 if (!is_being_placed)
6337 SetSynchDirty();
6338 }
6339
6340 //server-side
6341 void OnEndPlacement() {}
6342
6343 override bool IsHologram()
6344 {
6345 return m_IsHologram;
6346 }
6347
6348 bool CanBeDigged()
6349 {
6350 return m_CanBeDigged;
6351 }
6352
6354 {
6355 return 1;
6356 }
6357
6358 bool CanMakeGardenplot()
6359 {
6360 return false;
6361 }
6362
6363 void SetIsHologram(bool is_hologram)
6364 {
6365 m_IsHologram = is_hologram;
6366 SetSynchDirty();
6367 }
6368 /*
6369 protected float GetNutritionalEnergy()
6370 {
6371 Edible_Base edible = Edible_Base.Cast(this);
6372 return edible.GetFoodEnergy();
6373 }
6374
6375 protected float GetNutritionalWaterContent()
6376 {
6377 Edible_Base edible = Edible_Base.Cast(this);
6378 return edible.GetFoodWater();
6379 }
6380
6381 protected float GetNutritionalIndex()
6382 {
6383 Edible_Base edible = Edible_Base.Cast(this);
6384 return edible.GetFoodNutritionalIndex();
6385 }
6386
6387 protected float GetNutritionalFullnessIndex()
6388 {
6389 Edible_Base edible = Edible_Base.Cast(this);
6390 return edible.GetFoodTotalVolume();
6391 }
6392
6393 protected float GetNutritionalToxicity()
6394 {
6395 Edible_Base edible = Edible_Base.Cast(this);
6396 return edible.GetFoodToxicity();
6397
6398 }
6399 */
6400
6401
6402 // -------------------------------------------------------------------------
6403 override void OnMovedInsideCargo(EntityAI container)
6404 {
6405 super.OnMovedInsideCargo(container);
6406
6407 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6408 }
6409
6410 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
6411 {
6412 super.EEItemLocationChanged(oldLoc,newLoc);
6413
6414 PlayerBase new_player = null;
6415 PlayerBase old_player = null;
6416
6417 if (newLoc.GetParent())
6418 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
6419
6420 if (oldLoc.GetParent())
6421 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
6422
6423 if (old_player && oldLoc.GetType() == InventoryLocationType.HANDS)
6424 {
6425 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
6426
6427 if (r_index >= 0)
6428 {
6429 InventoryLocation r_il = new InventoryLocation;
6430 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6431
6432 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6433 int r_type = r_il.GetType();
6434 if (r_type == InventoryLocationType.CARGO || r_type == InventoryLocationType.PROXYCARGO)
6435 {
6436 r_il.GetParent().GetOnReleaseLock().Invoke(this);
6437 }
6438 else if (r_type == InventoryLocationType.ATTACHMENT)
6439 {
6440 r_il.GetParent().GetOnAttachmentReleaseLock().Invoke(this, r_il.GetSlot());
6441 }
6442
6443 }
6444 }
6445
6446 if (newLoc.GetType() == InventoryLocationType.HANDS)
6447 {
6448 if (new_player)
6449 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
6450
6451 if (new_player == old_player)
6452 {
6453
6454 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
6455 {
6456 if (oldLoc.GetType() == InventoryLocationType.CARGO)
6457 {
6458 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
6459 {
6460 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6461 }
6462 }
6463 else
6464 {
6465 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6466 }
6467 }
6468
6469 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
6470 {
6471 int type = oldLoc.GetType();
6472 if (type == InventoryLocationType.CARGO || type == InventoryLocationType.PROXYCARGO)
6473 {
6474 oldLoc.GetParent().GetOnSetLock().Invoke(this);
6475 }
6476 else if (type == InventoryLocationType.ATTACHMENT)
6477 {
6478 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
6479 }
6480 }
6481 if (!m_OldLocation)
6482 {
6483 m_OldLocation = new InventoryLocation;
6484 }
6485 m_OldLocation.Copy(oldLoc);
6486 }
6487 else
6488 {
6489 if (m_OldLocation)
6490 {
6491 m_OldLocation.Reset();
6492 }
6493 }
6494
6496 }
6497 else
6498 {
6499 if (new_player)
6500 {
6501 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
6502 if (res_index >= 0)
6503 {
6504 InventoryLocation il = new InventoryLocation;
6505 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
6506 ItemBase it = ItemBase.Cast(il.GetItem());
6507 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
6508 int rel_type = il.GetType();
6509 if (rel_type == InventoryLocationType.CARGO || rel_type == InventoryLocationType.PROXYCARGO)
6510 {
6511 il.GetParent().GetOnReleaseLock().Invoke(it);
6512 }
6513 else if (rel_type == InventoryLocationType.ATTACHMENT)
6514 {
6515 il.GetParent().GetOnAttachmentReleaseLock().Invoke(it, il.GetSlot());
6516 }
6517 //it.GetOnReleaseLock().Invoke(it);
6518 }
6519 }
6520 else if (old_player && newLoc.GetType() == InventoryLocationType.GROUND && m_ThrowItemOnDrop)
6521 {
6522 //ThrowPhysically(old_player, vector.Zero);
6523 m_ThrowItemOnDrop = false;
6524 }
6525
6526 if (m_OldLocation)
6527 {
6528 m_OldLocation.Reset();
6529 }
6530 }
6531 }
6532
6533 override void EOnContact(IEntity other, Contact extra)
6534 {
6536 {
6537 int liquidType = -1;
6538 float impactSpeed = ProcessImpactSoundEx(other, extra, m_ConfigWeight, m_ImpactSoundSurfaceHash, liquidType);
6539 if (impactSpeed > 0.0)
6540 {
6541 m_ImpactSpeed = impactSpeed;
6542 #ifndef SERVER
6543 PlayImpactSound(m_ConfigWeight, m_ImpactSpeed, m_ImpactSoundSurfaceHash);
6544 #else
6545 m_WantPlayImpactSound = true;
6546 SetSynchDirty();
6547 #endif
6548 m_CanPlayImpactSound = (liquidType == -1);// prevents further playing of the sound when the surface is a liquid type
6549 }
6550 }
6551
6552 #ifdef SERVER
6553 if (GetCompEM() && GetCompEM().IsPlugged())
6554 {
6555 if (GetCompEM().GetCordLength() < vector.Distance(GetPosition(), GetCompEM().GetEnergySource().GetPosition()))
6556 GetCompEM().UnplugThis();
6557 }
6558 #endif
6559 }
6560
6561 void RefreshPhysics();
6562
6563 override void OnCreatePhysics()
6564 {
6566 }
6567
6568 override void OnItemAttachmentSlotChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
6569 {
6570
6571 }
6572 // -------------------------------------------------------------------------
6573 override void OnItemLocationChanged(EntityAI old_owner, EntityAI new_owner)
6574 {
6575 super.OnItemLocationChanged(old_owner, new_owner);
6576
6577 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
6578 PlayerBase playerNew = PlayerBase.Cast(new_owner);
6579
6580 if (!relatedPlayer && playerNew)
6581 relatedPlayer = playerNew;
6582
6583 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
6584 {
6585 ActionManagerBase actionMgr = relatedPlayer.GetActionManager();
6586 if (actionMgr)
6587 {
6588 ActionBase currentAction = actionMgr.GetRunningAction();
6589 if (currentAction)
6590 currentAction.OnItemLocationChanged(this);
6591 }
6592 }
6593
6594 Man ownerPlayerOld = null;
6595 Man ownerPlayerNew = null;
6596
6597 if (old_owner)
6598 {
6599 if (old_owner.IsMan())
6600 {
6601 ownerPlayerOld = Man.Cast(old_owner);
6602 }
6603 else
6604 {
6605 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
6606 }
6607 }
6608 else
6609 {
6610 if (new_owner && IsElectricAppliance() && GetCompEM() && GetCompEM().IsPlugged())
6611 {
6612 ActionBase action = ActionManagerBase.GetAction(ActionRepositionPluggedItem);
6613
6614 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.GetID())
6615 {
6616 GetCompEM().UnplugThis();
6617 }
6618 }
6619 }
6620
6621 if (new_owner)
6622 {
6623 if (new_owner.IsMan())
6624 {
6625 ownerPlayerNew = Man.Cast(new_owner);
6626 }
6627 else
6628 {
6629 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
6630 }
6631 }
6632
6633 if (ownerPlayerOld != ownerPlayerNew)
6634 {
6635 if (ownerPlayerOld)
6636 {
6637 array<EntityAI> subItemsExit = new array<EntityAI>;
6638 GetInventory().EnumerateInventory(InventoryTraversalType.PREORDER,subItemsExit);
6639 for (int i = 0; i < subItemsExit.Count(); i++)
6640 {
6641 ItemBase itemExit = ItemBase.Cast(subItemsExit.Get(i));
6642 itemExit.OnInventoryExit(ownerPlayerOld);
6643 }
6644 }
6645
6646 if (ownerPlayerNew)
6647 {
6648 array<EntityAI> subItemsEnter = new array<EntityAI>;
6649 GetInventory().EnumerateInventory(InventoryTraversalType.PREORDER,subItemsEnter);
6650 for (int j = 0; j < subItemsEnter.Count(); j++)
6651 {
6652 ItemBase itemEnter = ItemBase.Cast(subItemsEnter.Get(j));
6653 itemEnter.OnInventoryEnter(ownerPlayerNew);
6654 }
6655 }
6656 }
6657 else if (ownerPlayerNew != null)
6658 {
6659 PlayerBase nplayer;
6660 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
6661 {
6662 array<EntityAI> subItemsUpdate = new array<EntityAI>;
6663 GetInventory().EnumerateInventory(InventoryTraversalType.PREORDER,subItemsUpdate);
6664 for (int k = 0; k < subItemsUpdate.Count(); k++)
6665 {
6666 ItemBase itemUpdate = ItemBase.Cast(subItemsUpdate.Get(k));
6667 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
6668 }
6669 }
6670 }
6671
6672 if (old_owner)
6673 old_owner.OnChildItemRemoved(this);
6674 if (new_owner)
6675 new_owner.OnChildItemReceived(this);
6676 }
6677
6678 // -------------------------------------------------------------------------------
6679 override void EEDelete(EntityAI parent)
6680 {
6681 super.EEDelete(parent);
6682 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
6683 if (player)
6684 {
6685 OnInventoryExit(player);
6686
6687 if (player.IsAlive())
6688 {
6689 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6690 if (r_index >= 0)
6691 {
6692 InventoryLocation r_il = new InventoryLocation;
6693 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6694
6695 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6696 int r_type = r_il.GetType();
6697 if (r_type == InventoryLocationType.CARGO || r_type == InventoryLocationType.PROXYCARGO)
6698 {
6699 r_il.GetParent().GetOnReleaseLock().Invoke(this);
6700 }
6701 else if (r_type == InventoryLocationType.ATTACHMENT)
6702 {
6703 r_il.GetParent().GetOnAttachmentReleaseLock().Invoke(this, r_il.GetSlot());
6704 }
6705
6706 }
6707
6708 player.RemoveQuickBarEntityShortcut(this);
6709 }
6710 }
6711 }
6712 // -------------------------------------------------------------------------------
6713 override void EEKilled(Object killer)
6714 {
6715 super.EEKilled(killer);
6716
6718 if (killer && killer.IsFireplace() && CanExplodeInFire())
6719 {
6720 if (GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
6721 {
6722 if (IsMagazine())
6723 {
6724 if (Magazine.Cast(this).GetAmmoCount() > 0)
6725 {
6726 ExplodeAmmo();
6727 }
6728 }
6729 else
6730 {
6731 Explode(DamageType.EXPLOSION);
6732 }
6733 }
6734 }
6735 }
6736
6737 override void OnWasAttached(EntityAI parent, int slot_id)
6738 {
6739 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6740
6741 super.OnWasAttached(parent, slot_id);
6742
6743 if (HasQuantity())
6744 UpdateNetSyncVariableFloat("m_VarQuantity", GetQuantityMin(), m_VarQuantityMax);
6745
6746 PlayAttachSound(InventorySlots.GetSlotName(slot_id));
6747 }
6748
6749 override void OnWasDetached(EntityAI parent, int slot_id)
6750 {
6751 super.OnWasDetached(parent, slot_id);
6752
6753 if (HasQuantity())
6754 UpdateNetSyncVariableFloat("m_VarQuantity", GetQuantityMin(), m_VarQuantityMax);
6755 }
6756
6757 override string ChangeIntoOnAttach(string slot)
6758 {
6759 int idx;
6760 TStringArray inventory_slots = new TStringArray;
6761 TStringArray attach_types = new TStringArray;
6762
6763 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
6764 if (inventory_slots.Count() < 1) //is string
6765 {
6766 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
6767 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
6768 }
6769 else //is array
6770 {
6771 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
6772 }
6773
6774 idx = inventory_slots.Find(slot);
6775 if (idx < 0)
6776 return "";
6777
6778 return attach_types.Get(idx);
6779 }
6780
6781 override string ChangeIntoOnDetach()
6782 {
6783 int idx = -1;
6784 string slot;
6785
6786 TStringArray inventory_slots = new TStringArray;
6787 TStringArray detach_types = new TStringArray;
6788
6789 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
6790 if (inventory_slots.Count() < 1) //is string
6791 {
6792 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
6793 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
6794 }
6795 else //is array
6796 {
6797 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
6798 if (detach_types.Count() < 1)
6799 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
6800 }
6801
6802 for (int i = 0; i < inventory_slots.Count(); i++)
6803 {
6804 slot = inventory_slots.Get(i);
6805 }
6806
6807 if (slot != "")
6808 {
6809 if (detach_types.Count() == 1)
6810 idx = 0;
6811 else
6812 idx = inventory_slots.Find(slot);
6813 }
6814 if (idx < 0)
6815 return "";
6816
6817 return detach_types.Get(idx);
6818 }
6819
6820 void ExplodeAmmo()
6821 {
6822 //timer
6823 ref Timer explode_timer = new Timer(CALL_CATEGORY_SYSTEM);
6824
6825 //min/max time
6826 float min_time = 1;
6827 float max_time = 3;
6828 float delay = Math.RandomFloat(min_time, max_time);
6829
6830 explode_timer.Run(delay, this, "DoAmmoExplosion");
6831 }
6832
6833 void DoAmmoExplosion()
6834 {
6835 Magazine magazine = Magazine.Cast(this);
6836 int pop_sounds_count = 6;
6837 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
6838
6839 //play sound
6840 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
6841 string sound_name = pop_sounds[ sound_idx ];
6842 GetGame().CreateSoundOnObject(this, sound_name, 20, false);
6843
6844 //remove ammo count
6845 magazine.ServerAddAmmoCount(-1);
6846
6847 //if condition then repeat -> ExplodeAmmo
6848 float min_temp_to_explode = 100; //min temperature for item to explode
6849
6850 if (magazine.GetAmmoCount() > 0 && GetTemperature() >= min_temp_to_explode) //TODO ? add check for parent -> fireplace
6851 {
6852 ExplodeAmmo();
6853 }
6854 }
6855
6856 // -------------------------------------------------------------------------------
6857 override void EEHitBy(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
6858 {
6859 super.EEHitBy(damageResult, damageType, source, component, dmgZone, ammo, modelPos, speedCoef);
6860
6861 const int CHANCE_DAMAGE_CARGO = 4;
6862 const int CHANCE_DAMAGE_ATTACHMENT = 1;
6863 const int CHANCE_DAMAGE_NOTHING = 2;
6864
6865 if (IsClothing() || IsContainer() || IsItemTent())
6866 {
6867 float dmg = damageResult.GetDamage("","Health") * -0.5;
6868 int chances;
6869 int rnd;
6870
6871 if (GetInventory().GetCargo())
6872 {
6873 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
6874 rnd = Math.RandomInt(0,chances);
6875
6876 if (rnd < CHANCE_DAMAGE_CARGO)
6877 {
6878 DamageItemInCargo(dmg);
6879 }
6880 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
6881 {
6883 }
6884 }
6885 else
6886 {
6887 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
6888 rnd = Math.RandomInt(0,chances);
6889
6890 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
6891 {
6893 }
6894 }
6895 }
6896 }
6897
6898 bool DamageItemInCargo(float damage)
6899 {
6900 if (GetInventory().GetCargo())
6901 {
6902 int item_count = GetInventory().GetCargo().GetItemCount();
6903 if (item_count > 0)
6904 {
6905 int random_pick = Math.RandomInt(0, item_count);
6906 ItemBase item = ItemBase.Cast(GetInventory().GetCargo().GetItem(random_pick));
6907 if (!item.IsExplosive())
6908 {
6909 item.AddHealth("","",damage);
6910 return true;
6911 }
6912 }
6913 }
6914 return false;
6915 }
6916
6917 bool DamageItemAttachments(float damage)
6918 {
6919 int attachment_count = GetInventory().AttachmentCount();
6920 if (attachment_count > 0)
6921 {
6922 int random_pick = Math.RandomInt(0, attachment_count);
6923 ItemBase attachment = ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
6924 if (!attachment.IsExplosive())
6925 {
6926 attachment.AddHealth("","",damage);
6927 return true;
6928 }
6929 }
6930 return false;
6931 }
6932
6933 override bool IsSplitable()
6934 {
6935 return m_CanThisBeSplit;
6936 }
6937 //----------------
6938 override bool CanBeSplit()
6939 {
6940 if (IsSplitable() && (GetQuantity() > 1))
6941 return GetInventory().CanRemoveEntity();
6942
6943 return false;
6944 }
6945
6946 protected bool ShouldSplitQuantity(float quantity)
6947 {
6948 // don't call 'CanBeSplit' here, too strict and will introduce a freeze-crash when dismantling fence with a fireplace nearby
6949 if (!IsSplitable())
6950 return false;
6951
6952 // nothing to split?
6953 if (GetQuantity() <= 1)
6954 return false;
6955
6956 // check if we should re-use the item instead of creating a new copy?
6957 // implicit cast to int, if 'IsSplitable' returns true, these values are assumed ints
6958 int delta = GetQuantity() - quantity;
6959 if (delta == 0)
6960 return false;
6961
6962 // valid to split
6963 return true;
6964 }
6965
6966 override void SplitIntoStackMaxClient(EntityAI destination_entity, int slot_id )
6967 {
6968 if (GetGame().IsClient())
6969 {
6970 if (ScriptInputUserData.CanStoreInputUserData())
6971 {
6972 ScriptInputUserData ctx = new ScriptInputUserData;
6974 ctx.Write(1);
6975 ItemBase i1 = this; // @NOTE: workaround for correct serialization
6976 ctx.Write(i1);
6977 ctx.Write(destination_entity);
6978 ctx.Write(true);
6979 ctx.Write(slot_id);
6980 ctx.Send();
6981 }
6982 }
6983 else if (!GetGame().IsMultiplayer())
6984 {
6985 SplitIntoStackMax(destination_entity, slot_id, PlayerBase.Cast(GetGame().GetPlayer()));
6986 }
6987 }
6988
6989 void SplitIntoStackMax(EntityAI destination_entity, int slot_id, PlayerBase player)
6990 {
6991 float split_quantity_new;
6992 ItemBase new_item;
6993 float quantity = GetQuantity();
6994 float stack_max = GetTargetQuantityMax(slot_id);
6995 InventoryLocation loc = new InventoryLocation;
6996
6997 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
6998 {
6999 if (stack_max <= GetQuantity())
7000 split_quantity_new = stack_max;
7001 else
7002 split_quantity_new = GetQuantity();
7003
7004 if (ShouldSplitQuantity(split_quantity_new))
7005 {
7006 new_item = ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(this.GetType(), slot_id));
7007 if (new_item)
7008 {
7009 new_item.SetResultOfSplit(true);
7010 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7011 AddQuantity(-split_quantity_new, false, true);
7012 new_item.SetQuantity(split_quantity_new, false, true);
7013 }
7014 }
7015 }
7016 else if (destination_entity && slot_id == -1)
7017 {
7018 if (quantity > stack_max)
7019 split_quantity_new = stack_max;
7020 else
7021 split_quantity_new = quantity;
7022
7023 if (ShouldSplitQuantity(split_quantity_new))
7024 {
7025 if (destination_entity.GetInventory().FindFreeLocationFor(this, FindInventoryLocationType.ANY, loc))
7026 {
7027 Object o = destination_entity.GetInventory().LocationCreateEntity(loc, GetType(), ECE_IN_INVENTORY, RF_DEFAULT);
7028 new_item = ItemBase.Cast(o);
7029 }
7030
7031 if (new_item)
7032 {
7033 new_item.SetResultOfSplit(true);
7034 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7035 AddQuantity(-split_quantity_new, false, true);
7036 new_item.SetQuantity(split_quantity_new, false, true);
7037 }
7038 }
7039 }
7040 else
7041 {
7042 if (stack_max != 0)
7043 {
7044 if (stack_max < GetQuantity())
7045 {
7046 split_quantity_new = GetQuantity() - stack_max;
7047 }
7048
7049 if (split_quantity_new == 0)
7050 {
7051 if (!GetGame().IsMultiplayer())
7052 player.PhysicalPredictiveDropItem(this);
7053 else
7054 player.ServerDropEntity(this);
7055 return;
7056 }
7057
7058 if (ShouldSplitQuantity(split_quantity_new))
7059 {
7060 new_item = ItemBase.Cast(GetGame().CreateObjectEx(GetType(), player.GetWorldPosition(), ECE_PLACE_ON_SURFACE));
7061
7062 if (new_item)
7063 {
7064 new_item.SetResultOfSplit(true);
7065 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7066 SetQuantity(split_quantity_new, false, true);
7067 new_item.SetQuantity(stack_max, false, true);
7068 new_item.PlaceOnSurface();
7069 }
7070 }
7071 }
7072 }
7073 }
7074
7075 override void SplitIntoStackMaxEx(EntityAI destination_entity, int slot_id)
7076 {
7077 float split_quantity_new;
7078 ItemBase new_item;
7079 float quantity = GetQuantity();
7080 float stack_max = GetTargetQuantityMax(slot_id);
7081 InventoryLocation loc = new InventoryLocation;
7082
7083 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7084 {
7085 if (stack_max <= GetQuantity())
7086 split_quantity_new = stack_max;
7087 else
7088 split_quantity_new = GetQuantity();
7089
7090 if (ShouldSplitQuantity(split_quantity_new))
7091 {
7092 new_item = ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(this.GetType(), slot_id));
7093 if (new_item)
7094 {
7095 new_item.SetResultOfSplit(true);
7096 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7097 AddQuantity(-split_quantity_new, false, true);
7098 new_item.SetQuantity(split_quantity_new, false, true);
7099 }
7100 }
7101 }
7102 else if (destination_entity && slot_id == -1)
7103 {
7104 if (quantity > stack_max)
7105 split_quantity_new = stack_max;
7106 else
7107 split_quantity_new = quantity;
7108
7109 if (ShouldSplitQuantity(split_quantity_new))
7110 {
7111 if (destination_entity.GetInventory().FindFreeLocationFor(this, FindInventoryLocationType.ANY, loc))
7112 {
7113 Object o = destination_entity.GetInventory().LocationCreateEntity(loc, GetType(), ECE_IN_INVENTORY, RF_DEFAULT);
7114 new_item = ItemBase.Cast(o);
7115 }
7116
7117 if (new_item)
7118 {
7119 new_item.SetResultOfSplit(true);
7120 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7121 AddQuantity(-split_quantity_new, false, true);
7122 new_item.SetQuantity(split_quantity_new, false, true);
7123 }
7124 }
7125 }
7126 else
7127 {
7128 if (stack_max != 0)
7129 {
7130 if (stack_max < GetQuantity())
7131 {
7132 split_quantity_new = GetQuantity() - stack_max;
7133 }
7134
7135 if (ShouldSplitQuantity(split_quantity_new))
7136 {
7137 new_item = ItemBase.Cast(GetGame().CreateObjectEx(GetType(),GetWorldPosition(), ECE_PLACE_ON_SURFACE));
7138
7139 if (new_item)
7140 {
7141 new_item.SetResultOfSplit(true);
7142 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7143 SetQuantity(split_quantity_new, false, true);
7144 new_item.SetQuantity(stack_max, false, true);
7145 new_item.PlaceOnSurface();
7146 }
7147 }
7148 }
7149 }
7150 }
7151
7152 void SplitIntoStackMaxToInventoryLocationClient(notnull InventoryLocation dst)
7153 {
7154 if (GetGame().IsClient())
7155 {
7156 if (ScriptInputUserData.CanStoreInputUserData())
7157 {
7158 ScriptInputUserData ctx = new ScriptInputUserData;
7160 ctx.Write(4);
7161 ItemBase thiz = this; // @NOTE: workaround for correct serialization
7162 ctx.Write(thiz);
7163 dst.WriteToContext(ctx);
7164 ctx.Send();
7165 }
7166 }
7167 else if (!GetGame().IsMultiplayer())
7168 {
7170 }
7171 }
7172
7173 void SplitIntoStackMaxCargoClient(EntityAI destination_entity, int idx, int row, int col)
7174 {
7175 if (GetGame().IsClient())
7176 {
7177 if (ScriptInputUserData.CanStoreInputUserData())
7178 {
7179 ScriptInputUserData ctx = new ScriptInputUserData;
7181 ctx.Write(2);
7182 ItemBase dummy = this; // @NOTE: workaround for correct serialization
7183 ctx.Write(dummy);
7184 ctx.Write(destination_entity);
7185 ctx.Write(true);
7186 ctx.Write(idx);
7187 ctx.Write(row);
7188 ctx.Write(col);
7189 ctx.Send();
7190 }
7191 }
7192 else if (!GetGame().IsMultiplayer())
7193 {
7194 SplitIntoStackMaxCargo(destination_entity, idx, row, col);
7195 }
7196 }
7197
7198 void SplitIntoStackMaxToInventoryLocation(notnull InventoryLocation dst)
7199 {
7201 }
7202
7203 ItemBase SplitIntoStackMaxToInventoryLocationEx(notnull InventoryLocation dst)
7204 {
7205 float quantity = GetQuantity();
7206 float split_quantity_new;
7207 ItemBase new_item;
7208 if (dst.IsValid())
7209 {
7210 int slot_id = dst.GetSlot();
7211 float stack_max = GetTargetQuantityMax(slot_id);
7212
7213 if (quantity > stack_max)
7214 split_quantity_new = stack_max;
7215 else
7216 split_quantity_new = quantity;
7217
7218 if (ShouldSplitQuantity(split_quantity_new))
7219 {
7220 new_item = ItemBase.Cast(GameInventory.LocationCreateEntity(dst, this.GetType(), ECE_IN_INVENTORY, RF_DEFAULT));
7221
7222 if (new_item)
7223 {
7224 new_item.SetResultOfSplit(true);
7225 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7226 AddQuantity(-split_quantity_new, false, true);
7227 new_item.SetQuantity(split_quantity_new, false, true);
7228 }
7229
7230 return new_item;
7231 }
7232 }
7233
7234 return null;
7235 }
7236
7237 void SplitIntoStackMaxCargo(EntityAI destination_entity, int idx, int row, int col)
7238 {
7239 float quantity = GetQuantity();
7240 float split_quantity_new;
7241 ItemBase new_item;
7242 if (destination_entity)
7243 {
7244 float stackable = GetTargetQuantityMax();
7245 if (quantity > stackable)
7246 split_quantity_new = stackable;
7247 else
7248 split_quantity_new = quantity;
7249
7250 if (ShouldSplitQuantity(split_quantity_new))
7251 {
7252 new_item = ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(this.GetType(), idx, row, col, false));
7253 if (new_item)
7254 {
7255 new_item.SetResultOfSplit(true);
7256 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7257 AddQuantity(-split_quantity_new, false, true);
7258 new_item.SetQuantity(split_quantity_new, false, true);
7259 }
7260 }
7261 }
7262 }
7263
7264 void SplitIntoStackMaxHandsClient(PlayerBase player)
7265 {
7266 if (GetGame().IsClient())
7267 {
7268 if (ScriptInputUserData.CanStoreInputUserData())
7269 {
7270 ScriptInputUserData ctx = new ScriptInputUserData;
7272 ctx.Write(3);
7273 ItemBase i1 = this; // @NOTE: workaround for correct serialization
7274 ctx.Write(i1);
7275 ItemBase destination_entity = this;
7276 ctx.Write(destination_entity);
7277 ctx.Write(true);
7278 ctx.Write(0);
7279 ctx.Send();
7280 }
7281 }
7282 else if (!GetGame().IsMultiplayer())
7283 {
7284 SplitIntoStackMaxHands(player);
7285 }
7286 }
7287
7288 void SplitIntoStackMaxHands(PlayerBase player)
7289 {
7290 float quantity = GetQuantity();
7291 float split_quantity_new;
7292 ref ItemBase new_item;
7293 if (player)
7294 {
7295 float stackable = GetTargetQuantityMax();
7296 if (quantity > stackable)
7297 split_quantity_new = stackable;
7298 else
7299 split_quantity_new = quantity;
7300
7301 if (ShouldSplitQuantity(split_quantity_new))
7302 {
7303 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.GetType());
7304 new_item = ItemBase.Cast(in_hands);
7305 if (new_item)
7306 {
7307 new_item.SetResultOfSplit(true);
7308 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7309 AddQuantity(-split_quantity_new, false, true);
7310 new_item.SetQuantity(split_quantity_new, false, true);
7311 }
7312 }
7313 }
7314 }
7315
7316 void SplitItemToInventoryLocation(notnull InventoryLocation dst)
7317 {
7318 float quantity = GetQuantity();
7319 float split_quantity_new = Math.Floor(quantity * 0.5);
7320
7321 if (!ShouldSplitQuantity(split_quantity_new))
7322 return;
7323
7324 ItemBase new_item = ItemBase.Cast(GameInventory.LocationCreateEntity(dst, GetType(), ECE_IN_INVENTORY, RF_DEFAULT));
7325
7326 if (new_item)
7327 {
7328 if (new_item.GetQuantityMax() < split_quantity_new)
7329 {
7330 split_quantity_new = new_item.GetQuantityMax();
7331 }
7332
7333 new_item.SetResultOfSplit(true);
7334 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7335
7336 if (dst.IsValid() && dst.GetType() == InventoryLocationType.ATTACHMENT && split_quantity_new > 1)
7337 {
7338 AddQuantity(-1, false, true);
7339 new_item.SetQuantity(1, false, true);
7340 }
7341 else
7342 {
7343 AddQuantity(-split_quantity_new, false, true);
7344 new_item.SetQuantity(split_quantity_new, false, true);
7345 }
7346 }
7347 }
7348
7349 void SplitItem(PlayerBase player)
7350 {
7351 float quantity = GetQuantity();
7352 float split_quantity_new = Math.Floor(quantity / 2);
7353
7354 if (!ShouldSplitQuantity(split_quantity_new))
7355 return;
7356
7357 InventoryLocation invloc = new InventoryLocation;
7358 bool found = player.GetInventory().FindFirstFreeLocationForNewEntity(GetType(), FindInventoryLocationType.ATTACHMENT, invloc);
7359
7360 ItemBase new_item;
7361 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
7362
7363 if (new_item)
7364 {
7365 if (new_item.GetQuantityMax() < split_quantity_new)
7366 {
7367 split_quantity_new = new_item.GetQuantityMax();
7368 }
7369 if (found && invloc.IsValid() && invloc.GetType() == InventoryLocationType.ATTACHMENT && split_quantity_new > 1)
7370 {
7371 AddQuantity(-1, false, true);
7372 new_item.SetQuantity(1, false, true);
7373 }
7374 else if (split_quantity_new > 1)
7375 {
7376 AddQuantity(-split_quantity_new, false, true);
7377 new_item.SetQuantity(split_quantity_new, false, true);
7378 }
7379 }
7380 }
7381
7383 void OnQuantityChanged(float delta)
7384 {
7385 SetWeightDirty();
7386 ItemBase parent = ItemBase.Cast(GetHierarchyParent());
7387
7388 if (parent)
7389 parent.OnAttachmentQuantityChangedEx(this, delta);
7390
7391 if (IsLiquidContainer())
7392 {
7393 if (GetQuantityNormalized() <= 0.0)
7394 {
7396 }
7397 else if (GetLiquidType() == LIQUID_NONE)
7398 {
7399 ErrorEx("Undefined liquid type quantity changed, please define liquid type first! Using init value.",ErrorExSeverity.INFO);
7401 }
7402 }
7403
7404 }
7405
7408 {
7409 // insert code here
7410 }
7411
7413 void OnAttachmentQuantityChangedEx(ItemBase item , float delta)
7414 {
7416 }
7417
7418 override void EEHealthLevelChanged(int oldLevel, int newLevel, string zone)
7419 {
7420 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
7421
7422 if (GetGame().IsServer())
7423 {
7424 if (newLevel == GameConstants.STATE_RUINED)
7425 {
7427 EntityAI parent = GetHierarchyParent();
7428 if (parent && parent.IsFireplace())
7429 {
7430 CargoBase cargo = GetInventory().GetCargo();
7431 if (cargo)
7432 {
7433 for (int i = 0; i < cargo.GetItemCount(); ++i)
7434 {
7435 parent.GetInventory().TakeEntityToInventory(InventoryMode.SERVER, FindInventoryLocationType.CARGO, cargo.GetItem(i));
7436 }
7437 }
7438 }
7439 }
7440
7441 if (IsResultOfSplit())
7442 {
7443 // reset the splitting result flag, return to normal item behavior
7444 SetResultOfSplit(false);
7445 return;
7446 }
7447
7448 if (m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
7449 {
7450 SetCleanness(0);//unclean the item upon damage dealt
7451 }
7452 }
7453 }
7454
7455 // just the split? TODO: verify
7456 override void OnRightClick()
7457 {
7458 super.OnRightClick();
7459
7460 if (CanBeSplit() && !GetDayZGame().IsLeftCtrlDown() && !GetGame().GetPlayer().GetInventory().HasInventoryReservation(this,null))
7461 {
7462 if (GetGame().IsClient())
7463 {
7464 if (ScriptInputUserData.CanStoreInputUserData())
7465 {
7466 EntityAI root = GetHierarchyRoot();
7467 Man playerOwner = GetHierarchyRootPlayer();
7468 InventoryLocation dst = new InventoryLocation;
7469
7470 // If we have no hierarchy root player and the root is the same as this item the source item is in the vicinity so we want to create the new split item there also
7471 if (!playerOwner && root && root == this)
7472 {
7474 }
7475 else
7476 {
7477 // Check if we can place the new split item in the same parent where the source item is placed in or otherwise drop it in vicinity
7478 GetInventory().GetCurrentInventoryLocation(dst);
7479 if (!dst.GetParent() || dst.GetParent() && !dst.GetParent().GetInventory().FindFreeLocationFor(this, FindInventoryLocationType.CARGO, dst))
7480 {
7481 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
7482 if (!player.GetInventory().FindFreeLocationFor(this, FindInventoryLocationType.CARGO, dst) || !playerOwner)
7483 {
7485 }
7486 else
7487 {
7488 dst.SetCargo(dst.GetParent(), this, dst.GetIdx(), dst.GetRow(), dst.GetCol(), dst.GetFlip());
7489 /* hacky solution to check reservation of "this" item instead of null since the gamecode is checking null against null and returning reservation=true incorrectly
7490 this shouldnt cause issues within this scope*/
7491 if (GetGame().GetPlayer().GetInventory().HasInventoryReservation(this, dst))
7492 {
7494 }
7495 else
7496 {
7497 GetGame().GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
7498 }
7499 }
7500 }
7501 }
7502
7503 ScriptInputUserData ctx = new ScriptInputUserData;
7505 ctx.Write(4);
7506 ItemBase thiz = this; // @NOTE: workaround for correct serialization
7507 ctx.Write(thiz);
7508 dst.WriteToContext(ctx);
7509 ctx.Write(true); // dummy
7510 ctx.Send();
7511 }
7512 }
7513 else if (!GetGame().IsMultiplayer())
7514 {
7515 SplitItem(PlayerBase.Cast(GetGame().GetPlayer()));
7516 }
7517 }
7518 }
7519
7520 protected void SetInventoryLocationToVicinityOrCurrent(EntityAI root, inout InventoryLocation dst)
7521 {
7522 if (root)
7523 {
7524 vector m4[4];
7525 root.GetTransform(m4);
7526 dst.SetGround(this, m4);
7527 }
7528 else
7529 {
7530 GetInventory().GetCurrentInventoryLocation(dst);
7531 }
7532 }
7533
7534 override bool CanBeCombined(EntityAI other_item, bool reservation_check = true, bool stack_max_limit = false)
7535 {
7536 //TODO: delete check zero quantity check after fix double posts hands fsm events
7537 if (!other_item || GetType() != other_item.GetType() || (IsFullQuantity() && other_item.GetQuantity() > 0) || other_item == this)
7538 return false;
7539
7540 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
7541 return false;
7542
7543 //can_this_be_combined = ConfigGetBool("canBeSplit");
7545 return false;
7546
7547
7548 Magazine mag = Magazine.Cast(this);
7549 if (mag)
7550 {
7551 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
7552 return false;
7553
7554 if (stack_max_limit)
7555 {
7556 Magazine other_mag = Magazine.Cast(other_item);
7557 if (other_item)
7558 {
7559 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
7560 return false;
7561 }
7562
7563 }
7564 }
7565 else
7566 {
7567 //TODO: delete check zero quantity check after fix double posts hands fsm events
7568 if (GetQuantity() >= GetQuantityMax() && other_item.GetQuantity() > 0 )
7569 return false;
7570
7571 if (stack_max_limit && (GetQuantity() + other_item.GetQuantity() > GetQuantityMax()))
7572 return false;
7573 }
7574
7575 PlayerBase player = null;
7576 if (CastTo(player, GetHierarchyRootPlayer())) //false when attached to player's attachment slot
7577 {
7578 if (player.GetInventory().HasAttachment(this))
7579 return false;
7580
7581 if (player.IsItemsToDelete())
7582 return false;
7583 }
7584
7585 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
7586 return false;
7587
7588 int slotID;
7589 string slotName;
7590 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
7591 return false;
7592
7593 return true;
7594 }
7595
7596 bool IsCombineAll(ItemBase other_item, bool use_stack_max = false)
7597 {
7598 return ComputeQuantityUsed(other_item, use_stack_max) == other_item.GetQuantity();
7599 }
7600
7601 bool IsResultOfSplit()
7602 {
7603 return m_IsResultOfSplit;
7604 }
7605
7606 void SetResultOfSplit(bool value)
7607 {
7608 m_IsResultOfSplit = value;
7609 }
7610
7611 int ComputeQuantityUsed(ItemBase other_item, bool use_stack_max = true)
7612 {
7613 return ComputeQuantityUsedEx(other_item, use_stack_max);
7614 }
7615
7616 float ComputeQuantityUsedEx(ItemBase other_item, bool use_stack_max = true)
7617 {
7618 float other_item_quantity = other_item.GetQuantity();
7619 float this_free_space;
7620
7621 float stack_max = GetQuantityMax();
7622
7623 this_free_space = stack_max - GetQuantity();
7624
7625 if (other_item_quantity > this_free_space)
7626 {
7627 return this_free_space;
7628 }
7629 else
7630 {
7631 return other_item_quantity;
7632 }
7633 }
7634
7635 override void CombineItemsEx(EntityAI entity2, bool use_stack_max = true)
7636 {
7637 CombineItems(ItemBase.Cast(entity2),use_stack_max);
7638 }
7639
7640 void CombineItems(ItemBase other_item, bool use_stack_max = true)
7641 {
7642 if (!CanBeCombined(other_item, false))
7643 return;
7644
7645 if (!IsMagazine() && other_item)
7646 {
7647 float quantity_used = ComputeQuantityUsedEx(other_item,use_stack_max);
7648 if (quantity_used != 0)
7649 {
7650 float hp1 = GetHealth01("","");
7651 float hp2 = other_item.GetHealth01("","");
7652 float hpResult = ((hp1*GetQuantity()) + (hp2*quantity_used));
7653 hpResult = hpResult / (GetQuantity() + quantity_used);
7654
7655 hpResult *= GetMaxHealth();
7656 Math.Round(hpResult);
7657 SetHealth("", "Health", hpResult);
7658
7659 AddQuantity(quantity_used);
7660 other_item.AddQuantity(-quantity_used);
7661 }
7662 }
7663 OnCombine(other_item);
7664 }
7665
7666 void OnCombine(ItemBase other_item)
7667 {
7668 #ifdef SERVER
7669 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
7670 GetHierarchyParent().IncreaseLifetimeUp();
7671 #endif
7672 };
7673
7674 void GetRecipesActions(Man player, out TSelectableActionInfoArray outputList)
7675 {
7676 PlayerBase p = PlayerBase.Cast(player);
7677
7678 array<int> recipesIds = p.m_Recipes;
7679 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(GetPlugin(PluginRecipesManager));
7680 if (moduleRecipesManager)
7681 {
7682 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
7683 moduleRecipesManager.GetValidRecipes(ItemBase.Cast(this), ItemBase.Cast(itemInHands), recipesIds, p);
7684 }
7685
7686 for (int i = 0;i < recipesIds.Count(); i++)
7687 {
7688 int key = recipesIds.Get(i);
7689 string recipeName = moduleRecipesManager.GetRecipeName(key);
7690 outputList.Insert(new TSelectableActionInfo(SAT_CRAFTING, key, recipeName));
7691 }
7692 }
7693
7694 // -------------------------------------------------------------------------
7695 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
7696 {
7697 super.GetDebugActions(outputList);
7698
7699 //quantity
7700 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_QUANTITY, "Quantity +20%", FadeColors.LIGHT_GREY));
7701 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_QUANTITY, "Quantity -20%", FadeColors.LIGHT_GREY));
7702 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SET_QUANTITY_0, "Set Quantity 0", FadeColors.LIGHT_GREY));
7703 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SET_MAX_QUANTITY, "Set Quantity Max", FadeColors.LIGHT_GREY));
7704 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
7705
7706 //health
7707 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_HEALTH, "Health +20%", FadeColors.LIGHT_GREY));
7708 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_HEALTH, "Health -20%", FadeColors.LIGHT_GREY));
7709 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.DESTROY_HEALTH, "Health 0", FadeColors.LIGHT_GREY));
7710 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
7711 //temperature
7712 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_TEMPERATURE, "Temperature +20", FadeColors.LIGHT_GREY));
7713 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_TEMPERATURE, "Temperature -20", FadeColors.LIGHT_GREY));
7714 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.FLIP_FROZEN, "Toggle Frozen", FadeColors.LIGHT_GREY));
7715 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
7716
7717 //wet
7718 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_WETNESS, "Wetness +20", FadeColors.LIGHT_GREY));
7719 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_WETNESS, "Wetness -20", FadeColors.LIGHT_GREY));
7720 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
7721
7722 //liquidtype
7723 if (IsLiquidContainer())
7724 {
7725 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.LIQUIDTYPE_UP, "LiquidType Next", FadeColors.LIGHT_GREY));
7726 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.LIQUIDTYPE_DOWN, "LiquidType Previous", FadeColors.LIGHT_GREY));
7727 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
7728 }
7729
7730 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.MAKE_SPECIAL, "Make Special", FadeColors.LIGHT_GREY));
7731 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
7732
7733 // watch
7734 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.WATCH_ITEM, "Watch (CTRL-Z)", FadeColors.LIGHT_GREY));
7735 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.WATCH_PLAYER, "Watch Player", FadeColors.LIGHT_GREY));
7736 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
7737
7738 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.DELETE, "Delete", FadeColors.RED));
7739
7740 InventoryLocation loc = new InventoryLocation();
7741 GetInventory().GetCurrentInventoryLocation(loc);
7742 if (!loc || loc.GetType() == InventoryLocationType.GROUND)
7743 {
7744 if (Gizmo_IsSupported())
7745 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.GIZMO_OBJECT, "Gizmo Object", FadeColors.LIGHT_GREY));
7746 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.GIZMO_PHYSICS, "Gizmo Physics (SP Only)", FadeColors.LIGHT_GREY)); // intentionally allowed for testing physics desync
7747 }
7748
7749 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
7750 }
7751
7752 // -------------------------------------------------------------------------
7753 // -------------------------------------------------------------------------
7754 // -------------------------------------------------------------------------
7755 override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
7756 {
7757 super.OnAction(action_id, player, ctx);
7758
7759 if (GetGame().IsClient() || !GetGame().IsMultiplayer())
7760 {
7761 switch (action_id)
7762 {
7763 case EActions.GIZMO_OBJECT:
7764 GetGame().GizmoSelectObject(this);
7765 return true;
7766 case EActions.GIZMO_PHYSICS:
7767 GetGame().GizmoSelectPhysics(GetPhysics());
7768 return true;
7769 }
7770 }
7771
7772 if (GetGame().IsServer())
7773 {
7774 switch (action_id)
7775 {
7776 case EActions.DELETE:
7777 Delete();
7778 return true;
7779 }
7780 }
7781
7782 if (action_id >= EActions.RECIPES_RANGE_START && action_id < EActions.RECIPES_RANGE_END)
7783 {
7784 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(GetPlugin(PluginRecipesManager));
7785 int idWithoutOffset = action_id - EActions.RECIPES_RANGE_START;
7786 PlayerBase p = PlayerBase.Cast(player);
7787 if (EActions.RECIPES_RANGE_START < 1000)
7788 {
7789 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
7790 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
7791 }
7792 }
7793 #ifndef SERVER
7794 else if (action_id == EActions.WATCH_PLAYER)
7795 {
7796 PluginDeveloper.SetDeveloperItemClientEx(player);
7797 }
7798 #endif
7799 if (GetGame().IsServer())
7800 {
7801 if (action_id >= EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id < EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
7802 {
7803 int id = action_id - EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
7804 OnDebugButtonPressServer(id + 1);
7805 }
7806
7807 else if (action_id >= EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id < EActions.DEBUG_AGENTS_RANGE_INJECT_END)
7808 {
7809 int agent_id = action_id - EActions.DEBUG_AGENTS_RANGE_INJECT_START;
7810 InsertAgent(agent_id,100);
7811 }
7812
7813 else if (action_id >= EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id < EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
7814 {
7815 int agent_id2 = action_id - EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
7816 RemoveAgent(agent_id2);
7817 }
7818
7819 else if (action_id == EActions.ADD_QUANTITY)
7820 {
7821 if (IsMagazine())
7822 {
7823 Magazine mag = Magazine.Cast(this);
7824 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
7825 }
7826 else
7827 {
7828 AddQuantity(GetQuantityMax() * 0.2);
7829 }
7830
7831 if (m_EM)
7832 {
7833 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
7834 }
7835 //PrintVariables();
7836 }
7837
7838 else if (action_id == EActions.REMOVE_QUANTITY) //Quantity -20%
7839 {
7840 if (IsMagazine())
7841 {
7842 Magazine mag2 = Magazine.Cast(this);
7843 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
7844 }
7845 else
7846 {
7847 AddQuantity(- GetQuantityMax() * 0.2);
7848 }
7849 if (m_EM)
7850 {
7851 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
7852 }
7853 //PrintVariables();
7854 }
7855
7856 else if (action_id == EActions.SET_QUANTITY_0) //SetMaxQuantity
7857 {
7858 SetQuantity(0);
7859
7860 if (m_EM)
7861 {
7862 m_EM.SetEnergy(0);
7863 }
7864 }
7865
7866 else if (action_id == EActions.SET_MAX_QUANTITY) //SetMaxQuantity
7867 {
7869
7870 if (m_EM)
7871 {
7872 m_EM.SetEnergy(m_EM.GetEnergyMax());
7873 }
7874 }
7875
7876 else if (action_id == EActions.ADD_HEALTH)
7877 {
7878 AddHealth("","",GetMaxHealth("","Health")/5);
7879 }
7880 else if (action_id == EActions.REMOVE_HEALTH)
7881 {
7882 AddHealth("","",-GetMaxHealth("","Health")/5);
7883 }
7884 else if (action_id == EActions.DESTROY_HEALTH)
7885 {
7886 SetHealth01("","",0);
7887 }
7888 else if (action_id == EActions.WATCH_ITEM)
7889 {
7891 mid.RegisterDebugItem(ItemBase.Cast(this), PlayerBase.Cast(player));
7892 #ifdef DEVELOPER
7893 SetDebugDeveloper_item(this);
7894 #endif
7895 }
7896
7897 else if (action_id == EActions.ADD_TEMPERATURE)
7898 {
7899 AddTemperature(20);
7900 //PrintVariables();
7901 }
7902
7903 else if (action_id == EActions.REMOVE_TEMPERATURE)
7904 {
7905 AddTemperature(-20);
7906 //PrintVariables();
7907 }
7908
7909 else if (action_id == EActions.FLIP_FROZEN)
7910 {
7911 SetFrozen(!GetIsFrozen());
7912 //PrintVariables();
7913 }
7914
7915 else if (action_id == EActions.ADD_WETNESS)
7916 {
7917 AddWet(GetWetMax()/5);
7918 //PrintVariables();
7919 }
7920
7921 else if (action_id == EActions.REMOVE_WETNESS)
7922 {
7923 AddWet(-GetWetMax()/5);
7924 //PrintVariables();
7925 }
7926
7927 else if (action_id == EActions.LIQUIDTYPE_UP)
7928 {
7929 int curr_type = GetLiquidType();
7930 SetLiquidType(curr_type * 2);
7931 //AddWet(1);
7932 //PrintVariables();
7933 }
7934
7935 else if (action_id == EActions.LIQUIDTYPE_DOWN)
7936 {
7937 int curr_type2 = GetLiquidType();
7938 SetLiquidType(curr_type2 / 2);
7939 }
7940
7941 else if (action_id == EActions.MAKE_SPECIAL)
7942 {
7943 auto debugParams = DebugSpawnParams.WithPlayer(player);
7944 OnDebugSpawnEx(debugParams);
7945 }
7946
7947 }
7948
7949
7950 return false;
7951 }
7952
7953 // -------------------------------------------------------------------------
7954
7955
7958 void OnActivatedByTripWire();
7959
7961 void OnActivatedByItem(notnull ItemBase item);
7962
7963 //----------------------------------------------------------------
7964 //returns true if item is able to explode when put in fire
7965 bool CanExplodeInFire()
7966 {
7967 return false;
7968 }
7969
7970 //----------------------------------------------------------------
7971 bool CanEat()
7972 {
7973 return true;
7974 }
7975
7976 //----------------------------------------------------------------
7977 override bool IsIgnoredByConstruction()
7978 {
7979 return true;
7980 }
7981
7982 //----------------------------------------------------------------
7983 //has FoodStages in config?
7984 bool HasFoodStage()
7985 {
7986 string config_path = string.Format("CfgVehicles %1 Food FoodStages", GetType());
7987 return GetGame().ConfigIsExisting(config_path);
7988 }
7989
7991 FoodStage GetFoodStage()
7992 {
7993 return null;
7994 }
7995
7996 bool CanBeCooked()
7997 {
7998 return false;
7999 }
8000
8001 bool CanBeCookedOnStick()
8002 {
8003 return false;
8004 }
8005
8007 void RefreshAudioVisualsOnClient( CookingMethodType cooking_method, bool is_done, bool is_empty, bool is_burned );
8009
8010 //----------------------------------------------------------------
8011 bool CanRepair(ItemBase item_repair_kit)
8012 {
8013 PluginRepairing module_repairing = PluginRepairing.Cast(GetPlugin(PluginRepairing));
8014 return module_repairing.CanRepair(this, item_repair_kit);
8015 }
8016
8017 //----------------------------------------------------------------
8018 bool Repair(PlayerBase player, ItemBase item_repair_kit, float specialty_weight)
8019 {
8020 PluginRepairing module_repairing = PluginRepairing.Cast(GetPlugin(PluginRepairing));
8021 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
8022 }
8023
8024 //----------------------------------------------------------------
8025 int GetItemSize()
8026 {
8027 /*
8028 vector v_size = this.ConfigGetVector("itemSize");
8029 int v_size_x = v_size[0];
8030 int v_size_y = v_size[1];
8031 int size = v_size_x * v_size_y;
8032 return size;
8033 */
8034
8035 return 1;
8036 }
8037
8038 //----------------------------------------------------------------
8039 //Override for allowing seemingly unallowed moves when two clients send a conflicting message simultaneously
8040 bool CanBeMovedOverride()
8041 {
8042 return m_CanBeMovedOverride;
8043 }
8044
8045 //----------------------------------------------------------------
8046 //Override for allowing seemingly unallowed moves when two clients send a conflicting message simultaneously
8047 void SetCanBeMovedOverride(bool setting)
8048 {
8049 m_CanBeMovedOverride = setting;
8050 }
8051
8052 //----------------------------------------------------------------
8060 void MessageToOwnerStatus(string text)
8061 {
8062 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8063
8064 if (player)
8065 {
8066 player.MessageStatus(text);
8067 }
8068 }
8069
8070 //----------------------------------------------------------------
8078 void MessageToOwnerAction(string text)
8079 {
8080 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8081
8082 if (player)
8083 {
8084 player.MessageAction(text);
8085 }
8086 }
8087
8088 //----------------------------------------------------------------
8096 void MessageToOwnerFriendly(string text)
8097 {
8098 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8099
8100 if (player)
8101 {
8102 player.MessageFriendly(text);
8103 }
8104 }
8105
8106 //----------------------------------------------------------------
8114 void MessageToOwnerImportant(string text)
8115 {
8116 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8117
8118 if (player)
8119 {
8120 player.MessageImportant(text);
8121 }
8122 }
8123
8124 override bool IsItemBase()
8125 {
8126 return true;
8127 }
8128
8129 // Checks if item is of questioned kind
8130 override bool KindOf(string tag)
8131 {
8132 bool found = false;
8133 string item_name = this.GetType();
8134 ref TStringArray item_tag_array = new TStringArray;
8135 GetGame().ConfigGetTextArray("cfgVehicles " + item_name + " itemInfo", item_tag_array);
8136
8137 int array_size = item_tag_array.Count();
8138 for (int i = 0; i < array_size; i++)
8139 {
8140 if (item_tag_array.Get(i) == tag)
8141 {
8142 found = true;
8143 break;
8144 }
8145 }
8146 return found;
8147 }
8148
8149
8150 override void OnRPC(PlayerIdentity sender, int rpc_type,ParamsReadContext ctx)
8151 {
8152 //Debug.Log("OnRPC called");
8153 super.OnRPC(sender, rpc_type,ctx);
8154
8155 //Play soundset for attachment locking (ActionLockAttachment.c)
8156 switch (rpc_type)
8157 {
8158 #ifndef SERVER
8159 case ERPCs.RPC_SOUND_LOCK_ATTACH:
8160 Param2<bool, string> p = new Param2<bool, string>(false, "");
8161
8162 if (!ctx.Read(p))
8163 return;
8164
8165 bool play = p.param1;
8166 string soundSet = p.param2;
8167
8168 if (play)
8169 {
8170 if (m_LockingSound)
8171 {
8173 {
8174 m_LockingSound = SEffectManager.PlaySound(soundSet, GetPosition(), 0, 0, true);
8175 }
8176 }
8177 else
8178 {
8179 m_LockingSound = SEffectManager.PlaySound(soundSet, GetPosition(), 0, 0, true);
8180 }
8181 }
8182 else
8183 {
8184 SEffectManager.DestroyEffect(m_LockingSound);
8185 }
8186
8187 break;
8188 #endif
8189
8190 }
8191
8192 if (GetWrittenNoteData())
8193 {
8194 GetWrittenNoteData().OnRPC(sender, rpc_type,ctx);
8195 }
8196 }
8197
8198 //-----------------------------
8199 // VARIABLE MANIPULATION SYSTEM
8200 //-----------------------------
8201 int NameToID(string name)
8202 {
8203 PluginVariables plugin = PluginVariables.Cast(GetPlugin(PluginVariables));
8204 return plugin.GetID(name);
8205 }
8206
8207 string IDToName(int id)
8208 {
8209 PluginVariables plugin = PluginVariables.Cast(GetPlugin(PluginVariables));
8210 return plugin.GetName(id);
8211 }
8212
8214 void OnSyncVariables(ParamsReadContext ctx)//with ID optimization
8215 {
8216 //Debug.Log("OnSyncVariables called for item: "+ ToString(this.GetType()),"varSync");
8217 //read the flags
8218 int varFlags;
8219 if (!ctx.Read(varFlags))
8220 return;
8221
8222 if (varFlags & ItemVariableFlags.FLOAT)
8223 {
8224 ReadVarsFromCTX(ctx);
8225 }
8226 }
8227
8228 override void SerializeNumericalVars(array<float> floats_out)
8229 {
8230 //some variables handled on EntityAI level already!
8231 super.SerializeNumericalVars(floats_out);
8232
8233 // the order of serialization must be the same as the order of de-serialization
8234 //--------------------------------------------
8235 if (IsVariableSet(VARIABLE_QUANTITY))
8236 {
8237 floats_out.Insert(m_VarQuantity);
8238 }
8239 //--------------------------------------------
8240 if (IsVariableSet(VARIABLE_WET))
8241 {
8242 floats_out.Insert(m_VarWet);
8243 }
8244 //--------------------------------------------
8245 if (IsVariableSet(VARIABLE_LIQUIDTYPE))
8246 {
8247 floats_out.Insert(m_VarLiquidType);
8248 }
8249 //--------------------------------------------
8250 if (IsVariableSet(VARIABLE_COLOR))
8251 {
8252 floats_out.Insert(m_ColorComponentR);
8253 floats_out.Insert(m_ColorComponentG);
8254 floats_out.Insert(m_ColorComponentB);
8255 floats_out.Insert(m_ColorComponentA);
8256 }
8257 //--------------------------------------------
8258 if (IsVariableSet(VARIABLE_CLEANNESS))
8259 {
8260 floats_out.Insert(m_Cleanness);
8261 }
8262 }
8263
8264 override void DeSerializeNumericalVars(array<float> floats)
8265 {
8266 //some variables handled on EntityAI level already!
8267 super.DeSerializeNumericalVars(floats);
8268
8269 // the order of serialization must be the same as the order of de-serialization
8270 int index = 0;
8271 int mask = Math.Round(floats.Get(index));
8272
8273 index++;
8274 //--------------------------------------------
8275 if (mask & VARIABLE_QUANTITY)
8276 {
8277 if (m_IsStoreLoad)
8278 {
8279 SetStoreLoadedQuantity(floats.Get(index));
8280 }
8281 else
8282 {
8283 float quantity = floats.Get(index);
8284 SetQuantity(quantity, true, false, false, false);
8285 }
8286 index++;
8287 }
8288 //--------------------------------------------
8289 if (mask & VARIABLE_WET)
8290 {
8291 float wet = floats.Get(index);
8292 SetWet(wet);
8293 index++;
8294 }
8295 //--------------------------------------------
8296 if (mask & VARIABLE_LIQUIDTYPE)
8297 {
8298 int liquidtype = Math.Round(floats.Get(index));
8299 SetLiquidType(liquidtype);
8300 index++;
8301 }
8302 //--------------------------------------------
8303 if (mask & VARIABLE_COLOR)
8304 {
8305 m_ColorComponentR = Math.Round(floats.Get(index));
8306 index++;
8307 m_ColorComponentG = Math.Round(floats.Get(index));
8308 index++;
8309 m_ColorComponentB = Math.Round(floats.Get(index));
8310 index++;
8311 m_ColorComponentA = Math.Round(floats.Get(index));
8312 index++;
8313 }
8314 //--------------------------------------------
8315 if (mask & VARIABLE_CLEANNESS)
8316 {
8317 int cleanness = Math.Round(floats.Get(index));
8318 SetCleanness(cleanness);
8319 index++;
8320 }
8321 }
8322
8323 override void WriteVarsToCTX(ParamsWriteContext ctx)
8324 {
8325 super.WriteVarsToCTX(ctx);
8326
8327 //--------------------------------------------
8328 if (IsVariableSet(VARIABLE_QUANTITY))
8329 {
8330 ctx.Write(GetQuantity());
8331 }
8332 //--------------------------------------------
8333 if (IsVariableSet(VARIABLE_WET))
8334 {
8335 ctx.Write(GetWet());
8336 }
8337 //--------------------------------------------
8338 if (IsVariableSet(VARIABLE_LIQUIDTYPE))
8339 {
8340 ctx.Write(GetLiquidType());
8341 }
8342 //--------------------------------------------
8343 if (IsVariableSet(VARIABLE_COLOR))
8344 {
8345 int r,g,b,a;
8346 GetColor(r,g,b,a);
8347 ctx.Write(r);
8348 ctx.Write(g);
8349 ctx.Write(b);
8350 ctx.Write(a);
8351 }
8352 //--------------------------------------------
8353 if (IsVariableSet(VARIABLE_CLEANNESS))
8354 {
8355 ctx.Write(GetCleanness());
8356 }
8357 }
8358
8359 override bool ReadVarsFromCTX(ParamsReadContext ctx, int version = -1)//with ID optimization
8360 {
8361 if (!super.ReadVarsFromCTX(ctx,version))
8362 return false;
8363
8364 int intValue;
8365 float value;
8366
8367 if (version < 140)
8368 {
8369 if (!ctx.Read(intValue))
8370 return false;
8371
8372 m_VariablesMask = intValue;
8373 }
8374
8375 if (m_VariablesMask & VARIABLE_QUANTITY)
8376 {
8377 if (!ctx.Read(value))
8378 return false;
8379
8380 if (IsStoreLoad())
8381 {
8383 }
8384 else
8385 {
8386 SetQuantity(value, true, false, false, false);
8387 }
8388 }
8389 //--------------------------------------------
8390 if (version < 140)
8391 {
8392 if (m_VariablesMask & VARIABLE_TEMPERATURE)
8393 {
8394 if (!ctx.Read(value))
8395 return false;
8396 SetTemperatureDirect(value);
8397 }
8398 }
8399 //--------------------------------------------
8400 if (m_VariablesMask & VARIABLE_WET)
8401 {
8402 if (!ctx.Read(value))
8403 return false;
8404 SetWet(value);
8405 }
8406 //--------------------------------------------
8407 if (m_VariablesMask & VARIABLE_LIQUIDTYPE)
8408 {
8409 if (!ctx.Read(intValue))
8410 return false;
8411 SetLiquidType(intValue);
8412 }
8413 //--------------------------------------------
8414 if (m_VariablesMask & VARIABLE_COLOR)
8415 {
8416 int r,g,b,a;
8417 if (!ctx.Read(r))
8418 return false;
8419 if (!ctx.Read(g))
8420 return false;
8421 if (!ctx.Read(b))
8422 return false;
8423 if (!ctx.Read(a))
8424 return false;
8425
8426 SetColor(r,g,b,a);
8427 }
8428 //--------------------------------------------
8429 if (m_VariablesMask & VARIABLE_CLEANNESS)
8430 {
8431 if (!ctx.Read(intValue))
8432 return false;
8433 SetCleanness(intValue);
8434 }
8435 //--------------------------------------------
8436 if (version >= 138 && version < 140)
8437 {
8438 if (m_VariablesMask & VARIABLE_TEMPERATURE)
8439 {
8440 if (!ctx.Read(intValue))
8441 return false;
8442 SetFrozen(intValue);
8443 }
8444 }
8445
8446 return true;
8447 }
8448
8449 //----------------------------------------------------------------
8450 override bool OnStoreLoad(ParamsReadContext ctx, int version)
8451 {
8452 m_IsStoreLoad = true;
8454 {
8455 m_FixDamageSystemInit = true;
8456 }
8457
8458 if (!super.OnStoreLoad(ctx, version))
8459 {
8460 m_IsStoreLoad = false;
8461 return false;
8462 }
8463
8464 if (version >= 114)
8465 {
8466 bool hasQuickBarIndexSaved;
8467
8468 if (!ctx.Read(hasQuickBarIndexSaved))
8469 {
8470 m_IsStoreLoad = false;
8471 return false;
8472 }
8473
8474 if (hasQuickBarIndexSaved)
8475 {
8476 int itmQBIndex;
8477
8478 //Load quickbar item bind
8479 if (!ctx.Read(itmQBIndex))
8480 {
8481 m_IsStoreLoad = false;
8482 return false;
8483 }
8484
8485 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
8486 if (itmQBIndex != -1 && parentPlayer)
8487 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
8488 }
8489 }
8490 else
8491 {
8492 // Backup of how it used to be
8493 PlayerBase player;
8494 int itemQBIndex;
8495 if (version == int.MAX)
8496 {
8497 if (!ctx.Read(itemQBIndex))
8498 {
8499 m_IsStoreLoad = false;
8500 return false;
8501 }
8502 }
8503 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
8504 {
8505 //Load quickbar item bind
8506 if (!ctx.Read(itemQBIndex))
8507 {
8508 m_IsStoreLoad = false;
8509 return false;
8510 }
8511 if (itemQBIndex != -1 && player)
8512 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
8513 }
8514 }
8515
8516 if (version < 140)
8517 {
8518 // variable management system
8519 if (!LoadVariables(ctx, version))
8520 {
8521 m_IsStoreLoad = false;
8522 return false;
8523 }
8524 }
8525
8526 //agent trasmission system
8527 if (!LoadAgents(ctx, version))
8528 {
8529 m_IsStoreLoad = false;
8530 return false;
8531 }
8532 if (version >= 132)
8533 {
8534 RemotelyActivatedItemBehaviour raib = GetRemotelyActivatedItemBehaviour();
8535 if (raib)
8536 {
8537 if (!raib.OnStoreLoad(ctx,version))
8538 {
8539 m_IsStoreLoad = false;
8540 return false;
8541 }
8542 }
8543 }
8544
8545 m_IsStoreLoad = false;
8546 return true;
8547 }
8548
8549 //----------------------------------------------------------------
8550
8551 override void OnStoreSave(ParamsWriteContext ctx)
8552 {
8553 super.OnStoreSave(ctx);
8554
8555 PlayerBase player;
8556 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
8557 {
8558 ctx.Write(true); // Keep track of if we should actually read this in or not
8559 //Save quickbar item bind
8560 int itemQBIndex = -1;
8561 itemQBIndex = player.FindQuickBarEntityIndex(this);
8562 ctx.Write(itemQBIndex);
8563 }
8564 else
8565 {
8566 ctx.Write(false); // Keep track of if we should actually read this in or not
8567 }
8568
8569 SaveAgents(ctx);//agent trasmission system
8570
8571 RemotelyActivatedItemBehaviour raib = GetRemotelyActivatedItemBehaviour();
8572 if (raib)
8573 {
8574 raib.OnStoreSave(ctx);
8575 }
8576 }
8577 //----------------------------------------------------------------
8578
8579 override void AfterStoreLoad()
8580 {
8581 super.AfterStoreLoad();
8582
8584 {
8586 }
8587
8588 if (GetStoreLoadedQuantity() != float.LOWEST)
8589 {
8591 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
8592 }
8593 }
8594
8595 override void EEOnAfterLoad()
8596 {
8597 super.EEOnAfterLoad();
8598
8600 {
8601 m_FixDamageSystemInit = false;
8602 }
8603
8606 }
8607
8608 bool CanBeDisinfected()
8609 {
8610 return false;
8611 }
8612
8613
8614 //----------------------------------------------------------------
8615 override void OnVariablesSynchronized()
8616 {
8617 if (m_Initialized)
8618 {
8619 #ifdef PLATFORM_CONSOLE
8620 //bruteforce it is
8621 if (IsSplitable())
8622 {
8623 UIScriptedMenu menu = GetGame().GetUIManager().FindMenu(MENU_INVENTORY);
8624 if (menu)
8625 {
8626 menu.Refresh();
8627 }
8628 }
8629 #endif
8630 }
8631
8633 {
8634 PlayImpactSound(m_ConfigWeight, m_ImpactSpeed, m_ImpactSoundSurfaceHash);
8635 m_WantPlayImpactSound = false;
8636 }
8637
8639 {
8640 SetWeightDirty();
8642 }
8643 if (m_VarWet != m_VarWetPrev)
8644 {
8647 }
8648
8649 if (m_SoundSyncPlay != 0)
8650 {
8651 m_ItemSoundHandler.PlayItemSoundClient(m_SoundSyncPlay);
8652 m_SoundSyncPlay = 0;
8653 }
8654 if (m_SoundSyncStop != 0)
8655 {
8656 m_ItemSoundHandler.StopItemSoundClient(m_SoundSyncStop);
8657 m_SoundSyncStop = 0;
8658 }
8659
8660 super.OnVariablesSynchronized();
8661 }
8662
8663 //------------------------- Quantity
8664 //----------------------------------------------------------------
8666 override bool SetQuantity(float value, bool destroy_config = true, bool destroy_forced = false, bool allow_client = false, bool clamp_to_stack_max = true)
8667 {
8668 if (!IsServerCheck(allow_client))
8669 return false;
8670
8671 if (!HasQuantity())
8672 return false;
8673
8674 float min = GetQuantityMin();
8675 float max = GetQuantityMax();
8676
8677 if (value <= (min + 0.001))
8678 value = min;
8679
8680 if (value == min)
8681 {
8682 if (destroy_config)
8683 {
8684 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
8685 if (dstr)
8686 {
8687 m_VarQuantity = Math.Clamp(value, min, max);
8688 this.Delete();
8689 return true;
8690 }
8691 }
8692 else if (destroy_forced)
8693 {
8694 m_VarQuantity = Math.Clamp(value, min, max);
8695 this.Delete();
8696 return true;
8697 }
8698 // we get here if destroy_config IS true AND dstr(config destroy param) IS false;
8699 RemoveAllAgents();//we remove all agents when we got to the min value, but the item is not getting deleted
8700 }
8701
8702 float delta = m_VarQuantity;
8703 m_VarQuantity = Math.Clamp(value, min, max);
8704
8705 if (GetStoreLoadedQuantity() == float.LOWEST)//any other value means we are setting quantity from storage
8706 {
8707 delta = m_VarQuantity - delta;
8708
8709 if (delta)
8710 OnQuantityChanged(delta);
8711 }
8712
8713 SetVariableMask(VARIABLE_QUANTITY);
8714
8715 return false;
8716 }
8717
8718 //----------------------------------------------------------------
8720 bool AddQuantity(float value, bool destroy_config = true, bool destroy_forced = false)
8721 {
8722 return SetQuantity(GetQuantity() + value, destroy_config, destroy_forced);
8723 }
8724 //----------------------------------------------------------------
8725 void SetQuantityMax()
8726 {
8727 float max = GetQuantityMax();
8728 SetQuantity(max);
8729 }
8730
8731 override void SetQuantityToMinimum()
8732 {
8733 float min = GetQuantityMin();
8734 SetQuantity(min);
8735 }
8736 //----------------------------------------------------------------
8738 override void SetQuantityNormalized(float value, bool destroy_config = true, bool destroy_forced = false)
8739 {
8740 float value_clamped = Math.Clamp(value, 0, 1);//just to make sure
8741 int result = Math.Round(Math.Lerp(GetQuantityMin(), GetQuantityMax(), value_clamped));
8742 SetQuantity(result, destroy_config, destroy_forced);
8743 }
8744
8745 //----------------------------------------------------------------
8747 override float GetQuantityNormalized()
8748 {
8749 return Math.InverseLerp(GetQuantityMin(), GetQuantityMax(),m_VarQuantity);
8750 }
8751
8753 {
8754 return GetQuantityNormalized();
8755 }
8756
8757 /*void SetAmmoNormalized(float value)
8758 {
8759 float value_clamped = Math.Clamp(value, 0, 1);
8760 Magazine this_mag = Magazine.Cast(this);
8761 int max_rounds = this_mag.GetAmmoMax();
8762 int result = value * max_rounds;//can the rounded if higher precision is required
8763 this_mag.SetAmmoCount(result);
8764 }*/
8765 //----------------------------------------------------------------
8766 override int GetQuantityMax()
8767 {
8768 int slot = -1;
8769 if (GetInventory())
8770 {
8771 InventoryLocation il = new InventoryLocation;
8772 GetInventory().GetCurrentInventoryLocation(il);
8773 slot = il.GetSlot();
8774 }
8775
8776 return GetTargetQuantityMax(slot);
8777 }
8778
8779 override int GetTargetQuantityMax(int attSlotID = -1)
8780 {
8781 float quantity_max = 0;
8782
8783 if (IsSplitable()) //only stackable/splitable items can check for stack size
8784 {
8785 if (attSlotID != -1)
8786 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
8787
8788 if (quantity_max <= 0)
8789 quantity_max = m_VarStackMax;
8790 }
8791
8792 if (quantity_max <= 0)
8793 quantity_max = m_VarQuantityMax;
8794
8795 return quantity_max;
8796 }
8797 //----------------------------------------------------------------
8798 override int GetQuantityMin()
8799 {
8800 return m_VarQuantityMin;
8801 }
8802 //----------------------------------------------------------------
8803 int GetQuantityInit()
8804 {
8805 return m_VarQuantityInit;
8806 }
8807
8808 //----------------------------------------------------------------
8809 override bool HasQuantity()
8810 {
8811 return !(GetQuantityMax() - GetQuantityMin() == 0);
8812 }
8813
8814 override float GetQuantity()
8815 {
8816 return m_VarQuantity;
8817 }
8818
8819 bool IsFullQuantity()
8820 {
8821 return GetQuantity() >= GetQuantityMax();
8822 }
8823
8824 //Calculates weight of single item without attachments and cargo
8825 override float GetSingleInventoryItemWeightEx()
8826 {
8827 //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
8828 float weightEx = GetWeightEx();//overall weight of the item
8829 float special = GetInventoryAndCargoWeight();//cargo and attachment weight
8830 return weightEx - special;
8831 }
8832
8833 // Obsolete, use GetSingleInventoryItemWeightEx() instead
8835 {
8837 }
8838
8839 override protected float GetWeightSpecialized(bool forceRecalc = false)
8840 {
8841 if (IsSplitable()) //quantity determines size of the stack
8842 {
8843 #ifdef DEVELOPER
8844 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
8845 {
8846 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
8847 data1.SetCalcDetails("TIB1: " + GetConfigWeightModifiedDebugText() +" * " + GetQuantity()+"(quantity)");
8848 }
8849 #endif
8850
8851 return GetQuantity() * GetConfigWeightModified();
8852 }
8853 else if (HasEnergyManager())// items with energy manager
8854 {
8855 #ifdef DEVELOPER
8856 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
8857 {
8858 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
8859 data2.SetCalcDetails("TIB2: "+super.GetWeightSpecialized(forceRecalc)+"(contents weight) + " + GetConfigWeightModifiedDebugText() +" + " + GetCompEM().GetEnergy()+"(energy) * " + ConfigGetFloat("weightPerQuantityUnit") +"(weightPerQuantityUnit)");
8860 }
8861 #endif
8862 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
8863 }
8864 else//everything else
8865 {
8866 #ifdef DEVELOPER
8867 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
8868 {
8869 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
8870 data3.SetCalcDetails("TIB3: "+super.GetWeightSpecialized(forceRecalc)+"(contents weight) + " + GetConfigWeightModifiedDebugText() +" + " + GetQuantity()+"(quantity) * " + ConfigGetFloat("weightPerQuantityUnit") +"(weightPerQuantityUnit))");
8871 }
8872 #endif
8873 return super.GetWeightSpecialized(forceRecalc) + (GetQuantity() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
8874 }
8875 }
8876
8878 int GetNumberOfItems()
8879 {
8880 int item_count = 0;
8881 ItemBase item;
8882
8883 if (GetInventory().GetCargo() != NULL)
8884 {
8885 item_count = GetInventory().GetCargo().GetItemCount();
8886 }
8887
8888 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
8889 {
8890 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
8891 if (item)
8892 item_count += item.GetNumberOfItems();
8893 }
8894 return item_count;
8895 }
8896
8898 float GetUnitWeight(bool include_wetness = true)
8899 {
8900 float weight = 0;
8901 float wetness = 1;
8902 if (include_wetness)
8903 wetness += GetWet();
8904 if (IsSplitable()) //quantity determines size of the stack
8905 {
8906 weight = wetness * m_ConfigWeight;
8907 }
8908 else if (IsLiquidContainer()) //is a liquid container, default liquid weight is set to 1. May revisit later?
8909 {
8910 weight = 1;
8911 }
8912 return weight;
8913 }
8914
8915 //-----------------------------------------------------------------
8916
8917 override void ClearInventory()
8918 {
8919 if ((GetGame().IsServer() || !GetGame().IsMultiplayer()) && GetInventory())
8920 {
8921 GameInventory inv = GetInventory();
8922 array<EntityAI> items = new array<EntityAI>;
8923 inv.EnumerateInventory(InventoryTraversalType.INORDER, items);
8924 for (int i = 0; i < items.Count(); i++)
8925 {
8926 ItemBase item = ItemBase.Cast(items.Get(i));
8927 if (item)
8928 {
8929 GetGame().ObjectDelete(item);
8930 }
8931 }
8932 }
8933 }
8934
8935 //------------------------- Energy
8936
8937 //----------------------------------------------------------------
8938 float GetEnergy()
8939 {
8940 float energy = 0;
8941 if (HasEnergyManager())
8942 {
8943 energy = GetCompEM().GetEnergy();
8944 }
8945 return energy;
8946 }
8947
8948
8949 override void OnEnergyConsumed()
8950 {
8951 super.OnEnergyConsumed();
8952
8954 }
8955
8956 override void OnEnergyAdded()
8957 {
8958 super.OnEnergyAdded();
8959
8961 }
8962
8963 // Converts energy (from Energy Manager) to quantity, if enabled.
8965 {
8966 if (GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
8967 {
8968 if (HasQuantity())
8969 {
8970 float energy_0to1 = GetCompEM().GetEnergy0To1();
8971 SetQuantityNormalized(energy_0to1);
8972 }
8973 }
8974 }
8975
8976 //----------------------------------------------------------------
8977 float GetHeatIsolationInit()
8978 {
8979 return ConfigGetFloat("heatIsolation");
8980 }
8981
8982 float GetHeatIsolation()
8983 {
8984 return m_HeatIsolation;
8985 }
8986
8987 float GetDryingIncrement(string pIncrementName)
8988 {
8989 string paramPath = string.Format("CfgVehicles %1 EnvironmentWetnessIncrements Drying %2", GetType(), pIncrementName);
8990 if (GetGame().ConfigIsExisting(paramPath))
8991 return GetGame().ConfigGetFloat(paramPath);
8992
8993 return 0.0;
8994 }
8995
8996 float GetSoakingIncrement(string pIncrementName)
8997 {
8998 string paramPath = string.Format("CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2", GetType(), pIncrementName);
8999 if (GetGame().ConfigIsExisting(paramPath))
9000 return GetGame().ConfigGetFloat(paramPath);
9001
9002 return 0.0;
9003 }
9004 //----------------------------------------------------------------
9005 override void SetWet(float value, bool allow_client = false)
9006 {
9007 if (!IsServerCheck(allow_client))
9008 return;
9009
9010 float min = GetWetMin();
9011 float max = GetWetMax();
9012
9013 float previousValue = m_VarWet;
9014
9015 m_VarWet = Math.Clamp(value, min, max);
9016
9017 if (previousValue != m_VarWet)
9018 {
9019 SetVariableMask(VARIABLE_WET);
9020 OnWetChanged(m_VarWet, previousValue);
9021 }
9022 }
9023 //----------------------------------------------------------------
9024 override void AddWet(float value)
9025 {
9026 SetWet(GetWet() + value);
9027 }
9028 //----------------------------------------------------------------
9029 override void SetWetMax()
9030 {
9032 }
9033 //----------------------------------------------------------------
9034 override float GetWet()
9035 {
9036 return m_VarWet;
9037 }
9038 //----------------------------------------------------------------
9039 override float GetWetMax()
9040 {
9041 return m_VarWetMax;
9042 }
9043 //----------------------------------------------------------------
9044 override float GetWetMin()
9045 {
9046 return m_VarWetMin;
9047 }
9048 //----------------------------------------------------------------
9049 override float GetWetInit()
9050 {
9051 return m_VarWetInit;
9052 }
9053 //----------------------------------------------------------------
9054 override void OnWetChanged(float newVal, float oldVal)
9055 {
9056 EWetnessLevel newLevel = GetWetLevelInternal(newVal);
9057 EWetnessLevel oldLevel = GetWetLevelInternal(oldVal);
9058 if (newLevel != oldLevel)
9059 {
9060 OnWetLevelChanged(newLevel,oldLevel);
9061 }
9062 }
9063
9064 override void OnWetLevelChanged(EWetnessLevel newLevel, EWetnessLevel oldLevel)
9065 {
9066 SetWeightDirty();
9067 }
9068
9069 override EWetnessLevel GetWetLevel()
9070 {
9071 return GetWetLevelInternal(m_VarWet);
9072 }
9073
9074 //----------------------------------------------------------------
9075
9076 override void SetStoreLoad(bool value)
9077 {
9078 m_IsStoreLoad = value;
9079 }
9080
9081 override bool IsStoreLoad()
9082 {
9083 return m_IsStoreLoad;
9084 }
9085
9086 override void SetStoreLoadedQuantity(float value)
9087 {
9088 m_StoreLoadedQuantity = value;
9089 }
9090
9091 override float GetStoreLoadedQuantity()
9092 {
9093 return m_StoreLoadedQuantity;
9094 }
9095
9096 //----------------------------------------------------------------
9097
9098 float GetItemModelLength()
9099 {
9100 if (ConfigIsExisting("itemModelLength"))
9101 {
9102 return ConfigGetFloat("itemModelLength");
9103 }
9104 return 0;
9105 }
9106
9107 float GetItemAttachOffset()
9108 {
9109 if (ConfigIsExisting("itemAttachOffset"))
9110 {
9111 return ConfigGetFloat("itemAttachOffset");
9112 }
9113 return 0;
9114 }
9115
9116 override void SetCleanness(int value, bool allow_client = false)
9117 {
9118 if (!IsServerCheck(allow_client))
9119 return;
9120
9121 int previousValue = m_Cleanness;
9122
9123 m_Cleanness = Math.Clamp(value, m_CleannessMin, m_CleannessMax);
9124
9125 if (previousValue != m_Cleanness)
9126 SetVariableMask(VARIABLE_CLEANNESS);
9127 }
9128
9129 override int GetCleanness()
9130 {
9131 return m_Cleanness;
9132 }
9133
9135 {
9136 return true;
9137 }
9138
9139 //----------------------------------------------------------------
9140 // ATTACHMENT LOCKING
9141 // Getters relevant to generic ActionLockAttachment
9142 int GetLockType()
9143 {
9144 return m_LockType;
9145 }
9146
9147 string GetLockSoundSet()
9148 {
9149 return m_LockSoundSet;
9150 }
9151
9152 //----------------------------------------------------------------
9153 //------------------------- Color
9154 // sets items color variable given color components
9155 override void SetColor(int r, int g, int b, int a)
9156 {
9161 SetVariableMask(VARIABLE_COLOR);
9162 }
9164 override void GetColor(out int r,out int g,out int b,out int a)
9165 {
9170 }
9171
9172 bool IsColorSet()
9173 {
9174 return IsVariableSet(VARIABLE_COLOR);
9175 }
9176
9178 string GetColorString()
9179 {
9180 int r,g,b,a;
9181 GetColor(r,g,b,a);
9182 r = r/255;
9183 g = g/255;
9184 b = b/255;
9185 a = a/255;
9186 return MiscGameplayFunctions.GetColorString(r, g, b, a);
9187 }
9188 //----------------------------------------------------------------
9189 //------------------------- LiquidType
9190
9191 override void SetLiquidType(int value, bool allow_client = false)
9192 {
9193 if (!IsServerCheck(allow_client))
9194 return;
9195
9196 int old = m_VarLiquidType;
9197 m_VarLiquidType = value;
9198 OnLiquidTypeChanged(old,value);
9199 SetVariableMask(VARIABLE_LIQUIDTYPE);
9200 }
9201
9202 int GetLiquidTypeInit()
9203 {
9204 return ConfigGetInt("varLiquidTypeInit");
9205 }
9206
9207 override int GetLiquidType()
9208 {
9209 return m_VarLiquidType;
9210 }
9211
9212 protected void OnLiquidTypeChanged(int oldType, int newType)
9213 {
9214 if (newType == LIQUID_NONE && GetIsFrozen())
9215 SetFrozen(false);
9216 }
9217
9219 void UpdateQuickbarShortcutVisibility(PlayerBase player)
9220 {
9221 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9222 }
9223
9224 // -------------------------------------------------------------------------
9226 void OnInventoryEnter(Man player)
9227 {
9228 PlayerBase nplayer;
9229 if (PlayerBase.CastTo(nplayer, player))
9230 {
9231 m_CanPlayImpactSound = true;
9232 //nplayer.OnItemInventoryEnter(this);
9233 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9234 }
9235 }
9236
9237 // -------------------------------------------------------------------------
9239 void OnInventoryExit(Man player)
9240 {
9241 PlayerBase nplayer;
9242 if (PlayerBase.CastTo(nplayer,player))
9243 {
9244 //nplayer.OnItemInventoryExit(this);
9245 nplayer.SetEnableQuickBarEntityShortcut(this,false);
9246
9247 }
9248
9249 //if (!GetGame().IsDedicatedServer())
9250 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
9251
9252
9253 if (HasEnergyManager())
9254 {
9255 GetCompEM().UpdatePlugState(); // Unplug the el. device if it's necesarry.
9256 }
9257 }
9258
9259 // ADVANCED PLACEMENT EVENTS
9260 override void OnPlacementStarted(Man player)
9261 {
9262 super.OnPlacementStarted(player);
9263
9264 SetTakeable(false);
9265 }
9266
9267 override void OnPlacementComplete(Man player, vector position = "0 0 0", vector orientation = "0 0 0")
9268 {
9269 if (m_AdminLog)
9270 {
9271 m_AdminLog.OnPlacementComplete(player, this);
9272 }
9273
9274 super.OnPlacementComplete(player, position, orientation);
9275 }
9276
9277 //-----------------------------
9278 // AGENT SYSTEM
9279 //-----------------------------
9280 //--------------------------------------------------------------------------
9281 bool ContainsAgent(int agent_id)
9282 {
9283 if (agent_id & m_AttachedAgents)
9284 {
9285 return true;
9286 }
9287 else
9288 {
9289 return false;
9290 }
9291 }
9292
9293 //--------------------------------------------------------------------------
9294 override void RemoveAgent(int agent_id)
9295 {
9296 if (ContainsAgent(agent_id))
9297 {
9298 m_AttachedAgents = ~agent_id & m_AttachedAgents;
9299 }
9300 }
9301
9302 //--------------------------------------------------------------------------
9303 override void RemoveAllAgents()
9304 {
9305 m_AttachedAgents = 0;
9306 }
9307 //--------------------------------------------------------------------------
9308 override void RemoveAllAgentsExcept(int agent_to_keep)
9309 {
9310 m_AttachedAgents = m_AttachedAgents & agent_to_keep;
9311 }
9312 // -------------------------------------------------------------------------
9313 override void InsertAgent(int agent, float count = 1)
9314 {
9315 if (count < 1)
9316 return;
9317 //Debug.Log("Inserting Agent on item: " + agent.ToString() +" count: " + count.ToString());
9319 }
9320
9322 void TransferAgents(int agents)
9323 {
9325 }
9326
9327 // -------------------------------------------------------------------------
9328 override int GetAgents()
9329 {
9330 return m_AttachedAgents;
9331 }
9332 //----------------------------------------------------------------------
9333
9334 /*int GetContaminationType()
9335 {
9336 int contamination_type;
9337
9338 const int CONTAMINATED_MASK = eAgents.CHOLERA | eAgents.INFLUENZA | eAgents.SALMONELLA | eAgents.BRAIN;
9339 const int POISONED_MASK = eAgents.FOOD_POISON | eAgents.CHEMICAL_POISON;
9340 const int NERVE_GAS_MASK = eAgents.CHEMICAL_POISON;
9341 const int DIRTY_MASK = eAgents.WOUND_AGENT;
9342
9343 Edible_Base edible = Edible_Base.Cast(this);
9344 int agents = GetAgents();
9345 if (edible)
9346 {
9347 NutritionalProfile profile = Edible_Base.GetNutritionalProfile(edible);
9348 if (profile)
9349 {
9350 agents = agents | profile.GetAgents();//merge item's agents with nutritional agents
9351 }
9352 }
9353 if (agents & CONTAMINATED_MASK)
9354 {
9355 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_CONTAMINATED;
9356 }
9357 if (agents & POISONED_MASK)
9358 {
9359 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_POISONED;
9360 }
9361 if (agents & NERVE_GAS_MASK)
9362 {
9363 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_NERVE_GAS;
9364 }
9365 if (agents & DIRTY_MASK)
9366 {
9367 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_DIRTY;
9368 }
9369
9370 return agents;
9371 }*/
9372
9373 // -------------------------------------------------------------------------
9374 bool LoadAgents(ParamsReadContext ctx, int version)
9375 {
9376 if (!ctx.Read(m_AttachedAgents))
9377 return false;
9378 return true;
9379 }
9380 // -------------------------------------------------------------------------
9382 {
9383
9385 }
9386 // -------------------------------------------------------------------------
9387
9389 override void CheckForRoofLimited(float timeTresholdMS = 3000)
9390 {
9391 super.CheckForRoofLimited(timeTresholdMS);
9392
9393 float time = GetGame().GetTime();
9394 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
9395 {
9396 m_PreviousRoofTestTime = time;
9397 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
9398 }
9399 }
9400
9401 // returns item's protection level against enviromental hazard, for masks with filters, returns the filters protection for valid filter, otherwise 0
9402 float GetProtectionLevel(int type, bool consider_filter = false, int system = 0)
9403 {
9404 if (IsDamageDestroyed() || (HasQuantity() && GetQuantity() <= 0))
9405 {
9406 return 0;
9407 }
9408
9409 if (GetInventory().GetAttachmentSlotsCount() != 0)//is it an item with attachable filter ?
9410 {
9411 ItemBase filter = ItemBase.Cast(FindAttachmentBySlotName("GasMaskFilter"));
9412 if (filter)
9413 return filter.GetProtectionLevel(type, false, system);//it's a valid filter, return the protection
9414 else
9415 return 0;//otherwise return 0 when no filter attached
9416 }
9417
9418 string subclassPath, entryName;
9419
9420 switch (type)
9421 {
9422 case DEF_BIOLOGICAL:
9423 entryName = "biological";
9424 break;
9425 case DEF_CHEMICAL:
9426 entryName = "chemical";
9427 break;
9428 default:
9429 entryName = "biological";
9430 break;
9431 }
9432
9433 subclassPath = "CfgVehicles " + this.GetType() + " Protection ";
9434
9435 return GetGame().ConfigGetFloat(subclassPath + entryName);
9436 }
9437
9438
9439
9441 override void EEOnCECreate()
9442 {
9443 if (!IsMagazine())
9445
9447 }
9448
9449
9450 //-------------------------
9451 // OPEN/CLOSE USER ACTIONS
9452 //-------------------------
9454 void Open();
9455 void Close();
9456 bool IsOpen()
9457 {
9458 return true;
9459 }
9460
9461 override bool CanDisplayCargo()
9462 {
9463 return IsOpen();
9464 }
9465
9466
9467 // ------------------------------------------------------------
9468 // CONDITIONS
9469 // ------------------------------------------------------------
9470 override bool CanPutInCargo(EntityAI parent)
9471 {
9472 if (parent)
9473 {
9474 if (parent.IsInherited(DayZInfected))
9475 return true;
9476
9477 if (!parent.IsRuined())
9478 return true;
9479 }
9480
9481 return true;
9482 }
9483
9484 override bool CanPutAsAttachment(EntityAI parent)
9485 {
9486 if (!super.CanPutAsAttachment(parent))
9487 {
9488 return false;
9489 }
9490
9491 if (!IsRuined() && !parent.IsRuined())
9492 {
9493 return true;
9494 }
9495
9496 return false;
9497 }
9498
9499 override bool CanReceiveItemIntoCargo(EntityAI item)
9500 {
9501 //removed 15.06. coz of loading from storage -> after load items in cargo was lost -> waiting for proper solution
9502 //if (GetHealthLevel() == GameConstants.STATE_RUINED)
9503 // return false;
9504
9505 return super.CanReceiveItemIntoCargo(item);
9506 }
9507
9508 override bool CanReceiveAttachment(EntityAI attachment, int slotId)
9509 {
9510 //removed 15.06. coz of loading from storage -> after load items in cargo was lost -> waiting for proper solution
9511 //if (GetHealthLevel() == GameConstants.STATE_RUINED)
9512 // return false;
9513
9514 GameInventory attachmentInv = attachment.GetInventory();
9515 if (attachmentInv && attachmentInv.GetCargo() && attachmentInv.GetCargo().GetItemCount() > 0)
9516 {
9517 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
9518 return false;
9519 }
9520
9521 InventoryLocation loc = new InventoryLocation();
9522 attachment.GetInventory().GetCurrentInventoryLocation(loc);
9523 if (loc && loc.IsValid() && !GetInventory().AreChildrenAccessible())
9524 return false;
9525
9526 return super.CanReceiveAttachment(attachment, slotId);
9527 }
9528
9529 override bool CanReleaseAttachment(EntityAI attachment)
9530 {
9531 if (!super.CanReleaseAttachment(attachment))
9532 return false;
9533
9534 return GetInventory().AreChildrenAccessible();
9535 }
9536
9537 /*override bool CanLoadAttachment(EntityAI attachment)
9538 {
9539 //removed 15.06. coz of loading from storage -> after load items in cargo was lost -> waiting for proper solution
9540 //if (GetHealthLevel() == GameConstants.STATE_RUINED)
9541 // return false;
9542
9543 GameInventory attachmentInv = attachment.GetInventory();
9544 if (attachmentInv && attachmentInv.GetCargo() && attachmentInv.GetCargo().GetItemCount() > 0)
9545 {
9546 bool boo = (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase));
9547 ErrorEx("CanLoadAttachment | this: " + this + " | attachment: " + attachment + " | boo: " + boo,ErrorExSeverity.INFO);
9548
9549 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
9550 return false;
9551 }
9552
9553 return super.CanLoadAttachment(attachment);
9554 }*/
9555
9556 // Plays muzzle flash particle effects
9557 static void PlayFireParticles(ItemBase weapon, int muzzle_index, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
9558 {
9559 int id = muzzle_owner.GetMuzzleID();
9560 array<ref WeaponParticlesOnFire> WPOF_array = m_OnFireEffect.Get(id);
9561
9562 if (WPOF_array)
9563 {
9564 for (int i = 0; i < WPOF_array.Count(); i++)
9565 {
9566 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
9567
9568 if (WPOF)
9569 {
9570 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
9571 }
9572 }
9573 }
9574 }
9575
9576 // Plays bullet eject particle effects (usually just smoke, the bullet itself is a 3D model and is not part of this function)
9577 static void PlayBulletCasingEjectParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
9578 {
9579 int id = muzzle_owner.GetMuzzleID();
9580 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = m_OnBulletCasingEjectEffect.Get(id);
9581
9582 if (WPOBE_array)
9583 {
9584 for (int i = 0; i < WPOBE_array.Count(); i++)
9585 {
9586 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
9587
9588 if (WPOBE)
9589 {
9590 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
9591 }
9592 }
9593 }
9594 }
9595
9596 // Plays all weapon overheating particles
9597 static void PlayOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
9598 {
9599 int id = muzzle_owner.GetMuzzleID();
9600 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9601
9602 if (WPOOH_array)
9603 {
9604 for (int i = 0; i < WPOOH_array.Count(); i++)
9605 {
9606 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9607
9608 if (WPOOH)
9609 {
9610 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
9611 }
9612 }
9613 }
9614 }
9615
9616 // Updates all weapon overheating particles
9617 static void UpdateOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
9618 {
9619 int id = muzzle_owner.GetMuzzleID();
9620 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9621
9622 if (WPOOH_array)
9623 {
9624 for (int i = 0; i < WPOOH_array.Count(); i++)
9625 {
9626 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9627
9628 if (WPOOH)
9629 {
9630 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9631 }
9632 }
9633 }
9634 }
9635
9636 // Stops overheating particles
9637 static void StopOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
9638 {
9639 int id = muzzle_owner.GetMuzzleID();
9640 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9641
9642 if (WPOOH_array)
9643 {
9644 for (int i = 0; i < WPOOH_array.Count(); i++)
9645 {
9646 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9647
9648 if (WPOOH)
9649 {
9650 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9651 }
9652 }
9653 }
9654 }
9655
9656 //----------------------------------------------------------------
9657 //Item Behaviour - unified approach
9658 override bool IsHeavyBehaviour()
9659 {
9660 if (m_ItemBehaviour == 0)
9661 {
9662 return true;
9663 }
9664
9665 return false;
9666 }
9667
9668 override bool IsOneHandedBehaviour()
9669 {
9670 if (m_ItemBehaviour == 1)
9671 {
9672 return true;
9673 }
9674
9675 return false;
9676 }
9677
9678 override bool IsTwoHandedBehaviour()
9679 {
9680 if (m_ItemBehaviour == 2)
9681 {
9682 return true;
9683 }
9684
9685 return false;
9686 }
9687
9688 bool IsDeployable()
9689 {
9690 return false;
9691 }
9692
9694 float GetDeployTime()
9695 {
9696 return UATimeSpent.DEFAULT_DEPLOY;
9697 }
9698
9699
9700 //----------------------------------------------------------------
9701 // Item Targeting (User Actions)
9702 override void SetTakeable(bool pState)
9703 {
9704 m_IsTakeable = pState;
9705 SetSynchDirty();
9706 }
9707
9708 override bool IsTakeable()
9709 {
9710 return m_IsTakeable;
9711 }
9712
9713 // For cases where we want to show object widget which cant be taken to hands
9715 {
9716 return false;
9717 }
9718
9720 protected void PreLoadSoundAttachmentType()
9721 {
9722 string att_type = "None";
9723
9724 if (ConfigIsExisting("soundAttType"))
9725 {
9726 att_type = ConfigGetString("soundAttType");
9727 }
9728
9729 m_SoundAttType = att_type;
9730 }
9731
9732 override string GetAttachmentSoundType()
9733 {
9734 return m_SoundAttType;
9735 }
9736
9737 //----------------------------------------------------------------
9738 //SOUNDS - ItemSoundHandler
9739 //----------------------------------------------------------------
9740
9741 string GetPlaceSoundset(); // played when deploy starts
9742 string GetLoopDeploySoundset(); // played when deploy starts and stopped when it finishes
9743 string GetDeploySoundset(); // played when deploy sucessfully finishes
9744 string GetLoopFoldSoundset(); // played when fold starts and stopped when it finishes
9745 string GetFoldSoundset(); // played when fold sucessfully finishes
9746
9748 {
9749 if (!m_ItemSoundHandler)
9751
9752 return m_ItemSoundHandler;
9753 }
9754
9755 // override to initialize sounds
9756 protected void InitItemSounds()
9757 {
9758 if (GetPlaceSoundset() == string.Empty && GetDeploySoundset() == string.Empty && GetLoopDeploySoundset() == string.Empty)
9759 return;
9760
9762
9763 if (GetPlaceSoundset() != string.Empty)
9764 handler.AddSound(SoundConstants.ITEM_PLACE, GetPlaceSoundset());
9765
9766 if (GetDeploySoundset() != string.Empty)
9767 handler.AddSound(SoundConstants.ITEM_DEPLOY, GetDeploySoundset());
9768
9769 SoundParameters params = new SoundParameters();
9770 params.m_Loop = true;
9771 if (GetLoopDeploySoundset() != string.Empty)
9772 handler.AddSound(SoundConstants.ITEM_DEPLOY_LOOP, GetLoopDeploySoundset(), params);
9773 }
9774
9775 // Start sound using ItemSoundHandler
9776 void StartItemSoundServer(int id)
9777 {
9778 if (!GetGame().IsServer())
9779 return;
9780
9781 m_SoundSyncPlay = id;
9782 SetSynchDirty();
9783
9784 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).Remove(ClearStartItemSoundServer); // in case one is queued already
9786 }
9787
9788 // Stop sound using ItemSoundHandler
9789 void StopItemSoundServer(int id)
9790 {
9791 if (!GetGame().IsServer())
9792 return;
9793
9794 m_SoundSyncStop = id;
9795 SetSynchDirty();
9796
9797 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).Remove(ClearStopItemSoundServer); // in case one is queued already
9799 }
9800
9801 protected void ClearStartItemSoundServer()
9802 {
9803 m_SoundSyncPlay = 0;
9804 }
9805
9806 protected void ClearStopItemSoundServer()
9807 {
9808 m_SoundSyncStop = 0;
9809 }
9810
9812 void PlayAttachSound(string slot_type)
9813 {
9814 if (!GetGame().IsDedicatedServer())
9815 {
9816 if (ConfigIsExisting("attachSoundSet"))
9817 {
9818 string cfg_path = "";
9819 string soundset = "";
9820 string type_name = GetType();
9821
9822 TStringArray cfg_soundset_array = new TStringArray;
9823 TStringArray cfg_slot_array = new TStringArray;
9824 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
9825 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
9826
9827 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
9828 {
9829 for (int i = 0; i < cfg_soundset_array.Count(); i++)
9830 {
9831 if (cfg_slot_array[i] == slot_type)
9832 {
9833 soundset = cfg_soundset_array[i];
9834 break;
9835 }
9836 }
9837 }
9838
9839 if (soundset != "")
9840 {
9841 EffectSound sound = SEffectManager.PlaySound(soundset, GetPosition());
9842 sound.SetAutodestroy(true);
9843 }
9844 }
9845 }
9846 }
9847
9848 void PlayDetachSound(string slot_type)
9849 {
9850 //TODO - evaluate if needed and devise universal config structure if so
9851 }
9852
9853 void OnApply(PlayerBase player);
9854
9856 {
9857 return 1.0;
9858 };
9859 //returns applicable selection
9860 array<string> GetHeadHidingSelection()
9861 {
9863 }
9864
9866 {
9868 }
9869
9870 WrittenNoteData GetWrittenNoteData() {};
9871
9873 {
9874 SetDynamicPhysicsLifeTime(0.01);
9875 m_ItemBeingDroppedPhys = false;
9876 }
9877
9879 {
9880 array<string> zone_names = new array<string>;
9881 GetDamageZones(zone_names);
9882 for (int i = 0; i < zone_names.Count(); i++)
9883 {
9884 SetHealthMax(zone_names.Get(i),"Health");
9885 }
9886 SetHealthMax("","Health");
9887 }
9888
9890 void SetZoneDamageCEInit()
9891 {
9892 float global_health = GetHealth01("","Health");
9893 array<string> zones = new array<string>;
9894 GetDamageZones(zones);
9895 //set damage of all zones to match global health level
9896 for (int i = 0; i < zones.Count(); i++)
9897 {
9898 SetHealth01(zones.Get(i),"Health",global_health);
9899 }
9900 }
9901
9903 bool IsCoverFaceForShave(string slot_name)
9904 {
9905 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
9906 }
9907
9908 void ProcessItemWetness(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
9909 {
9910 if (!hasRootAsPlayer)
9911 {
9912 if (refParentIB)
9913 {
9914 // parent is wet
9915 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (m_VarWet < m_VarWetMax))
9916 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
9917 // parent has liquid inside
9918 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (m_VarWet < m_VarWetMax))
9919 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
9920 // drying
9921 else if (m_VarWet > m_VarWetMin)
9922 AddWet(-1 * delta * GetDryingIncrement("ground") * 2);
9923 }
9924 else
9925 {
9926 // drying on ground or inside non-itembase (car, ...)
9927 if (m_VarWet > m_VarWetMin)
9928 AddWet(-1 * delta * GetDryingIncrement("ground"));
9929 }
9930 }
9931 }
9932
9933 void ProcessItemTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
9934 {
9936 {
9937 float target = g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(this);
9938 if (GetTemperature() != target || !IsFreezeThawProgressFinished())
9939 {
9940 float heatPermCoef = 1.0;
9941 EntityAI ent = this;
9942 while (ent)
9943 {
9944 heatPermCoef *= ent.GetHeatPermeabilityCoef();
9945 ent = ent.GetHierarchyParent();
9946 }
9947
9948 SetTemperatureEx(new TemperatureDataInterpolated(target,ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
9949 }
9950 }
9951 }
9952
9953 void HierarchyCheck(out bool hasParent, out bool hasRootAsPlayer, out ItemBase refParentIB)
9954 {
9955 // hierarchy check for an item to decide whether it has some parent and it is in some player inventory
9956 EntityAI parent = GetHierarchyParent();
9957 if (!parent)
9958 {
9959 hasParent = false;
9960 hasRootAsPlayer = false;
9961 }
9962 else
9963 {
9964 hasParent = true;
9965 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
9966 refParentIB = ItemBase.Cast(parent);
9967 }
9968 }
9969
9970 protected void ProcessDecay(float delta, bool hasRootAsPlayer)
9971 {
9972 // this is stub, implemented on Edible_Base
9973 }
9974
9975 bool CanDecay()
9976 {
9977 // return true used on selected food clases so they can decay
9978 return false;
9979 }
9980
9981 protected bool CanProcessDecay()
9982 {
9983 // this is stub, implemented on Edible_Base class
9984 // used to determine whether it is still necessary for the food to decay
9985 return false;
9986 }
9987
9988 protected bool CanHaveWetness()
9989 {
9990 // return true used on selected items that have a wetness effect
9991 return false;
9992 }
9993
9995 bool CanBeConsumed(ConsumeConditionData data = null)
9996 {
9997 return !GetIsFrozen() && IsOpen();
9998 }
9999
10000 override void ProcessVariables()
10001 {
10002 bool hasParent = false, hasRootAsPlayer = false;
10003 ItemBase refParentIB;
10004
10005 bool wwtu = g_Game.IsWorldWetTempUpdateEnabled();
10006 bool foodDecay = g_Game.IsFoodDecayEnabled();
10007
10008 if (wwtu || foodDecay)
10009 {
10010 bool processWetness = wwtu && CanHaveWetness();
10011 bool processTemperature = wwtu && CanHaveTemperature();
10012 bool processDecay = foodDecay && CanDecay() && CanProcessDecay();
10013
10014 if (processWetness || processTemperature || processDecay)
10015 {
10016 HierarchyCheck(hasParent, hasRootAsPlayer, refParentIB);
10017
10018 if (processWetness)
10019 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
10020
10021 if (processTemperature)
10022 ProcessItemTemperature(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
10023
10024 if (processDecay)
10025 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
10026 }
10027 }
10028 }
10029
10032 {
10033 return m_TemperaturePerQuantityWeight * GameConstants.ITEM_TEMPERATURE_QUANTITY_WEIGHT_MULTIPLIER;
10034 }
10035
10036 override float GetTemperatureFreezeThreshold()
10037 {
10039 return Liquid.GetFreezeThreshold(GetLiquidType());
10040
10041 return super.GetTemperatureFreezeThreshold();
10042 }
10043
10044 override float GetTemperatureThawThreshold()
10045 {
10047 return Liquid.GetThawThreshold(GetLiquidType());
10048
10049 return super.GetTemperatureThawThreshold();
10050 }
10051
10052 override float GetItemOverheatThreshold()
10053 {
10055 return Liquid.GetBoilThreshold(GetLiquidType());
10056
10057 return super.GetItemOverheatThreshold();
10058 }
10059
10060 override float GetTemperatureFreezeTime()
10061 {
10062 if (HasQuantity())
10063 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),GetQuantityNormalized());
10064
10065 return super.GetTemperatureFreezeTime();
10066 }
10067
10068 override float GetTemperatureThawTime()
10069 {
10070 if (HasQuantity())
10071 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),GetQuantityNormalized());
10072
10073 return super.GetTemperatureThawTime();
10074 }
10075
10077 void AffectLiquidContainerOnFill(int liquid_type, float amount);
10079 void AffectLiquidContainerOnTransfer(int liquidType, float amount, float sourceLiquidTemperature);
10080
10081 bool IsCargoException4x3(EntityAI item)
10082 {
10083 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
10084 }
10085
10087 {
10088 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
10089 }
10090
10092 void AddLightSourceItem(ItemBase lightsource)
10093 {
10094 m_LightSourceItem = lightsource;
10095 }
10096
10098 {
10099 m_LightSourceItem = null;
10100 }
10101
10103 {
10104 return m_LightSourceItem;
10105 }
10106
10108 array<int> GetValidFinishers()
10109 {
10110 return null;
10111 }
10112
10114 bool GetActionWidgetOverride(out typename name)
10115 {
10116 return false;
10117 }
10118
10119 bool PairWithDevice(notnull ItemBase otherDevice)
10120 {
10121 if (GetGame().IsServer())
10122 {
10123 ItemBase explosive = otherDevice;
10125 if (!trg)
10126 {
10127 trg = RemoteDetonatorTrigger.Cast(otherDevice);
10128 explosive = this;
10129 }
10130
10131 explosive.PairRemote(trg);
10132 trg.SetControlledDevice(explosive);
10133
10134 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
10135 trg.SetPersistentPairID(persistentID);
10136 explosive.SetPersistentPairID(persistentID);
10137
10138 return true;
10139 }
10140 return false;
10141 }
10142
10144 float GetBaitEffectivity()
10145 {
10146 float ret = 1.0;
10147 if (HasQuantity())
10148 ret *= GetQuantityNormalized();
10149 ret *= GetHealth01();
10150
10151 return ret;
10152 }
10153
10154 #ifdef DEVELOPER
10155 override void SetDebugItem()
10156 {
10157 super.SetDebugItem();
10158 _itemBase = this;
10159 }
10160
10161 override string GetDebugText()
10162 {
10163 string text = super.GetDebugText();
10164
10165 text += string.Format("Heat isolation(raw): %1\n", GetHeatIsolation());
10166 text += string.Format("Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(this));
10167
10168 return text;
10169 }
10170 #endif
10171
10172 bool CanBeUsedForSuicide()
10173 {
10174 return true;
10175 }
10176
10178 //DEPRECATED BELOW
10180 // Backwards compatibility
10181 void ProcessItemWetnessAndTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
10182 {
10183 ProcessItemWetness(delta, hasParent, hasRootAsPlayer, refParentIB);
10184 ProcessItemTemperature(delta, hasParent, hasRootAsPlayer, refParentIB);
10185 }
10186
10187 // replaced by ItemSoundHandler
10188 protected EffectSound m_SoundDeployFinish;
10189 protected EffectSound m_SoundPlace;
10190 protected EffectSound m_DeployLoopSoundEx;
10191 protected EffectSound m_SoundDeploy;
10192 bool m_IsPlaceSound;
10193 bool m_IsDeploySound;
10195
10196 string GetDeployFinishSoundset();
10197 void PlayDeploySound();
10198 void PlayDeployFinishSound();
10199 void PlayPlaceSound();
10200 void PlayDeployLoopSoundEx();
10201 void StopDeployLoopSoundEx();
10202 void SoundSynchRemoteReset();
10203 void SoundSynchRemote();
10204 bool UsesGlobalDeploy(){return false;}
10205 bool CanPlayDeployLoopSound(){return false;}
10207 bool IsPlaceSound(){return m_IsPlaceSound;}
10208 bool IsDeploySound(){return m_IsDeploySound;}
10209 void SetIsPlaceSound(bool is_place_sound);
10210 void SetIsDeploySound(bool is_deploy_sound);
10211}
10212
10213EntityAI SpawnItemOnLocation(string object_name, notnull InventoryLocation loc, bool full_quantity)
10214{
10215 EntityAI entity = SpawnEntity(object_name, loc, ECE_IN_INVENTORY, RF_DEFAULT);
10216 if (entity)
10217 {
10218 bool is_item = entity.IsInherited(ItemBase);
10219 if (is_item && full_quantity)
10220 {
10221 ItemBase item = ItemBase.Cast(entity);
10222 item.SetQuantity(item.GetQuantityInit());
10223 }
10224 }
10225 else
10226 {
10227 ErrorEx("Cannot spawn entity: " + object_name,ErrorExSeverity.INFO);
10228 return NULL;
10229 }
10230 return entity;
10231}
10232
10233void SetupSpawnedItem(ItemBase item, float health, float quantity)
10234{
10235 if (item)
10236 {
10237 if (health > 0)
10238 item.SetHealth("", "", health);
10239
10240 if (item.CanHaveTemperature())
10241 {
10242 item.SetTemperatureDirect(GameConstants.ITEM_TEMPERATURE_NEUTRAL_ZONE_MIDDLE);
10243 if (item.CanFreeze())
10244 item.SetFrozen(false);
10245 }
10246
10247 if (item.HasEnergyManager())
10248 {
10249 if (quantity >= 0)
10250 {
10251 item.GetCompEM().SetEnergy0To1(quantity);
10252 }
10253 else
10254 {
10255 item.GetCompEM().SetEnergy(Math.AbsFloat(quantity));
10256 }
10257 }
10258 else if (item.IsMagazine())
10259 {
10260 Magazine mag = Magazine.Cast(item);
10261 if (quantity >= 0)
10262 {
10263 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
10264 }
10265 else
10266 {
10267 mag.ServerSetAmmoCount(Math.AbsFloat(quantity));
10268 }
10269
10270 }
10271 else
10272 {
10273 if (quantity >= 0)
10274 {
10275 item.SetQuantityNormalized(quantity, false);
10276 }
10277 else
10278 {
10279 item.SetQuantity(Math.AbsFloat(quantity));
10280 }
10281
10282 }
10283 }
10284}
10285
10286#ifdef DEVELOPER
10287ItemBase _itemBase;//watched item goes here(LCTRL+RMB->Watch)
10288#endif
Param4< int, int, string, int > TSelectableActionInfoWithColor
Определения 3_Game/Entities/EntityAI.c:97
Param3 TSelectableActionInfo
EWetnessLevel
Определения 3_Game/Entities/EntityAI.c:2
InventoryMode
NOTE: PREDICTIVE is not to be used at all in multiplayer.
const int INPUT_UDT_ITEM_MANIPULATION
class LogManager EntityAI
eBleedingSourceType GetType()
ItemSuppressor SuppressorBase
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
int GetLiquidType()
Определения CCTWaterSurface.c:129
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
Open
Implementations only.
override void EEOnCECreate()
Определения ContaminatedArea_Dynamic.c:42
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
float GetTemperature()
Определения Environment.c:497
override bool IsExplosive()
Определения ExplosivesBase.c:59
override bool CanHaveTemperature()
Определения FireplaceBase.c:559
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:6380
static bool HasDebugActionsMask(int mask)
Определения ItemBase.c:5620
bool HidesSelectionBySlot()
Определения ItemBase.c:9347
float m_VarWetMin
Определения ItemBase.c:4881
void SplitItem(PlayerBase player)
Определения ItemBase.c:6831
void CopyScriptPropertiesFrom(EntityAI oldItem)
Определения ItemBase.c:9568
override void InsertAgent(int agent, float count=1)
Определения ItemBase.c:8795
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:8229
static void SetDebugActionsMask(int mask)
Определения ItemBase.c:5625
void SetIsDeploySound(bool is_deploy_sound)
bool IsOpen()
Определения ItemBase.c:8938
void SplitItemToInventoryLocation(notnull InventoryLocation dst)
Определения ItemBase.c:6798
override bool IsHeavyBehaviour()
Определения ItemBase.c:9140
override void SetWetMax()
Определения ItemBase.c:8511
bool IsCoverFaceForShave(string slot_name)
DEPRECATED in use, but returns correct values nontheless. Check performed elsewhere.
Определения ItemBase.c:9385
void ClearStartItemSoundServer()
Определения ItemBase.c:9283
float m_VarWet
Определения ItemBase.c:4878
void ProcessItemTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
Определения ItemBase.c:9415
map< typename, ref ActionOverrideData > TActionAnimOverrideMap
Определения ItemBase.c:2
override void RemoveAllAgentsExcept(int agent_to_keep)
Определения ItemBase.c:8790
static ref map< int, ref array< ref WeaponParticlesOnBulletCasingEject > > m_OnBulletCasingEjectEffect
Определения ItemBase.c:4941
bool CanBeMovedOverride()
Определения ItemBase.c:7522
override void SetWet(float value, bool allow_client=false)
Определения ItemBase.c:8487
ref TIntArray m_SingleUseActions
Определения ItemBase.c:4927
override void ProcessVariables()
Определения ItemBase.c:9482
ref TStringArray m_HeadHidingSelections
Определения ItemBase.c:4955
float GetWeightSpecialized(bool forceRecalc=false)
Определения ItemBase.c:8321
bool LoadAgents(ParamsReadContext ctx, int version)
Определения ItemBase.c:8856
void UpdateQuickbarShortcutVisibility(PlayerBase player)
To be called on moving item within character's inventory; 'player' should never be null.
Определения ItemBase.c:8701
void OverrideActionAnimation(typename action, int commandUID, int stanceMask=-1, int commandUIDProne=-1)
Определения ItemBase.c:5211
ref array< ref OverheatingParticle > m_OverheatingParticles
Определения ItemBase.c:4953
override float GetTemperatureFreezeThreshold()
Определения ItemBase.c:9518
bool m_IsSoundSynchRemote
Определения ItemBase.c:9676
float m_OverheatingShots
Определения ItemBase.c:4948
void StopItemSoundServer(int id)
Определения ItemBase.c:9271
static void ToggleDebugActionsMask(int mask)
Определения ItemBase.c:5640
void IncreaseOverheating(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:5364
override float GetTemperatureFreezeTime()
Определения ItemBase.c:9542
ref array< int > m_CompatibleLocks
Определения ItemBase.c:4965
bool CanBeCooked()
Определения ItemBase.c:7478
override void CombineItemsClient(EntityAI entity2, bool use_stack_max=true)
Определения ItemBase.c:5707
float m_TemperaturePerQuantityWeight
Определения ItemBase.c:4977
bool m_RecipesInitialized
Определения ItemBase.c:4863
void SplitIntoStackMax(EntityAI destination_entity, int slot_id, PlayerBase player)
Определения ItemBase.c:6471
override float GetTemperatureThawThreshold()
Определения ItemBase.c:9526
override void OnEnergyConsumed()
Определения ItemBase.c:8431
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:8360
override EWetnessLevel GetWetLevel()
Определения ItemBase.c:8551
float GetSingleInventoryItemWeight()
Определения ItemBase.c:8316
ref TIntArray m_InteractActions
Определения ItemBase.c:4929
void MessageToOwnerStatus(string text)
Send message to owner player in grey color.
Определения ItemBase.c:7542
float m_VarQuantity
Определения ItemBase.c:4869
bool CanPlayDeployLoopSound()
Определения ItemBase.c:9687
override float GetWetMax()
Определения ItemBase.c:8521
bool CanBeUsedForSuicide()
Определения ItemBase.c:9654
override void CombineItemsEx(EntityAI entity2, bool use_stack_max=true)
Определения ItemBase.c:7117
void OnItemInHandsPlayerSwimStart(PlayerBase player)
void SetIsHologram(bool is_hologram)
Определения ItemBase.c:5845
void OnSyncVariables(ParamsReadContext ctx)
DEPRECATED (most likely)
Определения ItemBase.c:7696
void StartItemSoundServer(int id)
Определения ItemBase.c:9258
void DoAmmoExplosion()
Определения ItemBase.c:6315
static ref map< int, ref array< ref WeaponParticlesOnFire > > m_OnFireEffect
Определения ItemBase.c:4940
void SplitIntoStackMaxCargoClient(EntityAI destination_entity, int idx, int row, int col)
Определения ItemBase.c:6655
int GetItemSize()
Определения ItemBase.c:7507
bool m_CanBeMovedOverride
Определения ItemBase.c:4906
override string ChangeIntoOnAttach(string slot)
Определения ItemBase.c:6239
void UpdateOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
Определения ItemBase.c:5432
bool CanDecay()
Определения ItemBase.c:9457
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:8202
void SetQuantityMax()
Определения ItemBase.c:8207
override float GetQuantity()
Определения ItemBase.c:8296
int m_ColorComponentR
Определения ItemBase.c:4918
int m_ShotsToStartOverheating
Определения ItemBase.c:4950
override void OnWetChanged(float newVal, float oldVal)
Определения ItemBase.c:8536
void StopOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
Определения ItemBase.c:5439
static void PlayFireParticles(ItemBase weapon, int muzzle_index, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:9039
void OnOverheatingDecay()
Определения ItemBase.c:5402
float GetDryingIncrement(string pIncrementName)
Определения ItemBase.c:8469
void SoundSynchRemoteReset()
int m_Cleanness
Определения ItemBase.c:4884
bool HasMuzzle()
Returns true if this item has a muzzle (weapons, suppressors)
Определения ItemBase.c:5540
bool UsesGlobalDeploy()
Определения ItemBase.c:9686
int m_ItemBehaviour
Определения ItemBase.c:4899
override bool CanReleaseAttachment(EntityAI attachment)
Определения ItemBase.c:9011
float m_HeatIsolation
Определения ItemBase.c:4894
float m_VarWetInit
Определения ItemBase.c:4880
override void OnMovedInsideCargo(EntityAI container)
Определения ItemBase.c:5885
void SetCEBasedQuantity()
Определения ItemBase.c:5653
bool m_CanPlayImpactSound
Определения ItemBase.c:4890
override string GetAttachmentSoundType()
Определения ItemBase.c:9214
float GetOverheatingCoef()
Определения ItemBase.c:5459
array< string > GetHeadHidingSelection()
Определения ItemBase.c:9342
void PlayAttachSound(string slot_type)
Plays sound on item attach. Be advised, the config structure may slightly change in 1....
Определения ItemBase.c:9294
override bool IsStoreLoad()
Определения ItemBase.c:8563
int ComputeQuantityUsed(ItemBase other_item, bool use_stack_max=true)
Определения ItemBase.c:7093
bool IsLightSource()
Определения ItemBase.c:5781
bool m_HasQuantityBar
Определения ItemBase.c:4912
void SetResultOfSplit(bool value)
Определения ItemBase.c:7088
void SplitIntoStackMaxCargo(EntityAI destination_entity, int idx, int row, int col)
Определения ItemBase.c:6719
void OnAttachmentQuantityChanged(ItemBase item)
Called on server side when some attachment's quantity is changed. Call super.OnAttachmentQuantityChan...
Определения ItemBase.c:6889
void UpdateAllOverheatingParticles()
Определения ItemBase.c:5467
float GetSoakingIncrement(string pIncrementName)
Определения ItemBase.c:8478
static void StopOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:9119
override float GetStoreLoadedQuantity()
Определения ItemBase.c:8573
int m_LockType
Определения ItemBase.c:4966
const int ITEM_SOUNDS_MAX
Определения ItemBase.c:4971
bool m_CanBeDigged
Определения ItemBase.c:4913
float m_ItemAttachOffset
Определения ItemBase.c:4896
float GetItemModelLength()
Определения ItemBase.c:8580
bool m_ThrowItemOnDrop
Определения ItemBase.c:4904
override bool ReadVarsFromCTX(ParamsReadContext ctx, int version=-1)
Определения ItemBase.c:7841
override void CheckForRoofLimited(float timeTresholdMS=3000)
Roof check for entity, limited by time (anti-spam solution)
Определения ItemBase.c:8871
void Close()
float GetHeatIsolation()
Определения ItemBase.c:8464
void CombineItems(ItemBase other_item, bool use_stack_max=true)
Определения ItemBase.c:7122
void TransferModifiers(PlayerBase reciever)
appears to be deprecated, legacy code
float GetTemperaturePerQuantityWeight()
Used in heat comfort calculations only!
Определения ItemBase.c:9513
bool CanHaveWetness()
Определения ItemBase.c:9470
int m_CleannessMin
Определения ItemBase.c:4886
void TransferAgents(int agents)
transfer agents from another item
Определения ItemBase.c:8804
string IDToName(int id)
Определения ItemBase.c:7689
bool CanBeConsumed(ConsumeConditionData data=null)
Items cannot be consumed if frozen by default. Override for exceptions.
Определения ItemBase.c:9477
float GetHeatIsolationInit()
Определения ItemBase.c:8459
void PlayPlaceSound()
void SetCanBeMovedOverride(bool setting)
Определения ItemBase.c:7529
override bool HasQuantity()
Определения ItemBase.c:8291
float m_VarWetPrev
Определения ItemBase.c:4879
int m_SoundSyncStop
Определения ItemBase.c:4973
bool IsCargoException4x3(EntityAI item)
Определения ItemBase.c:9563
ref TIntArray m_ContinuousActions
Определения ItemBase.c:4928
int GetMuzzleID()
Returns global muzzle ID. If not found, then it gets automatically registered.
Определения ItemBase.c:5549
void LoadParticleConfigOnFire(int id)
Определения ItemBase.c:5234
int m_VarLiquidType
Определения ItemBase.c:4898
int m_QuickBarBonus
Определения ItemBase.c:4900
void PreLoadSoundAttachmentType()
Attachment Sound Type getting from config file.
Определения ItemBase.c:9202
override float GetWetInit()
Определения ItemBase.c:8531
int m_ImpactSoundSurfaceHash
Определения ItemBase.c:4892
int m_SoundSyncPlay
Определения ItemBase.c:4972
int m_MaxOverheatingValue
Определения ItemBase.c:4951
void SetupSpawnedItem(ItemBase item, float health, float quantity)
Определения ItemBase.c:4875
bool m_IsTakeable
Определения ItemBase.c:4903
bool ShouldSplitQuantity(float quantity)
Определения ItemBase.c:6428
static ref map< string, int > m_WeaponTypeToID
Определения ItemBase.c:4943
string GetLockSoundSet()
Определения ItemBase.c:8629
string GetColorString()
Returns item's PROCEDURAL color as formated string, i.e. "#(argb,8,8,3)color(0.15,...
Определения ItemBase.c:8660
array< int > GetValidFinishers()
returns an array of possible finishers
Определения ItemBase.c:9590
void OnAttachmentQuantityChangedEx(ItemBase item, float delta)
Called on server side when some attachment's quantity is changed. Call super.OnAttachmentQuantityChan...
Определения ItemBase.c:6895
class ItemBase extends InventoryItem SpawnItemOnLocation(string object_name, notnull InventoryLocation loc, bool full_quantity)
Определения ItemBase.c:4855
ItemSoundHandler GetItemSoundHandler()
Определения ItemBase.c:9229
override int GetQuantityMin()
Определения ItemBase.c:8280
void SplitIntoStackMaxToInventoryLocationClient(notnull InventoryLocation dst)
Определения ItemBase.c:6634
override int GetQuickBarBonus()
Определения ItemBase.c:5119
override void SetTakeable(bool pState)
Определения ItemBase.c:9184
float m_OverheatingDecayInterval
Определения ItemBase.c:4952
void SetIsPlaceSound(bool is_place_sound)
override void SplitIntoStackMaxClient(EntityAI destination_entity, int slot_id)
Определения ItemBase.c:6448
void HierarchyCheck(out bool hasParent, out bool hasRootAsPlayer, out ItemBase refParentIB)
Определения ItemBase.c:9435
bool CanProcessDecay()
Определения ItemBase.c:9463
void RemoveAudioVisualsOnClient()
Определения Bottle_Base.c:151
void SoundSynchRemote()
static void AddDebugActionsMask(int mask)
Определения ItemBase.c:5630
void PlayDeployLoopSoundEx()
void RemoveLightSourceItem()
Определения ItemBase.c:9579
bool CanRepair(ItemBase item_repair_kit)
Определения ItemBase.c:7493
bool can_this_be_combined
Определения ItemBase.c:4908
EffectSound m_SoundDeploy
Определения ItemBase.c:9673
int m_Count
Определения ItemBase.c:4874
float GetBaitEffectivity()
generic effectivity as a bait for animal catching
Определения ItemBase.c:9626
float GetDeployTime()
how long it takes to deploy this item in seconds
Определения ItemBase.c:9176
override bool IsSplitable()
Определения ItemBase.c:6415
bool DamageItemAttachments(float damage)
Определения ItemBase.c:6399
override void WriteVarsToCTX(ParamsWriteContext ctx)
Определения ItemBase.c:7805
void ConvertEnergyToQuantity()
Определения ItemBase.c:8446
override void RemoveAllAgents()
Определения ItemBase.c:8785
override void SetQuantityToMinimum()
Определения ItemBase.c:8213
bool m_WantPlayImpactSound
Определения ItemBase.c:4889
override float GetTemperatureThawTime()
Определения ItemBase.c:9550
ref map< int, ref array< ref WeaponParticlesOnOverheating > > m_OnOverheatingEffect
Определения ItemBase.c:4942
int m_ColorComponentG
Определения ItemBase.c:4919
float m_StoreLoadedQuantity
Определения ItemBase.c:4876
void MessageToOwnerAction(string text)
Send message to owner player in yellow color.
Определения ItemBase.c:7560
int m_ColorComponentA
Определения ItemBase.c:4921
int m_VarQuantityInit
Определения ItemBase.c:4871
float GetFilterDamageRatio()
Определения ItemBase.c:5534
override void SetLiquidType(int value, bool allow_client=false)
Определения ItemBase.c:8673
void OnQuantityChanged(float delta)
Called on server side when this item's quantity is changed. Call super.OnQuantityChanged(); first whe...
Определения ItemBase.c:6865
void OnApply(PlayerBase player)
override 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:8220
bool m_HideSelectionsBySlot
Определения ItemBase.c:4956
bool IsOverheatingEffectActive()
Определения ItemBase.c:5397
void SetIsBeingPlaced(bool is_being_placed)
Определения ItemBase.c:5814
int GetLiquidContainerMask()
Определения ItemBase.c:5751
void SetInventoryLocationToVicinityOrCurrent(EntityAI root, inout InventoryLocation dst)
Определения ItemBase.c:7002
ref Timer m_CheckOverheating
Определения ItemBase.c:4949
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:5445
float GetEnergy()
Определения ItemBase.c:8420
bool CanBeDigged()
Определения ItemBase.c:5830
bool GetActionWidgetOverride(out typename name)
If we need a different (handheld)item action widget displayed, the logic goes in here.
Определения ItemBase.c:9596
bool IsNVG()
Определения ItemBase.c:5762
float GetUnitWeight(bool include_wetness=true)
Obsolete, use GetWeightEx instead.
Определения ItemBase.c:8380
void SetZoneDamageCEInit()
Sets zone damages to match randomized global health set by CE (CE spawn only)
Определения ItemBase.c:9372
bool m_IsDeploySound
Определения ItemBase.c:9675
bool CanEat()
Определения ItemBase.c:7453
static void PlayOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:9079
override bool IsOneHandedBehaviour()
Определения ItemBase.c:9150
void AddLightSourceItem(ItemBase lightsource)
Adds a light source child.
Определения ItemBase.c:9574
bool IsLiquidContainer()
Определения ItemBase.c:5746
FoodStage GetFoodStage()
overridden on Edible_Base; so we don't have to parse configs all the time
Определения ItemBase.c:7473
override float GetSingleInventoryItemWeightEx()
Определения ItemBase.c:8307
void SaveAgents(ParamsWriteContext ctx)
Определения ItemBase.c:8863
override int GetTargetQuantityMax(int attSlotID=-1)
Определения ItemBase.c:8261
int m_CleannessInit
Определения ItemBase.c:4885
float GetDisinfectQuantity(int system=0, Param param1=null)
Определения ItemBase.c:5529
override int GetAgents()
Определения ItemBase.c:8810
int m_VarQuantityMax
Определения ItemBase.c:4873
override bool IsHologram()
Определения ItemBase.c:5825
float GetItemAttachOffset()
Определения ItemBase.c:8589
bool IsPlaceSound()
Определения ItemBase.c:9689
static int GetDebugActionsMask()
Определения ItemBase.c:5615
void ProcessDecay(float delta, bool hasRootAsPlayer)
Определения ItemBase.c:9452
override bool IsItemBase()
Определения ItemBase.c:7606
void PlayDeploySound()
override bool IsTwoHandedBehaviour()
Определения ItemBase.c:9160
void ExplodeAmmo()
Определения ItemBase.c:6302
bool IsCombineAll(ItemBase other_item, bool use_stack_max=false)
Определения ItemBase.c:7078
float GetProtectionLevel(int type, bool consider_filter=false, int system=0)
Определения ItemBase.c:8884
static void PlayBulletCasingEjectParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:9059
override void OnEnergyAdded()
Определения ItemBase.c:8438
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:5774
EffectSound m_DeployLoopSoundEx
Определения ItemBase.c:9672
override void DeSerializeNumericalVars(array< float > floats)
Определения ItemBase.c:7746
void StopItemDynamicPhysics()
Определения ItemBase.c:9354
bool HasFoodStage()
Определения ItemBase.c:7466
override void SetStoreLoad(bool value)
Определения ItemBase.c:8558
float GetOverheatingValue()
Определения ItemBase.c:5359
bool ContainsAgent(int agent_id)
Определения ItemBase.c:8763
override void AddWet(float value)
Определения ItemBase.c:8506
bool IsLiquidPresent()
Определения ItemBase.c:5741
bool IsFullQuantity()
Определения ItemBase.c:8301
override void EOnContact(IEntity other, Contact extra)
Определения ItemBase.c:6015
void SplitIntoStackMaxHands(PlayerBase player)
Определения ItemBase.c:6770
void SplitIntoStackMaxHandsClient(PlayerBase player)
Определения ItemBase.c:6746
int m_CleannessMax
Определения ItemBase.c:4887
float m_VarStackMax
Определения ItemBase.c:4875
ref Timer m_PhysDropTimer
Определения ItemBase.c:4962
void MessageToOwnerFriendly(string text)
Send message to owner player in green color.
Определения ItemBase.c:7578
override void SetStoreLoadedQuantity(float value)
Определения ItemBase.c:8568
bool m_IsResultOfSplit string m_SoundAttType
distinguish if item has been created as new or it came from splitting (server only flag)
Определения ItemBase.c:4916
void CheckOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
Определения ItemBase.c:5380
void UnlockFromParent()
Unlocks this item from its attachment slot of its parent.
Определения ItemBase.c:5695
bool Repair(PlayerBase player, ItemBase item_repair_kit, float specialty_weight)
Определения ItemBase.c:7500
void OnLiquidTypeChanged(int oldType, int newType)
Определения ItemBase.c:8694
void StartOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
Определения ItemBase.c:5426
void PlayDeployFinishSound()
bool AllowFoodConsumption()
Определения ItemBase.c:8616
bool m_IsOverheatingEffectActive
Определения ItemBase.c:4947
int m_LiquidContainerMask
Определения ItemBase.c:4897
void ProcessItemWetness(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
Определения ItemBase.c:9390
override int GetCleanness()
Определения ItemBase.c:8611
bool PairWithDevice(notnull ItemBase otherDevice)
Определения ItemBase.c:9601
bool IsDeploySound()
Определения ItemBase.c:9690
static void RemoveDebugActionsMask(int mask)
Определения ItemBase.c:5635
static void UpdateOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:9099
int m_VarQuantityMin
Определения ItemBase.c:4872
void PerformDamageSystemReinit()
Определения ItemBase.c:9360
override void ClearInventory()
Определения ItemBase.c:8399
static int m_LastRegisteredWeaponID
Определения ItemBase.c:4944
ItemBase GetLightSourceItem()
Определения ItemBase.c:9584
void MessageToOwnerImportant(string text)
Send message to owner player in red color.
Определения ItemBase.c:7596
override float GetItemOverheatThreshold()
Определения ItemBase.c:9534
void StopDeployLoopSoundEx()
bool m_CanThisBeSplit
Определения ItemBase.c:4909
override void SerializeNumericalVars(array< float > floats_out)
Определения ItemBase.c:7710
ItemBase SplitIntoStackMaxToInventoryLocationEx(notnull InventoryLocation dst)
Определения ItemBase.c:6685
float m_ItemModelLength
Определения ItemBase.c:4895
bool m_IsHologram
Определения ItemBase.c:4902
static int m_DebugActionsMask
Определения ItemBase.c:4862
void KillAllOverheatingParticles()
Определения ItemBase.c:5495
bool CanBeCookedOnStick()
Определения ItemBase.c:7483
override int GetQuantityMax()
Определения ItemBase.c:8248
void GetRecipesActions(Man player, out TSelectableActionInfoArray outputList)
Определения ItemBase.c:7156
void OnActivatedByTripWire()
bool IsColorSet()
Определения ItemBase.c:8654
override void RemoveAgent(int agent_id)
Определения ItemBase.c:8776
bool m_ItemBeingDroppedPhys
Определения ItemBase.c:4905
override bool CanPutAsAttachment(EntityAI parent)
Определения ItemBase.c:8966
void PlayDetachSound(string slot_type)
Определения ItemBase.c:9330
static ref map< typename, ref TInputActionMap > m_ItemTypeActionsMap
Определения ItemBase.c:4856
void ProcessItemWetnessAndTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
Определения ItemBase.c:9663
override bool IsBeingPlaced()
Определения ItemBase.c:5809
int GetQuantityInit()
Определения ItemBase.c:8285
float ComputeQuantityUsedEx(ItemBase other_item, bool use_stack_max=true)
Определения ItemBase.c:7098
bool IsResultOfSplit()
Определения ItemBase.c:7083
bool m_FixDamageSystemInit
Определения ItemBase.c:4907
float m_ImpactSpeed
Определения ItemBase.c:4891
bool m_IsStoreLoad
Определения ItemBase.c:4910
int GetLiquidTypeInit()
Определения ItemBase.c:8684
string GetDeployFinishSoundset()
ItemBase m_LightSourceItem
Определения ItemBase.c:4925
void LockToParent()
Locks this item in it's current attachment slot of its parent. This makes the "locked" icon visible i...
Определения ItemBase.c:5682
override void SplitIntoStackMaxEx(EntityAI destination_entity, int slot_id)
Определения ItemBase.c:6557
int m_AttachedAgents
Определения ItemBase.c:4933
string m_LockSoundSet
Определения ItemBase.c:4968
void LoadParticleConfigOnOverheating(int id)
Определения ItemBase.c:5303
float m_VarQuantityPrev
Определения ItemBase.c:4870
bool IsSoundSynchRemote()
Определения ItemBase.c:9688
bool m_CanShowQuantity
Определения ItemBase.c:4911
override void OnRightClick()
Определения ItemBase.c:6938
int m_ColorComponentB
Определения ItemBase.c:4920
static ref map< typename, ref TActionAnimOverrideMap > m_ItemActionOverrides
Определения ItemBase.c:4858
bool IsActionTargetVisible()
Определения ItemBase.c:9196
override void OnItemAttachmentSlotChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
Определения ItemBase.c:6050
override void EEHitBy(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
Определения ItemBase.c:6339
bool m_IsBeingPlaced
Определения ItemBase.c:4901
int NameToID(string name)
Определения ItemBase.c:7683
void ~ItemBase()
Определения ItemBase.c:5580
override void OnWetLevelChanged(EWetnessLevel newLevel, EWetnessLevel oldLevel)
Определения ItemBase.c:8546
void ClearStopItemSoundServer()
Определения ItemBase.c:9288
override string ChangeIntoOnDetach()
Определения ItemBase.c:6263
float m_VarWetMax
Определения ItemBase.c:4882
void SplitIntoStackMaxToInventoryLocation(notnull InventoryLocation dst)
Определения ItemBase.c:6680
int GetLockType()
Определения ItemBase.c:8624
EffectSound m_SoundDeployFinish
Определения ItemBase.c:9670
override float GetWet()
Определения ItemBase.c:8516
EffectSound m_SoundPlace
Определения ItemBase.c:9671
float GetQuantityNormalizedScripted()
Определения ItemBase.c:8234
override void SetCleanness(int value, bool allow_client=false)
Определения ItemBase.c:8598
bool m_IsPlaceSound
Определения ItemBase.c:9674
override float GetWetMin()
Определения ItemBase.c:8526
ref ItemSoundHandler m_ItemSoundHandler
Определения ItemBase.c:4974
override bool KindOf(string tag)
Определения ItemBase.c:7612
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:1360
void OnItemLocationChanged(ItemBase item)
Определения ActionBase.c:998
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 void GizmoSelectObject(Object object)
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 native void GizmoSelectPhysics(Physics physics)
proto int GetTime()
returns mission time in milliseconds
proto native int ConfigGetType(string path)
Returns type of config value.
AnalyticsManagerClient GetAnalyticsClient()
Определения Global/game.c:1568
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()
Определения 3_Game/Entities/Man.c:44
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
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 string GetFoldSoundset()
Определения BaseBuildingBase.c:108
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:199
override void OnWasDetached(EntityAI parent, int slot_id)
override void EEOnAfterLoad()
Определения GardenBase.c:242
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()
override string GetLoopFoldSoundset()
Определения BaseBuildingBase.c:113
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:1238
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:489
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:496
override void OnStoreSave(ParamsWriteContext ctx)
Определения GardenBase.c:266
override void AfterStoreLoad()
Определения BarbedWire.c:155
override int GetOnDigWormsAmount()
Определения FieldShovel.c:27
override bool IsSelfAdjustingTemperature()
Определения PortableGasStove.c:287
override bool IsPlayerInside(PlayerBase player, string selection)
Определения BaseBuildingBase.c:1037
override void OnVariablesSynchronized()
Определения GardenBase.c:97
override void RefreshPhysics()
Определения BatteryCharger.c:359
override bool CanObstruct()
Определения BaseBuildingBase.c:84
override void OnWasAttached(EntityAI parent, int slot_id)
override bool CanReceiveAttachment(EntityAI attachment, int slotId)
Определения BaseBuildingBase.c:982
override bool CanPutInCargo(EntityAI parent)
Определения GardenBase.c:331
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:1008
override bool IsIgnoredByConstruction()
Определения BaseBuildingBase.c:1170
override void InitItemSounds()
Определения BaseBuildingBase.c:94
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:1032
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()
override bool CanBeSplit()
Определения Rag.c:34
override bool IsDeployable()
Определения BaseBuildingBase.c:365
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
Определения 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)
Определения 3_Game/tools/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
Определения 3_Game/constants.c:512
const int DEF_CHEMICAL
Определения 3_Game/constants.c:513
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:709
array< int > TIntArray
Определения EnScript.c:711
EntityEvent
Entity events for event-mask, or throwing event from code.
Определения EnEntity.c:45
static const float ITEM_TEMPERATURE_NEUTRAL_ZONE_MIDDLE
Определения 3_Game/constants.c:808
const int VARIABLE_LIQUIDTYPE
Определения 3_Game/constants.c:632
const int VARIABLE_CLEANNESS
Определения 3_Game/constants.c:635
const int VARIABLE_COLOR
Определения 3_Game/constants.c:634
const int VARIABLE_TEMPERATURE
Определения 3_Game/constants.c:630
const int VARIABLE_QUANTITY
Определения 3_Game/constants.c:628
const int VARIABLE_WET
Определения 3_Game/constants.c:631
const int LIQUID_NONE
Определения 3_Game/constants.c:529
static proto float AbsFloat(float f)
Returns absolute value.
const int MENU_INVENTORY
Определения 3_Game/constants.c:180
proto native bool dBodyIsDynamic(notnull IEntity ent)
const int SAT_CRAFTING
Определения 3_Game/constants.c:453
const int SAT_DEBUG_ACTION
Определения 3_Game/constants.c:454
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
Определения 3_Game/tools/tools.c:10
const int CALL_CATEGORY_SYSTEM
Определения 3_Game/tools/tools.c:8
proto native int GetColor()