5051{
5053 {
5054 return true;
5055 }
5056};
5057
5058
5059
5061{
5065
5067
5070
5071
5072
5073
5074
5083
5089
5094
5099
5120 protected bool m_IsResultOfSplit
5121
5123
5128
5129
5130
5132
5136
5137
5138
5140
5143
5144
5145
5151
5152
5160
5163
5164
5166
5167
5169
5170
5175
5176
5181
5182
5184
5185
5187 {
5192
5193 if (!
GetGame().IsDedicatedServer())
5194 {
5196 {
5198
5200 {
5202 }
5203 }
5204
5207 }
5208
5209 m_OldLocation = null;
5210
5212 {
5214 }
5215
5216 if (ConfigIsExisting("headSelectionsToHide"))
5217 {
5220 }
5221
5223 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
5224 {
5226 }
5227
5229
5230 m_IsResultOfSplit = false;
5231
5233 }
5234
5236 {
5237 super.InitItemVariables();
5238
5244 m_Count = ConfigGetInt(
"count");
5245
5248
5253
5256
5261
5273
5277
5278
5281 if (ConfigIsExisting("canBeSplit"))
5282 {
5285 }
5286
5288 if (ConfigIsExisting("itemBehaviour"))
5290
5291
5294 RegisterNetSyncVariableInt("m_VarLiquidType");
5295 RegisterNetSyncVariableInt("m_Cleanness",0,1);
5296
5297 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
5298 RegisterNetSyncVariableFloat("m_ImpactSpeed");
5299 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
5300
5301 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
5302 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
5303 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
5304 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
5305
5306 RegisterNetSyncVariableBool("m_IsBeingPlaced");
5307 RegisterNetSyncVariableBool("m_IsTakeable");
5308 RegisterNetSyncVariableBool("m_IsHologram");
5309
5312 {
5315 }
5316
5318
5320 if (ConfigIsExisting("temperaturePerQuantityWeight"))
5322
5323 }
5324
5326 {
5328 }
5329
5331 {
5334 {
5339 }
5340 }
5341
5342 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
5343 {
5345 {
5348 }
5349
5351 }
5352
5354 {
5360 }
5361
5363
5365 {
5367
5368 if (!action)
5369 {
5370 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
5371 return;
5372 }
5373
5375 if (!ai)
5376 {
5378 return;
5379 }
5380
5382 if (!action_array)
5383 {
5384 action_array = new array<ActionBase_Basic>;
5386 }
5387 if (LogManager.IsActionLogEnable())
5388 {
5389 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
5390 }
5391
5392 if (action_array.Find(action) != -1)
5393 {
5394 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
5395 }
5396 else
5397 {
5398 action_array.Insert(action);
5399 }
5400 }
5401
5403 {
5405 ActionBase action = player.GetActionManager().GetAction(actionName);
5408
5409 if (action_array)
5410 {
5411 action_array.RemoveItem(action);
5412 }
5413 }
5414
5415
5416
5418 {
5419 ActionOverrideData overrideData = new ActionOverrideData();
5423
5425 if (!actionMap)
5426 {
5429 }
5430
5431 actionMap.Insert(this.
Type(), overrideData);
5432
5433 }
5434
5436
5438
5439
5441 {
5444
5447
5448 string config_to_search = "CfgVehicles";
5449 string muzzle_owner_config;
5450
5452 {
5453 if (IsInherited(Weapon))
5454 config_to_search = "CfgWeapons";
5455
5456 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
5457
5458 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
5459
5461
5462 if (config_OnFire_subclass_count > 0)
5463 {
5464 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
5465
5466 for (int i = 0; i < config_OnFire_subclass_count; i++)
5467 {
5468 string particle_class = "";
5470 string config_OnFire_entry = config_OnFire_class + particle_class;
5471 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
5472 WPOF_array.Insert(WPOF);
5473 }
5474
5475
5477 }
5478 }
5479
5481 {
5482 config_to_search = "CfgWeapons";
5483 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
5484
5485 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
5486
5488
5489 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
5490 {
5491 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
5492
5493 for (i = 0; i < config_OnBulletCasingEject_count; i++)
5494 {
5495 string particle_class2 = "";
5497 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
5498 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
5499 WPOBE_array.Insert(WPOBE);
5500 }
5501
5502
5504 }
5505 }
5506 }
5507
5508
5510 {
5513
5515 {
5516 string config_to_search = "CfgVehicles";
5517
5518 if (IsInherited(Weapon))
5519 config_to_search = "CfgWeapons";
5520
5521 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
5522 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
5523
5524 if (
GetGame().ConfigIsExisting(config_OnOverheating_class))
5525 {
5526
5528
5530 {
5532 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
5534 return;
5535 }
5536
5539
5540
5541
5543 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
5544
5545 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
5546 {
5547 string particle_class = "";
5549 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
5551
5552 if (entry_type == CT_CLASS)
5553 {
5554 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
5555 WPOOH_array.Insert(WPOF);
5556 }
5557 }
5558
5559
5561 }
5562 }
5563 }
5564
5566 {
5568 }
5569
5571 {
5573 {
5575
5578
5581
5582 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
5583 }
5584 }
5585
5587 {
5589 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
5590
5592 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
5593
5595 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
5596
5598 {
5600 }
5601 }
5602
5604 {
5606 }
5607
5609 {
5612 else
5614
5616 {
5619 }
5620 else
5621 {
5624
5627 }
5628
5630 }
5631
5633 {
5635 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
5636 }
5637
5639 {
5641 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
5643 }
5644
5646 {
5648 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
5649 }
5650
5652 {
5655
5656 OverheatingParticle OP = new OverheatingParticle();
5661
5663 }
5664
5666 {
5669
5670 return -1;
5671 }
5672
5674 {
5676 {
5679
5680 for (int i = count; i > 0; --i)
5681 {
5682 int id = i - 1;
5685
5688
5689 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
5690 {
5691 if (p)
5692 {
5695 }
5696 }
5697 }
5698 }
5699 }
5700
5702 {
5704 {
5706 {
5707 int id = i - 1;
5709
5710 if (OP)
5711 {
5713
5714 if (p)
5715 {
5717 }
5718
5719 delete OP;
5720 }
5721 }
5722
5725 }
5726 }
5727
5730 {
5731 return 0.0;
5732 }
5733
5734
5736 {
5737 return 250;
5738 }
5739
5741 {
5742 return 0;
5743 }
5744
5747 {
5749 return true;
5750
5751 return false;
5752 }
5753
5756 {
5759
5761 {
5763 }
5764 else
5765 {
5766
5768 }
5769
5771 }
5772
5779 {
5780 return -1;
5781 }
5782
5783
5784
5785
5787 {
5789 {
5791 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
5792
5793 if (r_index >= 0)
5794 {
5795 InventoryLocation r_il = new InventoryLocation;
5796 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
5797
5798 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
5801 {
5802 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
5803 }
5805 {
5806 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
5807 }
5808
5809 }
5810
5811 player.GetHumanInventory().ClearUserReservedLocation(this);
5812 }
5813
5816 }
5817
5818
5819
5820
5822 {
5823 return ItemBase.m_DebugActionsMask;
5824 }
5825
5827 {
5828 return ItemBase.m_DebugActionsMask & mask;
5829 }
5830
5832 {
5833 ItemBase.m_DebugActionsMask = mask;
5834 }
5835
5837 {
5838 ItemBase.m_DebugActionsMask |= mask;
5839 }
5840
5842 {
5843 ItemBase.m_DebugActionsMask &= ~mask;
5844 }
5845
5847 {
5849 {
5851 }
5852 else
5853 {
5855 }
5856 }
5857
5858
5860 {
5861 if (GetEconomyProfile())
5862 {
5863 float q_max = GetEconomyProfile().GetQuantityMax();
5864 if (q_max > 0)
5865 {
5866 float q_min = GetEconomyProfile().GetQuantityMin();
5867 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
5868
5870 {
5871 ComponentEnergyManager comp = GetCompEM();
5873 {
5875 }
5876 }
5878 {
5880
5881 }
5882
5883 }
5884 }
5885 }
5886
5889 {
5890 EntityAI parent = GetHierarchyParent();
5891
5892 if (parent)
5893 {
5894 InventoryLocation inventory_location_to_lock = new InventoryLocation;
5895 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
5896 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
5897 }
5898 }
5899
5902 {
5903 EntityAI parent = GetHierarchyParent();
5904
5905 if (parent)
5906 {
5907 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
5908 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
5909 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
5910 }
5911 }
5912
5914 {
5915
5916
5917
5918
5920
5922 {
5923 if (ScriptInputUserData.CanStoreInputUserData())
5924 {
5925 ScriptInputUserData ctx = new ScriptInputUserData;
5931 ctx.
Write(use_stack_max);
5934
5936 {
5937 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
5938 }
5939 }
5940 }
5941 else if (!
GetGame().IsMultiplayer())
5942 {
5944 }
5945 }
5946
5948 {
5950 }
5951
5953 {
5955 }
5956
5958 {
5960 }
5961
5963 {
5964
5965 return false;
5966 }
5967
5969 {
5970 return false;
5971 }
5972
5976 {
5977 return false;
5978 }
5979
5981 {
5982 return "";
5983 }
5984
5986
5988 {
5989 return false;
5990 }
5991
5993 {
5994 return true;
5995 }
5996
5997
5998
6000 {
6001 return true;
6002 }
6003
6005 {
6006 return true;
6007 }
6008
6010 {
6011 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6013 }
6014
6016 {
6018 }
6019
6021 {
6023 if (!is_being_placed)
6025 SetSynchDirty();
6026 }
6027
6028
6030
6032 {
6034 }
6035
6037 {
6039 }
6040
6042 {
6043 return 1;
6044 }
6045
6047 {
6048 return false;
6049 }
6050
6052 {
6054 SetSynchDirty();
6055 }
6056
6057
6058
6059
6060
6061
6062
6063
6064
6065
6066
6067
6068
6069
6070
6071
6072
6073
6074
6075
6076
6077
6078
6079
6080
6081
6082
6083
6084
6085
6086
6087
6088
6089
6090
6092 {
6093 super.OnMovedInsideCargo(container);
6094
6095 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6096 }
6097
6098 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
6099 {
6100 super.EEItemLocationChanged(oldLoc,newLoc);
6101
6102 PlayerBase new_player = null;
6103 PlayerBase old_player = null;
6104
6105 if (newLoc.GetParent())
6106 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
6107
6108 if (oldLoc.GetParent())
6109 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
6110
6112 {
6113 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
6114
6115 if (r_index >= 0)
6116 {
6117 InventoryLocation r_il = new InventoryLocation;
6118 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6119
6120 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6123 {
6124 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6125 }
6127 {
6128 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6129 }
6130
6131 }
6132 }
6133
6135 {
6136 if (new_player)
6137 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
6138
6139 if (new_player == old_player)
6140 {
6141
6142 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
6143 {
6145 {
6146 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
6147 {
6148 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6149 }
6150 }
6151 else
6152 {
6153 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6154 }
6155 }
6156
6157 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
6158 {
6159 int type = oldLoc.GetType();
6161 {
6162 oldLoc.GetParent().GetOnSetLock().Invoke(this);
6163 }
6165 {
6166 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
6167 }
6168 }
6169 if (!m_OldLocation)
6170 {
6171 m_OldLocation = new InventoryLocation;
6172 }
6173 m_OldLocation.Copy(oldLoc);
6174 }
6175 else
6176 {
6177 if (m_OldLocation)
6178 {
6179 m_OldLocation.Reset();
6180 }
6181 }
6182
6184 }
6185 else
6186 {
6187 if (new_player)
6188 {
6189 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
6190 if (res_index >= 0)
6191 {
6192 InventoryLocation il = new InventoryLocation;
6193 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
6195 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
6198 {
6199 il.
GetParent().GetOnReleaseLock().Invoke(it);
6200 }
6202 {
6204 }
6205
6206 }
6207 }
6209 {
6210
6212 }
6213
6214 if (m_OldLocation)
6215 {
6216 m_OldLocation.Reset();
6217 }
6218 }
6219 }
6220
6221 override void EOnContact(IEntity other, Contact extra)
6222 {
6224 {
6225 int liquidType = -1;
6227 if (impactSpeed > 0.0)
6228 {
6230 #ifndef SERVER
6232 #else
6234 SetSynchDirty();
6235 #endif
6237 }
6238 }
6239
6240 #ifdef SERVER
6241 if (GetCompEM() && GetCompEM().IsPlugged())
6242 {
6243 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
6244 GetCompEM().UnplugThis();
6245 }
6246 #endif
6247 }
6248
6250
6252 {
6254 }
6255
6257 {
6258
6259 }
6260
6262 {
6263 super.OnItemLocationChanged(old_owner, new_owner);
6264
6265 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
6266 PlayerBase playerNew = PlayerBase.Cast(new_owner);
6267
6268 if (!relatedPlayer && playerNew)
6269 relatedPlayer = playerNew;
6270
6271 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
6272 {
6274 if (actionMgr)
6275 {
6276 ActionBase currentAction = actionMgr.GetRunningAction();
6277 if (currentAction)
6279 }
6280 }
6281
6282 Man ownerPlayerOld = null;
6283 Man ownerPlayerNew = null;
6284
6285 if (old_owner)
6286 {
6287 if (old_owner.
IsMan())
6288 {
6289 ownerPlayerOld = Man.Cast(old_owner);
6290 }
6291 else
6292 {
6293 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
6294 }
6295 }
6296 else
6297 {
6299 {
6301
6302 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
6303 {
6304 GetCompEM().UnplugThis();
6305 }
6306 }
6307 }
6308
6309 if (new_owner)
6310 {
6311 if (new_owner.
IsMan())
6312 {
6313 ownerPlayerNew = Man.Cast(new_owner);
6314 }
6315 else
6316 {
6317 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
6318 }
6319 }
6320
6321 if (ownerPlayerOld != ownerPlayerNew)
6322 {
6323 if (ownerPlayerOld)
6324 {
6325 array<EntityAI> subItemsExit = new array<EntityAI>;
6327 for (int i = 0; i < subItemsExit.Count(); i++)
6328 {
6331 }
6332 }
6333
6334 if (ownerPlayerNew)
6335 {
6336 array<EntityAI> subItemsEnter = new array<EntityAI>;
6338 for (int j = 0; j < subItemsEnter.Count(); j++)
6339 {
6342 }
6343 }
6344 }
6345 else if (ownerPlayerNew != null)
6346 {
6347 PlayerBase nplayer;
6348 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
6349 {
6350 array<EntityAI> subItemsUpdate = new array<EntityAI>;
6352 for (int k = 0; k < subItemsUpdate.Count(); k++)
6353 {
6355 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
6356 }
6357 }
6358 }
6359
6360 if (old_owner)
6361 old_owner.OnChildItemRemoved(this);
6362 if (new_owner)
6363 new_owner.OnChildItemReceived(this);
6364 }
6365
6366
6368 {
6369 super.EEDelete(parent);
6370 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
6371 if (player)
6372 {
6374
6375 if (player.IsAlive())
6376 {
6377 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6378 if (r_index >= 0)
6379 {
6380 InventoryLocation r_il = new InventoryLocation;
6381 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6382
6383 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6386 {
6387 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6388 }
6390 {
6391 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6392 }
6393
6394 }
6395
6396 player.RemoveQuickBarEntityShortcut(this);
6397 }
6398 }
6399 }
6400
6402 {
6403 super.EEKilled(killer);
6404
6407 {
6408 if (GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
6409 {
6410 if (IsMagazine())
6411 {
6412 if (Magazine.Cast(this).GetAmmoCount() > 0)
6413 {
6415 }
6416 }
6417 else
6418 {
6420 }
6421 }
6422 }
6423 }
6424
6426 {
6427 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6428
6429 super.OnWasAttached(parent, slot_id);
6430
6433
6435 }
6436
6438 {
6439 super.OnWasDetached(parent, slot_id);
6440
6443 }
6444
6446 {
6447 int idx;
6450
6451 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
6452 if (inventory_slots.Count() < 1)
6453 {
6454 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
6455 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
6456 }
6457 else
6458 {
6459 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
6460 }
6461
6462 idx = inventory_slots.Find(slot);
6463 if (idx < 0)
6464 return "";
6465
6466 return attach_types.Get(idx);
6467 }
6468
6470 {
6471 int idx = -1;
6472 string slot;
6473
6476
6477 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
6478 if (inventory_slots.Count() < 1)
6479 {
6480 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
6481 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
6482 }
6483 else
6484 {
6485 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
6486 if (detach_types.Count() < 1)
6487 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
6488 }
6489
6490 for (int i = 0; i < inventory_slots.Count(); i++)
6491 {
6492 slot = inventory_slots.Get(i);
6493 }
6494
6495 if (slot != "")
6496 {
6497 if (detach_types.Count() == 1)
6498 idx = 0;
6499 else
6500 idx = inventory_slots.Find(slot);
6501 }
6502 if (idx < 0)
6503 return "";
6504
6505 return detach_types.Get(idx);
6506 }
6507
6509 {
6510
6512
6513
6514 float min_time = 1;
6515 float max_time = 3;
6516 float delay = Math.RandomFloat(min_time, max_time);
6517
6518 explode_timer.Run(delay, this, "DoAmmoExplosion");
6519 }
6520
6522 {
6523 Magazine magazine = Magazine.Cast(this);
6524 int pop_sounds_count = 6;
6525 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
6526
6527
6528 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
6529 string sound_name = pop_sounds[ sound_idx ];
6531
6532
6533 magazine.ServerAddAmmoCount(-1);
6534
6535
6536 float min_temp_to_explode = 100;
6537
6538 if (magazine.GetAmmoCount() > 0 && GetTemperature() >= min_temp_to_explode)
6539 {
6541 }
6542 }
6543
6544
6545 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
6546 {
6547 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
6548
6549 const int CHANCE_DAMAGE_CARGO = 4;
6550 const int CHANCE_DAMAGE_ATTACHMENT = 1;
6551 const int CHANCE_DAMAGE_NOTHING = 2;
6552
6554 {
6555 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
6556 int chances;
6557 int rnd;
6558
6559 if (GetInventory().GetCargo())
6560 {
6561 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
6562 rnd = Math.RandomInt(0,chances);
6563
6564 if (rnd < CHANCE_DAMAGE_CARGO)
6565 {
6567 }
6568 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
6569 {
6571 }
6572 }
6573 else
6574 {
6575 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
6576 rnd = Math.RandomInt(0,chances);
6577
6578 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
6579 {
6581 }
6582 }
6583 }
6584 }
6585
6587 {
6588 if (GetInventory().GetCargo())
6589 {
6590 int item_count = GetInventory().GetCargo().GetItemCount();
6591 if (item_count > 0)
6592 {
6593 int random_pick = Math.RandomInt(0, item_count);
6595 if (!item.IsExplosive())
6596 {
6597 item.AddHealth("","",damage);
6598 return true;
6599 }
6600 }
6601 }
6602 return false;
6603 }
6604
6606 {
6607 int attachment_count = GetInventory().AttachmentCount();
6608 if (attachment_count > 0)
6609 {
6610 int random_pick = Math.RandomInt(0, attachment_count);
6611 ItemBase attachment =
ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
6612 if (!attachment.IsExplosive())
6613 {
6614 attachment.AddHealth("","",damage);
6615 return true;
6616 }
6617 }
6618 return false;
6619 }
6620
6622 {
6624 }
6625
6627 {
6629 return GetInventory().CanRemoveEntity();
6630
6631 return false;
6632 }
6633
6635 {
6637 return;
6638
6640 {
6641 if (ScriptInputUserData.CanStoreInputUserData())
6642 {
6643 ScriptInputUserData ctx = new ScriptInputUserData;
6648 ctx.
Write(destination_entity);
6652 }
6653 }
6654 else if (!
GetGame().IsMultiplayer())
6655 {
6657 }
6658 }
6659
6661 {
6663 return;
6664
6665 float split_quantity_new;
6669 InventoryLocation loc = new InventoryLocation;
6670
6671 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
6672 {
6674 split_quantity_new = stack_max;
6675 else
6677
6678 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
6679 if (new_item)
6680 {
6681 new_item.SetResultOfSplit(true);
6682 MiscGameplayFunctions.TransferItemProperties(this, new_item);
6684 new_item.SetQuantity(split_quantity_new);
6685 }
6686 }
6687 else if (destination_entity && slot_id == -1)
6688 {
6689 if (quantity > stack_max)
6690 split_quantity_new = stack_max;
6691 else
6692 split_quantity_new = quantity;
6693
6695 {
6698 }
6699
6700 if (new_item)
6701 {
6702 new_item.SetResultOfSplit(true);
6703 MiscGameplayFunctions.TransferItemProperties(this, new_item);
6705 new_item.SetQuantity(split_quantity_new);
6706 }
6707 }
6708 else
6709 {
6710 if (stack_max != 0)
6711 {
6713 {
6715 }
6716
6717 if (split_quantity_new == 0)
6718 {
6719 if (!
GetGame().IsMultiplayer())
6720 player.PhysicalPredictiveDropItem(this);
6721 else
6722 player.ServerDropEntity(this);
6723 return;
6724 }
6725
6727
6728 if (new_item)
6729 {
6730 new_item.SetResultOfSplit(true);
6731 MiscGameplayFunctions.TransferItemProperties(this, new_item);
6733 new_item.SetQuantity(stack_max);
6734 new_item.PlaceOnSurface();
6735 }
6736 }
6737 }
6738 }
6739
6741 {
6743 return;
6744
6745 float split_quantity_new;
6749 InventoryLocation loc = new InventoryLocation;
6750
6751 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
6752 {
6754 split_quantity_new = stack_max;
6755 else
6757
6758 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
6759 if (new_item)
6760 {
6761 new_item.SetResultOfSplit(true);
6762 MiscGameplayFunctions.TransferItemProperties(this, new_item);
6764 new_item.SetQuantity(split_quantity_new);
6765 }
6766 }
6767 else if (destination_entity && slot_id == -1)
6768 {
6769 if (quantity > stack_max)
6770 split_quantity_new = stack_max;
6771 else
6772 split_quantity_new = quantity;
6773
6775 {
6778 }
6779
6780 if (new_item)
6781 {
6782 new_item.SetResultOfSplit(true);
6783 MiscGameplayFunctions.TransferItemProperties(this, new_item);
6785 new_item.SetQuantity(split_quantity_new);
6786 }
6787 }
6788 else
6789 {
6790 if (stack_max != 0)
6791 {
6793 {
6795 }
6796
6798
6799 if (new_item)
6800 {
6801 new_item.SetResultOfSplit(true);
6802 MiscGameplayFunctions.TransferItemProperties(this, new_item);
6804 new_item.SetQuantity(stack_max);
6805 new_item.PlaceOnSurface();
6806 }
6807 }
6808 }
6809 }
6810
6812 {
6814 return;
6815
6817 {
6818 if (ScriptInputUserData.CanStoreInputUserData())
6819 {
6820 ScriptInputUserData ctx = new ScriptInputUserData;
6825 dst.WriteToContext(ctx);
6827 }
6828 }
6829 else if (!
GetGame().IsMultiplayer())
6830 {
6832 }
6833 }
6834
6836 {
6838 return;
6839
6841 {
6842 if (ScriptInputUserData.CanStoreInputUserData())
6843 {
6844 ScriptInputUserData ctx = new ScriptInputUserData;
6849 ctx.
Write(destination_entity);
6855 }
6856 }
6857 else if (!
GetGame().IsMultiplayer())
6858 {
6860 }
6861 }
6862
6864 {
6866 }
6867
6869 {
6871 return this;
6872
6874 float split_quantity_new;
6876 if (dst.IsValid())
6877 {
6878 int slot_id = dst.GetSlot();
6880
6881 if (quantity > stack_max)
6882 split_quantity_new = stack_max;
6883 else
6884 split_quantity_new = quantity;
6885
6887
6888 if (new_item)
6889 {
6890 new_item.SetResultOfSplit(true);
6891 MiscGameplayFunctions.TransferItemProperties(this,new_item);
6894 }
6895
6896 return new_item;
6897 }
6898
6899 return null;
6900 }
6901
6903 {
6905 return;
6906
6908 float split_quantity_new;
6910 if (destination_entity)
6911 {
6913 if (quantity > stackable)
6914 split_quantity_new = stackable;
6915 else
6916 split_quantity_new = quantity;
6917
6918 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
6919 if (new_item)
6920 {
6921 new_item.SetResultOfSplit(true);
6922 MiscGameplayFunctions.TransferItemProperties(this,new_item);
6924 new_item.SetQuantity(split_quantity_new);
6925 }
6926 }
6927 }
6928
6930 {
6932 return;
6933
6935 {
6936 if (ScriptInputUserData.CanStoreInputUserData())
6937 {
6938 ScriptInputUserData ctx = new ScriptInputUserData;
6943 ItemBase destination_entity =
this;
6944 ctx.
Write(destination_entity);
6948 }
6949 }
6950 else if (!
GetGame().IsMultiplayer())
6951 {
6953 }
6954 }
6955
6957 {
6959 return;
6960
6962 float split_quantity_new;
6964 if (player)
6965 {
6967 if (quantity > stackable)
6968 split_quantity_new = stackable;
6969 else
6970 split_quantity_new = quantity;
6971
6972 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
6973 new_item =
ItemBase.Cast(in_hands);
6974 if (new_item)
6975 {
6976 new_item.SetResultOfSplit(true);
6977 MiscGameplayFunctions.TransferItemProperties(this,new_item);
6979 new_item.SetQuantity(split_quantity_new);
6980 }
6981 }
6982 }
6983
6985 {
6987 return;
6988
6990 float split_quantity_new = Math.Floor(quantity * 0.5);
6991
6993
6994 if (new_item)
6995 {
6996 if (new_item.GetQuantityMax() < split_quantity_new)
6997 {
6998 split_quantity_new = new_item.GetQuantityMax();
6999 }
7000
7001 new_item.SetResultOfSplit(true);
7002 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7003
7005 {
7008 }
7009 else
7010 {
7013 }
7014 }
7015 }
7016
7018 {
7020 return;
7021
7023 float split_quantity_new = Math.Floor(quantity / 2);
7024
7025 InventoryLocation invloc = new InventoryLocation;
7027
7029 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
7030
7031 if (new_item)
7032 {
7033 if (new_item.GetQuantityMax() < split_quantity_new)
7034 {
7035 split_quantity_new = new_item.GetQuantityMax();
7036 }
7038 {
7041 }
7042 else
7043 {
7046 }
7047 }
7048 }
7049
7052 {
7053 SetWeightDirty();
7055
7056 if (parent)
7057 parent.OnAttachmentQuantityChangedEx(this, delta);
7058
7060 {
7062 {
7064 }
7066 {
7067 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
7069 }
7070 }
7071
7072 }
7073
7076 {
7077
7078 }
7079
7082 {
7084 }
7085
7087 {
7088 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
7089
7091 {
7092 if (newLevel == GameConstants.STATE_RUINED)
7093 {
7095 EntityAI parent = GetHierarchyParent();
7096 if (parent && parent.IsFireplace())
7097 {
7098 CargoBase cargo = GetInventory().GetCargo();
7099 if (cargo)
7100 {
7102 {
7104 }
7105 }
7106 }
7107 }
7108
7110 {
7111
7113 return;
7114 }
7115
7116 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
7117 {
7119 }
7120 }
7121 }
7122
7123
7125 {
7126 super.OnRightClick();
7127
7129 {
7131 {
7132 if (ScriptInputUserData.CanStoreInputUserData())
7133 {
7134 vector m4[4];
7136
7137 EntityAI root = GetHierarchyRoot();
7138
7139 InventoryLocation dst = new InventoryLocation;
7141 {
7142 if (root)
7143 {
7144 root.GetTransform(m4);
7146 }
7147 else
7148 GetInventory().GetCurrentInventoryLocation(dst);
7149 }
7150 else
7151 {
7153
7154
7155 if (
GetGame().
GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
7156 {
7157 if (root)
7158 {
7159 root.GetTransform(m4);
7161 }
7162 else
7163 GetInventory().GetCurrentInventoryLocation(dst);
7164 }
7165 else
7166 {
7167 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
7168 }
7169 }
7170
7171 ScriptInputUserData ctx = new ScriptInputUserData;
7179 }
7180 }
7181 else if (!
GetGame().IsMultiplayer())
7182 {
7184 }
7185 }
7186 }
7187
7188 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
7189 {
7190
7191 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
7192 return false;
7193
7194 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
7195 return false;
7196
7197
7199 return false;
7200
7201
7202 Magazine mag = Magazine.Cast(this);
7203 if (mag)
7204 {
7205 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
7206 return false;
7207
7208 if (stack_max_limit)
7209 {
7210 Magazine other_mag = Magazine.Cast(other_item);
7211 if (other_item)
7212 {
7213 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
7214 return false;
7215 }
7216
7217 }
7218 }
7219 else
7220 {
7221
7223 return false;
7224
7226 return false;
7227 }
7228
7229 PlayerBase player = null;
7230 if (CastTo(player, GetHierarchyRootPlayer()))
7231 {
7232 if (player.GetInventory().HasAttachment(this))
7233 return false;
7234
7235 if (player.IsItemsToDelete())
7236 return false;
7237 }
7238
7239 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
7240 return false;
7241
7242 int slotID;
7244 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
7245 return false;
7246
7247 return true;
7248 }
7249
7251 {
7253 }
7254
7256 {
7257 return m_IsResultOfSplit;
7258 }
7259
7261 {
7262 m_IsResultOfSplit = value;
7263 }
7264
7266 {
7268 }
7269
7271 {
7272 float other_item_quantity = other_item.GetQuantity();
7273 float this_free_space;
7274
7276
7278
7279 if (other_item_quantity > this_free_space)
7280 {
7281 return this_free_space;
7282 }
7283 else
7284 {
7285 return other_item_quantity;
7286 }
7287 }
7288
7290 {
7292 }
7293
7295 {
7297 return;
7298
7299 if (!IsMagazine() && other_item)
7300 {
7302 if (quantity_used != 0)
7303 {
7304 float hp1 = GetHealth01("","");
7305 float hp2 = other_item.GetHealth01("","");
7306 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
7307 hpResult = hpResult / (
GetQuantity() + quantity_used);
7308
7309 hpResult *= GetMaxHealth();
7310 Math.Round(hpResult);
7311 SetHealth("", "Health", hpResult);
7312
7314 other_item.AddQuantity(-quantity_used);
7315 }
7316 }
7318 }
7319
7321 {
7322 #ifdef SERVER
7323 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
7324 GetHierarchyParent().IncreaseLifetimeUp();
7325 #endif
7326 };
7327
7329 {
7330 PlayerBase p = PlayerBase.Cast(player);
7331
7332 array<int> recipesIds = p.m_Recipes;
7333 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
7334 if (moduleRecipesManager)
7335 {
7336 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
7337 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
7338 }
7339
7340 for (int i = 0;i < recipesIds.Count(); i++)
7341 {
7342 int key = recipesIds.Get(i);
7343 string recipeName = moduleRecipesManager.GetRecipeName(key);
7345 }
7346 }
7347
7348
7349 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
7350 {
7351 super.GetDebugActions(outputList);
7352
7353
7358
7359
7363
7367
7368
7371
7372
7374 {
7377 }
7378
7380
7383
7387 }
7388
7389
7390
7391
7393 {
7394 super.OnAction(action_id, player, ctx);
7395 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
7396 {
7397 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
7398 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
7399 PlayerBase p = PlayerBase.Cast(player);
7400 if (
EActions.RECIPES_RANGE_START < 1000)
7401 {
7402 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
7403 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
7404 }
7405 }
7406 #ifndef SERVER
7407 else if (action_id ==
EActions.WATCH_PLAYER)
7408 {
7409 PluginDeveloper.SetDeveloperItemClientEx(player);
7410 }
7411 #endif
7413 {
7414 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
7415 {
7416 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
7417 OnDebugButtonPressServer(id + 1);
7418 }
7419
7420 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
7421 {
7422 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
7424 }
7425
7426 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
7427 {
7428 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
7430 }
7431
7432 else if (action_id ==
EActions.ADD_QUANTITY)
7433 {
7434 if (IsMagazine())
7435 {
7436 Magazine mag = Magazine.Cast(this);
7437 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
7438 }
7439 else
7440 {
7442 }
7443
7444 if (m_EM)
7445 {
7446 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
7447 }
7448
7449 }
7450
7451 else if (action_id ==
EActions.REMOVE_QUANTITY)
7452 {
7453 if (IsMagazine())
7454 {
7455 Magazine mag2 = Magazine.Cast(this);
7456 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
7457 }
7458 else
7459 {
7461 }
7462 if (m_EM)
7463 {
7464 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
7465 }
7466
7467 }
7468
7469 else if (action_id ==
EActions.SET_QUANTITY_0)
7470 {
7472
7473 if (m_EM)
7474 {
7475 m_EM.SetEnergy(0);
7476 }
7477 }
7478
7479 else if (action_id ==
EActions.SET_MAX_QUANTITY)
7480 {
7482
7483 if (m_EM)
7484 {
7485 m_EM.SetEnergy(m_EM.GetEnergyMax());
7486 }
7487 }
7488
7489 else if (action_id ==
EActions.ADD_HEALTH)
7490 {
7491 AddHealth("","",GetMaxHealth("","Health")/5);
7492 }
7493 else if (action_id ==
EActions.REMOVE_HEALTH)
7494 {
7495 AddHealth("","",-GetMaxHealth("","Health")/5);
7496 }
7497 else if (action_id ==
EActions.DESTROY_HEALTH)
7498 {
7499 SetHealth01("","",0);
7500 }
7501 else if (action_id ==
EActions.WATCH_ITEM)
7502 {
7504 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
7505 #ifdef DEVELOPER
7506 SetDebugDeveloper_item(this);
7507 #endif
7508 }
7509
7510 else if (action_id ==
EActions.ADD_TEMPERATURE)
7511 {
7512 AddTemperature(20);
7513
7514 }
7515
7516 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
7517 {
7518 AddTemperature(-20);
7519
7520 }
7521
7522 else if (action_id ==
EActions.FLIP_FROZEN)
7523 {
7524 SetFrozen(!GetIsFrozen());
7525
7526 }
7527
7528 else if (action_id ==
EActions.ADD_WETNESS)
7529 {
7531
7532 }
7533
7534 else if (action_id ==
EActions.REMOVE_WETNESS)
7535 {
7537
7538 }
7539
7540 else if (action_id ==
EActions.LIQUIDTYPE_UP)
7541 {
7544
7545
7546 }
7547
7548 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
7549 {
7552 }
7553
7554 else if (action_id ==
EActions.MAKE_SPECIAL)
7555 {
7556 auto debugParams = DebugSpawnParams.WithPlayer(player);
7557 OnDebugSpawnEx(debugParams);
7558 }
7559
7560 else if (action_id ==
EActions.DELETE)
7561 {
7562 Delete();
7563 }
7564
7565 }
7566
7567
7568 return false;
7569 }
7570
7571
7572
7573
7577
7580
7581
7582
7584 {
7585 return false;
7586 }
7587
7588
7590 {
7591 return true;
7592 }
7593
7594
7596 {
7597 return true;
7598 }
7599
7600
7601
7603 {
7604 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
7606 }
7607
7610 {
7611 return null;
7612 }
7613
7615 {
7616 return false;
7617 }
7618
7620 {
7621 return false;
7622 }
7623
7627
7628
7630 {
7631 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
7632 return module_repairing.CanRepair(this, item_repair_kit);
7633 }
7634
7635
7636 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
7637 {
7638 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
7639 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
7640 }
7641
7642
7644 {
7645
7646
7647
7648
7649
7650
7651
7652
7653 return 1;
7654 }
7655
7656
7657
7659 {
7661 }
7662
7663
7664
7666 {
7668 }
7669
7670
7679 {
7680 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
7681
7682 if (player)
7683 {
7684 player.MessageStatus(text);
7685 }
7686 }
7687
7688
7697 {
7698 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
7699
7700 if (player)
7701 {
7702 player.MessageAction(text);
7703 }
7704 }
7705
7706
7715 {
7716 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
7717
7718 if (player)
7719 {
7720 player.MessageFriendly(text);
7721 }
7722 }
7723
7724
7733 {
7734 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
7735
7736 if (player)
7737 {
7738 player.MessageImportant(text);
7739 }
7740 }
7741
7743 {
7744 return true;
7745 }
7746
7747
7748 override bool KindOf(
string tag)
7749 {
7750 bool found = false;
7751 string item_name = this.
GetType();
7754
7755 int array_size = item_tag_array.Count();
7756 for (int i = 0; i < array_size; i++)
7757 {
7758 if (item_tag_array.Get(i) == tag)
7759 {
7760 found = true;
7761 break;
7762 }
7763 }
7764 return found;
7765 }
7766
7767
7769 {
7770
7771 super.OnRPC(sender, rpc_type,ctx);
7772
7773
7774 switch (rpc_type)
7775 {
7776 #ifndef SERVER
7777 case ERPCs.RPC_SOUND_LOCK_ATTACH:
7778 Param2<bool, string> p = new Param2<bool, string>(false, "");
7779
7781 return;
7782
7783 bool play = p.param1;
7784 string soundSet = p.param2;
7785
7786 if (play)
7787 {
7789 {
7791 {
7793 }
7794 }
7795 else
7796 {
7798 }
7799 }
7800 else
7801 {
7803 }
7804
7805 break;
7806 #endif
7807
7808 }
7809
7811 {
7813 }
7814 }
7815
7816
7817
7818
7820 {
7821 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
7822 return plugin.GetID(
name);
7823 }
7824
7826 {
7827 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
7828 return plugin.GetName(id);
7829 }
7830
7833 {
7834
7835
7836 int varFlags;
7837 if (!ctx.
Read(varFlags))
7838 return;
7839
7840 if (varFlags & ItemVariableFlags.FLOAT)
7841 {
7843 }
7844 }
7845
7847 {
7848
7849 super.SerializeNumericalVars(floats_out);
7850
7851
7852
7854 {
7856 }
7857
7859 {
7861 }
7862
7864 {
7866 }
7867
7869 {
7874 }
7875
7877 {
7879 }
7880 }
7881
7883 {
7884
7885 super.DeSerializeNumericalVars(floats);
7886
7887
7888 int index = 0;
7889 int mask = Math.Round(floats.Get(index));
7890
7891 index++;
7892
7894 {
7896 {
7898 }
7899 else
7900 {
7901 float quantity = floats.Get(index);
7903 }
7904 index++;
7905 }
7906
7908 {
7909 float wet = floats.Get(index);
7911 index++;
7912 }
7913
7915 {
7916 int liquidtype = Math.Round(floats.Get(index));
7918 index++;
7919 }
7920
7922 {
7924 index++;
7926 index++;
7928 index++;
7930 index++;
7931 }
7932
7934 {
7935 int cleanness = Math.Round(floats.Get(index));
7937 index++;
7938 }
7939 }
7940
7942 {
7943 super.WriteVarsToCTX(ctx);
7944
7945
7947 {
7949 }
7950
7952 {
7954 }
7955
7957 {
7959 }
7960
7962 {
7963 int r,g,b,a;
7969 }
7970
7972 {
7974 }
7975 }
7976
7978 {
7979 if (!super.ReadVarsFromCTX(ctx,version))
7980 return false;
7981
7982 int intValue;
7983 float value;
7984
7985 if (version < 140)
7986 {
7987 if (!ctx.
Read(intValue))
7988 return false;
7989
7990 m_VariablesMask = intValue;
7991 }
7992
7994 {
7995 if (!ctx.
Read(value))
7996 return false;
7997
7999 {
8001 }
8002 else
8003 {
8005 }
8006 }
8007
8008 if (version < 140)
8009 {
8011 {
8012 if (!ctx.
Read(value))
8013 return false;
8014 SetTemperatureDirect(value);
8015 }
8016 }
8017
8019 {
8020 if (!ctx.
Read(value))
8021 return false;
8023 }
8024
8026 {
8027 if (!ctx.
Read(intValue))
8028 return false;
8030 }
8031
8033 {
8034 int r,g,b,a;
8036 return false;
8038 return false;
8040 return false;
8042 return false;
8043
8045 }
8046
8048 {
8049 if (!ctx.
Read(intValue))
8050 return false;
8052 }
8053
8054 if (version >= 138 && version < 140)
8055 {
8057 {
8058 if (!ctx.
Read(intValue))
8059 return false;
8060 SetFrozen(intValue);
8061 }
8062 }
8063
8064 return true;
8065 }
8066
8067
8069 {
8072 {
8074 }
8075
8076 if (!super.OnStoreLoad(ctx, version))
8077 {
8079 return false;
8080 }
8081
8082 if (version >= 114)
8083 {
8084 bool hasQuickBarIndexSaved;
8085
8086 if (!ctx.
Read(hasQuickBarIndexSaved))
8087 {
8089 return false;
8090 }
8091
8092 if (hasQuickBarIndexSaved)
8093 {
8094 int itmQBIndex;
8095
8096
8097 if (!ctx.
Read(itmQBIndex))
8098 {
8100 return false;
8101 }
8102
8103 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
8104 if (itmQBIndex != -1 && parentPlayer)
8105 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
8106 }
8107 }
8108 else
8109 {
8110
8111 PlayerBase player;
8112 int itemQBIndex;
8113 if (version ==
int.
MAX)
8114 {
8115 if (!ctx.
Read(itemQBIndex))
8116 {
8118 return false;
8119 }
8120 }
8121 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
8122 {
8123
8124 if (!ctx.
Read(itemQBIndex))
8125 {
8127 return false;
8128 }
8129 if (itemQBIndex != -1 && player)
8130 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
8131 }
8132 }
8133
8134 if (version < 140)
8135 {
8136
8137 if (!LoadVariables(ctx, version))
8138 {
8140 return false;
8141 }
8142 }
8143
8144
8146 {
8148 return false;
8149 }
8150 if (version >= 132)
8151 {
8153 if (raib)
8154 {
8156 {
8158 return false;
8159 }
8160 }
8161 }
8162
8164 return true;
8165 }
8166
8167
8168
8170 {
8171 super.OnStoreSave(ctx);
8172
8173 PlayerBase player;
8174 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
8175 {
8177
8178 int itemQBIndex = -1;
8179 itemQBIndex = player.FindQuickBarEntityIndex(this);
8180 ctx.
Write(itemQBIndex);
8181 }
8182 else
8183 {
8185 }
8186
8188
8190 if (raib)
8191 {
8193 }
8194 }
8195
8196
8198 {
8199 super.AfterStoreLoad();
8200
8202 {
8204 }
8205
8207 {
8210 }
8211 }
8212
8214 {
8215 super.EEOnAfterLoad();
8216
8218 {
8220 }
8221
8224 }
8225
8227 {
8228 return false;
8229 }
8230
8231
8232
8234 {
8236 {
8237 #ifdef PLATFORM_CONSOLE
8238
8240 {
8242 if (menu)
8243 {
8245 }
8246 }
8247 #endif
8248 }
8249
8251 {
8254 }
8255
8257 {
8258 SetWeightDirty();
8260 }
8262 {
8265 }
8266
8268 {
8271 }
8273 {
8276 }
8277
8278 super.OnVariablesSynchronized();
8279 }
8280
8281
8282
8284 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
8285 {
8286 if (!IsServerCheck(allow_client))
8287 return false;
8288
8290 return false;
8291
8294
8295 if (value <= (min + 0.001))
8296 value = min;
8297
8298 if (value == min)
8299 {
8300 if (destroy_config)
8301 {
8302 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
8303 if (dstr)
8304 {
8306 this.Delete();
8307 return true;
8308 }
8309 }
8310 else if (destroy_forced)
8311 {
8313 this.Delete();
8314 return true;
8315 }
8316
8318 }
8319
8322
8324 {
8326
8327 if (delta)
8329 }
8330
8332
8333 return false;
8334 }
8335
8336
8338 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
8339 {
8341 }
8342
8344 {
8347 }
8348
8350 {
8353 }
8354
8357 {
8358 float value_clamped = Math.Clamp(value, 0, 1);
8360 SetQuantity(result, destroy_config, destroy_forced);
8361 }
8362
8363
8366 {
8368 }
8369
8371 {
8373 }
8374
8375
8376
8377
8378
8379
8380
8381
8382
8383
8385 {
8386 int slot = -1;
8387 if (GetInventory())
8388 {
8389 InventoryLocation il = new InventoryLocation;
8390 GetInventory().GetCurrentInventoryLocation(il);
8392 }
8393
8395 }
8396
8398 {
8399 float quantity_max = 0;
8400
8402 {
8403 if (attSlotID != -1)
8404 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
8405
8406 if (quantity_max <= 0)
8408 }
8409
8410 if (quantity_max <= 0)
8412
8413 return quantity_max;
8414 }
8415
8417 {
8419 }
8420
8422 {
8424 }
8425
8426
8428 {
8430 }
8431
8433 {
8435 }
8436
8438 {
8440 }
8441
8442
8444 {
8445
8446 float weightEx = GetWeightEx();
8447 float special = GetInventoryAndCargoWeight();
8448 return weightEx - special;
8449 }
8450
8451
8453 {
8455 }
8456
8458 {
8460 {
8461 #ifdef DEVELOPER
8462 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
8463 {
8464 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
8466 }
8467 #endif
8468
8470 }
8471 else if (HasEnergyManager())
8472 {
8473 #ifdef DEVELOPER
8474 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
8475 {
8476 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
8477 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
8478 }
8479 #endif
8480 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified());
8481 }
8482 else
8483 {
8484 #ifdef DEVELOPER
8485 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
8486 {
8487 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
8488 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
8489 }
8490 #endif
8491 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified());
8492 }
8493 }
8494
8497 {
8498 int item_count = 0;
8500
8501 if (GetInventory().GetCargo() != NULL)
8502 {
8503 item_count = GetInventory().GetCargo().GetItemCount();
8504 }
8505
8506 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
8507 {
8508 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
8509 if (item)
8510 item_count += item.GetNumberOfItems();
8511 }
8512 return item_count;
8513 }
8514
8517 {
8518 float weight = 0;
8519 float wetness = 1;
8520 if (include_wetness)
8523 {
8524 weight = wetness * m_ConfigWeight;
8525 }
8527 {
8528 weight = 1;
8529 }
8530 return weight;
8531 }
8532
8533
8534
8536 {
8537 if ((
GetGame().IsServer() || !
GetGame().IsMultiplayer()) && GetInventory())
8538 {
8539 GameInventory inv = GetInventory();
8540 array<EntityAI> items = new array<EntityAI>;
8542 for (int i = 0; i < items.Count(); i++)
8543 {
8545 if (item)
8546 {
8548 }
8549 }
8550 }
8551 }
8552
8553
8554
8555
8557 {
8558 float energy = 0;
8559 if (HasEnergyManager())
8560 {
8561 energy = GetCompEM().GetEnergy();
8562 }
8563 return energy;
8564 }
8565
8566
8568 {
8569 super.OnEnergyConsumed();
8570
8572 }
8573
8575 {
8576 super.OnEnergyAdded();
8577
8579 }
8580
8581
8583 {
8584 if (
GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
8585 {
8587 {
8588 float energy_0to1 = GetCompEM().GetEnergy0To1();
8590 }
8591 }
8592 }
8593
8594
8596 {
8597 return ConfigGetFloat("heatIsolation");
8598 }
8599
8601 {
8603 }
8604
8606 {
8607 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
8608 if (
GetGame().ConfigIsExisting(paramPath))
8610
8611 return 0.0;
8612 }
8613
8615 {
8616 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
8617 if (
GetGame().ConfigIsExisting(paramPath))
8619
8620 return 0.0;
8621 }
8622
8623 override void SetWet(
float value,
bool allow_client =
false)
8624 {
8625 if (!IsServerCheck(allow_client))
8626 return;
8627
8630
8632
8633 m_VarWet = Math.Clamp(value, min, max);
8634
8636 {
8639 }
8640 }
8641
8642 override void AddWet(
float value)
8643 {
8645 }
8646
8648 {
8650 }
8651
8653 {
8655 }
8656
8658 {
8660 }
8661
8663 {
8665 }
8666
8668 {
8670 }
8671
8673 {
8676 if (newLevel != oldLevel)
8677 {
8679 }
8680 }
8681
8683 {
8684 SetWeightDirty();
8685 }
8686
8688 {
8689 return GetWetLevelInternal(
m_VarWet);
8690 }
8691
8692
8693
8695 {
8697 }
8698
8700 {
8702 }
8703
8705 {
8707 }
8708
8710 {
8712 }
8713
8714
8715
8717 {
8718 if (ConfigIsExisting("itemModelLength"))
8719 {
8720 return ConfigGetFloat("itemModelLength");
8721 }
8722 return 0;
8723 }
8724
8726 {
8727 if (ConfigIsExisting("itemAttachOffset"))
8728 {
8729 return ConfigGetFloat("itemAttachOffset");
8730 }
8731 return 0;
8732 }
8733
8734 override void SetCleanness(
int value,
bool allow_client =
false)
8735 {
8736 if (!IsServerCheck(allow_client))
8737 return;
8738
8740
8742
8745 }
8746
8748 {
8750 }
8751
8753 {
8754 return true;
8755 }
8756
8757
8758
8759
8761 {
8763 }
8764
8766 {
8768 }
8769
8770
8771
8772
8773 override void SetColor(
int r,
int g,
int b,
int a)
8774 {
8780 }
8782 override void GetColor(out
int r,out
int g,out
int b,out
int a)
8783 {
8788 }
8789
8791 {
8793 }
8794
8797 {
8798 int r,g,b,a;
8800 r = r/255;
8801 g = g/255;
8802 b = b/255;
8803 a = a/255;
8804 return MiscGameplayFunctions.GetColorString(r, g, b, a);
8805 }
8806
8807
8808
8809 override void SetLiquidType(
int value,
bool allow_client =
false)
8810 {
8811 if (!IsServerCheck(allow_client))
8812 return;
8813
8818 }
8819
8821 {
8822 return ConfigGetInt("varLiquidTypeInit");
8823 }
8824
8826 {
8828 }
8829
8831 {
8833 SetFrozen(false);
8834 }
8835
8838 {
8839 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
8840 }
8841
8842
8845 {
8846 PlayerBase nplayer;
8847 if (PlayerBase.CastTo(nplayer, player))
8848 {
8850
8851 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
8852 }
8853 }
8854
8855
8858 {
8859 PlayerBase nplayer;
8860 if (PlayerBase.CastTo(nplayer,player))
8861 {
8862
8863 nplayer.SetEnableQuickBarEntityShortcut(this,false);
8864
8865 }
8866
8867
8868 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
8869
8870
8871 if (HasEnergyManager())
8872 {
8873 GetCompEM().UpdatePlugState();
8874 }
8875 }
8876
8877
8879 {
8880 super.OnPlacementStarted(player);
8881
8883 }
8884
8885 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
8886 {
8888 {
8889 m_AdminLog.OnPlacementComplete(player,
this);
8890 }
8891
8892 super.OnPlacementComplete(player, position, orientation);
8893 }
8894
8895
8896
8897
8898
8900 {
8902 {
8903 return true;
8904 }
8905 else
8906 {
8907 return false;
8908 }
8909 }
8910
8911
8913 {
8915 {
8917 }
8918 }
8919
8920
8922 {
8924 }
8925
8927 {
8929 }
8930
8931 override void InsertAgent(
int agent,
float count = 1)
8932 {
8933 if (count < 1)
8934 return;
8935
8937 }
8938
8941 {
8943 }
8944
8945
8947 {
8949 }
8950
8951
8952
8953
8954
8955
8956
8957
8958
8959
8960
8961
8962
8963
8964
8965
8966
8967
8968
8969
8970
8971
8972
8973
8974
8975
8976
8977
8978
8979
8980
8981
8982
8983
8984
8985
8986
8987
8988
8989
8990
8991
8993 {
8995 return false;
8996 return true;
8997 }
8998
9000 {
9001
9003 }
9004
9005
9008 {
9009 super.CheckForRoofLimited(timeTresholdMS);
9010
9012 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
9013 {
9014 m_PreviousRoofTestTime = time;
9015 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
9016 }
9017 }
9018
9019
9021 {
9023 {
9024 return 0;
9025 }
9026
9027 if (GetInventory().GetAttachmentSlotsCount() != 0)
9028 {
9029 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
9030 if (filter)
9031 return filter.GetProtectionLevel(type, false, system);
9032 else
9033 return 0;
9034 }
9035
9036 string subclassPath, entryName;
9037
9038 switch (type)
9039 {
9041 entryName = "biological";
9042 break;
9044 entryName = "chemical";
9045 break;
9046 default:
9047 entryName = "biological";
9048 break;
9049 }
9050
9051 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
9052
9054 }
9055
9056
9057
9060 {
9061 if (!IsMagazine())
9063
9065 }
9066
9067
9068
9069
9070
9075 {
9076 return true;
9077 }
9078
9080 {
9082 }
9083
9084
9085
9086
9087
9089 {
9090 if (parent)
9091 {
9092 if (parent.IsInherited(DayZInfected))
9093 return true;
9094
9095 if (!parent.IsRuined())
9096 return true;
9097 }
9098
9099 return true;
9100 }
9101
9103 {
9104 if (!super.CanPutAsAttachment(parent))
9105 {
9106 return false;
9107 }
9108
9109 if (!IsRuined() && !parent.IsRuined())
9110 {
9111 return true;
9112 }
9113
9114 return false;
9115 }
9116
9118 {
9119
9120
9121
9122
9123 return super.CanReceiveItemIntoCargo(item);
9124 }
9125
9127 {
9128
9129
9130
9131
9132 GameInventory attachmentInv = attachment.GetInventory();
9134 {
9135 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
9136 return false;
9137 }
9138
9139 InventoryLocation loc = new InventoryLocation();
9140 attachment.GetInventory().GetCurrentInventoryLocation(loc);
9141 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
9142 return false;
9143
9144 return super.CanReceiveAttachment(attachment, slotId);
9145 }
9146
9148 {
9149 if (!super.CanReleaseAttachment(attachment))
9150 return false;
9151
9152 return GetInventory().AreChildrenAccessible();
9153 }
9154
9155
9156
9157
9158
9159
9160
9161
9162
9163
9164
9165
9166
9167
9168
9169
9170
9171
9172
9173
9174
9176 {
9177 int id = muzzle_owner.GetMuzzleID();
9178 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
9179
9180 if (WPOF_array)
9181 {
9182 for (int i = 0; i < WPOF_array.Count(); i++)
9183 {
9184 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
9185
9186 if (WPOF)
9187 {
9188 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
9189 }
9190 }
9191 }
9192 }
9193
9194
9196 {
9197 int id = muzzle_owner.GetMuzzleID();
9199
9200 if (WPOBE_array)
9201 {
9202 for (int i = 0; i < WPOBE_array.Count(); i++)
9203 {
9204 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
9205
9206 if (WPOBE)
9207 {
9208 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
9209 }
9210 }
9211 }
9212 }
9213
9214
9216 {
9217 int id = muzzle_owner.GetMuzzleID();
9218 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9219
9220 if (WPOOH_array)
9221 {
9222 for (int i = 0; i < WPOOH_array.Count(); i++)
9223 {
9224 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9225
9226 if (WPOOH)
9227 {
9228 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
9229 }
9230 }
9231 }
9232 }
9233
9234
9236 {
9237 int id = muzzle_owner.GetMuzzleID();
9238 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9239
9240 if (WPOOH_array)
9241 {
9242 for (int i = 0; i < WPOOH_array.Count(); i++)
9243 {
9244 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9245
9246 if (WPOOH)
9247 {
9248 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9249 }
9250 }
9251 }
9252 }
9253
9254
9256 {
9257 int id = muzzle_owner.GetMuzzleID();
9258 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9259
9260 if (WPOOH_array)
9261 {
9262 for (int i = 0; i < WPOOH_array.Count(); i++)
9263 {
9264 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9265
9266 if (WPOOH)
9267 {
9268 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9269 }
9270 }
9271 }
9272 }
9273
9274
9275
9277 {
9279 {
9280 return true;
9281 }
9282
9283 return false;
9284 }
9285
9287 {
9289 {
9290 return true;
9291 }
9292
9293 return false;
9294 }
9295
9297 {
9299 {
9300 return true;
9301 }
9302
9303 return false;
9304 }
9305
9307 {
9308 return false;
9309 }
9310
9313 {
9314 return UATimeSpent.DEFAULT_DEPLOY;
9315 }
9316
9317
9318
9319
9321 {
9323 SetSynchDirty();
9324 }
9325
9327 {
9329 }
9330
9331
9333 {
9334 return false;
9335 }
9336
9339 {
9340 string att_type = "None";
9341
9342 if (ConfigIsExisting("soundAttType"))
9343 {
9344 att_type = ConfigGetString("soundAttType");
9345 }
9346
9348 }
9349
9351 {
9353 }
9354
9355
9356
9357
9358
9362
9364 {
9367
9369 }
9370
9371
9373 {
9375 return;
9376
9378
9381
9384
9385 SoundParameters params = new SoundParameters();
9389 }
9390
9391
9393 {
9395 return;
9396
9398 SetSynchDirty();
9399
9402 }
9403
9404
9406 {
9408 return;
9409
9411 SetSynchDirty();
9412
9415 }
9416
9418 {
9420 }
9421
9423 {
9425 }
9426
9429 {
9430 if (!
GetGame().IsDedicatedServer())
9431 {
9432 if (ConfigIsExisting("attachSoundSet"))
9433 {
9434 string cfg_path = "";
9435 string soundset = "";
9437
9440 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
9441 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
9442
9443 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
9444 {
9445 for (int i = 0; i < cfg_soundset_array.Count(); i++)
9446 {
9447 if (cfg_slot_array[i] == slot_type)
9448 {
9449 soundset = cfg_soundset_array[i];
9450 break;
9451 }
9452 }
9453 }
9454
9455 if (soundset != "")
9456 {
9457 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
9459 }
9460 }
9461 }
9462 }
9463
9465 {
9466
9467 }
9468
9469 void OnApply(PlayerBase player);
9470
9472 {
9473 return 1.0;
9474 };
9475
9477 {
9479 }
9480
9482 {
9484 }
9485
9487
9489 {
9490 SetDynamicPhysicsLifeTime(0.01);
9492 }
9493
9495 {
9496 array<string> zone_names = new array<string>;
9497 GetDamageZones(zone_names);
9498 for (int i = 0; i < zone_names.Count(); i++)
9499 {
9500 SetHealthMax(zone_names.Get(i),"Health");
9501 }
9502 SetHealthMax("","Health");
9503 }
9504
9507 {
9508 float global_health = GetHealth01("","Health");
9509 array<string> zones = new array<string>;
9510 GetDamageZones(zones);
9511
9512 for (int i = 0; i < zones.Count(); i++)
9513 {
9514 SetHealth01(zones.Get(i),"Health",global_health);
9515 }
9516 }
9517
9520 {
9521 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
9522 }
9523
9525 {
9526 if (!hasRootAsPlayer)
9527 {
9528 if (refParentIB)
9529 {
9530
9531 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
9532 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
9533
9534 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
9535 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
9536
9539 }
9540 else
9541 {
9542
9545 }
9546 }
9547 }
9548
9550 {
9552 {
9553 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
9554 if (GetTemperature() != target || !IsFreezeThawProgressFinished())
9555 {
9556 float heatPermCoef = 1.0;
9558 while (ent)
9559 {
9560 heatPermCoef *= ent.GetHeatPermeabilityCoef();
9561 ent = ent.GetHierarchyParent();
9562 }
9563
9564 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
9565 }
9566 }
9567 }
9568
9570 {
9571
9572 EntityAI parent = GetHierarchyParent();
9573 if (!parent)
9574 {
9575 hasParent = false;
9576 hasRootAsPlayer = false;
9577 }
9578 else
9579 {
9580 hasParent = true;
9581 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
9582 refParentIB =
ItemBase.Cast(parent);
9583 }
9584 }
9585
9586 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
9587 {
9588
9589 }
9590
9592 {
9593
9594 return false;
9595 }
9596
9598 {
9599
9600
9601 return false;
9602 }
9603
9605 {
9606
9607 return false;
9608 }
9609
9612 {
9613 return !GetIsFrozen() &&
IsOpen();
9614 }
9615
9617 {
9618 bool hasParent = false, hasRootAsPlayer = false;
9620
9621 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
9622 bool foodDecay =
g_Game.IsFoodDecayEnabled();
9623
9624 if (wwtu || foodDecay)
9625 {
9629
9630 if (processWetness || processTemperature || processDecay)
9631 {
9633
9634 if (processWetness)
9635 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
9636
9637 if (processTemperature)
9639
9640 if (processDecay)
9641 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
9642 }
9643 }
9644 }
9645
9648 {
9650 }
9651
9653 {
9656
9657 return super.GetTemperatureFreezeThreshold();
9658 }
9659
9661 {
9664
9665 return super.GetTemperatureThawThreshold();
9666 }
9667
9669 {
9672
9673 return super.GetItemOverheatThreshold();
9674 }
9675
9677 {
9679 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
9680
9681 return super.GetTemperatureFreezeTime();
9682 }
9683
9685 {
9687 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
9688
9689 return super.GetTemperatureThawTime();
9690 }
9691
9696
9698 {
9699 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
9700 }
9701
9703 {
9704 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
9705 }
9706
9709 {
9711 }
9712
9714 {
9716 }
9717
9719 {
9721 }
9722
9725 {
9726 return null;
9727 }
9728
9731 {
9732 return false;
9733 }
9734
9736 {
9738 {
9741 if (!trg)
9742 {
9744 explosive = this;
9745 }
9746
9747 explosive.PairRemote(trg);
9749
9750 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
9751 trg.SetPersistentPairID(persistentID);
9752 explosive.SetPersistentPairID(persistentID);
9753
9754 return true;
9755 }
9756 return false;
9757 }
9758
9761 {
9762 float ret = 1.0;
9765 ret *= GetHealth01();
9766
9767 return ret;
9768 }
9769
9770 #ifdef DEVELOPER
9771 override void SetDebugItem()
9772 {
9773 super.SetDebugItem();
9774 _itemBase = this;
9775 }
9776
9778 {
9779 string text = super.GetDebugText();
9780
9782 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
9783
9784 return text;
9785 }
9786 #endif
9787
9789 {
9790 return true;
9791 }
9792
9794
9796
9798 {
9801 }
9802
9803
9811
9827}
9828
9830{
9832 if (entity)
9833 {
9834 bool is_item = entity.IsInherited(
ItemBase);
9835 if (is_item && full_quantity)
9836 {
9839 }
9840 }
9841 else
9842 {
9844 return NULL;
9845 }
9846 return entity;
9847}
9848
9850{
9851 if (item)
9852 {
9853 if (health > 0)
9854 item.SetHealth("", "", health);
9855
9856 if (item.CanHaveTemperature())
9857 {
9859 if (item.CanFreeze())
9860 item.SetFrozen(false);
9861 }
9862
9863 if (item.HasEnergyManager())
9864 {
9865 if (quantity >= 0)
9866 {
9867 item.GetCompEM().SetEnergy0To1(quantity);
9868 }
9869 else
9870 {
9872 }
9873 }
9874 else if (item.IsMagazine())
9875 {
9876 Magazine mag = Magazine.Cast(item);
9877 if (quantity >= 0)
9878 {
9879 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
9880 }
9881 else
9882 {
9884 }
9885
9886 }
9887 else
9888 {
9889 if (quantity >= 0)
9890 {
9891 item.SetQuantityNormalized(quantity, false);
9892 }
9893 else
9894 {
9896 }
9897
9898 }
9899 }
9900}
9901
9902#ifdef DEVELOPER
9904#endif
Param4< int, int, string, int > TSelectableActionInfoWithColor
Param3 TSelectableActionInfo
InventoryMode
NOTE: PREDICTIVE is not to be used at all in multiplayer.
eBleedingSourceType GetType()
ItemSuppressor SuppressorBase
void ActionManagerBase(PlayerBase player)
map< typename, ref array< ActionBase_Basic > > TInputActionMap
void AddAction(typename actionName)
void RemoveAction(typename actionName)
TInputActionMap m_InputActionMap
override void GetActions(typename action_input_type, out array< ActionBase_Basic > actions)
const int ECE_PLACE_ON_SURFACE
proto native void SpawnEntity(string sClassName, vector vPos, float fRange, int iCount)
Spawn an entity through CE.
const int ECE_IN_INVENTORY
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
PlayerSpawnPreset slotName
DamageType
exposed from C++ (do not change)
PluginAdminLog m_AdminLog
override bool IsExplosive()
override bool CanHaveTemperature()
class GP5GasMask extends MaskBase ItemBase
FindInventoryLocationType
flags for searching locations in inventory
InventoryLocationType
types of Inventory Location
class BoxCollidingParams component
ComponentInfo for BoxCollidingResult.
bool DamageItemInCargo(float damage)
static bool HasDebugActionsMask(int mask)
bool HidesSelectionBySlot()
void SplitItem(PlayerBase player)
void CopyScriptPropertiesFrom(EntityAI oldItem)
override void InsertAgent(int agent, float count=1)
override float GetQuantityNormalized()
Gets quantity in normalized 0..1 form between the item's Min a Max values as defined by item's config...
static void SetDebugActionsMask(int mask)
void SetIsDeploySound(bool is_deploy_sound)
void SplitItemToInventoryLocation(notnull InventoryLocation dst)
override bool IsHeavyBehaviour()
override void SetWetMax()
bool IsCoverFaceForShave(string slot_name)
DEPRECATED in use, but returns correct values nontheless. Check performed elsewhere.
void ClearStartItemSoundServer()
void ProcessItemTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
map< typename, ref ActionOverrideData > TActionAnimOverrideMap
override void RemoveAllAgentsExcept(int agent_to_keep)
static ref map< int, ref array< ref WeaponParticlesOnBulletCasingEject > > m_OnBulletCasingEjectEffect
bool CanBeMovedOverride()
override void SetWet(float value, bool allow_client=false)
ref TIntArray m_SingleUseActions
override void ProcessVariables()
ref TStringArray m_HeadHidingSelections
float GetWeightSpecialized(bool forceRecalc=false)
bool LoadAgents(ParamsReadContext ctx, int version)
void UpdateQuickbarShortcutVisibility(PlayerBase player)
To be called on moving item within character's inventory; 'player' should never be null.
void OverrideActionAnimation(typename action, int commandUID, int stanceMask=-1, int commandUIDProne=-1)
ref array< ref OverheatingParticle > m_OverheatingParticles
override float GetTemperatureFreezeThreshold()
bool m_IsSoundSynchRemote
void StopItemSoundServer(int id)
static void ToggleDebugActionsMask(int mask)
void IncreaseOverheating(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
override float GetTemperatureFreezeTime()
ref array< int > m_CompatibleLocks
override void CombineItemsClient(EntityAI entity2, bool use_stack_max=true)
float m_TemperaturePerQuantityWeight
bool m_RecipesInitialized
void SplitIntoStackMax(EntityAI destination_entity, int slot_id, PlayerBase player)
override float GetTemperatureThawThreshold()
override void OnEnergyConsumed()
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...
void RefreshAudioVisualsOnClient(CookingMethodType cooking_method, bool is_done, bool is_empty, bool is_burned)
cooking-related effect methods
int GetNumberOfItems()
Returns the number of items in cargo, otherwise returns 0(non-cargo objects). Recursive.
override EWetnessLevel GetWetLevel()
float GetSingleInventoryItemWeight()
ref TIntArray m_InteractActions
void MessageToOwnerStatus(string text)
Send message to owner player in grey color.
bool CanPlayDeployLoopSound()
override float GetWetMax()
bool CanBeUsedForSuicide()
override void CombineItemsEx(EntityAI entity2, bool use_stack_max=true)
void OnItemInHandsPlayerSwimStart(PlayerBase player)
void SetIsHologram(bool is_hologram)
void OnSyncVariables(ParamsReadContext ctx)
DEPRECATED (most likely)
void StartItemSoundServer(int id)
static ref map< int, ref array< ref WeaponParticlesOnFire > > m_OnFireEffect
void SplitIntoStackMaxCargoClient(EntityAI destination_entity, int idx, int row, int col)
bool m_CanBeMovedOverride
override string ChangeIntoOnAttach(string slot)
void UpdateOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
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...
override float GetQuantity()
int m_ShotsToStartOverheating
override void OnWetChanged(float newVal, float oldVal)
void StopOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
static void PlayFireParticles(ItemBase weapon, int muzzle_index, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
void OnOverheatingDecay()
float GetDryingIncrement(string pIncrementName)
void SoundSynchRemoteReset()
bool HasMuzzle()
Returns true if this item has a muzzle (weapons, suppressors)
override bool CanReleaseAttachment(EntityAI attachment)
override void OnMovedInsideCargo(EntityAI container)
void SetCEBasedQuantity()
bool m_CanPlayImpactSound
override string GetAttachmentSoundType()
float GetOverheatingCoef()
array< string > GetHeadHidingSelection()
void PlayAttachSound(string slot_type)
Plays sound on item attach. Be advised, the config structure may slightly change in 1....
override bool IsStoreLoad()
int ComputeQuantityUsed(ItemBase other_item, bool use_stack_max=true)
void SetResultOfSplit(bool value)
void SplitIntoStackMaxCargo(EntityAI destination_entity, int idx, int row, int col)
void OnAttachmentQuantityChanged(ItemBase item)
Called on server side when some attachment's quantity is changed. Call super.OnAttachmentQuantityChan...
void UpdateAllOverheatingParticles()
float GetSoakingIncrement(string pIncrementName)
static void StopOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
override float GetStoreLoadedQuantity()
const int ITEM_SOUNDS_MAX
float GetItemModelLength()
override bool ReadVarsFromCTX(ParamsReadContext ctx, int version=-1)
override void CheckForRoofLimited(float timeTresholdMS=3000)
Roof check for entity, limited by time (anti-spam solution)
void CombineItems(ItemBase other_item, bool use_stack_max=true)
void TransferModifiers(PlayerBase reciever)
appears to be deprecated, legacy code
float GetTemperaturePerQuantityWeight()
Used in heat comfort calculations only!
void TransferAgents(int agents)
transfer agents from another item
bool CanBeConsumed(ConsumeConditionData data=null)
Items cannot be consumed if frozen by default. Override for exceptions.
float GetHeatIsolationInit()
void SetCanBeMovedOverride(bool setting)
override bool HasQuantity()
bool IsCargoException4x3(EntityAI item)
ref TIntArray m_ContinuousActions
int GetMuzzleID()
Returns global muzzle ID. If not found, then it gets automatically registered.
void LoadParticleConfigOnFire(int id)
void PreLoadSoundAttachmentType()
Attachment Sound Type getting from config file.
override float GetWetInit()
int m_ImpactSoundSurfaceHash
int m_MaxOverheatingValue
void SetupSpawnedItem(ItemBase item, float health, float quantity)
static ref map< string, int > m_WeaponTypeToID
string GetColorString()
Returns item's PROCEDURAL color as formated string, i.e. "#(argb,8,8,3)color(0.15,...
array< int > GetValidFinishers()
returns an array of possible finishers
void OnAttachmentQuantityChangedEx(ItemBase item, float delta)
Called on server side when some attachment's quantity is changed. Call super.OnAttachmentQuantityChan...
class ItemBase extends InventoryItem SpawnItemOnLocation(string object_name, notnull InventoryLocation loc, bool full_quantity)
ItemSoundHandler GetItemSoundHandler()
override int GetQuantityMin()
void SplitIntoStackMaxToInventoryLocationClient(notnull InventoryLocation dst)
override int GetQuickBarBonus()
override void SetTakeable(bool pState)
float m_OverheatingDecayInterval
void SetIsPlaceSound(bool is_place_sound)
override void SplitIntoStackMaxClient(EntityAI destination_entity, int slot_id)
void HierarchyCheck(out bool hasParent, out bool hasRootAsPlayer, out ItemBase refParentIB)
void RemoveAudioVisualsOnClient()
static void AddDebugActionsMask(int mask)
void PlayDeployLoopSoundEx()
void RemoveLightSourceItem()
bool CanRepair(ItemBase item_repair_kit)
bool can_this_be_combined
EffectSound m_SoundDeploy
float GetBaitEffectivity()
generic effectivity as a bait for animal catching
float GetDeployTime()
how long it takes to deploy this item in seconds
override bool IsSplitable()
bool DamageItemAttachments(float damage)
override void WriteVarsToCTX(ParamsWriteContext ctx)
void ConvertEnergyToQuantity()
override void RemoveAllAgents()
override void SetQuantityToMinimum()
bool m_WantPlayImpactSound
override float GetTemperatureThawTime()
ref map< int, ref array< ref WeaponParticlesOnOverheating > > m_OnOverheatingEffect
float m_StoreLoadedQuantity
void MessageToOwnerAction(string text)
Send message to owner player in yellow color.
float GetFilterDamageRatio()
override void SetLiquidType(int value, bool allow_client=false)
void OnQuantityChanged(float delta)
Called on server side when this item's quantity is changed. Call super.OnQuantityChanged(); first whe...
void OnApply(PlayerBase player)
bool m_HideSelectionsBySlot
bool IsOverheatingEffectActive()
void SetIsBeingPlaced(bool is_being_placed)
int GetLiquidContainerMask()
ref Timer m_CheckOverheating
void RegisterOverheatingParticle(Particle p, float min_heat_coef, float max_heat_coef, int particle_id, Object parent, vector local_pos, vector local_ori)
bool GetActionWidgetOverride(out typename name)
If we need a different (handheld)item action widget displayed, the logic goes in here.
float GetUnitWeight(bool include_wetness=true)
Obsolete, use GetWeightEx instead.
void SetZoneDamageCEInit()
Sets zone damages to match randomized global health set by CE (CE spawn only)
static void PlayOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
override bool IsOneHandedBehaviour()
void AddLightSourceItem(ItemBase lightsource)
Adds a light source child.
FoodStage GetFoodStage()
overridden on Edible_Base; so we don't have to parse configs all the time
override float GetSingleInventoryItemWeightEx()
void SaveAgents(ParamsWriteContext ctx)
override int GetTargetQuantityMax(int attSlotID=-1)
float GetDisinfectQuantity(int system=0, Param param1=null)
override bool IsHologram()
float GetItemAttachOffset()
static int GetDebugActionsMask()
override int GetLiquidType()
void ProcessDecay(float delta, bool hasRootAsPlayer)
override bool IsItemBase()
override bool IsTwoHandedBehaviour()
bool IsCombineAll(ItemBase other_item, bool use_stack_max=false)
float GetProtectionLevel(int type, bool consider_filter=false, int system=0)
static void PlayBulletCasingEjectParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
override void OnEnergyAdded()
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()
EffectSound m_DeployLoopSoundEx
override void DeSerializeNumericalVars(array< float > floats)
void StopItemDynamicPhysics()
override void SetStoreLoad(bool value)
float GetOverheatingValue()
bool ContainsAgent(int agent_id)
override void AddWet(float value)
override void EOnContact(IEntity other, Contact extra)
void SplitIntoStackMaxHands(PlayerBase player)
void SplitIntoStackMaxHandsClient(PlayerBase player)
ref Timer m_PhysDropTimer
void MessageToOwnerFriendly(string text)
Send message to owner player in green color.
override void SetStoreLoadedQuantity(float value)
bool m_IsResultOfSplit string m_SoundAttType
distinguish if item has been created as new or it came from splitting (server only flag)
void CheckOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
void UnlockFromParent()
Unlocks this item from its attachment slot of its parent.
bool Repair(PlayerBase player, ItemBase item_repair_kit, float specialty_weight)
void OnLiquidTypeChanged(int oldType, int newType)
void StartOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
void PlayDeployFinishSound()
bool AllowFoodConsumption()
bool m_IsOverheatingEffectActive
int m_LiquidContainerMask
void ProcessItemWetness(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
override int GetCleanness()
bool PairWithDevice(notnull ItemBase otherDevice)
static void RemoveDebugActionsMask(int mask)
static void UpdateOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
void PerformDamageSystemReinit()
override void ClearInventory()
static int m_LastRegisteredWeaponID
ItemBase GetLightSourceItem()
void MessageToOwnerImportant(string text)
Send message to owner player in red color.
override float GetItemOverheatThreshold()
void StopDeployLoopSoundEx()
override void SerializeNumericalVars(array< float > floats_out)
void Open()
Implementations only.
ItemBase SplitIntoStackMaxToInventoryLocationEx(notnull InventoryLocation dst)
static int m_DebugActionsMask
void KillAllOverheatingParticles()
bool CanBeCookedOnStick()
override int GetQuantityMax()
void GetRecipesActions(Man player, out TSelectableActionInfoArray outputList)
void OnActivatedByTripWire()
override void RemoveAgent(int agent_id)
bool m_ItemBeingDroppedPhys
override bool CanPutAsAttachment(EntityAI parent)
void PlayDetachSound(string slot_type)
static ref map< typename, ref TInputActionMap > m_ItemTypeActionsMap
void ProcessItemWetnessAndTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
override bool IsBeingPlaced()
float ComputeQuantityUsedEx(ItemBase other_item, bool use_stack_max=true)
bool m_FixDamageSystemInit
string GetDeployFinishSoundset()
ItemBase m_LightSourceItem
void LockToParent()
Locks this item in it's current attachment slot of its parent. This makes the "locked" icon visible i...
override void SplitIntoStackMaxEx(EntityAI destination_entity, int slot_id)
void LoadParticleConfigOnOverheating(int id)
bool IsSoundSynchRemote()
override void EEOnCECreate()
Called when entity is being created as new by CE/ Debug.
override void OnRightClick()
static ref map< typename, ref TActionAnimOverrideMap > m_ItemActionOverrides
bool IsActionTargetVisible()
override void OnItemAttachmentSlotChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
override void EEHitBy(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
int NameToID(string name)
override void OnWetLevelChanged(EWetnessLevel newLevel, EWetnessLevel oldLevel)
void ClearStopItemSoundServer()
override string ChangeIntoOnDetach()
void SplitIntoStackMaxToInventoryLocation(notnull InventoryLocation dst)
EffectSound m_SoundDeployFinish
float GetQuantityNormalizedScripted()
override void SetCleanness(int value, bool allow_client=false)
override float GetWetMin()
ref ItemSoundHandler m_ItemSoundHandler
override bool KindOf(string tag)
void ItemSoundHandler(ItemBase parent)
EffectSound m_LockingSound
void PluginItemDiagnostic()
PluginBase GetPlugin(typename plugin_type)
override RemotelyActivatedItemBehaviour GetRemotelyActivatedItemBehaviour()
void RemoteDetonatorTrigger()
override void OnActivatedByItem(notnull ItemBase item)
Called when this item is activated by other.
override void Explode(int damageType, string ammoType="")
void OnItemLocationChanged(ItemBase item)
void OnItemAttachedAtPlayer(EntityAI item, string slot_name)
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)
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()
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)
void SetEnergy0To1(float energy01)
Energy manager: Sets stored energy for this device between 0 and MAX based on relative input value be...
float GetEnergyMaxPristine()
Energy manager: Returns the maximum amount of energy this device can store. It's damage is NOT taken ...
override void SetAutodestroy(bool auto_destroy)
Sets whether Effect automatically cleans up when it stops.
bool IsSoundPlaying()
Get whether EffectSound is currently playing.
proto native bool EnumerateInventory(InventoryTraversalType tt, out array< EntityAI > items)
enumerate inventory using traversal type and filling items array
proto native CargoBase GetCargo()
cargo
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)
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
override bool CanDisplayCargo()
override void OnInventoryEnter(Man player)
override bool CanPutAsAttachment(EntityAI parent)
override bool CanReceiveItemIntoCargo(EntityAI item)
override bool OnStoreLoad(ParamsReadContext ctx, int version)
override void OnWasDetached(EntityAI parent, int slot_id)
override void EEOnAfterLoad()
override void EEDelete(EntityAI parent)
override bool CanBeRepairedByCrafting()
override void OnPlacementStarted(Man player)
override void OnItemLocationChanged(EntityAI old_owner, EntityAI new_owner)
override bool IsElectricAppliance()
override bool IsItemTent()
override void SetActions()
override bool CanMakeGardenplot()
override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
override WrittenNoteData GetWrittenNoteData()
override int GetDamageSystemVersionChange()
override bool SetQuantity(float value, bool destroy_config=true, bool destroy_forced=false, bool allow_client=false, bool clamp_to_stack_max=true)
override void InitItemVariables()
override void SetActionAnimOverrides()
override void OnCreatePhysics()
override string GetDeploySoundset()
override float GetBandagingEffectivity()
override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
override void EEHealthLevelChanged(int oldLevel, int newLevel, string zone)
override void OnStoreSave(ParamsWriteContext ctx)
override void AfterStoreLoad()
override int GetOnDigWormsAmount()
override bool IsSelfAdjustingTemperature()
override bool IsPlayerInside(PlayerBase player, string selection)
override void OnVariablesSynchronized()
override void RefreshPhysics()
override bool CanObstruct()
override void OnWasAttached(EntityAI parent, int slot_id)
override bool CanReceiveAttachment(EntityAI attachment, int slotId)
override bool CanPutInCargo(EntityAI parent)
override string GetLoopDeploySoundset()
override void OnPlacementComplete(Man player, vector position="0 0 0", vector orientation="0 0 0")
override void OnInventoryExit(Man player)
override bool IsTakeable()
override bool IsIgnoredByConstruction()
override void InitItemSounds()
override void EEKilled(Object killer)
override void OnCombine(ItemBase other_item)
override bool CanExplodeInFire()
override bool IsFacingPlayer(PlayerBase player, string selection)
override bool CanBeCombined(EntityAI other_item, bool reservation_check=true, bool stack_max_limit=false)
override bool IsBloodContainer()
override bool IsClothing()
override bool CanBeSplit()
override bool IsDeployable()
override void OnRPC(PlayerIdentity sender, int rpc_type, ParamsReadContext ctx)
override bool CanBeDisinfected()
override float GetInfectionChance(int system=0, Param param=null)
override void OnEndPlacement()
float GetOverheatingLimitMax()
void SetOverheatingLimitMax(float max)
void SetParticleParams(int particle_id, Object parent, vector local_pos, vector local_ori)
float GetOverheatingLimitMin()
void SetOverheatingLimitMin(float min)
void RegisterParticle(Particle p)
void Stop()
Legacy function for backwards compatibility with 1.14 and below.
void SetControlledDevice(EntityAI pDevice)
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 bool Write(void value_out)
proto bool Read(void value_in)
proto native float GetDamage(string zoneName, string healthType)
UIScriptedMenu FindMenu(int id)
Returns menu with specific ID if it is open (see MenuID)
void SetCalcDetails(string details)
void OnRPC(PlayerIdentity sender, int rpc_type, ParamsReadContext ctx)
Serializer ParamsReadContext
InventoryTraversalType
tree traversal type, for more see http://en.wikipedia.org/wiki/Tree_traversal
proto native CGame GetGame()
Serializer ParamsWriteContext
const int COMP_TYPE_ENERGY_MANAGER
void Error(string err)
Messagebox with error message.
proto native void SetColor(int color)
array< string > TStringArray
EntityEvent
Entity events for event-mask, or throwing event from code.
static const float ITEM_TEMPERATURE_NEUTRAL_ZONE_MIDDLE
const int VARIABLE_LIQUIDTYPE
const int VARIABLE_CLEANNESS
const int VARIABLE_TEMPERATURE
const int VARIABLE_QUANTITY
static proto float AbsFloat(float f)
Returns absolute value.
proto native bool dBodyIsDynamic(notnull IEntity ent)
const int SAT_DEBUG_ACTION
class JsonUndergroundAreaTriggerData GetPosition
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.