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

◆ LoadParticleConfigOnOverheating()

void SpawnItemOnLocation::LoadParticleConfigOnOverheating ( int id)
private

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

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

Используется в InventoryItem::ItemBase().