5299{
5301 {
5302 return true;
5303 }
5304};
5305
5307{
5308
5309};
5310
5311
5312
5314{
5318
5320
5323
5324
5325
5326
5327
5336
5342
5347
5352
5373 protected bool m_IsResultOfSplit
5374
5376
5381
5382
5383
5385
5389
5390
5391
5393
5396
5397
5398
5404
5405
5413
5416
5417
5419
5420
5422
5423
5428
5429
5434
5436
5437
5439
5440
5442 {
5447
5448 if (!
g_Game.IsDedicatedServer())
5449 {
5451 {
5453
5455 {
5457 }
5458 }
5459
5462 }
5463
5464 m_OldLocation = null;
5465
5467 {
5469 }
5470
5471 if (ConfigIsExisting("headSelectionsToHide"))
5472 {
5475 }
5476
5478 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
5479 {
5481 }
5482
5484
5485 m_IsResultOfSplit = false;
5486
5488 }
5489
5491 {
5492 super.InitItemVariables();
5493
5499 m_Count = ConfigGetInt(
"count");
5500
5503
5508
5511
5516
5528
5532
5533
5536 if (ConfigIsExisting("canBeSplit"))
5537 {
5540 }
5541
5543 if (ConfigIsExisting("itemBehaviour"))
5545
5546
5549 RegisterNetSyncVariableInt("m_VarLiquidType");
5550 RegisterNetSyncVariableInt("m_Cleanness",0,1);
5551
5552 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
5553 RegisterNetSyncVariableFloat("m_ImpactSpeed");
5554 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
5555
5556 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
5557 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
5558 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
5559 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
5560
5561 RegisterNetSyncVariableBool("m_IsBeingPlaced");
5562 RegisterNetSyncVariableBool("m_IsTakeable");
5563 RegisterNetSyncVariableBool("m_IsHologram");
5564
5567 {
5570 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
5571 }
5572
5574
5576 if (ConfigIsExisting("temperaturePerQuantityWeight"))
5578
5580 }
5581
5583 {
5585 }
5586
5588 {
5591 {
5596 }
5597 }
5598
5599 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
5600 {
5602 {
5605 }
5606
5608 }
5609
5611 {
5617 }
5618
5620
5622 {
5624
5625 if (!action)
5626 {
5627 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
5628 return;
5629 }
5630
5632 if (!ai)
5633 {
5635 return;
5636 }
5637
5639 if (!action_array)
5640 {
5641 action_array = new array<ActionBase_Basic>;
5643 }
5644 if (LogManager.IsActionLogEnable())
5645 {
5646 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
5647 }
5648
5649 if (action_array.Find(action) != -1)
5650 {
5651 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
5652 }
5653 else
5654 {
5655 action_array.Insert(action);
5656 }
5657 }
5658
5660 {
5661 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
5662 ActionBase action = player.GetActionManager().GetAction(actionName);
5665
5666 if (action_array)
5667 {
5668 action_array.RemoveItem(action);
5669 }
5670 }
5671
5672
5673
5675 {
5676 ActionOverrideData overrideData = new ActionOverrideData();
5680
5682 if (!actionMap)
5683 {
5686 }
5687
5688 actionMap.Insert(this.
Type(), overrideData);
5689
5690 }
5691
5693
5695
5696
5698 {
5701
5704
5705 string config_to_search = "CfgVehicles";
5706 string muzzle_owner_config;
5707
5709 {
5710 if (IsInherited(Weapon))
5711 config_to_search = "CfgWeapons";
5712
5713 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
5714
5715 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
5716
5717 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
5718
5719 if (config_OnFire_subclass_count > 0)
5720 {
5721 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
5722
5723 for (int i = 0; i < config_OnFire_subclass_count; i++)
5724 {
5725 string particle_class = "";
5726 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
5727 string config_OnFire_entry = config_OnFire_class + particle_class;
5728 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
5729 WPOF_array.Insert(WPOF);
5730 }
5731
5732
5734 }
5735 }
5736
5738 {
5739 config_to_search = "CfgWeapons";
5740 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
5741
5742 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
5743
5744 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
5745
5746 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
5747 {
5748 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
5749
5750 for (i = 0; i < config_OnBulletCasingEject_count; i++)
5751 {
5752 string particle_class2 = "";
5753 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
5754 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
5755 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
5756 WPOBE_array.Insert(WPOBE);
5757 }
5758
5759
5761 }
5762 }
5763 }
5764
5765
5767 {
5770
5772 {
5773 string config_to_search = "CfgVehicles";
5774
5775 if (IsInherited(Weapon))
5776 config_to_search = "CfgWeapons";
5777
5778 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
5779 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
5780
5781 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
5782 {
5783
5785
5787 {
5789 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
5791 return;
5792 }
5793
5796
5797
5798
5799 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
5800 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
5801
5802 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
5803 {
5804 string particle_class = "";
5805 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
5806 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
5807 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
5808
5809 if (entry_type == CT_CLASS)
5810 {
5811 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
5812 WPOOH_array.Insert(WPOF);
5813 }
5814 }
5815
5816
5818 }
5819 }
5820 }
5821
5823 {
5825 }
5826
5828 {
5830 {
5832
5835
5838
5839 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
5840 }
5841 }
5842
5844 {
5846 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
5847
5849 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
5850
5852 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
5853
5855 {
5857 }
5858 }
5859
5861 {
5863 }
5864
5866 {
5869 else
5871
5873 {
5876 }
5877 else
5878 {
5881
5884 }
5885
5887 }
5888
5890 {
5892 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
5893 }
5894
5896 {
5898 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
5900 }
5901
5903 {
5905 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
5906 }
5907
5909 {
5912
5913 OverheatingParticle OP = new OverheatingParticle();
5918
5920 }
5921
5923 {
5926
5927 return -1;
5928 }
5929
5931 {
5933 {
5936
5937 for (int i = count; i > 0; --i)
5938 {
5939 int id = i - 1;
5942
5945
5946 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
5947 {
5948 if (p)
5949 {
5952 }
5953 }
5954 }
5955 }
5956 }
5957
5959 {
5961 {
5963 {
5964 int id = i - 1;
5966
5967 if (OP)
5968 {
5970
5971 if (p)
5972 {
5974 }
5975
5976 delete OP;
5977 }
5978 }
5979
5982 }
5983 }
5984
5987 {
5988 return 0.0;
5989 }
5990
5991
5993 {
5994 return 250;
5995 }
5996
5998 {
5999 return 0;
6000 }
6001
6004 {
6006 return true;
6007
6008 return false;
6009 }
6010
6013 {
6016
6018 {
6020 }
6021 else
6022 {
6023
6025 }
6026
6028 }
6029
6036 {
6037 return -1;
6038 }
6039
6040
6041
6042
6044 {
6046 {
6047 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6048 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6049
6050 if (r_index >= 0)
6051 {
6052 InventoryLocation r_il = new InventoryLocation;
6053 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6054
6055 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6058 {
6059 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6060 }
6062 {
6063 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6064 }
6065
6066 }
6067
6068 player.GetHumanInventory().ClearUserReservedLocation(this);
6069 }
6070
6073 }
6074
6075
6076
6077
6079 {
6080 return ItemBase.m_DebugActionsMask;
6081 }
6082
6084 {
6085 return ItemBase.m_DebugActionsMask & mask;
6086 }
6087
6089 {
6090 ItemBase.m_DebugActionsMask = mask;
6091 }
6092
6094 {
6095 ItemBase.m_DebugActionsMask |= mask;
6096 }
6097
6099 {
6100 ItemBase.m_DebugActionsMask &= ~mask;
6101 }
6102
6104 {
6106 {
6108 }
6109 else
6110 {
6112 }
6113 }
6114
6115
6117 {
6118 if (GetEconomyProfile())
6119 {
6120 float q_max = GetEconomyProfile().GetQuantityMax();
6121 if (q_max > 0)
6122 {
6123 float q_min = GetEconomyProfile().GetQuantityMin();
6124 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
6125
6127 {
6128 ComponentEnergyManager comp = GetCompEM();
6130 {
6132 }
6133 }
6135 {
6137
6138 }
6139
6140 }
6141 }
6142 }
6143
6146 {
6147 EntityAI parent = GetHierarchyParent();
6148
6149 if (parent)
6150 {
6151 InventoryLocation inventory_location_to_lock = new InventoryLocation;
6152 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
6153 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
6154 }
6155 }
6156
6159 {
6160 EntityAI parent = GetHierarchyParent();
6161
6162 if (parent)
6163 {
6164 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
6165 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
6166 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
6167 }
6168 }
6169
6171 {
6172
6173
6174
6175
6177
6179 {
6180 if (ScriptInputUserData.CanStoreInputUserData())
6181 {
6182 ScriptInputUserData ctx = new ScriptInputUserData;
6188 ctx.
Write(use_stack_max);
6191
6193 {
6194 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
6195 }
6196 }
6197 }
6198 else if (!
g_Game.IsMultiplayer())
6199 {
6201 }
6202 }
6203
6205 {
6207 }
6208
6210 {
6212 }
6213
6215 {
6217 }
6218
6220 {
6221
6222 return false;
6223 }
6224
6226 {
6227 return false;
6228 }
6229
6233 {
6234 return false;
6235 }
6236
6238 {
6239 return "";
6240 }
6241
6243
6245 {
6246 return false;
6247 }
6248
6250 {
6251 return true;
6252 }
6253
6254
6255
6257 {
6258 return true;
6259 }
6260
6262 {
6263 return true;
6264 }
6265
6267 {
6268 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6270 }
6271
6273 {
6275 }
6276
6278 {
6280 if (!is_being_placed)
6282 SetSynchDirty();
6283 }
6284
6285
6287
6289 {
6291 }
6292
6294 {
6296 }
6297
6299 {
6300 return 1;
6301 }
6302
6304 {
6305 return false;
6306 }
6307
6309 {
6311 SetSynchDirty();
6312 }
6313
6314
6315
6316
6317
6318
6319
6320
6321
6322
6323
6324
6325
6326
6327
6328
6329
6330
6331
6332
6333
6334
6335
6336
6337
6338
6339
6340
6341
6342
6343
6344
6345
6346
6347
6349 {
6350 super.OnMovedInsideCargo(container);
6351
6352 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6353 }
6354
6355 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
6356 {
6357 super.EEItemLocationChanged(oldLoc, newLoc);
6358
6359 PlayerBase newPlayer = null;
6360 PlayerBase oldPlayer = null;
6361
6362 if (newLoc.GetParent())
6363 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
6364
6365 if (oldLoc.GetParent())
6366 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
6367
6369 {
6370 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
6371
6372 if (rIndex >= 0)
6373 {
6374 InventoryLocation rIl = new InventoryLocation;
6375 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
6376
6377 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
6380 {
6381 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
6382 }
6384 {
6386 }
6387
6388 }
6389 }
6390
6392 {
6393 if (newPlayer)
6394 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
6395
6396 if (newPlayer == oldPlayer)
6397 {
6398 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
6399 {
6401 {
6402 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
6403 {
6404 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6405 }
6406 }
6407 else
6408 {
6409 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6410 }
6411 }
6412
6413 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
6414 {
6415 int type = oldLoc.GetType();
6417 {
6418 oldLoc.GetParent().GetOnSetLock().Invoke(this);
6419 }
6421 {
6422 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
6423 }
6424 }
6425 if (!m_OldLocation)
6426 {
6427 m_OldLocation = new InventoryLocation;
6428 }
6429 m_OldLocation.Copy(oldLoc);
6430 }
6431 else
6432 {
6433 if (m_OldLocation)
6434 {
6435 m_OldLocation.Reset();
6436 }
6437 }
6438
6439 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
6440 }
6441 else
6442 {
6443 if (newPlayer)
6444 {
6445 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
6446 if (resIndex >= 0)
6447 {
6448 InventoryLocation il = new InventoryLocation;
6449 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
6451 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
6454 {
6455 il.
GetParent().GetOnReleaseLock().Invoke(it);
6456 }
6458 {
6460 }
6461
6462 }
6463 }
6465 {
6466
6468 }
6469
6470 if (m_OldLocation)
6471 {
6472 m_OldLocation.Reset();
6473 }
6474 }
6475
6477 {
6478 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
6479 }
6480
6482 {
6483 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
6484 }
6485 }
6486
6487 override void EOnContact(IEntity other, Contact extra)
6488 {
6490 {
6491 int liquidType = -1;
6493 if (impactSpeed > 0.0)
6494 {
6496 #ifndef SERVER
6498 #else
6500 SetSynchDirty();
6501 #endif
6503 }
6504 }
6505
6506 #ifdef SERVER
6507 if (GetCompEM() && GetCompEM().IsPlugged())
6508 {
6509 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
6510 GetCompEM().UnplugThis();
6511 }
6512 #endif
6513 }
6514
6516
6518 {
6520 }
6521
6523 {
6524
6525 }
6526
6528 {
6529 super.OnItemLocationChanged(old_owner, new_owner);
6530
6531 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
6532 PlayerBase playerNew = PlayerBase.Cast(new_owner);
6533
6534 if (!relatedPlayer && playerNew)
6535 relatedPlayer = playerNew;
6536
6537 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
6538 {
6540 if (actionMgr)
6541 {
6542 ActionBase currentAction = actionMgr.GetRunningAction();
6543 if (currentAction)
6545 }
6546 }
6547
6548 Man ownerPlayerOld = null;
6549 Man ownerPlayerNew = null;
6550
6551 if (old_owner)
6552 {
6553 if (old_owner.
IsMan())
6554 {
6555 ownerPlayerOld = Man.Cast(old_owner);
6556 }
6557 else
6558 {
6559 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
6560 }
6561 }
6562 else
6563 {
6565 {
6567
6568 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
6569 {
6570 GetCompEM().UnplugThis();
6571 }
6572 }
6573 }
6574
6575 if (new_owner)
6576 {
6577 if (new_owner.
IsMan())
6578 {
6579 ownerPlayerNew = Man.Cast(new_owner);
6580 }
6581 else
6582 {
6583 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
6584 }
6585 }
6586
6587 if (ownerPlayerOld != ownerPlayerNew)
6588 {
6589 if (ownerPlayerOld)
6590 {
6591 array<EntityAI> subItemsExit = new array<EntityAI>;
6593 for (int i = 0; i < subItemsExit.Count(); i++)
6594 {
6597 }
6598 }
6599
6600 if (ownerPlayerNew)
6601 {
6602 array<EntityAI> subItemsEnter = new array<EntityAI>;
6604 for (int j = 0; j < subItemsEnter.Count(); j++)
6605 {
6608 }
6609 }
6610 }
6611 else if (ownerPlayerNew != null)
6612 {
6613 PlayerBase nplayer;
6614 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
6615 {
6616 array<EntityAI> subItemsUpdate = new array<EntityAI>;
6618 for (int k = 0; k < subItemsUpdate.Count(); k++)
6619 {
6621 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
6622 }
6623 }
6624 }
6625
6626 if (old_owner)
6627 old_owner.OnChildItemRemoved(this);
6628 if (new_owner)
6629 new_owner.OnChildItemReceived(this);
6630 }
6631
6632
6634 {
6635 super.EEDelete(parent);
6636 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
6637 if (player)
6638 {
6640
6641 if (player.IsAlive())
6642 {
6643 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6644 if (r_index >= 0)
6645 {
6646 InventoryLocation r_il = new InventoryLocation;
6647 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6648
6649 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6652 {
6653 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6654 }
6656 {
6657 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6658 }
6659
6660 }
6661
6662 player.RemoveQuickBarEntityShortcut(this);
6663 }
6664 }
6665 }
6666
6668 {
6669 super.EEKilled(killer);
6670
6673 {
6674 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
6675 {
6676 if (IsMagazine())
6677 {
6678 if (Magazine.Cast(this).GetAmmoCount() > 0)
6679 {
6681 }
6682 }
6683 else
6684 {
6686 }
6687 }
6688 }
6689 }
6690
6692 {
6693 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6694
6695 super.OnWasAttached(parent, slot_id);
6696
6699
6702 }
6703
6705 {
6706 super.OnWasDetached(parent, slot_id);
6707
6710
6713 }
6714
6716 {
6717 int idx;
6720
6721 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
6722 if (inventory_slots.Count() < 1)
6723 {
6724 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
6725 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
6726 }
6727 else
6728 {
6729 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
6730 }
6731
6732 idx = inventory_slots.Find(slot);
6733 if (idx < 0)
6734 return "";
6735
6736 return attach_types.Get(idx);
6737 }
6738
6740 {
6741 int idx = -1;
6742 string slot;
6743
6746
6747 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
6748 if (inventory_slots.Count() < 1)
6749 {
6750 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
6751 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
6752 }
6753 else
6754 {
6755 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
6756 if (detach_types.Count() < 1)
6757 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
6758 }
6759
6760 for (int i = 0; i < inventory_slots.Count(); i++)
6761 {
6762 slot = inventory_slots.Get(i);
6763 }
6764
6765 if (slot != "")
6766 {
6767 if (detach_types.Count() == 1)
6768 idx = 0;
6769 else
6770 idx = inventory_slots.Find(slot);
6771 }
6772 if (idx < 0)
6773 return "";
6774
6775 return detach_types.Get(idx);
6776 }
6777
6779 {
6780
6782
6783
6784 float min_time = 1;
6785 float max_time = 3;
6786 float delay = Math.RandomFloat(min_time, max_time);
6787
6788 explode_timer.Run(delay, this, "DoAmmoExplosion");
6789 }
6790
6792 {
6793 Magazine magazine = Magazine.Cast(this);
6794 int pop_sounds_count = 6;
6795 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
6796
6797
6798 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
6799 string sound_name = pop_sounds[ sound_idx ];
6800 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
6801
6802
6803 magazine.ServerAddAmmoCount(-1);
6804
6805
6806 float min_temp_to_explode = 100;
6807
6808 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
6809 {
6811 }
6812 }
6813
6814
6815 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
6816 {
6817 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
6818
6819 const int CHANCE_DAMAGE_CARGO = 4;
6820 const int CHANCE_DAMAGE_ATTACHMENT = 1;
6821 const int CHANCE_DAMAGE_NOTHING = 2;
6822
6824 {
6825 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
6826 int chances;
6827 int rnd;
6828
6829 if (GetInventory().GetCargo())
6830 {
6831 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
6832 rnd = Math.RandomInt(0,chances);
6833
6834 if (rnd < CHANCE_DAMAGE_CARGO)
6835 {
6837 }
6838 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
6839 {
6841 }
6842 }
6843 else
6844 {
6845 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
6846 rnd = Math.RandomInt(0,chances);
6847
6848 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
6849 {
6851 }
6852 }
6853 }
6854 }
6855
6857 {
6858 CargoBase cargo = GetInventory().GetCargo();
6859 if (cargo)
6860 {
6862 if (item_count > 0)
6863 {
6864 int random_pick = Math.RandomInt(0, item_count);
6866 if (!item.IsExplosive())
6867 {
6868 item.AddHealth("","",damage);
6869 return true;
6870 }
6871 }
6872 }
6873 return false;
6874 }
6875
6877 {
6878 GameInventory inventory = GetInventory();
6880 if (attachment_count > 0)
6881 {
6882 int random_pick = Math.RandomInt(0, attachment_count);
6884 if (!attachment.IsExplosive())
6885 {
6886 attachment.AddHealth("","",damage);
6887 return true;
6888 }
6889 }
6890 return false;
6891 }
6892
6894 {
6896 }
6897
6899 {
6901 return GetInventory().CanRemoveEntity();
6902
6903 return false;
6904 }
6905
6907 {
6908
6910 return false;
6911
6912
6914 return false;
6915
6916
6917
6919 if (delta == 0)
6920 return false;
6921
6922
6923 return true;
6924 }
6925
6927 {
6929 {
6930 if (ScriptInputUserData.CanStoreInputUserData())
6931 {
6932 ScriptInputUserData ctx = new ScriptInputUserData;
6937 ctx.
Write(destination_entity);
6941 }
6942 }
6943 else if (!
g_Game.IsMultiplayer())
6944 {
6946 }
6947 }
6948
6950 {
6951 float split_quantity_new;
6955 InventoryLocation loc = new InventoryLocation;
6956
6957 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
6958 {
6960 split_quantity_new = stack_max;
6961 else
6963
6965 {
6966 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
6967 if (new_item)
6968 {
6969 new_item.SetResultOfSplit(true);
6970 MiscGameplayFunctions.TransferItemProperties(this, new_item);
6972 new_item.
SetQuantity(split_quantity_new,
false,
true);
6973 }
6974 }
6975 }
6976 else if (destination_entity && slot_id == -1)
6977 {
6978 if (quantity > stack_max)
6979 split_quantity_new = stack_max;
6980 else
6981 split_quantity_new = quantity;
6982
6984 {
6985 GameInventory destinationInventory = destination_entity.GetInventory();
6987 {
6990 }
6991
6992 if (new_item)
6993 {
6994 new_item.SetResultOfSplit(true);
6995 MiscGameplayFunctions.TransferItemProperties(this, new_item);
6997 new_item.
SetQuantity(split_quantity_new,
false,
true);
6998 }
6999 }
7000 }
7001 else
7002 {
7003 if (stack_max != 0)
7004 {
7006 {
7008 }
7009
7010 if (split_quantity_new == 0)
7011 {
7012 if (!
g_Game.IsMultiplayer())
7013 player.PhysicalPredictiveDropItem(this);
7014 else
7015 player.ServerDropEntity(this);
7016 return;
7017 }
7018
7020 {
7022
7023 if (new_item)
7024 {
7025 new_item.SetResultOfSplit(true);
7026 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7029 new_item.PlaceOnSurface();
7030 }
7031 }
7032 }
7033 }
7034 }
7035
7037 {
7038 float split_quantity_new;
7042 InventoryLocation loc = new InventoryLocation;
7043
7044 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7045 {
7047 split_quantity_new = stack_max;
7048 else
7050
7052 {
7053 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7054 if (new_item)
7055 {
7056 new_item.SetResultOfSplit(true);
7057 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7059 new_item.
SetQuantity(split_quantity_new,
false,
true);
7060 }
7061 }
7062 }
7063 else if (destination_entity && slot_id == -1)
7064 {
7065 if (quantity > stack_max)
7066 split_quantity_new = stack_max;
7067 else
7068 split_quantity_new = quantity;
7069
7071 {
7072 GameInventory destinationInventory = destination_entity.GetInventory();
7074 {
7077 }
7078
7079 if (new_item)
7080 {
7081 new_item.SetResultOfSplit(true);
7082 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7084 new_item.
SetQuantity(split_quantity_new,
false,
true);
7085 }
7086 }
7087 }
7088 else
7089 {
7090 if (stack_max != 0)
7091 {
7093 {
7095 }
7096
7098 {
7100
7101 if (new_item)
7102 {
7103 new_item.SetResultOfSplit(true);
7104 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7107 new_item.PlaceOnSurface();
7108 }
7109 }
7110 }
7111 }
7112 }
7113
7115 {
7117 {
7118 if (ScriptInputUserData.CanStoreInputUserData())
7119 {
7120 ScriptInputUserData ctx = new ScriptInputUserData;
7125 dst.WriteToContext(ctx);
7127 }
7128 }
7129 else if (!
g_Game.IsMultiplayer())
7130 {
7132 }
7133 }
7134
7136 {
7138 {
7139 if (ScriptInputUserData.CanStoreInputUserData())
7140 {
7141 ScriptInputUserData ctx = new ScriptInputUserData;
7146 ctx.
Write(destination_entity);
7152 }
7153 }
7154 else if (!
g_Game.IsMultiplayer())
7155 {
7157 }
7158 }
7159
7161 {
7163 }
7164
7166 {
7168 float split_quantity_new;
7170 if (dst.IsValid())
7171 {
7172 int slot_id = dst.GetSlot();
7174
7175 if (quantity > stack_max)
7176 split_quantity_new = stack_max;
7177 else
7178 split_quantity_new = quantity;
7179
7181 {
7183
7184 if (new_item)
7185 {
7186 new_item.SetResultOfSplit(true);
7187 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7189 new_item.
SetQuantity(split_quantity_new,
false,
true);
7190 }
7191
7192 return new_item;
7193 }
7194 }
7195
7196 return null;
7197 }
7198
7200 {
7202 float split_quantity_new;
7204 if (destination_entity)
7205 {
7207 if (quantity > stackable)
7208 split_quantity_new = stackable;
7209 else
7210 split_quantity_new = quantity;
7211
7213 {
7214 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
7215 if (new_item)
7216 {
7217 new_item.SetResultOfSplit(true);
7218 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7220 new_item.
SetQuantity(split_quantity_new,
false,
true);
7221 }
7222 }
7223 }
7224 }
7225
7227 {
7229 {
7230 if (ScriptInputUserData.CanStoreInputUserData())
7231 {
7232 ScriptInputUserData ctx = new ScriptInputUserData;
7237 ItemBase destination_entity =
this;
7238 ctx.
Write(destination_entity);
7242 }
7243 }
7244 else if (!
g_Game.IsMultiplayer())
7245 {
7247 }
7248 }
7249
7251 {
7253 float split_quantity_new;
7255 if (player)
7256 {
7258 if (quantity > stackable)
7259 split_quantity_new = stackable;
7260 else
7261 split_quantity_new = quantity;
7262
7264 {
7265 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
7266 new_item =
ItemBase.Cast(in_hands);
7267 if (new_item)
7268 {
7269 new_item.SetResultOfSplit(true);
7270 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7272 new_item.SetQuantity(split_quantity_new, false, true);
7273 }
7274 }
7275 }
7276 }
7277
7279 {
7281 float split_quantity_new = Math.Floor(quantity * 0.5);
7282
7284 return;
7285
7287
7288 if (new_item)
7289 {
7290 if (new_item.GetQuantityMax() < split_quantity_new)
7291 {
7292 split_quantity_new = new_item.GetQuantityMax();
7293 }
7294
7295 new_item.SetResultOfSplit(true);
7296 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7297
7299 {
7302 }
7303 else
7304 {
7306 new_item.
SetQuantity(split_quantity_new,
false,
true);
7307 }
7308 }
7309 }
7310
7312 {
7314 float split_quantity_new = Math.Floor(quantity / 2);
7315
7317 return;
7318
7319 InventoryLocation invloc = new InventoryLocation;
7321
7323 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
7324
7325 if (new_item)
7326 {
7327 if (new_item.GetQuantityMax() < split_quantity_new)
7328 {
7329 split_quantity_new = new_item.GetQuantityMax();
7330 }
7332 {
7335 }
7336 else if (split_quantity_new > 1)
7337 {
7339 new_item.
SetQuantity(split_quantity_new,
false,
true);
7340 }
7341 }
7342 }
7343
7346 {
7347 SetWeightDirty();
7349
7350 if (parent)
7351 parent.OnAttachmentQuantityChangedEx(this, delta);
7352
7354 {
7356 {
7358 }
7360 {
7361 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
7363 }
7364 }
7365 }
7366
7369 {
7370
7371 }
7372
7375 {
7377 }
7378
7380 {
7381 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
7382
7384 {
7385 if (newLevel == GameConstants.STATE_RUINED)
7386 {
7388 EntityAI parent = GetHierarchyParent();
7389 if (parent && parent.IsFireplace())
7390 {
7391 CargoBase cargo = GetInventory().GetCargo();
7392 if (cargo)
7393 {
7395 {
7397 }
7398 }
7399 }
7400 }
7401
7403 {
7404
7406 return;
7407 }
7408
7409 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
7410 {
7412 }
7413 }
7414 }
7415
7416
7418 {
7419 super.OnRightClick();
7420
7422 {
7424 {
7425 if (ScriptInputUserData.CanStoreInputUserData())
7426 {
7427 EntityAI root = GetHierarchyRoot();
7428 Man playerOwner = GetHierarchyRootPlayer();
7429 InventoryLocation dst = new InventoryLocation;
7430
7431
7432 if (!playerOwner && root && root == this)
7433 {
7435 }
7436 else
7437 {
7438
7439 GetInventory().GetCurrentInventoryLocation(dst);
7441 {
7442 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7444 {
7446 }
7447 else
7448 {
7450
7451
7452 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
7453 {
7455 }
7456 else
7457 {
7458 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
7459 }
7460 }
7461 }
7462 }
7463
7464 ScriptInputUserData ctx = new ScriptInputUserData;
7472 }
7473 }
7474 else if (!
g_Game.IsMultiplayer())
7475 {
7477 }
7478 }
7479 }
7480
7482 {
7483 if (root)
7484 {
7485 vector m4[4];
7486 root.GetTransform(m4);
7487 dst.SetGround(this, m4);
7488 }
7489 else
7490 {
7491 GetInventory().GetCurrentInventoryLocation(dst);
7492 }
7493 }
7494
7495 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
7496 {
7497
7498 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
7499 return false;
7500
7501 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
7502 return false;
7503
7504
7506 return false;
7507
7508
7509 Magazine mag = Magazine.Cast(this);
7510 if (mag)
7511 {
7512 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
7513 return false;
7514
7515 if (stack_max_limit)
7516 {
7517 Magazine other_mag = Magazine.Cast(other_item);
7518 if (other_item)
7519 {
7520 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
7521 return false;
7522 }
7523
7524 }
7525 }
7526 else
7527 {
7528
7530 return false;
7531
7533 return false;
7534 }
7535
7536 PlayerBase player = null;
7537 if (CastTo(player, GetHierarchyRootPlayer()))
7538 {
7539 if (player.GetInventory().HasAttachment(this))
7540 return false;
7541
7542 if (player.IsItemsToDelete())
7543 return false;
7544 }
7545
7546 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
7547 return false;
7548
7549 int slotID;
7551 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
7552 return false;
7553
7554 return true;
7555 }
7556
7558 {
7560 }
7561
7563 {
7564 return m_IsResultOfSplit;
7565 }
7566
7568 {
7569 m_IsResultOfSplit = value;
7570 }
7571
7573 {
7575 }
7576
7578 {
7579 float other_item_quantity = other_item.GetQuantity();
7580 float this_free_space;
7581
7583
7585
7586 if (other_item_quantity > this_free_space)
7587 {
7588 return this_free_space;
7589 }
7590 else
7591 {
7592 return other_item_quantity;
7593 }
7594 }
7595
7597 {
7599 }
7600
7602 {
7604 return;
7605
7606 if (!IsMagazine() && other_item)
7607 {
7609 if (quantity_used != 0)
7610 {
7611 float hp1 = GetHealth01("","");
7612 float hp2 = other_item.GetHealth01("","");
7613 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
7614 hpResult = hpResult / (
GetQuantity() + quantity_used);
7615
7616 hpResult *= GetMaxHealth();
7617 Math.Round(hpResult);
7618 SetHealth("", "Health", hpResult);
7619
7621 other_item.AddQuantity(-quantity_used);
7622 }
7623 }
7625 }
7626
7628 {
7629 #ifdef SERVER
7630 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
7631 GetHierarchyParent().IncreaseLifetimeUp();
7632 #endif
7633 };
7634
7636 {
7637 PlayerBase p = PlayerBase.Cast(player);
7638
7639 array<int> recipesIds = p.m_Recipes;
7640 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
7641 if (moduleRecipesManager)
7642 {
7643 EntityAI itemInHands = player.GetEntityInHands();
7644 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
7645 }
7646
7647 for (int i = 0;i < recipesIds.Count(); i++)
7648 {
7649 int key = recipesIds.Get(i);
7650 string recipeName = moduleRecipesManager.GetRecipeName(key);
7652 }
7653 }
7654
7655
7656 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
7657 {
7658 super.GetDebugActions(outputList);
7659
7660
7666
7667
7672
7677
7678
7682
7683
7685 {
7689 }
7690
7693
7694
7698
7700
7701 InventoryLocation loc = new InventoryLocation();
7702 GetInventory().GetCurrentInventoryLocation(loc);
7704 {
7705 if (Gizmo_IsSupported())
7708 }
7709
7711 }
7712
7713
7714
7715
7717 {
7718 super.OnAction(action_id, player, ctx);
7719
7721 {
7722 switch (action_id)
7723 {
7727 return true;
7731 return true;
7732 }
7733 }
7734
7736 {
7737 switch (action_id)
7738 {
7740 Delete();
7741 return true;
7742 }
7743 }
7744
7745 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
7746 {
7747 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
7748 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
7749 PlayerBase p = PlayerBase.Cast(player);
7750 if (
EActions.RECIPES_RANGE_START < 1000)
7751 {
7752 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
7753 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
7754 }
7755 }
7756 #ifndef SERVER
7757 else if (action_id ==
EActions.WATCH_PLAYER)
7758 {
7759 PluginDeveloper.SetDeveloperItemClientEx(player);
7760 }
7761 #endif
7763 {
7764 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
7765 {
7766 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
7767 OnDebugButtonPressServer(id + 1);
7768 }
7769
7770 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
7771 {
7772 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
7774 }
7775
7776 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
7777 {
7778 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
7780 }
7781
7782 else if (action_id ==
EActions.ADD_QUANTITY)
7783 {
7784 if (IsMagazine())
7785 {
7786 Magazine mag = Magazine.Cast(this);
7787 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
7788 }
7789 else
7790 {
7792 }
7793
7794 if (m_EM)
7795 {
7796 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
7797 }
7798
7799 }
7800
7801 else if (action_id ==
EActions.REMOVE_QUANTITY)
7802 {
7803 if (IsMagazine())
7804 {
7805 Magazine mag2 = Magazine.Cast(this);
7806 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
7807 }
7808 else
7809 {
7811 }
7812 if (m_EM)
7813 {
7814 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
7815 }
7816
7817 }
7818
7819 else if (action_id ==
EActions.SET_QUANTITY_0)
7820 {
7822
7823 if (m_EM)
7824 {
7825 m_EM.SetEnergy(0);
7826 }
7827 }
7828
7829 else if (action_id ==
EActions.SET_MAX_QUANTITY)
7830 {
7832
7833 if (m_EM)
7834 {
7835 m_EM.SetEnergy(m_EM.GetEnergyMax());
7836 }
7837 }
7838
7839 else if (action_id ==
EActions.ADD_HEALTH)
7840 {
7841 AddHealth("","",GetMaxHealth("","Health")/5);
7842 }
7843 else if (action_id ==
EActions.REMOVE_HEALTH)
7844 {
7845 AddHealth("","",-GetMaxHealth("","Health")/5);
7846 }
7847 else if (action_id ==
EActions.DESTROY_HEALTH)
7848 {
7849 SetHealth01("","",0);
7850 }
7851 else if (action_id ==
EActions.WATCH_ITEM)
7852 {
7854 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
7855 #ifdef DEVELOPER
7856 SetDebugDeveloper_item(this);
7857 #endif
7858 }
7859
7860 else if (action_id ==
EActions.ADD_TEMPERATURE)
7861 {
7862 AddTemperature(20);
7863
7864 }
7865
7866 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
7867 {
7868 AddTemperature(-20);
7869
7870 }
7871
7872 else if (action_id ==
EActions.FLIP_FROZEN)
7873 {
7874 SetFrozen(!GetIsFrozen());
7875
7876 }
7877
7878 else if (action_id ==
EActions.ADD_WETNESS)
7879 {
7881
7882 }
7883
7884 else if (action_id ==
EActions.REMOVE_WETNESS)
7885 {
7887
7888 }
7889
7890 else if (action_id ==
EActions.LIQUIDTYPE_UP)
7891 {
7894
7895
7896 }
7897
7898 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
7899 {
7902 }
7903
7904 else if (action_id ==
EActions.MAKE_SPECIAL)
7905 {
7906 auto debugParams = DebugSpawnParams.WithPlayer(player);
7907 OnDebugSpawnEx(debugParams);
7908 }
7909
7910 }
7911
7912
7913 return false;
7914 }
7915
7916
7917
7918
7922
7925
7926
7927
7929 {
7930 return false;
7931 }
7932
7933
7935 {
7936 return true;
7937 }
7938
7939
7941 {
7942 return true;
7943 }
7944
7945
7946
7948 {
7949 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
7950 return g_Game.ConfigIsExisting(config_path);
7951 }
7952
7955 {
7956 return null;
7957 }
7958
7960 {
7961 return false;
7962 }
7963
7965 {
7966 return false;
7967 }
7968
7972
7973
7975 {
7976 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
7977 return module_repairing.CanRepair(this, item_repair_kit);
7978 }
7979
7980
7981 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
7982 {
7983 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
7984 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
7985 }
7986
7987
7989 {
7990
7991
7992
7993
7994
7995
7996
7997
7998 return 1;
7999 }
8000
8001
8002
8004 {
8006 }
8007
8008
8009
8011 {
8013 }
8014
8015
8024 {
8025 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8026
8027 if (player)
8028 {
8029 player.MessageStatus(text);
8030 }
8031 }
8032
8033
8042 {
8043 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8044
8045 if (player)
8046 {
8047 player.MessageAction(text);
8048 }
8049 }
8050
8051
8060 {
8061 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8062
8063 if (player)
8064 {
8065 player.MessageFriendly(text);
8066 }
8067 }
8068
8069
8078 {
8079 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8080
8081 if (player)
8082 {
8083 player.MessageImportant(text);
8084 }
8085 }
8086
8088 {
8089 return true;
8090 }
8091
8092
8093 override bool KindOf(
string tag)
8094 {
8095 bool found = false;
8096 string item_name = this.
GetType();
8098 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
8099
8100 int array_size = item_tag_array.Count();
8101 for (int i = 0; i < array_size; i++)
8102 {
8103 if (item_tag_array.Get(i) == tag)
8104 {
8105 found = true;
8106 break;
8107 }
8108 }
8109 return found;
8110 }
8111
8112
8114 {
8115
8116 super.OnRPC(sender, rpc_type,ctx);
8117
8118
8119 switch (rpc_type)
8120 {
8121 #ifndef SERVER
8122 case ERPCs.RPC_SOUND_LOCK_ATTACH:
8123 Param2<bool, string> p = new Param2<bool, string>(false, "");
8124
8126 return;
8127
8128 bool play = p.param1;
8129 string soundSet = p.param2;
8130
8131 if (play)
8132 {
8134 {
8136 {
8138 }
8139 }
8140 else
8141 {
8143 }
8144 }
8145 else
8146 {
8148 }
8149
8150 break;
8151 #endif
8152
8153 }
8154
8156 {
8158 }
8159 }
8160
8161
8162
8163
8165 {
8166 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8167 return plugin.GetID(
name);
8168 }
8169
8171 {
8172 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8173 return plugin.GetName(id);
8174 }
8175
8178 {
8179
8180
8181 int varFlags;
8182 if (!ctx.
Read(varFlags))
8183 return;
8184
8185 if (varFlags & ItemVariableFlags.FLOAT)
8186 {
8188 }
8189 }
8190
8192 {
8193
8194 super.SerializeNumericalVars(floats_out);
8195
8196
8197
8199 {
8201 }
8202
8204 {
8206 }
8207
8209 {
8211 }
8212
8214 {
8219 }
8220
8222 {
8224 }
8225 }
8226
8228 {
8229
8230 super.DeSerializeNumericalVars(floats);
8231
8232
8233 int index = 0;
8234 int mask = Math.Round(floats.Get(index));
8235
8236 index++;
8237
8239 {
8241 {
8243 }
8244 else
8245 {
8246 float quantity = floats.Get(index);
8248 }
8249 index++;
8250 }
8251
8253 {
8254 float wet = floats.Get(index);
8256 index++;
8257 }
8258
8260 {
8261 int liquidtype = Math.Round(floats.Get(index));
8263 index++;
8264 }
8265
8267 {
8269 index++;
8271 index++;
8273 index++;
8275 index++;
8276 }
8277
8279 {
8280 int cleanness = Math.Round(floats.Get(index));
8282 index++;
8283 }
8284 }
8285
8287 {
8288 super.WriteVarsToCTX(ctx);
8289
8290
8292 {
8294 }
8295
8297 {
8299 }
8300
8302 {
8304 }
8305
8307 {
8308 int r,g,b,a;
8314 }
8315
8317 {
8319 }
8320 }
8321
8323 {
8324 if (!super.ReadVarsFromCTX(ctx,version))
8325 return false;
8326
8327 int intValue;
8328 float value;
8329
8330 if (version < 140)
8331 {
8332 if (!ctx.
Read(intValue))
8333 return false;
8334
8335 m_VariablesMask = intValue;
8336 }
8337
8339 {
8340 if (!ctx.
Read(value))
8341 return false;
8342
8344 {
8346 }
8347 else
8348 {
8350 }
8351 }
8352
8353 if (version < 140)
8354 {
8356 {
8357 if (!ctx.
Read(value))
8358 return false;
8359 SetTemperatureDirect(value);
8360 }
8361 }
8362
8364 {
8365 if (!ctx.
Read(value))
8366 return false;
8368 }
8369
8371 {
8372 if (!ctx.
Read(intValue))
8373 return false;
8375 }
8376
8378 {
8379 int r,g,b,a;
8381 return false;
8383 return false;
8385 return false;
8387 return false;
8388
8390 }
8391
8393 {
8394 if (!ctx.
Read(intValue))
8395 return false;
8397 }
8398
8399 if (version >= 138 && version < 140)
8400 {
8402 {
8403 if (!ctx.
Read(intValue))
8404 return false;
8405 SetFrozen(intValue);
8406 }
8407 }
8408
8409 return true;
8410 }
8411
8412
8414 {
8417 {
8419 }
8420
8421 if (!super.OnStoreLoad(ctx, version))
8422 {
8424 return false;
8425 }
8426
8427 if (version >= 114)
8428 {
8429 bool hasQuickBarIndexSaved;
8430
8431 if (!ctx.
Read(hasQuickBarIndexSaved))
8432 {
8434 return false;
8435 }
8436
8437 if (hasQuickBarIndexSaved)
8438 {
8439 int itmQBIndex;
8440
8441
8442 if (!ctx.
Read(itmQBIndex))
8443 {
8445 return false;
8446 }
8447
8448 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
8449 if (itmQBIndex != -1 && parentPlayer)
8450 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
8451 }
8452 }
8453 else
8454 {
8455
8456 PlayerBase player;
8457 int itemQBIndex;
8458 if (version ==
int.
MAX)
8459 {
8460 if (!ctx.
Read(itemQBIndex))
8461 {
8463 return false;
8464 }
8465 }
8466 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
8467 {
8468
8469 if (!ctx.
Read(itemQBIndex))
8470 {
8472 return false;
8473 }
8474 if (itemQBIndex != -1 && player)
8475 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
8476 }
8477 }
8478
8479 if (version < 140)
8480 {
8481
8482 if (!LoadVariables(ctx, version))
8483 {
8485 return false;
8486 }
8487 }
8488
8489
8491 {
8493 return false;
8494 }
8495 if (version >= 132)
8496 {
8498 if (raib)
8499 {
8501 {
8503 return false;
8504 }
8505 }
8506 }
8507
8509 return true;
8510 }
8511
8512
8513
8515 {
8516 super.OnStoreSave(ctx);
8517
8518 PlayerBase player;
8519 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
8520 {
8522
8523 int itemQBIndex = -1;
8524 itemQBIndex = player.FindQuickBarEntityIndex(this);
8525 ctx.
Write(itemQBIndex);
8526 }
8527 else
8528 {
8530 }
8531
8533
8535 if (raib)
8536 {
8538 }
8539 }
8540
8541
8543 {
8544 super.AfterStoreLoad();
8545
8547 {
8549 }
8550
8552 {
8555 }
8556 }
8557
8559 {
8560 super.EEOnAfterLoad();
8561
8563 {
8565 }
8566
8569 }
8570
8572 {
8573 return false;
8574 }
8575
8576
8577
8579 {
8581 {
8582 #ifdef PLATFORM_CONSOLE
8583
8585 {
8587 if (menu)
8588 {
8590 }
8591 }
8592 #endif
8593 }
8594
8596 {
8599 }
8600
8602 {
8603 SetWeightDirty();
8605 }
8607 {
8610 }
8611
8613 {
8616
8619 }
8621 {
8625 }
8626
8627 super.OnVariablesSynchronized();
8628 }
8629
8630
8631
8633 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
8634 {
8635 if (!IsServerCheck(allow_client))
8636 return false;
8637
8639 return false;
8640
8643
8644 if (value <= (min + 0.001))
8645 value = min;
8646
8647 if (value == min)
8648 {
8649 if (destroy_config)
8650 {
8651 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
8652 if (dstr)
8653 {
8655 this.Delete();
8656 return true;
8657 }
8658 }
8659 else if (destroy_forced)
8660 {
8662 this.Delete();
8663 return true;
8664 }
8665
8667 }
8668
8671
8673 {
8674 EntityAI parent = GetHierarchyRoot();
8675 InventoryLocation iLoc = new InventoryLocation();
8676 GetInventory().GetCurrentInventoryLocation(iLoc);
8678 {
8679 int iLocSlot = iLoc.
GetSlot();
8681 {
8683 }
8685 {
8687 }
8688 }
8689 }
8690
8692 {
8694
8695 if (delta)
8697 }
8698
8700
8701 return false;
8702 }
8703
8704
8706 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
8707 {
8709 }
8710
8712 {
8715 }
8716
8718 {
8721 }
8722
8724 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
8725 {
8726 float value_clamped = Math.Clamp(value, 0, 1);
8728 SetQuantity(result, destroy_config, destroy_forced);
8729 }
8730
8731
8734 {
8736 }
8737
8739 {
8741 }
8742
8743
8744
8745
8746
8747
8748
8749
8750
8751
8753 {
8754 int slot = -1;
8755 GameInventory inventory = GetInventory();
8756 if (inventory)
8757 {
8758 InventoryLocation il = new InventoryLocation;
8761 }
8762
8764 }
8765
8767 {
8768 float quantity_max = 0;
8769
8771 {
8772 if (attSlotID != -1)
8773 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
8774
8775 if (quantity_max <= 0)
8777 }
8778
8779 if (quantity_max <= 0)
8781
8782 return quantity_max;
8783 }
8784
8786 {
8788 }
8789
8791 {
8793 }
8794
8795
8797 {
8799 }
8800
8802 {
8804 }
8805
8807 {
8809 }
8810
8811
8813 {
8814
8815 float weightEx = GetWeightEx();
8816 float special = GetInventoryAndCargoWeight();
8817 return weightEx - special;
8818 }
8819
8820
8822 {
8824 }
8825
8827 {
8829 {
8830 #ifdef DEVELOPER
8831 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
8832 {
8833 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
8835 }
8836 #endif
8837
8839 }
8840 else if (HasEnergyManager())
8841 {
8842 #ifdef DEVELOPER
8843 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
8844 {
8845 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
8846 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
8847 }
8848 #endif
8849 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
8850 }
8851 else
8852 {
8853 #ifdef DEVELOPER
8854 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
8855 {
8856 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
8857 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
8858 }
8859 #endif
8860 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
8861 }
8862 }
8863
8866 {
8867 int item_count = 0;
8869
8870 GameInventory inventory = GetInventory();
8871 CargoBase cargo = inventory.
GetCargo();
8872 if (cargo != NULL)
8873 {
8875 }
8876
8878 for (int i = 0; i < nAttachments; ++i)
8879 {
8881 if (item)
8882 item_count += item.GetNumberOfItems();
8883 }
8884 return item_count;
8885 }
8886
8889 {
8890 float weight = 0;
8891 float wetness = 1;
8892 if (include_wetness)
8895 {
8896 weight = wetness * m_ConfigWeight;
8897 }
8899 {
8900 weight = 1;
8901 }
8902 return weight;
8903 }
8904
8905
8906
8908 {
8909 GameInventory inventory = GetInventory();
8910 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
8911 {
8912 array<EntityAI> items = new array<EntityAI>;
8914 for (int i = 0; i < items.Count(); ++i)
8915 {
8917 if (item)
8918 {
8919 g_Game.ObjectDelete(item);
8920 }
8921 }
8922 }
8923 }
8924
8925
8926
8927
8929 {
8930 float energy = 0;
8931 if (HasEnergyManager())
8932 {
8933 energy = GetCompEM().GetEnergy();
8934 }
8935 return energy;
8936 }
8937
8938
8940 {
8941 super.OnEnergyConsumed();
8942
8944 }
8945
8947 {
8948 super.OnEnergyAdded();
8949
8951 }
8952
8953
8955 {
8956 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
8957 {
8959 {
8960 float energy_0to1 = GetCompEM().GetEnergy0To1();
8962 }
8963 }
8964 }
8965
8966
8968 {
8969 return ConfigGetFloat("heatIsolation");
8970 }
8971
8973 {
8975 }
8976
8978 {
8979 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
8980 if (
g_Game.ConfigIsExisting(paramPath))
8981 return g_Game.ConfigGetFloat(paramPath);
8982
8983 return 0.0;
8984 }
8985
8987 {
8988 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
8989 if (
g_Game.ConfigIsExisting(paramPath))
8990 return g_Game.ConfigGetFloat(paramPath);
8991
8992 return 0.0;
8993 }
8994
8995 override void SetWet(
float value,
bool allow_client =
false)
8996 {
8997 if (!IsServerCheck(allow_client))
8998 return;
8999
9002
9004
9005 m_VarWet = Math.Clamp(value, min, max);
9006
9008 {
9011 }
9012 }
9013
9014 override void AddWet(
float value)
9015 {
9017 }
9018
9020 {
9022 }
9023
9025 {
9027 }
9028
9030 {
9032 }
9033
9035 {
9037 }
9038
9040 {
9042 }
9043
9045 {
9048 if (newLevel != oldLevel)
9049 {
9051 }
9052 }
9053
9055 {
9056 SetWeightDirty();
9057 }
9058
9060 {
9061 return GetWetLevelInternal(
m_VarWet);
9062 }
9063
9064
9065
9067 {
9069 }
9070
9072 {
9074 }
9075
9077 {
9079 }
9080
9082 {
9084 }
9085
9086
9087
9089 {
9090 if (ConfigIsExisting("itemModelLength"))
9091 {
9092 return ConfigGetFloat("itemModelLength");
9093 }
9094 return 0;
9095 }
9096
9098 {
9099 if (ConfigIsExisting("itemAttachOffset"))
9100 {
9101 return ConfigGetFloat("itemAttachOffset");
9102 }
9103 return 0;
9104 }
9105
9106 override void SetCleanness(
int value,
bool allow_client =
false)
9107 {
9108 if (!IsServerCheck(allow_client))
9109 return;
9110
9112
9114
9117 }
9118
9120 {
9122 }
9123
9125 {
9126 return true;
9127 }
9128
9129
9130
9131
9133 {
9135 }
9136
9138 {
9140 }
9141
9142
9143
9144
9145 override void SetColor(
int r,
int g,
int b,
int a)
9146 {
9152 }
9154 override void GetColor(out
int r,out
int g,out
int b,out
int a)
9155 {
9160 }
9161
9163 {
9165 }
9166
9169 {
9170 int r,g,b,a;
9172 r = r/255;
9173 g = g/255;
9174 b = b/255;
9175 a = a/255;
9176 return MiscGameplayFunctions.GetColorString(r, g, b, a);
9177 }
9178
9179
9180
9181 override void SetLiquidType(
int value,
bool allow_client =
false)
9182 {
9183 if (!IsServerCheck(allow_client))
9184 return;
9185
9190 }
9191
9193 {
9194 return ConfigGetInt("varLiquidTypeInit");
9195 }
9196
9198 {
9200 }
9201
9203 {
9205 SetFrozen(false);
9206 }
9207
9210 {
9211 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9212 }
9213
9214
9217 {
9218 PlayerBase nplayer;
9219 if (PlayerBase.CastTo(nplayer, player))
9220 {
9222 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9223 }
9224 }
9225
9226
9229 {
9230 PlayerBase nplayer;
9231 if (PlayerBase.CastTo(nplayer,player))
9232 {
9233 nplayer.SetEnableQuickBarEntityShortcut(this, false);
9234 }
9235
9236 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
9237
9238 if (HasEnergyManager())
9239 {
9240 GetCompEM().UpdatePlugState();
9241 }
9242 }
9243
9244
9246 {
9247 super.OnPlacementStarted(player);
9248
9250 }
9251
9252 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
9253 {
9255 {
9256 m_AdminLog.OnPlacementComplete(player,
this);
9257 }
9258
9259 super.OnPlacementComplete(player, position, orientation);
9260 }
9261
9262
9263
9264
9265
9267 {
9269 {
9270 return true;
9271 }
9272 else
9273 {
9274 return false;
9275 }
9276 }
9277
9278
9280 {
9282 {
9284 }
9285 }
9286
9287
9289 {
9291 }
9292
9294 {
9296 }
9297
9298 override void InsertAgent(
int agent,
float count = 1)
9299 {
9300 if (count < 1)
9301 return;
9302
9304 }
9305
9308 {
9310 }
9311
9312
9314 {
9316 }
9317
9318
9319
9320
9321
9322
9323
9324
9325
9326
9327
9328
9329
9330
9331
9332
9333
9334
9335
9336
9337
9338
9339
9340
9341
9342
9343
9344
9345
9346
9347
9348
9349
9350
9351
9352
9353
9354
9355
9356
9357
9358
9360 {
9362 return false;
9363 return true;
9364 }
9365
9367 {
9368
9370 }
9371
9372
9375 {
9376 super.CheckForRoofLimited(timeTresholdMS);
9377
9378 float time =
g_Game.GetTime();
9379 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
9380 {
9381 m_PreviousRoofTestTime = time;
9382 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
9383 }
9384 }
9385
9386
9388 {
9390 {
9391 return 0;
9392 }
9393
9394 if (GetInventory().GetAttachmentSlotsCount() != 0)
9395 {
9396 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
9397 if (filter)
9398 return filter.GetProtectionLevel(type, false, system);
9399 else
9400 return 0;
9401 }
9402
9403 string subclassPath, entryName;
9404
9405 switch (type)
9406 {
9408 entryName = "biological";
9409 break;
9411 entryName = "chemical";
9412 break;
9413 default:
9414 entryName = "biological";
9415 break;
9416 }
9417
9418 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
9419
9420 return g_Game.ConfigGetFloat(subclassPath + entryName);
9421 }
9422
9423
9424
9427 {
9428 if (!IsMagazine())
9430
9432 }
9433
9434
9435
9436
9437
9442 {
9443 return true;
9444 }
9445
9447 {
9449 }
9450
9451
9452
9453
9454
9456 {
9457 if (parent)
9458 {
9459 if (parent.IsInherited(DayZInfected))
9460 return true;
9461
9462 if (!parent.IsRuined())
9463 return true;
9464 }
9465
9466 return true;
9467 }
9468
9470 {
9471 if (!super.CanPutAsAttachment(parent))
9472 {
9473 return false;
9474 }
9475
9476 if (!IsRuined() && !parent.IsRuined())
9477 {
9478 return true;
9479 }
9480
9481 return false;
9482 }
9483
9485 {
9486
9487
9488
9489
9490 return super.CanReceiveItemIntoCargo(item);
9491 }
9492
9494 {
9495
9496
9497
9498
9499 GameInventory attachmentInv = attachment.GetInventory();
9501 {
9502 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
9503 return false;
9504 }
9505
9506 InventoryLocation loc = new InventoryLocation();
9507 attachment.GetInventory().GetCurrentInventoryLocation(loc);
9508 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
9509 return false;
9510
9511 return super.CanReceiveAttachment(attachment, slotId);
9512 }
9513
9515 {
9516 if (!super.CanReleaseAttachment(attachment))
9517 return false;
9518
9519 return GetInventory().AreChildrenAccessible();
9520 }
9521
9522
9523
9524
9525
9526
9527
9528
9529
9530
9531
9532
9533
9534
9535
9536
9537
9538
9539
9540
9541
9543 {
9544 int id = muzzle_owner.GetMuzzleID();
9545 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
9546
9547 if (WPOF_array)
9548 {
9549 for (int i = 0; i < WPOF_array.Count(); i++)
9550 {
9551 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
9552
9553 if (WPOF)
9554 {
9555 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
9556 }
9557 }
9558 }
9559 }
9560
9561
9563 {
9564 int id = muzzle_owner.GetMuzzleID();
9566
9567 if (WPOBE_array)
9568 {
9569 for (int i = 0; i < WPOBE_array.Count(); i++)
9570 {
9571 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
9572
9573 if (WPOBE)
9574 {
9575 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
9576 }
9577 }
9578 }
9579 }
9580
9581
9583 {
9584 int id = muzzle_owner.GetMuzzleID();
9585 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9586
9587 if (WPOOH_array)
9588 {
9589 for (int i = 0; i < WPOOH_array.Count(); i++)
9590 {
9591 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9592
9593 if (WPOOH)
9594 {
9595 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
9596 }
9597 }
9598 }
9599 }
9600
9601
9603 {
9604 int id = muzzle_owner.GetMuzzleID();
9605 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9606
9607 if (WPOOH_array)
9608 {
9609 for (int i = 0; i < WPOOH_array.Count(); i++)
9610 {
9611 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9612
9613 if (WPOOH)
9614 {
9615 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9616 }
9617 }
9618 }
9619 }
9620
9621
9623 {
9624 int id = muzzle_owner.GetMuzzleID();
9625 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9626
9627 if (WPOOH_array)
9628 {
9629 for (int i = 0; i < WPOOH_array.Count(); i++)
9630 {
9631 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9632
9633 if (WPOOH)
9634 {
9635 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9636 }
9637 }
9638 }
9639 }
9640
9641
9642
9644 {
9646 {
9647 return true;
9648 }
9649
9650 return false;
9651 }
9652
9654 {
9656 {
9657 return true;
9658 }
9659
9660 return false;
9661 }
9662
9664 {
9666 {
9667 return true;
9668 }
9669
9670 return false;
9671 }
9672
9674 {
9675 return false;
9676 }
9677
9680 {
9681 return UATimeSpent.DEFAULT_DEPLOY;
9682 }
9683
9684
9685
9686
9688 {
9690 SetSynchDirty();
9691 }
9692
9694 {
9696 }
9697
9698
9700 {
9701 return false;
9702 }
9703
9706 {
9707 string att_type = "None";
9708
9709 if (ConfigIsExisting("soundAttType"))
9710 {
9711 att_type = ConfigGetString("soundAttType");
9712 }
9713
9715 }
9716
9718 {
9720 }
9721
9722
9723
9724
9725
9731
9733 {
9736
9738 }
9739
9740
9742 {
9744 return;
9745
9747
9750
9753
9754 SoundParameters params = new SoundParameters();
9758 }
9759
9760
9762 {
9764 {
9767
9768 SetSynchDirty();
9769
9772 }
9773 }
9774
9776 {
9778 }
9779
9780
9782 {
9784 return;
9785
9787 SetSynchDirty();
9788
9791 }
9792
9794 {
9797 }
9798
9800 {
9802 }
9803
9804 void OnApply(PlayerBase player);
9805
9807 {
9808 return 1.0;
9809 };
9810
9812 {
9814 }
9815
9817 {
9819 }
9820
9822
9824 {
9825 SetDynamicPhysicsLifeTime(0.01);
9827 }
9828
9830 {
9831 array<string> zone_names = new array<string>;
9832 GetDamageZones(zone_names);
9833 for (int i = 0; i < zone_names.Count(); i++)
9834 {
9835 SetHealthMax(zone_names.Get(i),"Health");
9836 }
9837 SetHealthMax("","Health");
9838 }
9839
9842 {
9843 float global_health = GetHealth01("","Health");
9844 array<string> zones = new array<string>;
9845 GetDamageZones(zones);
9846
9847 for (int i = 0; i < zones.Count(); i++)
9848 {
9849 SetHealth01(zones.Get(i),"Health",global_health);
9850 }
9851 }
9852
9855 {
9856 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
9857 }
9858
9860 {
9861 if (!hasRootAsPlayer)
9862 {
9863 if (refParentIB)
9864 {
9865
9866 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
9867 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
9868
9869 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
9870 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
9871
9874 }
9875 else
9876 {
9877
9880 }
9881 }
9882 }
9883
9885 {
9887 {
9888 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
9889 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
9890 {
9891 float heatPermCoef = 1.0;
9893 while (ent)
9894 {
9895 heatPermCoef *= ent.GetHeatPermeabilityCoef();
9896 ent = ent.GetHierarchyParent();
9897 }
9898
9899 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
9900 }
9901 }
9902 }
9903
9905 {
9906
9907 EntityAI parent = GetHierarchyParent();
9908 if (!parent)
9909 {
9910 hasParent = false;
9911 hasRootAsPlayer = false;
9912 }
9913 else
9914 {
9915 hasParent = true;
9916 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
9917 refParentIB =
ItemBase.Cast(parent);
9918 }
9919 }
9920
9921 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
9922 {
9923
9924 }
9925
9927 {
9928
9929 return false;
9930 }
9931
9933 {
9934
9935
9936 return false;
9937 }
9938
9940 {
9941
9942 return false;
9943 }
9944
9947 {
9948 return !GetIsFrozen() &&
IsOpen();
9949 }
9950
9952 {
9953 bool hasParent = false, hasRootAsPlayer = false;
9955
9956 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
9957 bool foodDecay =
g_Game.IsFoodDecayEnabled();
9958
9959 if (wwtu || foodDecay)
9960 {
9964
9965 if (processWetness || processTemperature || processDecay)
9966 {
9968
9969 if (processWetness)
9970 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
9971
9972 if (processTemperature)
9974
9975 if (processDecay)
9976 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
9977 }
9978 }
9979 }
9980
9983 {
9985 }
9986
9988 {
9991
9992 return super.GetTemperatureFreezeThreshold();
9993 }
9994
9996 {
9999
10000 return super.GetTemperatureThawThreshold();
10001 }
10002
10004 {
10007
10008 return super.GetItemOverheatThreshold();
10009 }
10010
10012 {
10014 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
10015
10016 return super.GetTemperatureFreezeTime();
10017 }
10018
10020 {
10022 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
10023
10024 return super.GetTemperatureThawTime();
10025 }
10026
10031
10033 {
10034 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
10035 }
10036
10038 {
10039 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
10040 }
10041
10044 {
10046 }
10047
10049 {
10051 }
10052
10054 {
10056 }
10057
10060 {
10061 return null;
10062 }
10063
10066 {
10067 return false;
10068 }
10069
10071 {
10073 {
10076 if (!trg)
10077 {
10079 explosive = this;
10080 }
10081
10082 explosive.PairRemote(trg);
10084
10085 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
10086 trg.SetPersistentPairID(persistentID);
10087 explosive.SetPersistentPairID(persistentID);
10088
10089 return true;
10090 }
10091 return false;
10092 }
10093
10096 {
10097 float ret = 1.0;
10100 ret *= GetHealth01();
10101
10102 return ret;
10103 }
10104
10105 #ifdef DEVELOPER
10106 override void SetDebugItem()
10107 {
10108 super.SetDebugItem();
10109 _itemBase = this;
10110 }
10111
10113 {
10114 string text = super.GetDebugText();
10115
10117 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
10118
10119 return text;
10120 }
10121 #endif
10122
10124 {
10125 return true;
10126 }
10127
10129
10131
10133 {
10136 }
10137
10138
10146
10162
10163 [
Obsolete(
"Use ItemSoundHandler instead")]
10166 {
10167 if (!
g_Game.IsDedicatedServer())
10168 {
10169 if (ConfigIsExisting("attachSoundSet"))
10170 {
10171 string cfg_path = "";
10172 string soundset = "";
10173 string type_name =
GetType();
10174
10177 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
10178 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
10179
10180 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
10181 {
10182 for (int i = 0; i < cfg_soundset_array.Count(); i++)
10183 {
10184 if (cfg_slot_array[i] == slot_type)
10185 {
10186 soundset = cfg_soundset_array[i];
10187 break;
10188 }
10189 }
10190 }
10191
10192 if (soundset != "")
10193 {
10194 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
10196 }
10197 }
10198 }
10199 }
10200
10202}
10203
10205{
10207 if (entity)
10208 {
10209 bool is_item = entity.IsInherited(
ItemBase);
10210 if (is_item && full_quantity)
10211 {
10214 }
10215 }
10216 else
10217 {
10219 return NULL;
10220 }
10221 return entity;
10222}
10223
10225{
10226 if (item)
10227 {
10228 if (health > 0)
10229 item.SetHealth("", "", health);
10230
10231 if (item.CanHaveTemperature())
10232 {
10234 if (item.CanFreeze())
10235 item.SetFrozen(false);
10236 }
10237
10238 if (item.HasEnergyManager())
10239 {
10240 if (quantity >= 0)
10241 {
10242 item.GetCompEM().SetEnergy0To1(quantity);
10243 }
10244 else
10245 {
10247 }
10248 }
10249 else if (item.IsMagazine())
10250 {
10251 Magazine mag = Magazine.Cast(item);
10252 if (quantity >= 0)
10253 {
10254 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
10255 }
10256 else
10257 {
10259 }
10260
10261 }
10262 else
10263 {
10264 if (quantity >= 0)
10265 {
10266 item.SetQuantityNormalized(quantity, false);
10267 }
10268 else
10269 {
10271 }
10272
10273 }
10274 }
10275}
10276
10277#ifdef DEVELOPER
10279#endif
Param4< int, int, string, int > TSelectableActionInfoWithColor
Param3 TSelectableActionInfo
bool SetAttachSoundEvent()
bool SetDetachSoundEvent()
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 IsPrepareToDelete()
override bool CanHaveTemperature()
class GP5GasMask extends MaskBase ItemBase
proto GizmoApi GetGizmoApi()
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
void StartItemSoundServer(int id, int slotId)
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)
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()
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)
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)
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 EntityAI GetAttachmentFromIndex(int index)
proto native bool GetCurrentInventoryLocation(out notnull InventoryLocation loc)
returns information about current item location
proto native bool EnumerateInventory(InventoryTraversalType tt, out array< EntityAI > items)
enumerate inventory using traversal type and filling items array
proto native CargoBase GetCargo()
cargo
static proto native EntityAI LocationCreateEntity(notnull InventoryLocation inv_loc, string type, int iSetupFlags, int iRotation)
creates new item directly at location
proto native int AttachmentCount()
Returns count of attachments attached to this item.
proto native bool FindFreeLocationFor(notnull EntityAI item, FindInventoryLocationType flags, out notnull InventoryLocation loc)
FindFreeLocationFor.
proto void SelectObject(Object object)
proto void SelectPhysics(Physics physics)
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 bool Write(void value_out)
proto bool Read(void value_in)
proto native float GetDamage(string zoneName, string healthType)
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
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
void Obsolete(string msg="")
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
vector GetPosition()
Get the world position of the Effect.
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.