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

◆ InitializeActions()

void SpawnItemOnLocation::InitializeActions ( )
private

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

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