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

◆ ItemBase()

void SpawnItemOnLocation::ItemBase ( )
private

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

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