5151{
5153 {
5154 return true;
5155 }
5156};
5157
5158
5159
5161{
5165
5167
5170
5171
5172
5173
5174
5183
5189
5194
5199
5220 protected bool m_IsResultOfSplit
5221
5223
5228
5229
5230
5232
5236
5237
5238
5240
5243
5244
5245
5251
5252
5260
5263
5264
5266
5267
5269
5270
5275
5276
5281
5282
5284
5285
5287 {
5292
5293 if (!
GetGame().IsDedicatedServer())
5294 {
5296 {
5298
5300 {
5302 }
5303 }
5304
5307 }
5308
5309 m_OldLocation = null;
5310
5312 {
5314 }
5315
5316 if (ConfigIsExisting("headSelectionsToHide"))
5317 {
5320 }
5321
5323 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
5324 {
5326 }
5327
5329
5330 m_IsResultOfSplit = false;
5331
5333 }
5334
5336 {
5337 super.InitItemVariables();
5338
5344 m_Count = ConfigGetInt(
"count");
5345
5348
5353
5356
5361
5373
5377
5378
5381 if (ConfigIsExisting("canBeSplit"))
5382 {
5385 }
5386
5388 if (ConfigIsExisting("itemBehaviour"))
5390
5391
5394 RegisterNetSyncVariableInt("m_VarLiquidType");
5395 RegisterNetSyncVariableInt("m_Cleanness",0,1);
5396
5397 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
5398 RegisterNetSyncVariableFloat("m_ImpactSpeed");
5399 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
5400
5401 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
5402 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
5403 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
5404 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
5405
5406 RegisterNetSyncVariableBool("m_IsBeingPlaced");
5407 RegisterNetSyncVariableBool("m_IsTakeable");
5408 RegisterNetSyncVariableBool("m_IsHologram");
5409
5412 {
5415 }
5416
5418
5420 if (ConfigIsExisting("temperaturePerQuantityWeight"))
5422
5423 }
5424
5426 {
5428 }
5429
5431 {
5434 {
5439 }
5440 }
5441
5442 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
5443 {
5445 {
5448 }
5449
5451 }
5452
5454 {
5460 }
5461
5463
5465 {
5467
5468 if (!action)
5469 {
5470 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
5471 return;
5472 }
5473
5475 if (!ai)
5476 {
5478 return;
5479 }
5480
5482 if (!action_array)
5483 {
5484 action_array = new array<ActionBase_Basic>;
5486 }
5487 if (LogManager.IsActionLogEnable())
5488 {
5489 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
5490 }
5491
5492 if (action_array.Find(action) != -1)
5493 {
5494 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
5495 }
5496 else
5497 {
5498 action_array.Insert(action);
5499 }
5500 }
5501
5503 {
5505 ActionBase action = player.GetActionManager().GetAction(actionName);
5508
5509 if (action_array)
5510 {
5511 action_array.RemoveItem(action);
5512 }
5513 }
5514
5515
5516
5518 {
5519 ActionOverrideData overrideData = new ActionOverrideData();
5523
5525 if (!actionMap)
5526 {
5529 }
5530
5531 actionMap.Insert(this.
Type(), overrideData);
5532
5533 }
5534
5536
5538
5539
5541 {
5544
5547
5548 string config_to_search = "CfgVehicles";
5549 string muzzle_owner_config;
5550
5552 {
5553 if (IsInherited(Weapon))
5554 config_to_search = "CfgWeapons";
5555
5556 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
5557
5558 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
5559
5561
5562 if (config_OnFire_subclass_count > 0)
5563 {
5564 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
5565
5566 for (int i = 0; i < config_OnFire_subclass_count; i++)
5567 {
5568 string particle_class = "";
5570 string config_OnFire_entry = config_OnFire_class + particle_class;
5571 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
5572 WPOF_array.Insert(WPOF);
5573 }
5574
5575
5577 }
5578 }
5579
5581 {
5582 config_to_search = "CfgWeapons";
5583 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
5584
5585 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
5586
5588
5589 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
5590 {
5591 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
5592
5593 for (i = 0; i < config_OnBulletCasingEject_count; i++)
5594 {
5595 string particle_class2 = "";
5597 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
5598 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
5599 WPOBE_array.Insert(WPOBE);
5600 }
5601
5602
5604 }
5605 }
5606 }
5607
5608
5610 {
5613
5615 {
5616 string config_to_search = "CfgVehicles";
5617
5618 if (IsInherited(Weapon))
5619 config_to_search = "CfgWeapons";
5620
5621 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
5622 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
5623
5624 if (
GetGame().ConfigIsExisting(config_OnOverheating_class))
5625 {
5626
5628
5630 {
5632 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
5634 return;
5635 }
5636
5639
5640
5641
5643 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
5644
5645 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
5646 {
5647 string particle_class = "";
5649 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
5651
5652 if (entry_type == CT_CLASS)
5653 {
5654 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
5655 WPOOH_array.Insert(WPOF);
5656 }
5657 }
5658
5659
5661 }
5662 }
5663 }
5664
5666 {
5668 }
5669
5671 {
5673 {
5675
5678
5681
5682 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
5683 }
5684 }
5685
5687 {
5689 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
5690
5692 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
5693
5695 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
5696
5698 {
5700 }
5701 }
5702
5704 {
5706 }
5707
5709 {
5712 else
5714
5716 {
5719 }
5720 else
5721 {
5724
5727 }
5728
5730 }
5731
5733 {
5735 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
5736 }
5737
5739 {
5741 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
5743 }
5744
5746 {
5748 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
5749 }
5750
5752 {
5755
5756 OverheatingParticle OP = new OverheatingParticle();
5761
5763 }
5764
5766 {
5769
5770 return -1;
5771 }
5772
5774 {
5776 {
5779
5780 for (int i = count; i > 0; --i)
5781 {
5782 int id = i - 1;
5785
5788
5789 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
5790 {
5791 if (p)
5792 {
5795 }
5796 }
5797 }
5798 }
5799 }
5800
5802 {
5804 {
5806 {
5807 int id = i - 1;
5809
5810 if (OP)
5811 {
5813
5814 if (p)
5815 {
5817 }
5818
5819 delete OP;
5820 }
5821 }
5822
5825 }
5826 }
5827
5830 {
5831 return 0.0;
5832 }
5833
5834
5836 {
5837 return 250;
5838 }
5839
5841 {
5842 return 0;
5843 }
5844
5847 {
5849 return true;
5850
5851 return false;
5852 }
5853
5856 {
5859
5861 {
5863 }
5864 else
5865 {
5866
5868 }
5869
5871 }
5872
5879 {
5880 return -1;
5881 }
5882
5883
5884
5885
5887 {
5889 {
5891 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
5892
5893 if (r_index >= 0)
5894 {
5895 InventoryLocation r_il = new InventoryLocation;
5896 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
5897
5898 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
5901 {
5902 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
5903 }
5905 {
5906 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
5907 }
5908
5909 }
5910
5911 player.GetHumanInventory().ClearUserReservedLocation(this);
5912 }
5913
5916 }
5917
5918
5919
5920
5922 {
5923 return ItemBase.m_DebugActionsMask;
5924 }
5925
5927 {
5928 return ItemBase.m_DebugActionsMask & mask;
5929 }
5930
5932 {
5933 ItemBase.m_DebugActionsMask = mask;
5934 }
5935
5937 {
5938 ItemBase.m_DebugActionsMask |= mask;
5939 }
5940
5942 {
5943 ItemBase.m_DebugActionsMask &= ~mask;
5944 }
5945
5947 {
5949 {
5951 }
5952 else
5953 {
5955 }
5956 }
5957
5958
5960 {
5961 if (GetEconomyProfile())
5962 {
5963 float q_max = GetEconomyProfile().GetQuantityMax();
5964 if (q_max > 0)
5965 {
5966 float q_min = GetEconomyProfile().GetQuantityMin();
5967 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
5968
5970 {
5971 ComponentEnergyManager comp = GetCompEM();
5973 {
5975 }
5976 }
5978 {
5980
5981 }
5982
5983 }
5984 }
5985 }
5986
5989 {
5990 EntityAI parent = GetHierarchyParent();
5991
5992 if (parent)
5993 {
5994 InventoryLocation inventory_location_to_lock = new InventoryLocation;
5995 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
5996 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
5997 }
5998 }
5999
6002 {
6003 EntityAI parent = GetHierarchyParent();
6004
6005 if (parent)
6006 {
6007 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
6008 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
6009 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
6010 }
6011 }
6012
6014 {
6015
6016
6017
6018
6020
6022 {
6023 if (ScriptInputUserData.CanStoreInputUserData())
6024 {
6025 ScriptInputUserData ctx = new ScriptInputUserData;
6031 ctx.
Write(use_stack_max);
6034
6036 {
6037 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
6038 }
6039 }
6040 }
6041 else if (!
GetGame().IsMultiplayer())
6042 {
6044 }
6045 }
6046
6048 {
6050 }
6051
6053 {
6055 }
6056
6058 {
6060 }
6061
6063 {
6064
6065 return false;
6066 }
6067
6069 {
6070 return false;
6071 }
6072
6076 {
6077 return false;
6078 }
6079
6081 {
6082 return "";
6083 }
6084
6086
6088 {
6089 return false;
6090 }
6091
6093 {
6094 return true;
6095 }
6096
6097
6098
6100 {
6101 return true;
6102 }
6103
6105 {
6106 return true;
6107 }
6108
6110 {
6111 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6113 }
6114
6116 {
6118 }
6119
6121 {
6123 if (!is_being_placed)
6125 SetSynchDirty();
6126 }
6127
6128
6130
6132 {
6134 }
6135
6137 {
6139 }
6140
6142 {
6143 return 1;
6144 }
6145
6147 {
6148 return false;
6149 }
6150
6152 {
6154 SetSynchDirty();
6155 }
6156
6157
6158
6159
6160
6161
6162
6163
6164
6165
6166
6167
6168
6169
6170
6171
6172
6173
6174
6175
6176
6177
6178
6179
6180
6181
6182
6183
6184
6185
6186
6187
6188
6189
6190
6192 {
6193 super.OnMovedInsideCargo(container);
6194
6195 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6196 }
6197
6198 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
6199 {
6200 super.EEItemLocationChanged(oldLoc,newLoc);
6201
6202 PlayerBase new_player = null;
6203 PlayerBase old_player = null;
6204
6205 if (newLoc.GetParent())
6206 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
6207
6208 if (oldLoc.GetParent())
6209 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
6210
6212 {
6213 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
6214
6215 if (r_index >= 0)
6216 {
6217 InventoryLocation r_il = new InventoryLocation;
6218 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6219
6220 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6223 {
6224 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6225 }
6227 {
6228 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6229 }
6230
6231 }
6232 }
6233
6235 {
6236 if (new_player)
6237 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
6238
6239 if (new_player == old_player)
6240 {
6241
6242 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
6243 {
6245 {
6246 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
6247 {
6248 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6249 }
6250 }
6251 else
6252 {
6253 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6254 }
6255 }
6256
6257 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
6258 {
6259 int type = oldLoc.GetType();
6261 {
6262 oldLoc.GetParent().GetOnSetLock().Invoke(this);
6263 }
6265 {
6266 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
6267 }
6268 }
6269 if (!m_OldLocation)
6270 {
6271 m_OldLocation = new InventoryLocation;
6272 }
6273 m_OldLocation.Copy(oldLoc);
6274 }
6275 else
6276 {
6277 if (m_OldLocation)
6278 {
6279 m_OldLocation.Reset();
6280 }
6281 }
6282
6284 }
6285 else
6286 {
6287 if (new_player)
6288 {
6289 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
6290 if (res_index >= 0)
6291 {
6292 InventoryLocation il = new InventoryLocation;
6293 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
6295 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
6298 {
6299 il.
GetParent().GetOnReleaseLock().Invoke(it);
6300 }
6302 {
6304 }
6305
6306 }
6307 }
6309 {
6310
6312 }
6313
6314 if (m_OldLocation)
6315 {
6316 m_OldLocation.Reset();
6317 }
6318 }
6319 }
6320
6321 override void EOnContact(IEntity other, Contact extra)
6322 {
6324 {
6325 int liquidType = -1;
6327 if (impactSpeed > 0.0)
6328 {
6330 #ifndef SERVER
6332 #else
6334 SetSynchDirty();
6335 #endif
6337 }
6338 }
6339
6340 #ifdef SERVER
6341 if (GetCompEM() && GetCompEM().IsPlugged())
6342 {
6343 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
6344 GetCompEM().UnplugThis();
6345 }
6346 #endif
6347 }
6348
6350
6352 {
6354 }
6355
6357 {
6358
6359 }
6360
6362 {
6363 super.OnItemLocationChanged(old_owner, new_owner);
6364
6365 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
6366 PlayerBase playerNew = PlayerBase.Cast(new_owner);
6367
6368 if (!relatedPlayer && playerNew)
6369 relatedPlayer = playerNew;
6370
6371 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
6372 {
6374 if (actionMgr)
6375 {
6376 ActionBase currentAction = actionMgr.GetRunningAction();
6377 if (currentAction)
6379 }
6380 }
6381
6382 Man ownerPlayerOld = null;
6383 Man ownerPlayerNew = null;
6384
6385 if (old_owner)
6386 {
6387 if (old_owner.
IsMan())
6388 {
6389 ownerPlayerOld = Man.Cast(old_owner);
6390 }
6391 else
6392 {
6393 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
6394 }
6395 }
6396 else
6397 {
6399 {
6401
6402 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
6403 {
6404 GetCompEM().UnplugThis();
6405 }
6406 }
6407 }
6408
6409 if (new_owner)
6410 {
6411 if (new_owner.
IsMan())
6412 {
6413 ownerPlayerNew = Man.Cast(new_owner);
6414 }
6415 else
6416 {
6417 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
6418 }
6419 }
6420
6421 if (ownerPlayerOld != ownerPlayerNew)
6422 {
6423 if (ownerPlayerOld)
6424 {
6425 array<EntityAI> subItemsExit = new array<EntityAI>;
6427 for (int i = 0; i < subItemsExit.Count(); i++)
6428 {
6431 }
6432 }
6433
6434 if (ownerPlayerNew)
6435 {
6436 array<EntityAI> subItemsEnter = new array<EntityAI>;
6438 for (int j = 0; j < subItemsEnter.Count(); j++)
6439 {
6442 }
6443 }
6444 }
6445 else if (ownerPlayerNew != null)
6446 {
6447 PlayerBase nplayer;
6448 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
6449 {
6450 array<EntityAI> subItemsUpdate = new array<EntityAI>;
6452 for (int k = 0; k < subItemsUpdate.Count(); k++)
6453 {
6455 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
6456 }
6457 }
6458 }
6459
6460 if (old_owner)
6461 old_owner.OnChildItemRemoved(this);
6462 if (new_owner)
6463 new_owner.OnChildItemReceived(this);
6464 }
6465
6466
6468 {
6469 super.EEDelete(parent);
6470 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
6471 if (player)
6472 {
6474
6475 if (player.IsAlive())
6476 {
6477 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6478 if (r_index >= 0)
6479 {
6480 InventoryLocation r_il = new InventoryLocation;
6481 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6482
6483 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6486 {
6487 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6488 }
6490 {
6491 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6492 }
6493
6494 }
6495
6496 player.RemoveQuickBarEntityShortcut(this);
6497 }
6498 }
6499 }
6500
6502 {
6503 super.EEKilled(killer);
6504
6507 {
6508 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
6509 {
6510 if (IsMagazine())
6511 {
6512 if (Magazine.Cast(this).GetAmmoCount() > 0)
6513 {
6515 }
6516 }
6517 else
6518 {
6520 }
6521 }
6522 }
6523 }
6524
6526 {
6527 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6528
6529 super.OnWasAttached(parent, slot_id);
6530
6533
6535 }
6536
6538 {
6539 super.OnWasDetached(parent, slot_id);
6540
6543 }
6544
6546 {
6547 int idx;
6550
6551 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
6552 if (inventory_slots.Count() < 1)
6553 {
6554 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
6555 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
6556 }
6557 else
6558 {
6559 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
6560 }
6561
6562 idx = inventory_slots.Find(slot);
6563 if (idx < 0)
6564 return "";
6565
6566 return attach_types.Get(idx);
6567 }
6568
6570 {
6571 int idx = -1;
6572 string slot;
6573
6576
6577 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
6578 if (inventory_slots.Count() < 1)
6579 {
6580 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
6581 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
6582 }
6583 else
6584 {
6585 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
6586 if (detach_types.Count() < 1)
6587 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
6588 }
6589
6590 for (int i = 0; i < inventory_slots.Count(); i++)
6591 {
6592 slot = inventory_slots.Get(i);
6593 }
6594
6595 if (slot != "")
6596 {
6597 if (detach_types.Count() == 1)
6598 idx = 0;
6599 else
6600 idx = inventory_slots.Find(slot);
6601 }
6602 if (idx < 0)
6603 return "";
6604
6605 return detach_types.Get(idx);
6606 }
6607
6609 {
6610
6612
6613
6614 float min_time = 1;
6615 float max_time = 3;
6616 float delay = Math.RandomFloat(min_time, max_time);
6617
6618 explode_timer.Run(delay, this, "DoAmmoExplosion");
6619 }
6620
6622 {
6623 Magazine magazine = Magazine.Cast(this);
6624 int pop_sounds_count = 6;
6625 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
6626
6627
6628 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
6629 string sound_name = pop_sounds[ sound_idx ];
6631
6632
6633 magazine.ServerAddAmmoCount(-1);
6634
6635
6636 float min_temp_to_explode = 100;
6637
6638 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
6639 {
6641 }
6642 }
6643
6644
6645 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
6646 {
6647 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
6648
6649 const int CHANCE_DAMAGE_CARGO = 4;
6650 const int CHANCE_DAMAGE_ATTACHMENT = 1;
6651 const int CHANCE_DAMAGE_NOTHING = 2;
6652
6654 {
6655 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
6656 int chances;
6657 int rnd;
6658
6659 if (GetInventory().GetCargo())
6660 {
6661 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
6662 rnd = Math.RandomInt(0,chances);
6663
6664 if (rnd < CHANCE_DAMAGE_CARGO)
6665 {
6667 }
6668 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
6669 {
6671 }
6672 }
6673 else
6674 {
6675 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
6676 rnd = Math.RandomInt(0,chances);
6677
6678 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
6679 {
6681 }
6682 }
6683 }
6684 }
6685
6687 {
6688 if (GetInventory().GetCargo())
6689 {
6690 int item_count = GetInventory().GetCargo().GetItemCount();
6691 if (item_count > 0)
6692 {
6693 int random_pick = Math.RandomInt(0, item_count);
6695 if (!item.IsExplosive())
6696 {
6697 item.AddHealth("","",damage);
6698 return true;
6699 }
6700 }
6701 }
6702 return false;
6703 }
6704
6706 {
6707 int attachment_count = GetInventory().AttachmentCount();
6708 if (attachment_count > 0)
6709 {
6710 int random_pick = Math.RandomInt(0, attachment_count);
6711 ItemBase attachment =
ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
6712 if (!attachment.IsExplosive())
6713 {
6714 attachment.AddHealth("","",damage);
6715 return true;
6716 }
6717 }
6718 return false;
6719 }
6720
6722 {
6724 }
6725
6727 {
6729 return GetInventory().CanRemoveEntity();
6730
6731 return false;
6732 }
6733
6735 {
6736
6738 return false;
6739
6740
6742 return false;
6743
6744
6745
6747 if (delta == 0)
6748 return false;
6749
6750
6751 return true;
6752 }
6753
6755 {
6757 {
6758 if (ScriptInputUserData.CanStoreInputUserData())
6759 {
6760 ScriptInputUserData ctx = new ScriptInputUserData;
6765 ctx.
Write(destination_entity);
6769 }
6770 }
6771 else if (!
GetGame().IsMultiplayer())
6772 {
6774 }
6775 }
6776
6778 {
6779 float split_quantity_new;
6783 InventoryLocation loc = new InventoryLocation;
6784
6785 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
6786 {
6788 split_quantity_new = stack_max;
6789 else
6791
6793 {
6794 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
6795 if (new_item)
6796 {
6797 new_item.SetResultOfSplit(true);
6798 MiscGameplayFunctions.TransferItemProperties(this, new_item);
6800 new_item.
SetQuantity(split_quantity_new,
false,
true);
6801 }
6802 }
6803 }
6804 else if (destination_entity && slot_id == -1)
6805 {
6806 if (quantity > stack_max)
6807 split_quantity_new = stack_max;
6808 else
6809 split_quantity_new = quantity;
6810
6812 {
6814 {
6817 }
6818
6819 if (new_item)
6820 {
6821 new_item.SetResultOfSplit(true);
6822 MiscGameplayFunctions.TransferItemProperties(this, new_item);
6824 new_item.
SetQuantity(split_quantity_new,
false,
true);
6825 }
6826 }
6827 }
6828 else
6829 {
6830 if (stack_max != 0)
6831 {
6833 {
6835 }
6836
6837 if (split_quantity_new == 0)
6838 {
6839 if (!
GetGame().IsMultiplayer())
6840 player.PhysicalPredictiveDropItem(this);
6841 else
6842 player.ServerDropEntity(this);
6843 return;
6844 }
6845
6847 {
6849
6850 if (new_item)
6851 {
6852 new_item.SetResultOfSplit(true);
6853 MiscGameplayFunctions.TransferItemProperties(this, new_item);
6856 new_item.PlaceOnSurface();
6857 }
6858 }
6859 }
6860 }
6861 }
6862
6864 {
6865 float split_quantity_new;
6869 InventoryLocation loc = new InventoryLocation;
6870
6871 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
6872 {
6874 split_quantity_new = stack_max;
6875 else
6877
6879 {
6880 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
6881 if (new_item)
6882 {
6883 new_item.SetResultOfSplit(true);
6884 MiscGameplayFunctions.TransferItemProperties(this, new_item);
6886 new_item.
SetQuantity(split_quantity_new,
false,
true);
6887 }
6888 }
6889 }
6890 else if (destination_entity && slot_id == -1)
6891 {
6892 if (quantity > stack_max)
6893 split_quantity_new = stack_max;
6894 else
6895 split_quantity_new = quantity;
6896
6898 {
6900 {
6903 }
6904
6905 if (new_item)
6906 {
6907 new_item.SetResultOfSplit(true);
6908 MiscGameplayFunctions.TransferItemProperties(this, new_item);
6910 new_item.
SetQuantity(split_quantity_new,
false,
true);
6911 }
6912 }
6913 }
6914 else
6915 {
6916 if (stack_max != 0)
6917 {
6919 {
6921 }
6922
6924 {
6926
6927 if (new_item)
6928 {
6929 new_item.SetResultOfSplit(true);
6930 MiscGameplayFunctions.TransferItemProperties(this, new_item);
6933 new_item.PlaceOnSurface();
6934 }
6935 }
6936 }
6937 }
6938 }
6939
6941 {
6943 {
6944 if (ScriptInputUserData.CanStoreInputUserData())
6945 {
6946 ScriptInputUserData ctx = new ScriptInputUserData;
6951 dst.WriteToContext(ctx);
6953 }
6954 }
6955 else if (!
GetGame().IsMultiplayer())
6956 {
6958 }
6959 }
6960
6962 {
6964 {
6965 if (ScriptInputUserData.CanStoreInputUserData())
6966 {
6967 ScriptInputUserData ctx = new ScriptInputUserData;
6972 ctx.
Write(destination_entity);
6978 }
6979 }
6980 else if (!
GetGame().IsMultiplayer())
6981 {
6983 }
6984 }
6985
6987 {
6989 }
6990
6992 {
6994 float split_quantity_new;
6996 if (dst.IsValid())
6997 {
6998 int slot_id = dst.GetSlot();
7000
7001 if (quantity > stack_max)
7002 split_quantity_new = stack_max;
7003 else
7004 split_quantity_new = quantity;
7005
7007 {
7009
7010 if (new_item)
7011 {
7012 new_item.SetResultOfSplit(true);
7013 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7015 new_item.
SetQuantity(split_quantity_new,
false,
true);
7016 }
7017
7018 return new_item;
7019 }
7020 }
7021
7022 return null;
7023 }
7024
7026 {
7028 float split_quantity_new;
7030 if (destination_entity)
7031 {
7033 if (quantity > stackable)
7034 split_quantity_new = stackable;
7035 else
7036 split_quantity_new = quantity;
7037
7039 {
7040 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
7041 if (new_item)
7042 {
7043 new_item.SetResultOfSplit(true);
7044 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7046 new_item.
SetQuantity(split_quantity_new,
false,
true);
7047 }
7048 }
7049 }
7050 }
7051
7053 {
7055 {
7056 if (ScriptInputUserData.CanStoreInputUserData())
7057 {
7058 ScriptInputUserData ctx = new ScriptInputUserData;
7063 ItemBase destination_entity =
this;
7064 ctx.
Write(destination_entity);
7068 }
7069 }
7070 else if (!
GetGame().IsMultiplayer())
7071 {
7073 }
7074 }
7075
7077 {
7079 float split_quantity_new;
7081 if (player)
7082 {
7084 if (quantity > stackable)
7085 split_quantity_new = stackable;
7086 else
7087 split_quantity_new = quantity;
7088
7090 {
7091 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
7092 new_item =
ItemBase.Cast(in_hands);
7093 if (new_item)
7094 {
7095 new_item.SetResultOfSplit(true);
7096 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7098 new_item.SetQuantity(split_quantity_new, false, true);
7099 }
7100 }
7101 }
7102 }
7103
7105 {
7107 float split_quantity_new = Math.Floor(quantity * 0.5);
7108
7110 return;
7111
7113
7114 if (new_item)
7115 {
7116 if (new_item.GetQuantityMax() < split_quantity_new)
7117 {
7118 split_quantity_new = new_item.GetQuantityMax();
7119 }
7120
7121 new_item.SetResultOfSplit(true);
7122 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7123
7125 {
7128 }
7129 else
7130 {
7132 new_item.
SetQuantity(split_quantity_new,
false,
true);
7133 }
7134 }
7135 }
7136
7138 {
7140 float split_quantity_new = Math.Floor(quantity / 2);
7141
7143 return;
7144
7145 InventoryLocation invloc = new InventoryLocation;
7147
7149 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
7150
7151 if (new_item)
7152 {
7153 if (new_item.GetQuantityMax() < split_quantity_new)
7154 {
7155 split_quantity_new = new_item.GetQuantityMax();
7156 }
7158 {
7161 }
7162 else if (split_quantity_new > 1)
7163 {
7165 new_item.
SetQuantity(split_quantity_new,
false,
true);
7166 }
7167 }
7168 }
7169
7172 {
7173 SetWeightDirty();
7175
7176 if (parent)
7177 parent.OnAttachmentQuantityChangedEx(this, delta);
7178
7180 {
7182 {
7184 }
7186 {
7187 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
7189 }
7190 }
7191
7192 }
7193
7196 {
7197
7198 }
7199
7202 {
7204 }
7205
7207 {
7208 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
7209
7211 {
7212 if (newLevel == GameConstants.STATE_RUINED)
7213 {
7215 EntityAI parent = GetHierarchyParent();
7216 if (parent && parent.IsFireplace())
7217 {
7218 CargoBase cargo = GetInventory().GetCargo();
7219 if (cargo)
7220 {
7222 {
7224 }
7225 }
7226 }
7227 }
7228
7230 {
7231
7233 return;
7234 }
7235
7236 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
7237 {
7239 }
7240 }
7241 }
7242
7243
7245 {
7246 super.OnRightClick();
7247
7249 {
7251 {
7252 if (ScriptInputUserData.CanStoreInputUserData())
7253 {
7254 EntityAI root = GetHierarchyRoot();
7255 Man playerOwner = GetHierarchyRootPlayer();
7256 InventoryLocation dst = new InventoryLocation;
7257
7258
7259 if (!playerOwner && root && root == this)
7260 {
7262 }
7263 else
7264 {
7265
7266 GetInventory().GetCurrentInventoryLocation(dst);
7268 {
7271 {
7273 }
7274 else
7275 {
7277
7278
7279 if (
GetGame().
GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
7280 {
7282 }
7283 else
7284 {
7285 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
7286 }
7287 }
7288 }
7289 }
7290
7291 ScriptInputUserData ctx = new ScriptInputUserData;
7299 }
7300 }
7301 else if (!
GetGame().IsMultiplayer())
7302 {
7304 }
7305 }
7306 }
7307
7309 {
7310 if (root)
7311 {
7312 vector m4[4];
7313 root.GetTransform(m4);
7314 dst.SetGround(this, m4);
7315 }
7316 else
7317 {
7318 GetInventory().GetCurrentInventoryLocation(dst);
7319 }
7320 }
7321
7322 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
7323 {
7324
7325 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
7326 return false;
7327
7328 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
7329 return false;
7330
7331
7333 return false;
7334
7335
7336 Magazine mag = Magazine.Cast(this);
7337 if (mag)
7338 {
7339 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
7340 return false;
7341
7342 if (stack_max_limit)
7343 {
7344 Magazine other_mag = Magazine.Cast(other_item);
7345 if (other_item)
7346 {
7347 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
7348 return false;
7349 }
7350
7351 }
7352 }
7353 else
7354 {
7355
7357 return false;
7358
7360 return false;
7361 }
7362
7363 PlayerBase player = null;
7364 if (CastTo(player, GetHierarchyRootPlayer()))
7365 {
7366 if (player.GetInventory().HasAttachment(this))
7367 return false;
7368
7369 if (player.IsItemsToDelete())
7370 return false;
7371 }
7372
7373 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
7374 return false;
7375
7376 int slotID;
7378 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
7379 return false;
7380
7381 return true;
7382 }
7383
7385 {
7387 }
7388
7390 {
7391 return m_IsResultOfSplit;
7392 }
7393
7395 {
7396 m_IsResultOfSplit = value;
7397 }
7398
7400 {
7402 }
7403
7405 {
7406 float other_item_quantity = other_item.GetQuantity();
7407 float this_free_space;
7408
7410
7412
7413 if (other_item_quantity > this_free_space)
7414 {
7415 return this_free_space;
7416 }
7417 else
7418 {
7419 return other_item_quantity;
7420 }
7421 }
7422
7424 {
7426 }
7427
7429 {
7431 return;
7432
7433 if (!IsMagazine() && other_item)
7434 {
7436 if (quantity_used != 0)
7437 {
7438 float hp1 = GetHealth01("","");
7439 float hp2 = other_item.GetHealth01("","");
7440 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
7441 hpResult = hpResult / (
GetQuantity() + quantity_used);
7442
7443 hpResult *= GetMaxHealth();
7444 Math.Round(hpResult);
7445 SetHealth("", "Health", hpResult);
7446
7448 other_item.AddQuantity(-quantity_used);
7449 }
7450 }
7452 }
7453
7455 {
7456 #ifdef SERVER
7457 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
7458 GetHierarchyParent().IncreaseLifetimeUp();
7459 #endif
7460 };
7461
7463 {
7464 PlayerBase p = PlayerBase.Cast(player);
7465
7466 array<int> recipesIds = p.m_Recipes;
7467 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
7468 if (moduleRecipesManager)
7469 {
7470 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
7471 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
7472 }
7473
7474 for (int i = 0;i < recipesIds.Count(); i++)
7475 {
7476 int key = recipesIds.Get(i);
7477 string recipeName = moduleRecipesManager.GetRecipeName(key);
7479 }
7480 }
7481
7482
7483 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
7484 {
7485 super.GetDebugActions(outputList);
7486
7487
7493
7494
7499
7504
7505
7509
7510
7512 {
7516 }
7517
7520
7521
7525
7527
7528 InventoryLocation loc = new InventoryLocation();
7529 GetInventory().GetCurrentInventoryLocation(loc);
7531 {
7532 if (Gizmo_IsSupported())
7535 }
7536
7538 }
7539
7540
7541
7542
7544 {
7545 super.OnAction(action_id, player, ctx);
7546
7548 {
7549 switch (action_id)
7550 {
7553 return true;
7556 return true;
7557 }
7558 }
7559
7561 {
7562 switch (action_id)
7563 {
7565 Delete();
7566 return true;
7567 }
7568 }
7569
7570 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
7571 {
7572 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
7573 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
7574 PlayerBase p = PlayerBase.Cast(player);
7575 if (
EActions.RECIPES_RANGE_START < 1000)
7576 {
7577 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
7578 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
7579 }
7580 }
7581 #ifndef SERVER
7582 else if (action_id ==
EActions.WATCH_PLAYER)
7583 {
7584 PluginDeveloper.SetDeveloperItemClientEx(player);
7585 }
7586 #endif
7588 {
7589 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
7590 {
7591 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
7592 OnDebugButtonPressServer(id + 1);
7593 }
7594
7595 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
7596 {
7597 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
7599 }
7600
7601 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
7602 {
7603 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
7605 }
7606
7607 else if (action_id ==
EActions.ADD_QUANTITY)
7608 {
7609 if (IsMagazine())
7610 {
7611 Magazine mag = Magazine.Cast(this);
7612 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
7613 }
7614 else
7615 {
7617 }
7618
7619 if (m_EM)
7620 {
7621 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
7622 }
7623
7624 }
7625
7626 else if (action_id ==
EActions.REMOVE_QUANTITY)
7627 {
7628 if (IsMagazine())
7629 {
7630 Magazine mag2 = Magazine.Cast(this);
7631 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
7632 }
7633 else
7634 {
7636 }
7637 if (m_EM)
7638 {
7639 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
7640 }
7641
7642 }
7643
7644 else if (action_id ==
EActions.SET_QUANTITY_0)
7645 {
7647
7648 if (m_EM)
7649 {
7650 m_EM.SetEnergy(0);
7651 }
7652 }
7653
7654 else if (action_id ==
EActions.SET_MAX_QUANTITY)
7655 {
7657
7658 if (m_EM)
7659 {
7660 m_EM.SetEnergy(m_EM.GetEnergyMax());
7661 }
7662 }
7663
7664 else if (action_id ==
EActions.ADD_HEALTH)
7665 {
7666 AddHealth("","",GetMaxHealth("","Health")/5);
7667 }
7668 else if (action_id ==
EActions.REMOVE_HEALTH)
7669 {
7670 AddHealth("","",-GetMaxHealth("","Health")/5);
7671 }
7672 else if (action_id ==
EActions.DESTROY_HEALTH)
7673 {
7674 SetHealth01("","",0);
7675 }
7676 else if (action_id ==
EActions.WATCH_ITEM)
7677 {
7679 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
7680 #ifdef DEVELOPER
7681 SetDebugDeveloper_item(this);
7682 #endif
7683 }
7684
7685 else if (action_id ==
EActions.ADD_TEMPERATURE)
7686 {
7687 AddTemperature(20);
7688
7689 }
7690
7691 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
7692 {
7693 AddTemperature(-20);
7694
7695 }
7696
7697 else if (action_id ==
EActions.FLIP_FROZEN)
7698 {
7699 SetFrozen(!GetIsFrozen());
7700
7701 }
7702
7703 else if (action_id ==
EActions.ADD_WETNESS)
7704 {
7706
7707 }
7708
7709 else if (action_id ==
EActions.REMOVE_WETNESS)
7710 {
7712
7713 }
7714
7715 else if (action_id ==
EActions.LIQUIDTYPE_UP)
7716 {
7719
7720
7721 }
7722
7723 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
7724 {
7727 }
7728
7729 else if (action_id ==
EActions.MAKE_SPECIAL)
7730 {
7731 auto debugParams = DebugSpawnParams.WithPlayer(player);
7732 OnDebugSpawnEx(debugParams);
7733 }
7734
7735 }
7736
7737
7738 return false;
7739 }
7740
7741
7742
7743
7747
7750
7751
7752
7754 {
7755 return false;
7756 }
7757
7758
7760 {
7761 return true;
7762 }
7763
7764
7766 {
7767 return true;
7768 }
7769
7770
7771
7773 {
7774 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
7776 }
7777
7780 {
7781 return null;
7782 }
7783
7785 {
7786 return false;
7787 }
7788
7790 {
7791 return false;
7792 }
7793
7797
7798
7800 {
7801 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
7802 return module_repairing.CanRepair(this, item_repair_kit);
7803 }
7804
7805
7806 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
7807 {
7808 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
7809 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
7810 }
7811
7812
7814 {
7815
7816
7817
7818
7819
7820
7821
7822
7823 return 1;
7824 }
7825
7826
7827
7829 {
7831 }
7832
7833
7834
7836 {
7838 }
7839
7840
7849 {
7850 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
7851
7852 if (player)
7853 {
7854 player.MessageStatus(text);
7855 }
7856 }
7857
7858
7867 {
7868 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
7869
7870 if (player)
7871 {
7872 player.MessageAction(text);
7873 }
7874 }
7875
7876
7885 {
7886 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
7887
7888 if (player)
7889 {
7890 player.MessageFriendly(text);
7891 }
7892 }
7893
7894
7903 {
7904 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
7905
7906 if (player)
7907 {
7908 player.MessageImportant(text);
7909 }
7910 }
7911
7913 {
7914 return true;
7915 }
7916
7917
7918 override bool KindOf(
string tag)
7919 {
7920 bool found = false;
7921 string item_name = this.
GetType();
7924
7925 int array_size = item_tag_array.Count();
7926 for (int i = 0; i < array_size; i++)
7927 {
7928 if (item_tag_array.Get(i) == tag)
7929 {
7930 found = true;
7931 break;
7932 }
7933 }
7934 return found;
7935 }
7936
7937
7939 {
7940
7941 super.OnRPC(sender, rpc_type,ctx);
7942
7943
7944 switch (rpc_type)
7945 {
7946 #ifndef SERVER
7947 case ERPCs.RPC_SOUND_LOCK_ATTACH:
7948 Param2<bool, string> p = new Param2<bool, string>(false, "");
7949
7951 return;
7952
7953 bool play = p.param1;
7954 string soundSet = p.param2;
7955
7956 if (play)
7957 {
7959 {
7961 {
7963 }
7964 }
7965 else
7966 {
7968 }
7969 }
7970 else
7971 {
7973 }
7974
7975 break;
7976 #endif
7977
7978 }
7979
7981 {
7983 }
7984 }
7985
7986
7987
7988
7990 {
7991 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
7992 return plugin.GetID(
name);
7993 }
7994
7996 {
7997 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
7998 return plugin.GetName(id);
7999 }
8000
8003 {
8004
8005
8006 int varFlags;
8007 if (!ctx.
Read(varFlags))
8008 return;
8009
8010 if (varFlags & ItemVariableFlags.FLOAT)
8011 {
8013 }
8014 }
8015
8017 {
8018
8019 super.SerializeNumericalVars(floats_out);
8020
8021
8022
8024 {
8026 }
8027
8029 {
8031 }
8032
8034 {
8036 }
8037
8039 {
8044 }
8045
8047 {
8049 }
8050 }
8051
8053 {
8054
8055 super.DeSerializeNumericalVars(floats);
8056
8057
8058 int index = 0;
8059 int mask = Math.Round(floats.Get(index));
8060
8061 index++;
8062
8064 {
8066 {
8068 }
8069 else
8070 {
8071 float quantity = floats.Get(index);
8073 }
8074 index++;
8075 }
8076
8078 {
8079 float wet = floats.Get(index);
8081 index++;
8082 }
8083
8085 {
8086 int liquidtype = Math.Round(floats.Get(index));
8088 index++;
8089 }
8090
8092 {
8094 index++;
8096 index++;
8098 index++;
8100 index++;
8101 }
8102
8104 {
8105 int cleanness = Math.Round(floats.Get(index));
8107 index++;
8108 }
8109 }
8110
8112 {
8113 super.WriteVarsToCTX(ctx);
8114
8115
8117 {
8119 }
8120
8122 {
8124 }
8125
8127 {
8129 }
8130
8132 {
8133 int r,g,b,a;
8139 }
8140
8142 {
8144 }
8145 }
8146
8148 {
8149 if (!super.ReadVarsFromCTX(ctx,version))
8150 return false;
8151
8152 int intValue;
8153 float value;
8154
8155 if (version < 140)
8156 {
8157 if (!ctx.
Read(intValue))
8158 return false;
8159
8160 m_VariablesMask = intValue;
8161 }
8162
8164 {
8165 if (!ctx.
Read(value))
8166 return false;
8167
8169 {
8171 }
8172 else
8173 {
8175 }
8176 }
8177
8178 if (version < 140)
8179 {
8181 {
8182 if (!ctx.
Read(value))
8183 return false;
8184 SetTemperatureDirect(value);
8185 }
8186 }
8187
8189 {
8190 if (!ctx.
Read(value))
8191 return false;
8193 }
8194
8196 {
8197 if (!ctx.
Read(intValue))
8198 return false;
8200 }
8201
8203 {
8204 int r,g,b,a;
8206 return false;
8208 return false;
8210 return false;
8212 return false;
8213
8215 }
8216
8218 {
8219 if (!ctx.
Read(intValue))
8220 return false;
8222 }
8223
8224 if (version >= 138 && version < 140)
8225 {
8227 {
8228 if (!ctx.
Read(intValue))
8229 return false;
8230 SetFrozen(intValue);
8231 }
8232 }
8233
8234 return true;
8235 }
8236
8237
8239 {
8242 {
8244 }
8245
8246 if (!super.OnStoreLoad(ctx, version))
8247 {
8249 return false;
8250 }
8251
8252 if (version >= 114)
8253 {
8254 bool hasQuickBarIndexSaved;
8255
8256 if (!ctx.
Read(hasQuickBarIndexSaved))
8257 {
8259 return false;
8260 }
8261
8262 if (hasQuickBarIndexSaved)
8263 {
8264 int itmQBIndex;
8265
8266
8267 if (!ctx.
Read(itmQBIndex))
8268 {
8270 return false;
8271 }
8272
8273 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
8274 if (itmQBIndex != -1 && parentPlayer)
8275 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
8276 }
8277 }
8278 else
8279 {
8280
8281 PlayerBase player;
8282 int itemQBIndex;
8283 if (version ==
int.
MAX)
8284 {
8285 if (!ctx.
Read(itemQBIndex))
8286 {
8288 return false;
8289 }
8290 }
8291 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
8292 {
8293
8294 if (!ctx.
Read(itemQBIndex))
8295 {
8297 return false;
8298 }
8299 if (itemQBIndex != -1 && player)
8300 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
8301 }
8302 }
8303
8304 if (version < 140)
8305 {
8306
8307 if (!LoadVariables(ctx, version))
8308 {
8310 return false;
8311 }
8312 }
8313
8314
8316 {
8318 return false;
8319 }
8320 if (version >= 132)
8321 {
8323 if (raib)
8324 {
8326 {
8328 return false;
8329 }
8330 }
8331 }
8332
8334 return true;
8335 }
8336
8337
8338
8340 {
8341 super.OnStoreSave(ctx);
8342
8343 PlayerBase player;
8344 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
8345 {
8347
8348 int itemQBIndex = -1;
8349 itemQBIndex = player.FindQuickBarEntityIndex(this);
8350 ctx.
Write(itemQBIndex);
8351 }
8352 else
8353 {
8355 }
8356
8358
8360 if (raib)
8361 {
8363 }
8364 }
8365
8366
8368 {
8369 super.AfterStoreLoad();
8370
8372 {
8374 }
8375
8377 {
8380 }
8381 }
8382
8384 {
8385 super.EEOnAfterLoad();
8386
8388 {
8390 }
8391
8394 }
8395
8397 {
8398 return false;
8399 }
8400
8401
8402
8404 {
8406 {
8407 #ifdef PLATFORM_CONSOLE
8408
8410 {
8412 if (menu)
8413 {
8415 }
8416 }
8417 #endif
8418 }
8419
8421 {
8424 }
8425
8427 {
8428 SetWeightDirty();
8430 }
8432 {
8435 }
8436
8438 {
8441 }
8443 {
8446 }
8447
8448 super.OnVariablesSynchronized();
8449 }
8450
8451
8452
8454 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
8455 {
8456 if (!IsServerCheck(allow_client))
8457 return false;
8458
8460 return false;
8461
8464
8465 if (value <= (min + 0.001))
8466 value = min;
8467
8468 if (value == min)
8469 {
8470 if (destroy_config)
8471 {
8472 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
8473 if (dstr)
8474 {
8476 this.Delete();
8477 return true;
8478 }
8479 }
8480 else if (destroy_forced)
8481 {
8483 this.Delete();
8484 return true;
8485 }
8486
8488 }
8489
8492
8494 {
8496
8497 if (delta)
8499 }
8500
8502
8503 return false;
8504 }
8505
8506
8508 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
8509 {
8511 }
8512
8514 {
8517 }
8518
8520 {
8523 }
8524
8526 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
8527 {
8528 float value_clamped = Math.Clamp(value, 0, 1);
8530 SetQuantity(result, destroy_config, destroy_forced);
8531 }
8532
8533
8536 {
8538 }
8539
8541 {
8543 }
8544
8545
8546
8547
8548
8549
8550
8551
8552
8553
8555 {
8556 int slot = -1;
8557 if (GetInventory())
8558 {
8559 InventoryLocation il = new InventoryLocation;
8560 GetInventory().GetCurrentInventoryLocation(il);
8562 }
8563
8565 }
8566
8568 {
8569 float quantity_max = 0;
8570
8572 {
8573 if (attSlotID != -1)
8574 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
8575
8576 if (quantity_max <= 0)
8578 }
8579
8580 if (quantity_max <= 0)
8582
8583 return quantity_max;
8584 }
8585
8587 {
8589 }
8590
8592 {
8594 }
8595
8596
8598 {
8600 }
8601
8603 {
8605 }
8606
8608 {
8610 }
8611
8612
8614 {
8615
8616 float weightEx = GetWeightEx();
8617 float special = GetInventoryAndCargoWeight();
8618 return weightEx - special;
8619 }
8620
8621
8623 {
8625 }
8626
8628 {
8630 {
8631 #ifdef DEVELOPER
8632 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
8633 {
8634 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
8636 }
8637 #endif
8638
8640 }
8641 else if (HasEnergyManager())
8642 {
8643 #ifdef DEVELOPER
8644 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
8645 {
8646 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
8647 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
8648 }
8649 #endif
8650 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
8651 }
8652 else
8653 {
8654 #ifdef DEVELOPER
8655 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
8656 {
8657 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
8658 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
8659 }
8660 #endif
8661 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
8662 }
8663 }
8664
8667 {
8668 int item_count = 0;
8670
8671 if (GetInventory().GetCargo() != NULL)
8672 {
8673 item_count = GetInventory().GetCargo().GetItemCount();
8674 }
8675
8676 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
8677 {
8678 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
8679 if (item)
8680 item_count += item.GetNumberOfItems();
8681 }
8682 return item_count;
8683 }
8684
8687 {
8688 float weight = 0;
8689 float wetness = 1;
8690 if (include_wetness)
8693 {
8694 weight = wetness * m_ConfigWeight;
8695 }
8697 {
8698 weight = 1;
8699 }
8700 return weight;
8701 }
8702
8703
8704
8706 {
8707 if ((
GetGame().IsServer() || !
GetGame().IsMultiplayer()) && GetInventory())
8708 {
8709 GameInventory inv = GetInventory();
8710 array<EntityAI> items = new array<EntityAI>;
8712 for (int i = 0; i < items.Count(); i++)
8713 {
8715 if (item)
8716 {
8718 }
8719 }
8720 }
8721 }
8722
8723
8724
8725
8727 {
8728 float energy = 0;
8729 if (HasEnergyManager())
8730 {
8731 energy = GetCompEM().GetEnergy();
8732 }
8733 return energy;
8734 }
8735
8736
8738 {
8739 super.OnEnergyConsumed();
8740
8742 }
8743
8745 {
8746 super.OnEnergyAdded();
8747
8749 }
8750
8751
8753 {
8754 if (
GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
8755 {
8757 {
8758 float energy_0to1 = GetCompEM().GetEnergy0To1();
8760 }
8761 }
8762 }
8763
8764
8766 {
8767 return ConfigGetFloat("heatIsolation");
8768 }
8769
8771 {
8773 }
8774
8776 {
8777 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
8778 if (
GetGame().ConfigIsExisting(paramPath))
8780
8781 return 0.0;
8782 }
8783
8785 {
8786 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
8787 if (
GetGame().ConfigIsExisting(paramPath))
8789
8790 return 0.0;
8791 }
8792
8793 override void SetWet(
float value,
bool allow_client =
false)
8794 {
8795 if (!IsServerCheck(allow_client))
8796 return;
8797
8800
8802
8803 m_VarWet = Math.Clamp(value, min, max);
8804
8806 {
8809 }
8810 }
8811
8812 override void AddWet(
float value)
8813 {
8815 }
8816
8818 {
8820 }
8821
8823 {
8825 }
8826
8828 {
8830 }
8831
8833 {
8835 }
8836
8838 {
8840 }
8841
8843 {
8846 if (newLevel != oldLevel)
8847 {
8849 }
8850 }
8851
8853 {
8854 SetWeightDirty();
8855 }
8856
8858 {
8859 return GetWetLevelInternal(
m_VarWet);
8860 }
8861
8862
8863
8865 {
8867 }
8868
8870 {
8872 }
8873
8875 {
8877 }
8878
8880 {
8882 }
8883
8884
8885
8887 {
8888 if (ConfigIsExisting("itemModelLength"))
8889 {
8890 return ConfigGetFloat("itemModelLength");
8891 }
8892 return 0;
8893 }
8894
8896 {
8897 if (ConfigIsExisting("itemAttachOffset"))
8898 {
8899 return ConfigGetFloat("itemAttachOffset");
8900 }
8901 return 0;
8902 }
8903
8904 override void SetCleanness(
int value,
bool allow_client =
false)
8905 {
8906 if (!IsServerCheck(allow_client))
8907 return;
8908
8910
8912
8915 }
8916
8918 {
8920 }
8921
8923 {
8924 return true;
8925 }
8926
8927
8928
8929
8931 {
8933 }
8934
8936 {
8938 }
8939
8940
8941
8942
8943 override void SetColor(
int r,
int g,
int b,
int a)
8944 {
8950 }
8952 override void GetColor(out
int r,out
int g,out
int b,out
int a)
8953 {
8958 }
8959
8961 {
8963 }
8964
8967 {
8968 int r,g,b,a;
8970 r = r/255;
8971 g = g/255;
8972 b = b/255;
8973 a = a/255;
8974 return MiscGameplayFunctions.GetColorString(r, g, b, a);
8975 }
8976
8977
8978
8979 override void SetLiquidType(
int value,
bool allow_client =
false)
8980 {
8981 if (!IsServerCheck(allow_client))
8982 return;
8983
8988 }
8989
8991 {
8992 return ConfigGetInt("varLiquidTypeInit");
8993 }
8994
8996 {
8998 }
8999
9001 {
9003 SetFrozen(false);
9004 }
9005
9008 {
9009 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9010 }
9011
9012
9015 {
9016 PlayerBase nplayer;
9017 if (PlayerBase.CastTo(nplayer, player))
9018 {
9020
9021 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9022 }
9023 }
9024
9025
9028 {
9029 PlayerBase nplayer;
9030 if (PlayerBase.CastTo(nplayer,player))
9031 {
9032
9033 nplayer.SetEnableQuickBarEntityShortcut(this,false);
9034
9035 }
9036
9037
9038 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
9039
9040
9041 if (HasEnergyManager())
9042 {
9043 GetCompEM().UpdatePlugState();
9044 }
9045 }
9046
9047
9049 {
9050 super.OnPlacementStarted(player);
9051
9053 }
9054
9055 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
9056 {
9058 {
9059 m_AdminLog.OnPlacementComplete(player,
this);
9060 }
9061
9062 super.OnPlacementComplete(player, position, orientation);
9063 }
9064
9065
9066
9067
9068
9070 {
9072 {
9073 return true;
9074 }
9075 else
9076 {
9077 return false;
9078 }
9079 }
9080
9081
9083 {
9085 {
9087 }
9088 }
9089
9090
9092 {
9094 }
9095
9097 {
9099 }
9100
9101 override void InsertAgent(
int agent,
float count = 1)
9102 {
9103 if (count < 1)
9104 return;
9105
9107 }
9108
9111 {
9113 }
9114
9115
9117 {
9119 }
9120
9121
9122
9123
9124
9125
9126
9127
9128
9129
9130
9131
9132
9133
9134
9135
9136
9137
9138
9139
9140
9141
9142
9143
9144
9145
9146
9147
9148
9149
9150
9151
9152
9153
9154
9155
9156
9157
9158
9159
9160
9161
9163 {
9165 return false;
9166 return true;
9167 }
9168
9170 {
9171
9173 }
9174
9175
9178 {
9179 super.CheckForRoofLimited(timeTresholdMS);
9180
9182 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
9183 {
9184 m_PreviousRoofTestTime = time;
9185 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
9186 }
9187 }
9188
9189
9191 {
9193 {
9194 return 0;
9195 }
9196
9197 if (GetInventory().GetAttachmentSlotsCount() != 0)
9198 {
9199 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
9200 if (filter)
9201 return filter.GetProtectionLevel(type, false, system);
9202 else
9203 return 0;
9204 }
9205
9206 string subclassPath, entryName;
9207
9208 switch (type)
9209 {
9211 entryName = "biological";
9212 break;
9214 entryName = "chemical";
9215 break;
9216 default:
9217 entryName = "biological";
9218 break;
9219 }
9220
9221 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
9222
9224 }
9225
9226
9227
9230 {
9231 if (!IsMagazine())
9233
9235 }
9236
9237
9238
9239
9240
9245 {
9246 return true;
9247 }
9248
9250 {
9252 }
9253
9254
9255
9256
9257
9259 {
9260 if (parent)
9261 {
9262 if (parent.IsInherited(DayZInfected))
9263 return true;
9264
9265 if (!parent.IsRuined())
9266 return true;
9267 }
9268
9269 return true;
9270 }
9271
9273 {
9274 if (!super.CanPutAsAttachment(parent))
9275 {
9276 return false;
9277 }
9278
9279 if (!IsRuined() && !parent.IsRuined())
9280 {
9281 return true;
9282 }
9283
9284 return false;
9285 }
9286
9288 {
9289
9290
9291
9292
9293 return super.CanReceiveItemIntoCargo(item);
9294 }
9295
9297 {
9298
9299
9300
9301
9302 GameInventory attachmentInv = attachment.GetInventory();
9304 {
9305 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
9306 return false;
9307 }
9308
9309 InventoryLocation loc = new InventoryLocation();
9310 attachment.GetInventory().GetCurrentInventoryLocation(loc);
9311 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
9312 return false;
9313
9314 return super.CanReceiveAttachment(attachment, slotId);
9315 }
9316
9318 {
9319 if (!super.CanReleaseAttachment(attachment))
9320 return false;
9321
9322 return GetInventory().AreChildrenAccessible();
9323 }
9324
9325
9326
9327
9328
9329
9330
9331
9332
9333
9334
9335
9336
9337
9338
9339
9340
9341
9342
9343
9344
9346 {
9347 int id = muzzle_owner.GetMuzzleID();
9348 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
9349
9350 if (WPOF_array)
9351 {
9352 for (int i = 0; i < WPOF_array.Count(); i++)
9353 {
9354 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
9355
9356 if (WPOF)
9357 {
9358 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
9359 }
9360 }
9361 }
9362 }
9363
9364
9366 {
9367 int id = muzzle_owner.GetMuzzleID();
9369
9370 if (WPOBE_array)
9371 {
9372 for (int i = 0; i < WPOBE_array.Count(); i++)
9373 {
9374 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
9375
9376 if (WPOBE)
9377 {
9378 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
9379 }
9380 }
9381 }
9382 }
9383
9384
9386 {
9387 int id = muzzle_owner.GetMuzzleID();
9388 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9389
9390 if (WPOOH_array)
9391 {
9392 for (int i = 0; i < WPOOH_array.Count(); i++)
9393 {
9394 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9395
9396 if (WPOOH)
9397 {
9398 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
9399 }
9400 }
9401 }
9402 }
9403
9404
9406 {
9407 int id = muzzle_owner.GetMuzzleID();
9408 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9409
9410 if (WPOOH_array)
9411 {
9412 for (int i = 0; i < WPOOH_array.Count(); i++)
9413 {
9414 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9415
9416 if (WPOOH)
9417 {
9418 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9419 }
9420 }
9421 }
9422 }
9423
9424
9426 {
9427 int id = muzzle_owner.GetMuzzleID();
9428 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9429
9430 if (WPOOH_array)
9431 {
9432 for (int i = 0; i < WPOOH_array.Count(); i++)
9433 {
9434 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9435
9436 if (WPOOH)
9437 {
9438 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9439 }
9440 }
9441 }
9442 }
9443
9444
9445
9447 {
9449 {
9450 return true;
9451 }
9452
9453 return false;
9454 }
9455
9457 {
9459 {
9460 return true;
9461 }
9462
9463 return false;
9464 }
9465
9467 {
9469 {
9470 return true;
9471 }
9472
9473 return false;
9474 }
9475
9477 {
9478 return false;
9479 }
9480
9483 {
9484 return UATimeSpent.DEFAULT_DEPLOY;
9485 }
9486
9487
9488
9489
9491 {
9493 SetSynchDirty();
9494 }
9495
9497 {
9499 }
9500
9501
9503 {
9504 return false;
9505 }
9506
9509 {
9510 string att_type = "None";
9511
9512 if (ConfigIsExisting("soundAttType"))
9513 {
9514 att_type = ConfigGetString("soundAttType");
9515 }
9516
9518 }
9519
9521 {
9523 }
9524
9525
9526
9527
9528
9534
9536 {
9539
9541 }
9542
9543
9545 {
9547 return;
9548
9550
9553
9556
9557 SoundParameters params = new SoundParameters();
9561 }
9562
9563
9565 {
9567 return;
9568
9570 SetSynchDirty();
9571
9574 }
9575
9576
9578 {
9580 return;
9581
9583 SetSynchDirty();
9584
9587 }
9588
9590 {
9592 }
9593
9595 {
9597 }
9598
9601 {
9602 if (!
GetGame().IsDedicatedServer())
9603 {
9604 if (ConfigIsExisting("attachSoundSet"))
9605 {
9606 string cfg_path = "";
9607 string soundset = "";
9609
9612 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
9613 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
9614
9615 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
9616 {
9617 for (int i = 0; i < cfg_soundset_array.Count(); i++)
9618 {
9619 if (cfg_slot_array[i] == slot_type)
9620 {
9621 soundset = cfg_soundset_array[i];
9622 break;
9623 }
9624 }
9625 }
9626
9627 if (soundset != "")
9628 {
9629 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
9631 }
9632 }
9633 }
9634 }
9635
9637 {
9638
9639 }
9640
9641 void OnApply(PlayerBase player);
9642
9644 {
9645 return 1.0;
9646 };
9647
9649 {
9651 }
9652
9654 {
9656 }
9657
9659
9661 {
9662 SetDynamicPhysicsLifeTime(0.01);
9664 }
9665
9667 {
9668 array<string> zone_names = new array<string>;
9669 GetDamageZones(zone_names);
9670 for (int i = 0; i < zone_names.Count(); i++)
9671 {
9672 SetHealthMax(zone_names.Get(i),"Health");
9673 }
9674 SetHealthMax("","Health");
9675 }
9676
9679 {
9680 float global_health = GetHealth01("","Health");
9681 array<string> zones = new array<string>;
9682 GetDamageZones(zones);
9683
9684 for (int i = 0; i < zones.Count(); i++)
9685 {
9686 SetHealth01(zones.Get(i),"Health",global_health);
9687 }
9688 }
9689
9692 {
9693 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
9694 }
9695
9697 {
9698 if (!hasRootAsPlayer)
9699 {
9700 if (refParentIB)
9701 {
9702
9703 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
9704 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
9705
9706 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
9707 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
9708
9711 }
9712 else
9713 {
9714
9717 }
9718 }
9719 }
9720
9722 {
9724 {
9725 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
9726 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
9727 {
9728 float heatPermCoef = 1.0;
9730 while (ent)
9731 {
9732 heatPermCoef *= ent.GetHeatPermeabilityCoef();
9733 ent = ent.GetHierarchyParent();
9734 }
9735
9736 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
9737 }
9738 }
9739 }
9740
9742 {
9743
9744 EntityAI parent = GetHierarchyParent();
9745 if (!parent)
9746 {
9747 hasParent = false;
9748 hasRootAsPlayer = false;
9749 }
9750 else
9751 {
9752 hasParent = true;
9753 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
9754 refParentIB =
ItemBase.Cast(parent);
9755 }
9756 }
9757
9758 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
9759 {
9760
9761 }
9762
9764 {
9765
9766 return false;
9767 }
9768
9770 {
9771
9772
9773 return false;
9774 }
9775
9777 {
9778
9779 return false;
9780 }
9781
9784 {
9785 return !GetIsFrozen() &&
IsOpen();
9786 }
9787
9789 {
9790 bool hasParent = false, hasRootAsPlayer = false;
9792
9793 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
9794 bool foodDecay =
g_Game.IsFoodDecayEnabled();
9795
9796 if (wwtu || foodDecay)
9797 {
9801
9802 if (processWetness || processTemperature || processDecay)
9803 {
9805
9806 if (processWetness)
9807 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
9808
9809 if (processTemperature)
9811
9812 if (processDecay)
9813 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
9814 }
9815 }
9816 }
9817
9820 {
9822 }
9823
9825 {
9828
9829 return super.GetTemperatureFreezeThreshold();
9830 }
9831
9833 {
9836
9837 return super.GetTemperatureThawThreshold();
9838 }
9839
9841 {
9844
9845 return super.GetItemOverheatThreshold();
9846 }
9847
9849 {
9851 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
9852
9853 return super.GetTemperatureFreezeTime();
9854 }
9855
9857 {
9859 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
9860
9861 return super.GetTemperatureThawTime();
9862 }
9863
9868
9870 {
9871 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
9872 }
9873
9875 {
9876 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
9877 }
9878
9881 {
9883 }
9884
9886 {
9888 }
9889
9891 {
9893 }
9894
9897 {
9898 return null;
9899 }
9900
9903 {
9904 return false;
9905 }
9906
9908 {
9910 {
9913 if (!trg)
9914 {
9916 explosive = this;
9917 }
9918
9919 explosive.PairRemote(trg);
9921
9922 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
9923 trg.SetPersistentPairID(persistentID);
9924 explosive.SetPersistentPairID(persistentID);
9925
9926 return true;
9927 }
9928 return false;
9929 }
9930
9933 {
9934 float ret = 1.0;
9937 ret *= GetHealth01();
9938
9939 return ret;
9940 }
9941
9942 #ifdef DEVELOPER
9943 override void SetDebugItem()
9944 {
9945 super.SetDebugItem();
9946 _itemBase = this;
9947 }
9948
9950 {
9951 string text = super.GetDebugText();
9952
9954 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
9955
9956 return text;
9957 }
9958 #endif
9959
9961 {
9962 return true;
9963 }
9964
9966
9968
9970 {
9973 }
9974
9975
9983
9999}
10000
10002{
10004 if (entity)
10005 {
10006 bool is_item = entity.IsInherited(
ItemBase);
10007 if (is_item && full_quantity)
10008 {
10011 }
10012 }
10013 else
10014 {
10016 return NULL;
10017 }
10018 return entity;
10019}
10020
10022{
10023 if (item)
10024 {
10025 if (health > 0)
10026 item.SetHealth("", "", health);
10027
10028 if (item.CanHaveTemperature())
10029 {
10031 if (item.CanFreeze())
10032 item.SetFrozen(false);
10033 }
10034
10035 if (item.HasEnergyManager())
10036 {
10037 if (quantity >= 0)
10038 {
10039 item.GetCompEM().SetEnergy0To1(quantity);
10040 }
10041 else
10042 {
10044 }
10045 }
10046 else if (item.IsMagazine())
10047 {
10048 Magazine mag = Magazine.Cast(item);
10049 if (quantity >= 0)
10050 {
10051 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
10052 }
10053 else
10054 {
10056 }
10057
10058 }
10059 else
10060 {
10061 if (quantity >= 0)
10062 {
10063 item.SetQuantityNormalized(quantity, false);
10064 }
10065 else
10066 {
10068 }
10069
10070 }
10071 }
10072}
10073
10074#ifdef DEVELOPER
10076#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
Open
Implementations only.
override void EEOnCECreate()
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 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)
bool ShouldSplitQuantity(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)
override 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...
bool m_HideSelectionsBySlot
bool IsOverheatingEffectActive()
void SetIsBeingPlaced(bool is_being_placed)
int GetLiquidContainerMask()
void SetInventoryLocationToVicinityOrCurrent(EntityAI root, inout InventoryLocation dst)
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()
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)
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 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 void GizmoSelectObject(Object object)
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 native void GizmoSelectPhysics(Physics physics)
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
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 string GetFoldSoundset()
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 string GetLoopFoldSoundset()
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.