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

◆ GetQuickBarBonus()

override int SpawnItemOnLocation::GetQuickBarBonus ( )
private

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

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