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

◆ GetOverheatingValue()

float SpawnItemOnLocation::GetOverheatingValue ( )
private

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

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