5368{
5370 {
5371 return true;
5372 }
5373};
5374
5376{
5377
5378};
5379
5380
5381
5383{
5387
5389
5392
5393
5394
5395
5396
5405
5411
5416
5421
5442 protected bool m_IsResultOfSplit
5443
5445
5450
5451
5452
5454
5458
5459
5460
5462
5465
5466
5467
5473
5474
5482
5485
5486
5488
5489
5491
5492
5497
5498
5503
5505
5506
5508
5509
5511 {
5516
5517 if (!
g_Game.IsDedicatedServer())
5518 {
5520 {
5522
5524 {
5526 }
5527 }
5528
5531 }
5532
5533 m_OldLocation = null;
5534
5536 {
5538 }
5539
5540 if (ConfigIsExisting("headSelectionsToHide"))
5541 {
5544 }
5545
5547 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
5548 {
5550 }
5551
5553
5554 m_IsResultOfSplit = false;
5555
5557 }
5558
5560 {
5561 super.InitItemVariables();
5562
5568 m_Count = ConfigGetInt(
"count");
5569
5572
5577
5580
5585
5597
5601
5602
5605 if (ConfigIsExisting("canBeSplit"))
5606 {
5609 }
5610
5612 if (ConfigIsExisting("itemBehaviour"))
5614
5615
5618 RegisterNetSyncVariableInt("m_VarLiquidType");
5619 RegisterNetSyncVariableInt("m_Cleanness",0,1);
5620
5621 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
5622 RegisterNetSyncVariableFloat("m_ImpactSpeed");
5623 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
5624
5625 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
5626 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
5627 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
5628 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
5629
5630 RegisterNetSyncVariableBool("m_IsBeingPlaced");
5631 RegisterNetSyncVariableBool("m_IsTakeable");
5632 RegisterNetSyncVariableBool("m_IsHologram");
5633
5636 {
5639 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
5640 }
5641
5643
5645 if (ConfigIsExisting("temperaturePerQuantityWeight"))
5647
5649 }
5650
5652 {
5654 }
5655
5657 {
5660 {
5665 }
5666 }
5667
5668 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
5669 {
5671 {
5674 }
5675
5677 }
5678
5680 {
5686 }
5687
5689
5691 {
5693
5694 if (!action)
5695 {
5696 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
5697 return;
5698 }
5699
5701 if (!ai)
5702 {
5704 return;
5705 }
5706
5708 if (!action_array)
5709 {
5710 action_array = new array<ActionBase_Basic>;
5712 }
5713 if (LogManager.IsActionLogEnable())
5714 {
5715 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
5716 }
5717
5718 if (action_array.Find(action) != -1)
5719 {
5720 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
5721 }
5722 else
5723 {
5724 action_array.Insert(action);
5725 }
5726 }
5727
5729 {
5730 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
5731 ActionBase action = player.GetActionManager().GetAction(actionName);
5734
5735 if (action_array)
5736 {
5737 action_array.RemoveItem(action);
5738 }
5739 }
5740
5741
5742
5744 {
5745 ActionOverrideData overrideData = new ActionOverrideData();
5749
5751 if (!actionMap)
5752 {
5755 }
5756
5757 actionMap.Insert(this.
Type(), overrideData);
5758
5759 }
5760
5762
5764
5765
5767 {
5770
5773
5774 string config_to_search = "CfgVehicles";
5775 string muzzle_owner_config;
5776
5778 {
5779 if (IsInherited(Weapon))
5780 config_to_search = "CfgWeapons";
5781
5782 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
5783
5784 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
5785
5786 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
5787
5788 if (config_OnFire_subclass_count > 0)
5789 {
5790 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
5791
5792 for (int i = 0; i < config_OnFire_subclass_count; i++)
5793 {
5794 string particle_class = "";
5795 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
5796 string config_OnFire_entry = config_OnFire_class + particle_class;
5797 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
5798 WPOF_array.Insert(WPOF);
5799 }
5800
5801
5803 }
5804 }
5805
5807 {
5808 config_to_search = "CfgWeapons";
5809 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
5810
5811 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
5812
5813 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
5814
5815 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
5816 {
5817 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
5818
5819 for (i = 0; i < config_OnBulletCasingEject_count; i++)
5820 {
5821 string particle_class2 = "";
5822 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
5823 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
5824 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
5825 WPOBE_array.Insert(WPOBE);
5826 }
5827
5828
5830 }
5831 }
5832 }
5833
5834
5836 {
5839
5841 {
5842 string config_to_search = "CfgVehicles";
5843
5844 if (IsInherited(Weapon))
5845 config_to_search = "CfgWeapons";
5846
5847 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
5848 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
5849
5850 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
5851 {
5852
5854
5856 {
5858 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
5860 return;
5861 }
5862
5865
5866
5867
5868 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
5869 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
5870
5871 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
5872 {
5873 string particle_class = "";
5874 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
5875 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
5876 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
5877
5878 if (entry_type == CT_CLASS)
5879 {
5880 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
5881 WPOOH_array.Insert(WPOF);
5882 }
5883 }
5884
5885
5887 }
5888 }
5889 }
5890
5892 {
5894 }
5895
5897 {
5899 {
5901
5904
5907
5908 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
5909 }
5910 }
5911
5913 {
5915 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
5916
5918 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
5919
5921 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
5922
5924 {
5926 }
5927 }
5928
5930 {
5932 }
5933
5935 {
5938 else
5940
5942 {
5945 }
5946 else
5947 {
5950
5953 }
5954
5956 }
5957
5959 {
5961 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
5962 }
5963
5965 {
5967 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
5969 }
5970
5972 {
5974 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
5975 }
5976
5978 {
5981
5982 OverheatingParticle OP = new OverheatingParticle();
5987
5989 }
5990
5992 {
5995
5996 return -1;
5997 }
5998
6000 {
6002 {
6005
6006 for (int i = count; i > 0; --i)
6007 {
6008 int id = i - 1;
6011
6014
6015 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
6016 {
6017 if (p)
6018 {
6021 }
6022 }
6023 }
6024 }
6025 }
6026
6028 {
6030 {
6032 {
6033 int id = i - 1;
6035
6036 if (OP)
6037 {
6039
6040 if (p)
6041 {
6043 }
6044
6045 delete OP;
6046 }
6047 }
6048
6051 }
6052 }
6053
6056 {
6057 return 0.0;
6058 }
6059
6060
6062 {
6063 return 250;
6064 }
6065
6067 {
6068 return 0;
6069 }
6070
6073 {
6075 return true;
6076
6077 return false;
6078 }
6079
6082 {
6085
6087 {
6089 }
6090 else
6091 {
6092
6094 }
6095
6097 }
6098
6105 {
6106 return -1;
6107 }
6108
6109
6110
6111
6113 {
6115 {
6116 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6117 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6118
6119 if (r_index >= 0)
6120 {
6121 InventoryLocation r_il = new InventoryLocation;
6122 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6123
6124 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6127 {
6128 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6129 }
6131 {
6132 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6133 }
6134
6135 }
6136
6137 player.GetHumanInventory().ClearUserReservedLocation(this);
6138 }
6139
6142 }
6143
6144
6145
6146
6148 {
6149 return ItemBase.m_DebugActionsMask;
6150 }
6151
6153 {
6154 return ItemBase.m_DebugActionsMask & mask;
6155 }
6156
6158 {
6159 ItemBase.m_DebugActionsMask = mask;
6160 }
6161
6163 {
6164 ItemBase.m_DebugActionsMask |= mask;
6165 }
6166
6168 {
6169 ItemBase.m_DebugActionsMask &= ~mask;
6170 }
6171
6173 {
6175 {
6177 }
6178 else
6179 {
6181 }
6182 }
6183
6184
6186 {
6187 if (GetEconomyProfile())
6188 {
6189 float q_max = GetEconomyProfile().GetQuantityMax();
6190 if (q_max > 0)
6191 {
6192 float q_min = GetEconomyProfile().GetQuantityMin();
6193 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
6194
6196 {
6197 ComponentEnergyManager comp = GetCompEM();
6199 {
6201 }
6202 }
6204 {
6206
6207 }
6208
6209 }
6210 }
6211 }
6212
6215 {
6216 EntityAI parent = GetHierarchyParent();
6217
6218 if (parent)
6219 {
6220 InventoryLocation inventory_location_to_lock = new InventoryLocation;
6221 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
6222 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
6223 }
6224 }
6225
6228 {
6229 EntityAI parent = GetHierarchyParent();
6230
6231 if (parent)
6232 {
6233 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
6234 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
6235 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
6236 }
6237 }
6238
6240 {
6241
6242
6243
6244
6246
6248 {
6249 if (ScriptInputUserData.CanStoreInputUserData())
6250 {
6251 ScriptInputUserData ctx = new ScriptInputUserData;
6257 ctx.
Write(use_stack_max);
6260
6262 {
6263 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
6264 }
6265 }
6266 }
6267 else if (!
g_Game.IsMultiplayer())
6268 {
6270 }
6271 }
6272
6274 {
6276 }
6277
6279 {
6281 }
6282
6284 {
6286 }
6287
6289 {
6290
6291 return false;
6292 }
6293
6295 {
6296 return false;
6297 }
6298
6302 {
6303 return false;
6304 }
6305
6307 {
6308 return "";
6309 }
6310
6312
6314 {
6315 return false;
6316 }
6317
6319 {
6320 return true;
6321 }
6322
6323
6324
6326 {
6327 return true;
6328 }
6329
6331 {
6332 return true;
6333 }
6334
6336 {
6337 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6339 }
6340
6342 {
6344 }
6345
6347 {
6349 if (!is_being_placed)
6351 SetSynchDirty();
6352 }
6353
6354
6356
6358 {
6360 }
6361
6363 {
6365 }
6366
6368 {
6369 return 1;
6370 }
6371
6373 {
6374 return false;
6375 }
6376
6378 {
6380 SetSynchDirty();
6381 }
6382
6383
6384
6385
6386
6387
6388
6389
6390
6391
6392
6393
6394
6395
6396
6397
6398
6399
6400
6401
6402
6403
6404
6405
6406
6407
6408
6409
6410
6411
6412
6413
6414
6415
6416
6418 {
6419 super.OnMovedInsideCargo(container);
6420
6421 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6422 }
6423
6424 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
6425 {
6426 super.EEItemLocationChanged(oldLoc, newLoc);
6427
6428 PlayerBase newPlayer = null;
6429 PlayerBase oldPlayer = null;
6430
6431 if (newLoc.GetParent())
6432 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
6433
6434 if (oldLoc.GetParent())
6435 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
6436
6438 {
6439 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
6440
6441 if (rIndex >= 0)
6442 {
6443 InventoryLocation rIl = new InventoryLocation;
6444 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
6445
6446 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
6449 {
6450 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
6451 }
6453 {
6455 }
6456
6457 }
6458 }
6459
6461 {
6462 if (newPlayer)
6463 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
6464
6465 if (newPlayer == oldPlayer)
6466 {
6467 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
6468 {
6470 {
6471 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
6472 {
6473 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6474 }
6475 }
6476 else
6477 {
6478 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6479 }
6480 }
6481
6482 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
6483 {
6484 int type = oldLoc.GetType();
6486 {
6487 oldLoc.GetParent().GetOnSetLock().Invoke(this);
6488 }
6490 {
6491 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
6492 }
6493 }
6494 if (!m_OldLocation)
6495 {
6496 m_OldLocation = new InventoryLocation;
6497 }
6498 m_OldLocation.Copy(oldLoc);
6499 }
6500 else
6501 {
6502 if (m_OldLocation)
6503 {
6504 m_OldLocation.Reset();
6505 }
6506 }
6507
6508 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
6509 }
6510 else
6511 {
6512 if (newPlayer)
6513 {
6514 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
6515 if (resIndex >= 0)
6516 {
6517 InventoryLocation il = new InventoryLocation;
6518 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
6520 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
6523 {
6524 il.
GetParent().GetOnReleaseLock().Invoke(it);
6525 }
6527 {
6529 }
6530
6531 }
6532 }
6534 {
6535
6537 }
6538
6539 if (m_OldLocation)
6540 {
6541 m_OldLocation.Reset();
6542 }
6543 }
6544
6546 {
6547 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
6548 }
6549
6551 {
6552 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
6553 }
6554 }
6555
6556 override void EOnContact(IEntity other, Contact extra)
6557 {
6559 {
6560 int liquidType = -1;
6562 if (impactSpeed > 0.0)
6563 {
6565 #ifndef SERVER
6567 #else
6569 SetSynchDirty();
6570 #endif
6572 }
6573 }
6574
6575 #ifdef SERVER
6576 if (GetCompEM() && GetCompEM().IsPlugged())
6577 {
6578 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
6579 GetCompEM().UnplugThis();
6580 }
6581 #endif
6582 }
6583
6585
6587 {
6589 }
6590
6592 {
6593
6594 }
6595
6597 {
6598 super.OnItemLocationChanged(old_owner, new_owner);
6599
6600 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
6601 PlayerBase playerNew = PlayerBase.Cast(new_owner);
6602
6603 if (!relatedPlayer && playerNew)
6604 relatedPlayer = playerNew;
6605
6606 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
6607 {
6609 if (actionMgr)
6610 {
6611 ActionBase currentAction = actionMgr.GetRunningAction();
6612 if (currentAction)
6614 }
6615 }
6616
6617 Man ownerPlayerOld = null;
6618 Man ownerPlayerNew = null;
6619
6620 if (old_owner)
6621 {
6622 if (old_owner.
IsMan())
6623 {
6624 ownerPlayerOld = Man.Cast(old_owner);
6625 }
6626 else
6627 {
6628 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
6629 }
6630 }
6631 else
6632 {
6634 {
6636
6637 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
6638 {
6639 GetCompEM().UnplugThis();
6640 }
6641 }
6642 }
6643
6644 if (new_owner)
6645 {
6646 if (new_owner.
IsMan())
6647 {
6648 ownerPlayerNew = Man.Cast(new_owner);
6649 }
6650 else
6651 {
6652 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
6653 }
6654 }
6655
6656 if (ownerPlayerOld != ownerPlayerNew)
6657 {
6658 if (ownerPlayerOld)
6659 {
6660 array<EntityAI> subItemsExit = new array<EntityAI>;
6662 for (int i = 0; i < subItemsExit.Count(); i++)
6663 {
6666 }
6667 }
6668
6669 if (ownerPlayerNew)
6670 {
6671 array<EntityAI> subItemsEnter = new array<EntityAI>;
6673 for (int j = 0; j < subItemsEnter.Count(); j++)
6674 {
6677 }
6678 }
6679 }
6680 else if (ownerPlayerNew != null)
6681 {
6682 PlayerBase nplayer;
6683 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
6684 {
6685 array<EntityAI> subItemsUpdate = new array<EntityAI>;
6687 for (int k = 0; k < subItemsUpdate.Count(); k++)
6688 {
6690 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
6691 }
6692 }
6693 }
6694
6695 if (old_owner)
6696 old_owner.OnChildItemRemoved(this);
6697 if (new_owner)
6698 new_owner.OnChildItemReceived(this);
6699 }
6700
6701
6703 {
6704 super.EEDelete(parent);
6705 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
6706 if (player)
6707 {
6709
6710 if (player.IsAlive())
6711 {
6712 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6713 if (r_index >= 0)
6714 {
6715 InventoryLocation r_il = new InventoryLocation;
6716 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6717
6718 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6721 {
6722 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6723 }
6725 {
6726 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6727 }
6728
6729 }
6730
6731 player.RemoveQuickBarEntityShortcut(this);
6732 }
6733 }
6734 }
6735
6737 {
6738 super.EEKilled(killer);
6739
6742 {
6743 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
6744 {
6745 if (IsMagazine())
6746 {
6747 if (Magazine.Cast(this).GetAmmoCount() > 0)
6748 {
6750 }
6751 }
6752 else
6753 {
6755 }
6756 }
6757 }
6758 }
6759
6761 {
6762 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6763
6764 super.OnWasAttached(parent, slot_id);
6765
6768
6771 }
6772
6774 {
6775 super.OnWasDetached(parent, slot_id);
6776
6779
6782 }
6783
6785 {
6786 int idx;
6789
6790 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
6791 if (inventory_slots.Count() < 1)
6792 {
6793 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
6794 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
6795 }
6796 else
6797 {
6798 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
6799 }
6800
6801 idx = inventory_slots.Find(slot);
6802 if (idx < 0)
6803 return "";
6804
6805 return attach_types.Get(idx);
6806 }
6807
6809 {
6810 int idx = -1;
6811 string slot;
6812
6815
6816 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
6817 if (inventory_slots.Count() < 1)
6818 {
6819 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
6820 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
6821 }
6822 else
6823 {
6824 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
6825 if (detach_types.Count() < 1)
6826 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
6827 }
6828
6829 for (int i = 0; i < inventory_slots.Count(); i++)
6830 {
6831 slot = inventory_slots.Get(i);
6832 }
6833
6834 if (slot != "")
6835 {
6836 if (detach_types.Count() == 1)
6837 idx = 0;
6838 else
6839 idx = inventory_slots.Find(slot);
6840 }
6841 if (idx < 0)
6842 return "";
6843
6844 return detach_types.Get(idx);
6845 }
6846
6848 {
6849
6851
6852
6853 float min_time = 1;
6854 float max_time = 3;
6855 float delay = Math.RandomFloat(min_time, max_time);
6856
6857 explode_timer.Run(delay, this, "DoAmmoExplosion");
6858 }
6859
6861 {
6862 Magazine magazine = Magazine.Cast(this);
6863 int pop_sounds_count = 6;
6864 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
6865
6866
6867 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
6868 string sound_name = pop_sounds[ sound_idx ];
6869 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
6870
6871
6872 magazine.ServerAddAmmoCount(-1);
6873
6874
6875 float min_temp_to_explode = 100;
6876
6877 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
6878 {
6880 }
6881 }
6882
6883
6884 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
6885 {
6886 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
6887
6888 const int CHANCE_DAMAGE_CARGO = 4;
6889 const int CHANCE_DAMAGE_ATTACHMENT = 1;
6890 const int CHANCE_DAMAGE_NOTHING = 2;
6891
6893 {
6894 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
6895 int chances;
6896 int rnd;
6897
6898 if (GetInventory().GetCargo())
6899 {
6900 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
6901 rnd = Math.RandomInt(0,chances);
6902
6903 if (rnd < CHANCE_DAMAGE_CARGO)
6904 {
6906 }
6907 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
6908 {
6910 }
6911 }
6912 else
6913 {
6914 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
6915 rnd = Math.RandomInt(0,chances);
6916
6917 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
6918 {
6920 }
6921 }
6922 }
6923 }
6924
6926 {
6927 CargoBase cargo = GetInventory().GetCargo();
6928 if (cargo)
6929 {
6931 if (item_count > 0)
6932 {
6933 int random_pick = Math.RandomInt(0, item_count);
6935 if (!item.IsExplosive())
6936 {
6937 item.AddHealth("","",damage);
6938 return true;
6939 }
6940 }
6941 }
6942 return false;
6943 }
6944
6946 {
6947 GameInventory inventory = GetInventory();
6949 if (attachment_count > 0)
6950 {
6951 int random_pick = Math.RandomInt(0, attachment_count);
6953 if (!attachment.IsExplosive())
6954 {
6955 attachment.AddHealth("","",damage);
6956 return true;
6957 }
6958 }
6959 return false;
6960 }
6961
6963 {
6965 }
6966
6968 {
6970 return GetInventory().CanRemoveEntity();
6971
6972 return false;
6973 }
6974
6976 {
6977
6979 return false;
6980
6981
6983 return false;
6984
6985
6986
6988 if (delta == 0)
6989 return false;
6990
6991
6992 return true;
6993 }
6994
6996 {
6998 {
6999 if (ScriptInputUserData.CanStoreInputUserData())
7000 {
7001 ScriptInputUserData ctx = new ScriptInputUserData;
7006 ctx.
Write(destination_entity);
7010 }
7011 }
7012 else if (!
g_Game.IsMultiplayer())
7013 {
7015 }
7016 }
7017
7019 {
7020 float split_quantity_new;
7024 InventoryLocation loc = new InventoryLocation;
7025
7026 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7027 {
7029 split_quantity_new = stack_max;
7030 else
7032
7034 {
7035 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7036 if (new_item)
7037 {
7038 new_item.SetResultOfSplit(true);
7039 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7041 new_item.
SetQuantity(split_quantity_new,
false,
true);
7042 }
7043 }
7044 }
7045 else if (destination_entity && slot_id == -1)
7046 {
7047 if (quantity > stack_max)
7048 split_quantity_new = stack_max;
7049 else
7050 split_quantity_new = quantity;
7051
7053 {
7054 GameInventory destinationInventory = destination_entity.GetInventory();
7056 {
7059 }
7060
7061 if (new_item)
7062 {
7063 new_item.SetResultOfSplit(true);
7064 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7066 new_item.
SetQuantity(split_quantity_new,
false,
true);
7067 }
7068 }
7069 }
7070 else
7071 {
7072 if (stack_max != 0)
7073 {
7075 {
7077 }
7078
7079 if (split_quantity_new == 0)
7080 {
7081 if (!
g_Game.IsMultiplayer())
7082 player.PhysicalPredictiveDropItem(this);
7083 else
7084 player.ServerDropEntity(this);
7085 return;
7086 }
7087
7089 {
7091
7092 if (new_item)
7093 {
7094 new_item.SetResultOfSplit(true);
7095 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7098 new_item.PlaceOnSurface();
7099 }
7100 }
7101 }
7102 }
7103 }
7104
7106 {
7107 float split_quantity_new;
7111 InventoryLocation loc = new InventoryLocation;
7112
7113 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7114 {
7116 split_quantity_new = stack_max;
7117 else
7119
7121 {
7122 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7123 if (new_item)
7124 {
7125 new_item.SetResultOfSplit(true);
7126 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7128 new_item.
SetQuantity(split_quantity_new,
false,
true);
7129 }
7130 }
7131 }
7132 else if (destination_entity && slot_id == -1)
7133 {
7134 if (quantity > stack_max)
7135 split_quantity_new = stack_max;
7136 else
7137 split_quantity_new = quantity;
7138
7140 {
7141 GameInventory destinationInventory = destination_entity.GetInventory();
7143 {
7146 }
7147
7148 if (new_item)
7149 {
7150 new_item.SetResultOfSplit(true);
7151 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7153 new_item.
SetQuantity(split_quantity_new,
false,
true);
7154 }
7155 }
7156 }
7157 else
7158 {
7159 if (stack_max != 0)
7160 {
7162 {
7164 }
7165
7167 {
7169
7170 if (new_item)
7171 {
7172 new_item.SetResultOfSplit(true);
7173 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7176 new_item.PlaceOnSurface();
7177 }
7178 }
7179 }
7180 }
7181 }
7182
7184 {
7186 {
7187 if (ScriptInputUserData.CanStoreInputUserData())
7188 {
7189 ScriptInputUserData ctx = new ScriptInputUserData;
7194 dst.WriteToContext(ctx);
7196 }
7197 }
7198 else if (!
g_Game.IsMultiplayer())
7199 {
7201 }
7202 }
7203
7205 {
7207 {
7208 if (ScriptInputUserData.CanStoreInputUserData())
7209 {
7210 ScriptInputUserData ctx = new ScriptInputUserData;
7215 ctx.
Write(destination_entity);
7221 }
7222 }
7223 else if (!
g_Game.IsMultiplayer())
7224 {
7226 }
7227 }
7228
7230 {
7232 }
7233
7235 {
7237 float split_quantity_new;
7239 if (dst.IsValid())
7240 {
7241 int slot_id = dst.GetSlot();
7243
7244 if (quantity > stack_max)
7245 split_quantity_new = stack_max;
7246 else
7247 split_quantity_new = quantity;
7248
7250 {
7252
7253 if (new_item)
7254 {
7255 new_item.SetResultOfSplit(true);
7256 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7258 new_item.
SetQuantity(split_quantity_new,
false,
true);
7259 }
7260
7261 return new_item;
7262 }
7263 }
7264
7265 return null;
7266 }
7267
7269 {
7271 float split_quantity_new;
7273 if (destination_entity)
7274 {
7276 if (quantity > stackable)
7277 split_quantity_new = stackable;
7278 else
7279 split_quantity_new = quantity;
7280
7282 {
7283 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
7284 if (new_item)
7285 {
7286 new_item.SetResultOfSplit(true);
7287 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7289 new_item.
SetQuantity(split_quantity_new,
false,
true);
7290 }
7291 }
7292 }
7293 }
7294
7296 {
7298 {
7299 if (ScriptInputUserData.CanStoreInputUserData())
7300 {
7301 ScriptInputUserData ctx = new ScriptInputUserData;
7306 ItemBase destination_entity =
this;
7307 ctx.
Write(destination_entity);
7311 }
7312 }
7313 else if (!
g_Game.IsMultiplayer())
7314 {
7316 }
7317 }
7318
7320 {
7322 float split_quantity_new;
7324 if (player)
7325 {
7327 if (quantity > stackable)
7328 split_quantity_new = stackable;
7329 else
7330 split_quantity_new = quantity;
7331
7333 {
7334 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
7335 new_item =
ItemBase.Cast(in_hands);
7336 if (new_item)
7337 {
7338 new_item.SetResultOfSplit(true);
7339 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7341 new_item.SetQuantity(split_quantity_new, false, true);
7342 }
7343 }
7344 }
7345 }
7346
7348 {
7350 float split_quantity_new = Math.Floor(quantity * 0.5);
7351
7353 return;
7354
7356
7357 if (new_item)
7358 {
7359 if (new_item.GetQuantityMax() < split_quantity_new)
7360 {
7361 split_quantity_new = new_item.GetQuantityMax();
7362 }
7363
7364 new_item.SetResultOfSplit(true);
7365 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7366
7368 {
7371 }
7372 else
7373 {
7375 new_item.
SetQuantity(split_quantity_new,
false,
true);
7376 }
7377 }
7378 }
7379
7381 {
7383 float split_quantity_new = Math.Floor(quantity / 2);
7384
7386 return;
7387
7388 InventoryLocation invloc = new InventoryLocation;
7390
7392 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
7393
7394 if (new_item)
7395 {
7396 if (new_item.GetQuantityMax() < split_quantity_new)
7397 {
7398 split_quantity_new = new_item.GetQuantityMax();
7399 }
7401 {
7404 }
7405 else if (split_quantity_new > 1)
7406 {
7408 new_item.
SetQuantity(split_quantity_new,
false,
true);
7409 }
7410 }
7411 }
7412
7415 {
7416 SetWeightDirty();
7418
7419 if (parent)
7420 parent.OnAttachmentQuantityChangedEx(this, delta);
7421
7423 {
7425 {
7427 }
7429 {
7430 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
7432 }
7433 }
7434 }
7435
7438 {
7439
7440 }
7441
7444 {
7446 }
7447
7449 {
7450 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
7451
7453 {
7454 if (newLevel == GameConstants.STATE_RUINED)
7455 {
7457 EntityAI parent = GetHierarchyParent();
7458 if (parent && parent.IsFireplace())
7459 {
7460 CargoBase cargo = GetInventory().GetCargo();
7461 if (cargo)
7462 {
7464 {
7466 }
7467 }
7468 }
7469 }
7470
7472 {
7473
7475 return;
7476 }
7477
7478 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
7479 {
7481 }
7482 }
7483 }
7484
7485
7487 {
7488 super.OnRightClick();
7489
7491 {
7493 {
7494 if (ScriptInputUserData.CanStoreInputUserData())
7495 {
7496 EntityAI root = GetHierarchyRoot();
7497 Man playerOwner = GetHierarchyRootPlayer();
7498 InventoryLocation dst = new InventoryLocation;
7499
7500
7501 if (!playerOwner && root && root == this)
7502 {
7504 }
7505 else
7506 {
7507
7508 GetInventory().GetCurrentInventoryLocation(dst);
7510 {
7511 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7513 {
7515 }
7516 else
7517 {
7519
7520
7521 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
7522 {
7524 }
7525 else
7526 {
7527 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
7528 }
7529 }
7530 }
7531 }
7532
7533 ScriptInputUserData ctx = new ScriptInputUserData;
7541 }
7542 }
7543 else if (!
g_Game.IsMultiplayer())
7544 {
7546 }
7547 }
7548 }
7549
7551 {
7552 if (root)
7553 {
7554 vector m4[4];
7555 root.GetTransform(m4);
7556 dst.SetGround(this, m4);
7557 }
7558 else
7559 {
7560 GetInventory().GetCurrentInventoryLocation(dst);
7561 }
7562 }
7563
7564 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
7565 {
7566
7567 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
7568 return false;
7569
7570 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
7571 return false;
7572
7573
7575 return false;
7576
7577
7578 Magazine mag = Magazine.Cast(this);
7579 if (mag)
7580 {
7581 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
7582 return false;
7583
7584 if (stack_max_limit)
7585 {
7586 Magazine other_mag = Magazine.Cast(other_item);
7587 if (other_item)
7588 {
7589 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
7590 return false;
7591 }
7592
7593 }
7594 }
7595 else
7596 {
7597
7599 return false;
7600
7602 return false;
7603 }
7604
7605 PlayerBase player = null;
7606 if (CastTo(player, GetHierarchyRootPlayer()))
7607 {
7608 if (player.GetInventory().HasAttachment(this))
7609 return false;
7610
7611 if (player.IsItemsToDelete())
7612 return false;
7613 }
7614
7615 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
7616 return false;
7617
7618 int slotID;
7620 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
7621 return false;
7622
7623 return true;
7624 }
7625
7627 {
7629 }
7630
7632 {
7633 return m_IsResultOfSplit;
7634 }
7635
7637 {
7638 m_IsResultOfSplit = value;
7639 }
7640
7642 {
7644 }
7645
7647 {
7648 float other_item_quantity = other_item.GetQuantity();
7649 float this_free_space;
7650
7652
7654
7655 if (other_item_quantity > this_free_space)
7656 {
7657 return this_free_space;
7658 }
7659 else
7660 {
7661 return other_item_quantity;
7662 }
7663 }
7664
7666 {
7668 }
7669
7671 {
7673 return;
7674
7675 if (!IsMagazine() && other_item)
7676 {
7678 if (quantity_used != 0)
7679 {
7680 float hp1 = GetHealth01("","");
7681 float hp2 = other_item.GetHealth01("","");
7682 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
7683 hpResult = hpResult / (
GetQuantity() + quantity_used);
7684
7685 hpResult *= GetMaxHealth();
7686 Math.Round(hpResult);
7687 SetHealth("", "Health", hpResult);
7688
7690 other_item.AddQuantity(-quantity_used);
7691 }
7692 }
7694 }
7695
7697 {
7698 #ifdef SERVER
7699 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
7700 GetHierarchyParent().IncreaseLifetimeUp();
7701 #endif
7702 };
7703
7705 {
7706 PlayerBase p = PlayerBase.Cast(player);
7707
7708 array<int> recipesIds = p.m_Recipes;
7709 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
7710 if (moduleRecipesManager)
7711 {
7712 EntityAI itemInHands = player.GetEntityInHands();
7713 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
7714 }
7715
7716 for (int i = 0;i < recipesIds.Count(); i++)
7717 {
7718 int key = recipesIds.Get(i);
7719 string recipeName = moduleRecipesManager.GetRecipeName(key);
7721 }
7722 }
7723
7724
7725 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
7726 {
7727 super.GetDebugActions(outputList);
7728
7729
7735
7736
7741
7746
7747
7751
7752
7754 {
7758 }
7759
7762
7763
7767
7769
7770 InventoryLocation loc = new InventoryLocation();
7771 GetInventory().GetCurrentInventoryLocation(loc);
7773 {
7774 if (Gizmo_IsSupported())
7777 }
7778
7780 }
7781
7782
7783
7784
7786 {
7787 super.OnAction(action_id, player, ctx);
7788
7790 {
7791 switch (action_id)
7792 {
7796 return true;
7800 return true;
7801 }
7802 }
7803
7805 {
7806 switch (action_id)
7807 {
7809 Delete();
7810 return true;
7811 }
7812 }
7813
7814 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
7815 {
7816 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
7817 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
7818 PlayerBase p = PlayerBase.Cast(player);
7819 if (
EActions.RECIPES_RANGE_START < 1000)
7820 {
7821 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
7822 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
7823 }
7824 }
7825 #ifndef SERVER
7826 else if (action_id ==
EActions.WATCH_PLAYER)
7827 {
7828 PluginDeveloper.SetDeveloperItemClientEx(player);
7829 }
7830 #endif
7832 {
7833 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
7834 {
7835 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
7836 OnDebugButtonPressServer(id + 1);
7837 }
7838
7839 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
7840 {
7841 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
7843 }
7844
7845 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
7846 {
7847 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
7849 }
7850
7851 else if (action_id ==
EActions.ADD_QUANTITY)
7852 {
7853 if (IsMagazine())
7854 {
7855 Magazine mag = Magazine.Cast(this);
7856 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
7857 }
7858 else
7859 {
7861 }
7862
7863 if (m_EM)
7864 {
7865 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
7866 }
7867
7868 }
7869
7870 else if (action_id ==
EActions.REMOVE_QUANTITY)
7871 {
7872 if (IsMagazine())
7873 {
7874 Magazine mag2 = Magazine.Cast(this);
7875 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
7876 }
7877 else
7878 {
7880 }
7881 if (m_EM)
7882 {
7883 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
7884 }
7885
7886 }
7887
7888 else if (action_id ==
EActions.SET_QUANTITY_0)
7889 {
7891
7892 if (m_EM)
7893 {
7894 m_EM.SetEnergy(0);
7895 }
7896 }
7897
7898 else if (action_id ==
EActions.SET_MAX_QUANTITY)
7899 {
7901
7902 if (m_EM)
7903 {
7904 m_EM.SetEnergy(m_EM.GetEnergyMax());
7905 }
7906 }
7907
7908 else if (action_id ==
EActions.ADD_HEALTH)
7909 {
7910 AddHealth("","",GetMaxHealth("","Health")/5);
7911 }
7912 else if (action_id ==
EActions.REMOVE_HEALTH)
7913 {
7914 AddHealth("","",-GetMaxHealth("","Health")/5);
7915 }
7916 else if (action_id ==
EActions.DESTROY_HEALTH)
7917 {
7918 SetHealth01("","",0);
7919 }
7920 else if (action_id ==
EActions.WATCH_ITEM)
7921 {
7923 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
7924 #ifdef DEVELOPER
7925 SetDebugDeveloper_item(this);
7926 #endif
7927 }
7928
7929 else if (action_id ==
EActions.ADD_TEMPERATURE)
7930 {
7931 AddTemperature(20);
7932
7933 }
7934
7935 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
7936 {
7937 AddTemperature(-20);
7938
7939 }
7940
7941 else if (action_id ==
EActions.FLIP_FROZEN)
7942 {
7943 SetFrozen(!GetIsFrozen());
7944
7945 }
7946
7947 else if (action_id ==
EActions.ADD_WETNESS)
7948 {
7950
7951 }
7952
7953 else if (action_id ==
EActions.REMOVE_WETNESS)
7954 {
7956
7957 }
7958
7959 else if (action_id ==
EActions.LIQUIDTYPE_UP)
7960 {
7963
7964
7965 }
7966
7967 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
7968 {
7971 }
7972
7973 else if (action_id ==
EActions.MAKE_SPECIAL)
7974 {
7975 auto debugParams = DebugSpawnParams.WithPlayer(player);
7976 OnDebugSpawnEx(debugParams);
7977 }
7978
7979 }
7980
7981
7982 return false;
7983 }
7984
7985
7986
7987
7991
7994
7995
7996
7998 {
7999 return false;
8000 }
8001
8002
8004 {
8005 return true;
8006 }
8007
8008
8010 {
8011 return true;
8012 }
8013
8014
8015
8017 {
8018 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
8019 return g_Game.ConfigIsExisting(config_path);
8020 }
8021
8024 {
8025 return null;
8026 }
8027
8029 {
8030 return false;
8031 }
8032
8034 {
8035 return false;
8036 }
8037
8041
8042
8044 {
8045 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8046 return module_repairing.CanRepair(this, item_repair_kit);
8047 }
8048
8049
8050 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
8051 {
8052 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8053 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
8054 }
8055
8056
8058 {
8059
8060
8061
8062
8063
8064
8065
8066
8067 return 1;
8068 }
8069
8070
8071
8073 {
8075 }
8076
8077
8078
8080 {
8082 }
8083
8084
8093 {
8094 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8095
8096 if (player)
8097 {
8098 player.MessageStatus(text);
8099 }
8100 }
8101
8102
8111 {
8112 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8113
8114 if (player)
8115 {
8116 player.MessageAction(text);
8117 }
8118 }
8119
8120
8129 {
8130 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8131
8132 if (player)
8133 {
8134 player.MessageFriendly(text);
8135 }
8136 }
8137
8138
8147 {
8148 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8149
8150 if (player)
8151 {
8152 player.MessageImportant(text);
8153 }
8154 }
8155
8157 {
8158 return true;
8159 }
8160
8161
8162 override bool KindOf(
string tag)
8163 {
8164 bool found = false;
8165 string item_name = this.
GetType();
8167 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
8168
8169 int array_size = item_tag_array.Count();
8170 for (int i = 0; i < array_size; i++)
8171 {
8172 if (item_tag_array.Get(i) == tag)
8173 {
8174 found = true;
8175 break;
8176 }
8177 }
8178 return found;
8179 }
8180
8181
8183 {
8184
8185 super.OnRPC(sender, rpc_type,ctx);
8186
8187
8188 switch (rpc_type)
8189 {
8190 #ifndef SERVER
8191 case ERPCs.RPC_SOUND_LOCK_ATTACH:
8192 Param2<bool, string> p = new Param2<bool, string>(false, "");
8193
8195 return;
8196
8197 bool play = p.param1;
8198 string soundSet = p.param2;
8199
8200 if (play)
8201 {
8203 {
8205 {
8207 }
8208 }
8209 else
8210 {
8212 }
8213 }
8214 else
8215 {
8217 }
8218
8219 break;
8220 #endif
8221
8222 }
8223
8225 {
8227 }
8228 }
8229
8230
8231
8232
8234 {
8235 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8236 return plugin.GetID(
name);
8237 }
8238
8240 {
8241 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8242 return plugin.GetName(id);
8243 }
8244
8247 {
8248
8249
8250 int varFlags;
8251 if (!ctx.
Read(varFlags))
8252 return;
8253
8254 if (varFlags & ItemVariableFlags.FLOAT)
8255 {
8257 }
8258 }
8259
8261 {
8262
8263 super.SerializeNumericalVars(floats_out);
8264
8265
8266
8268 {
8270 }
8271
8273 {
8275 }
8276
8278 {
8280 }
8281
8283 {
8288 }
8289
8291 {
8293 }
8294 }
8295
8297 {
8298
8299 super.DeSerializeNumericalVars(floats);
8300
8301
8302 int index = 0;
8303 int mask = Math.Round(floats.Get(index));
8304
8305 index++;
8306
8308 {
8310 {
8312 }
8313 else
8314 {
8315 float quantity = floats.Get(index);
8317 }
8318 index++;
8319 }
8320
8322 {
8323 float wet = floats.Get(index);
8325 index++;
8326 }
8327
8329 {
8330 int liquidtype = Math.Round(floats.Get(index));
8332 index++;
8333 }
8334
8336 {
8338 index++;
8340 index++;
8342 index++;
8344 index++;
8345 }
8346
8348 {
8349 int cleanness = Math.Round(floats.Get(index));
8351 index++;
8352 }
8353 }
8354
8356 {
8357 super.WriteVarsToCTX(ctx);
8358
8359
8361 {
8363 }
8364
8366 {
8368 }
8369
8371 {
8373 }
8374
8376 {
8377 int r,g,b,a;
8383 }
8384
8386 {
8388 }
8389 }
8390
8392 {
8393 if (!super.ReadVarsFromCTX(ctx,version))
8394 return false;
8395
8396 int intValue;
8397 float value;
8398
8399 if (version < 140)
8400 {
8401 if (!ctx.
Read(intValue))
8402 return false;
8403
8404 m_VariablesMask = intValue;
8405 }
8406
8408 {
8409 if (!ctx.
Read(value))
8410 return false;
8411
8413 {
8415 }
8416 else
8417 {
8419 }
8420 }
8421
8422 if (version < 140)
8423 {
8425 {
8426 if (!ctx.
Read(value))
8427 return false;
8428 SetTemperatureDirect(value);
8429 }
8430 }
8431
8433 {
8434 if (!ctx.
Read(value))
8435 return false;
8437 }
8438
8440 {
8441 if (!ctx.
Read(intValue))
8442 return false;
8444 }
8445
8447 {
8448 int r,g,b,a;
8450 return false;
8452 return false;
8454 return false;
8456 return false;
8457
8459 }
8460
8462 {
8463 if (!ctx.
Read(intValue))
8464 return false;
8466 }
8467
8468 if (version >= 138 && version < 140)
8469 {
8471 {
8472 if (!ctx.
Read(intValue))
8473 return false;
8474 SetFrozen(intValue);
8475 }
8476 }
8477
8478 return true;
8479 }
8480
8481
8483 {
8486 {
8488 }
8489
8490 if (!super.OnStoreLoad(ctx, version))
8491 {
8493 return false;
8494 }
8495
8496 if (version >= 114)
8497 {
8498 bool hasQuickBarIndexSaved;
8499
8500 if (!ctx.
Read(hasQuickBarIndexSaved))
8501 {
8503 return false;
8504 }
8505
8506 if (hasQuickBarIndexSaved)
8507 {
8508 int itmQBIndex;
8509
8510
8511 if (!ctx.
Read(itmQBIndex))
8512 {
8514 return false;
8515 }
8516
8517 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
8518 if (itmQBIndex != -1 && parentPlayer)
8519 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
8520 }
8521 }
8522 else
8523 {
8524
8525 PlayerBase player;
8526 int itemQBIndex;
8527 if (version ==
int.
MAX)
8528 {
8529 if (!ctx.
Read(itemQBIndex))
8530 {
8532 return false;
8533 }
8534 }
8535 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
8536 {
8537
8538 if (!ctx.
Read(itemQBIndex))
8539 {
8541 return false;
8542 }
8543 if (itemQBIndex != -1 && player)
8544 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
8545 }
8546 }
8547
8548 if (version < 140)
8549 {
8550
8551 if (!LoadVariables(ctx, version))
8552 {
8554 return false;
8555 }
8556 }
8557
8558
8560 {
8562 return false;
8563 }
8564 if (version >= 132)
8565 {
8567 if (raib)
8568 {
8570 {
8572 return false;
8573 }
8574 }
8575 }
8576
8578 return true;
8579 }
8580
8581
8582
8584 {
8585 super.OnStoreSave(ctx);
8586
8587 PlayerBase player;
8588 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
8589 {
8591
8592 int itemQBIndex = -1;
8593 itemQBIndex = player.FindQuickBarEntityIndex(this);
8594 ctx.
Write(itemQBIndex);
8595 }
8596 else
8597 {
8599 }
8600
8602
8604 if (raib)
8605 {
8607 }
8608 }
8609
8610
8612 {
8613 super.AfterStoreLoad();
8614
8616 {
8618 }
8619
8621 {
8624 }
8625 }
8626
8628 {
8629 super.EEOnAfterLoad();
8630
8632 {
8634 }
8635
8638 }
8639
8641 {
8642 return false;
8643 }
8644
8645
8646
8648 {
8650 {
8651 #ifdef PLATFORM_CONSOLE
8652
8654 {
8656 if (menu)
8657 {
8659 }
8660 }
8661 #endif
8662 }
8663
8665 {
8668 }
8669
8671 {
8672 SetWeightDirty();
8674 }
8676 {
8679 }
8680
8682 {
8685
8688 }
8690 {
8694 }
8695
8696 super.OnVariablesSynchronized();
8697 }
8698
8699
8700
8702 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
8703 {
8704 if (!IsServerCheck(allow_client))
8705 return false;
8706
8708 return false;
8709
8712
8713 if (value <= (min + 0.001))
8714 value = min;
8715
8716 if (value == min)
8717 {
8718 if (destroy_config)
8719 {
8720 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
8721 if (dstr)
8722 {
8724 this.Delete();
8725 return true;
8726 }
8727 }
8728 else if (destroy_forced)
8729 {
8731 this.Delete();
8732 return true;
8733 }
8734
8736 }
8737
8740
8742 {
8743 EntityAI parent = GetHierarchyRoot();
8744 InventoryLocation iLoc = new InventoryLocation();
8745 GetInventory().GetCurrentInventoryLocation(iLoc);
8747 {
8748 int iLocSlot = iLoc.
GetSlot();
8750 {
8752 }
8754 {
8756 }
8757 }
8758 }
8759
8761 {
8763
8764 if (delta)
8766 }
8767
8769
8770 return false;
8771 }
8772
8773
8775 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
8776 {
8778 }
8779
8781 {
8784 }
8785
8787 {
8790 }
8791
8793 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
8794 {
8795 float value_clamped = Math.Clamp(value, 0, 1);
8797 SetQuantity(result, destroy_config, destroy_forced);
8798 }
8799
8800
8803 {
8805 }
8806
8808 {
8810 }
8811
8812
8813
8814
8815
8816
8817
8818
8819
8820
8822 {
8823 int slot = -1;
8824 GameInventory inventory = GetInventory();
8825 if (inventory)
8826 {
8827 InventoryLocation il = new InventoryLocation;
8830 }
8831
8833 }
8834
8836 {
8837 float quantity_max = 0;
8838
8840 {
8841 if (attSlotID != -1)
8842 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
8843
8844 if (quantity_max <= 0)
8846 }
8847
8848 if (quantity_max <= 0)
8850
8851 return quantity_max;
8852 }
8853
8855 {
8857 }
8858
8860 {
8862 }
8863
8864
8866 {
8868 }
8869
8871 {
8873 }
8874
8876 {
8878 }
8879
8880
8882 {
8883
8884 float weightEx = GetWeightEx();
8885 float special = GetInventoryAndCargoWeight();
8886 return weightEx - special;
8887 }
8888
8889
8891 {
8893 }
8894
8896 {
8898 {
8899 #ifdef DEVELOPER
8900 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
8901 {
8902 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
8904 }
8905 #endif
8906
8908 }
8909 else if (HasEnergyManager())
8910 {
8911 #ifdef DEVELOPER
8912 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
8913 {
8914 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
8915 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
8916 }
8917 #endif
8918 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
8919 }
8920 else
8921 {
8922 #ifdef DEVELOPER
8923 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
8924 {
8925 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
8926 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
8927 }
8928 #endif
8929 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
8930 }
8931 }
8932
8935 {
8936 int item_count = 0;
8938
8939 GameInventory inventory = GetInventory();
8940 CargoBase cargo = inventory.
GetCargo();
8941 if (cargo != NULL)
8942 {
8944 }
8945
8947 for (int i = 0; i < nAttachments; ++i)
8948 {
8950 if (item)
8951 item_count += item.GetNumberOfItems();
8952 }
8953 return item_count;
8954 }
8955
8958 {
8959 float weight = 0;
8960 float wetness = 1;
8961 if (include_wetness)
8964 {
8965 weight = wetness * m_ConfigWeight;
8966 }
8968 {
8969 weight = 1;
8970 }
8971 return weight;
8972 }
8973
8974
8975
8977 {
8978 GameInventory inventory = GetInventory();
8979 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
8980 {
8981 array<EntityAI> items = new array<EntityAI>;
8983 for (int i = 0; i < items.Count(); ++i)
8984 {
8986 if (item)
8987 {
8988 g_Game.ObjectDelete(item);
8989 }
8990 }
8991 }
8992 }
8993
8994
8995
8996
8998 {
8999 float energy = 0;
9000 if (HasEnergyManager())
9001 {
9002 energy = GetCompEM().GetEnergy();
9003 }
9004 return energy;
9005 }
9006
9007
9009 {
9010 super.OnEnergyConsumed();
9011
9013 }
9014
9016 {
9017 super.OnEnergyAdded();
9018
9020 }
9021
9022
9024 {
9025 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
9026 {
9028 {
9029 float energy_0to1 = GetCompEM().GetEnergy0To1();
9031 }
9032 }
9033 }
9034
9035
9037 {
9038 return ConfigGetFloat("heatIsolation");
9039 }
9040
9042 {
9044 }
9045
9047 {
9048 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
9049 if (
g_Game.ConfigIsExisting(paramPath))
9050 return g_Game.ConfigGetFloat(paramPath);
9051
9052 return 0.0;
9053 }
9054
9056 {
9057 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
9058 if (
g_Game.ConfigIsExisting(paramPath))
9059 return g_Game.ConfigGetFloat(paramPath);
9060
9061 return 0.0;
9062 }
9063
9064 override void SetWet(
float value,
bool allow_client =
false)
9065 {
9066 if (!IsServerCheck(allow_client))
9067 return;
9068
9071
9073
9074 m_VarWet = Math.Clamp(value, min, max);
9075
9077 {
9080 }
9081 }
9082
9083 override void AddWet(
float value)
9084 {
9086 }
9087
9089 {
9091 }
9092
9094 {
9096 }
9097
9099 {
9101 }
9102
9104 {
9106 }
9107
9109 {
9111 }
9112
9114 {
9117 if (newLevel != oldLevel)
9118 {
9120 }
9121 }
9122
9124 {
9125 SetWeightDirty();
9126 }
9127
9129 {
9130 return GetWetLevelInternal(
m_VarWet);
9131 }
9132
9133
9134
9136 {
9138 }
9139
9141 {
9143 }
9144
9146 {
9148 }
9149
9151 {
9153 }
9154
9155
9156
9158 {
9159 if (ConfigIsExisting("itemModelLength"))
9160 {
9161 return ConfigGetFloat("itemModelLength");
9162 }
9163 return 0;
9164 }
9165
9167 {
9168 if (ConfigIsExisting("itemAttachOffset"))
9169 {
9170 return ConfigGetFloat("itemAttachOffset");
9171 }
9172 return 0;
9173 }
9174
9175 override void SetCleanness(
int value,
bool allow_client =
false)
9176 {
9177 if (!IsServerCheck(allow_client))
9178 return;
9179
9181
9183
9186 }
9187
9189 {
9191 }
9192
9194 {
9195 return true;
9196 }
9197
9198
9199
9200
9202 {
9204 }
9205
9207 {
9209 }
9210
9211
9212
9213
9214 override void SetColor(
int r,
int g,
int b,
int a)
9215 {
9221 }
9223 override void GetColor(out
int r,out
int g,out
int b,out
int a)
9224 {
9229 }
9230
9232 {
9234 }
9235
9238 {
9239 int r,g,b,a;
9241 r = r/255;
9242 g = g/255;
9243 b = b/255;
9244 a = a/255;
9245 return MiscGameplayFunctions.GetColorString(r, g, b, a);
9246 }
9247
9248
9249
9250 override void SetLiquidType(
int value,
bool allow_client =
false)
9251 {
9252 if (!IsServerCheck(allow_client))
9253 return;
9254
9259 }
9260
9262 {
9263 return ConfigGetInt("varLiquidTypeInit");
9264 }
9265
9267 {
9269 }
9270
9272 {
9274 SetFrozen(false);
9275 }
9276
9279 {
9280 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9281 }
9282
9283
9286 {
9287 PlayerBase nplayer;
9288 if (PlayerBase.CastTo(nplayer, player))
9289 {
9291 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9292 }
9293 }
9294
9295
9298 {
9299 PlayerBase nplayer;
9300 if (PlayerBase.CastTo(nplayer,player))
9301 {
9302 nplayer.SetEnableQuickBarEntityShortcut(this, false);
9303 }
9304
9305 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
9306
9307 if (HasEnergyManager())
9308 {
9309 GetCompEM().UpdatePlugState();
9310 }
9311 }
9312
9313
9315 {
9316 super.OnPlacementStarted(player);
9317
9319 }
9320
9321 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
9322 {
9324 {
9325 m_AdminLog.OnPlacementComplete(player,
this);
9326 }
9327
9328 super.OnPlacementComplete(player, position, orientation);
9329 }
9330
9331
9332
9333
9334
9336 {
9338 {
9339 return true;
9340 }
9341 else
9342 {
9343 return false;
9344 }
9345 }
9346
9347
9349 {
9351 {
9353 }
9354 }
9355
9356
9358 {
9360 }
9361
9363 {
9365 }
9366
9367 override void InsertAgent(
int agent,
float count = 1)
9368 {
9369 if (count < 1)
9370 return;
9371
9373 }
9374
9377 {
9379 }
9380
9381
9383 {
9385 }
9386
9387
9388
9389
9390
9391
9392
9393
9394
9395
9396
9397
9398
9399
9400
9401
9402
9403
9404
9405
9406
9407
9408
9409
9410
9411
9412
9413
9414
9415
9416
9417
9418
9419
9420
9421
9422
9423
9424
9425
9426
9427
9429 {
9431 return false;
9432 return true;
9433 }
9434
9436 {
9437
9439 }
9440
9441
9444 {
9445 super.CheckForRoofLimited(timeTresholdMS);
9446
9447 float time =
g_Game.GetTime();
9448 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
9449 {
9450 m_PreviousRoofTestTime = time;
9451 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
9452 }
9453 }
9454
9455
9457 {
9459 {
9460 return 0;
9461 }
9462
9463 if (GetInventory().GetAttachmentSlotsCount() != 0)
9464 {
9465 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
9466 if (filter)
9467 return filter.GetProtectionLevel(type, false, system);
9468 else
9469 return 0;
9470 }
9471
9472 string subclassPath, entryName;
9473
9474 switch (type)
9475 {
9477 entryName = "biological";
9478 break;
9480 entryName = "chemical";
9481 break;
9482 default:
9483 entryName = "biological";
9484 break;
9485 }
9486
9487 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
9488
9489 return g_Game.ConfigGetFloat(subclassPath + entryName);
9490 }
9491
9492
9493
9496 {
9497 if (!IsMagazine())
9499
9501 }
9502
9503
9504
9505
9506
9511 {
9512 return true;
9513 }
9514
9516 {
9518 }
9519
9520
9521
9522
9523
9525 {
9526 if (parent)
9527 {
9528 if (parent.IsInherited(DayZInfected))
9529 return true;
9530
9531 if (!parent.IsRuined())
9532 return true;
9533 }
9534
9535 return true;
9536 }
9537
9539 {
9540 if (!super.CanPutAsAttachment(parent))
9541 {
9542 return false;
9543 }
9544
9545 if (!IsRuined() && !parent.IsRuined())
9546 {
9547 return true;
9548 }
9549
9550 return false;
9551 }
9552
9554 {
9555
9556
9557
9558
9559 return super.CanReceiveItemIntoCargo(item);
9560 }
9561
9563 {
9564
9565
9566
9567
9568 GameInventory attachmentInv = attachment.GetInventory();
9570 {
9571 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
9572 return false;
9573 }
9574
9575 InventoryLocation loc = new InventoryLocation();
9576 attachment.GetInventory().GetCurrentInventoryLocation(loc);
9577 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
9578 return false;
9579
9580 return super.CanReceiveAttachment(attachment, slotId);
9581 }
9582
9584 {
9585 if (!super.CanReleaseAttachment(attachment))
9586 return false;
9587
9588 return GetInventory().AreChildrenAccessible();
9589 }
9590
9591
9592
9593
9594
9595
9596
9597
9598
9599
9600
9601
9602
9603
9604
9605
9606
9607
9608
9609
9610
9612 {
9613 int id = muzzle_owner.GetMuzzleID();
9614 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
9615
9616 if (WPOF_array)
9617 {
9618 for (int i = 0; i < WPOF_array.Count(); i++)
9619 {
9620 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
9621
9622 if (WPOF)
9623 {
9624 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
9625 }
9626 }
9627 }
9628 }
9629
9630
9632 {
9633 int id = muzzle_owner.GetMuzzleID();
9635
9636 if (WPOBE_array)
9637 {
9638 for (int i = 0; i < WPOBE_array.Count(); i++)
9639 {
9640 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
9641
9642 if (WPOBE)
9643 {
9644 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
9645 }
9646 }
9647 }
9648 }
9649
9650
9652 {
9653 int id = muzzle_owner.GetMuzzleID();
9654 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9655
9656 if (WPOOH_array)
9657 {
9658 for (int i = 0; i < WPOOH_array.Count(); i++)
9659 {
9660 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9661
9662 if (WPOOH)
9663 {
9664 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
9665 }
9666 }
9667 }
9668 }
9669
9670
9672 {
9673 int id = muzzle_owner.GetMuzzleID();
9674 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9675
9676 if (WPOOH_array)
9677 {
9678 for (int i = 0; i < WPOOH_array.Count(); i++)
9679 {
9680 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9681
9682 if (WPOOH)
9683 {
9684 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9685 }
9686 }
9687 }
9688 }
9689
9690
9692 {
9693 int id = muzzle_owner.GetMuzzleID();
9694 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9695
9696 if (WPOOH_array)
9697 {
9698 for (int i = 0; i < WPOOH_array.Count(); i++)
9699 {
9700 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9701
9702 if (WPOOH)
9703 {
9704 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9705 }
9706 }
9707 }
9708 }
9709
9710
9711
9713 {
9715 {
9716 return true;
9717 }
9718
9719 return false;
9720 }
9721
9723 {
9725 {
9726 return true;
9727 }
9728
9729 return false;
9730 }
9731
9733 {
9735 {
9736 return true;
9737 }
9738
9739 return false;
9740 }
9741
9743 {
9744 return false;
9745 }
9746
9749 {
9750 return UATimeSpent.DEFAULT_DEPLOY;
9751 }
9752
9753
9754
9755
9757 {
9759 SetSynchDirty();
9760 }
9761
9763 {
9765 }
9766
9767
9769 {
9770 return false;
9771 }
9772
9775 {
9776 string att_type = "None";
9777
9778 if (ConfigIsExisting("soundAttType"))
9779 {
9780 att_type = ConfigGetString("soundAttType");
9781 }
9782
9784 }
9785
9787 {
9789 }
9790
9791
9792
9793
9794
9800
9802 {
9805
9807 }
9808
9809
9811 {
9813 return;
9814
9816
9819
9822
9823 SoundParameters params = new SoundParameters();
9827 }
9828
9829
9831 {
9833 {
9836
9837 SetSynchDirty();
9838
9841 }
9842 }
9843
9845 {
9847 }
9848
9849
9851 {
9853 return;
9854
9856 SetSynchDirty();
9857
9860 }
9861
9863 {
9866 }
9867
9869 {
9871 }
9872
9873 void OnApply(PlayerBase player);
9874
9876 {
9877 return 1.0;
9878 };
9879
9881 {
9883 }
9884
9886 {
9888 }
9889
9891
9893 {
9894 SetDynamicPhysicsLifeTime(0.01);
9896 }
9897
9899 {
9900 array<string> zone_names = new array<string>;
9901 GetDamageZones(zone_names);
9902 for (int i = 0; i < zone_names.Count(); i++)
9903 {
9904 SetHealthMax(zone_names.Get(i),"Health");
9905 }
9906 SetHealthMax("","Health");
9907 }
9908
9911 {
9912 float global_health = GetHealth01("","Health");
9913 array<string> zones = new array<string>;
9914 GetDamageZones(zones);
9915
9916 for (int i = 0; i < zones.Count(); i++)
9917 {
9918 SetHealth01(zones.Get(i),"Health",global_health);
9919 }
9920 }
9921
9924 {
9925 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
9926 }
9927
9929 {
9930 if (!hasRootAsPlayer)
9931 {
9932 if (refParentIB)
9933 {
9934
9935 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
9936 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
9937
9938 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
9939 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
9940
9943 }
9944 else
9945 {
9946
9949 }
9950 }
9951 }
9952
9954 {
9956 {
9957 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
9958 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
9959 {
9960 float heatPermCoef = 1.0;
9962 while (ent)
9963 {
9964 heatPermCoef *= ent.GetHeatPermeabilityCoef();
9965 ent = ent.GetHierarchyParent();
9966 }
9967
9968 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
9969 }
9970 }
9971 }
9972
9974 {
9975
9976 EntityAI parent = GetHierarchyParent();
9977 if (!parent)
9978 {
9979 hasParent = false;
9980 hasRootAsPlayer = false;
9981 }
9982 else
9983 {
9984 hasParent = true;
9985 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
9986 refParentIB =
ItemBase.Cast(parent);
9987 }
9988 }
9989
9990 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
9991 {
9992
9993 }
9994
9996 {
9997
9998 return false;
9999 }
10000
10002 {
10003
10004
10005 return false;
10006 }
10007
10009 {
10010
10011 return false;
10012 }
10013
10016 {
10017 return !GetIsFrozen() &&
IsOpen();
10018 }
10019
10021 {
10022 bool hasParent = false, hasRootAsPlayer = false;
10024
10025 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
10026 bool foodDecay =
g_Game.IsFoodDecayEnabled();
10027
10028 if (wwtu || foodDecay)
10029 {
10033
10034 if (processWetness || processTemperature || processDecay)
10035 {
10037
10038 if (processWetness)
10039 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
10040
10041 if (processTemperature)
10043
10044 if (processDecay)
10045 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
10046 }
10047 }
10048 }
10049
10052 {
10054 }
10055
10057 {
10060
10061 return super.GetTemperatureFreezeThreshold();
10062 }
10063
10065 {
10068
10069 return super.GetTemperatureThawThreshold();
10070 }
10071
10073 {
10076
10077 return super.GetItemOverheatThreshold();
10078 }
10079
10081 {
10083 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
10084
10085 return super.GetTemperatureFreezeTime();
10086 }
10087
10089 {
10091 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
10092
10093 return super.GetTemperatureThawTime();
10094 }
10095
10100
10102 {
10103 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
10104 }
10105
10107 {
10108 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
10109 }
10110
10113 {
10115 }
10116
10118 {
10120 }
10121
10123 {
10125 }
10126
10129 {
10130 return null;
10131 }
10132
10135 {
10136 return false;
10137 }
10138
10140 {
10142 {
10145 if (!trg)
10146 {
10148 explosive = this;
10149 }
10150
10151 explosive.PairRemote(trg);
10153
10154 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
10155 trg.SetPersistentPairID(persistentID);
10156 explosive.SetPersistentPairID(persistentID);
10157
10158 return true;
10159 }
10160 return false;
10161 }
10162
10165 {
10166 float ret = 1.0;
10169 ret *= GetHealth01();
10170
10171 return ret;
10172 }
10173
10174 #ifdef DEVELOPER
10175 override void SetDebugItem()
10176 {
10177 super.SetDebugItem();
10178 _itemBase = this;
10179 }
10180
10182 {
10183 string text = super.GetDebugText();
10184
10186 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
10187
10188 return text;
10189 }
10190 #endif
10191
10193 {
10194 return true;
10195 }
10196
10198
10200
10202 {
10205 }
10206
10207
10215
10231
10232 [
Obsolete(
"Use ItemSoundHandler instead")]
10235 {
10236 if (!
g_Game.IsDedicatedServer())
10237 {
10238 if (ConfigIsExisting("attachSoundSet"))
10239 {
10240 string cfg_path = "";
10241 string soundset = "";
10242 string type_name =
GetType();
10243
10246 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
10247 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
10248
10249 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
10250 {
10251 for (int i = 0; i < cfg_soundset_array.Count(); i++)
10252 {
10253 if (cfg_slot_array[i] == slot_type)
10254 {
10255 soundset = cfg_soundset_array[i];
10256 break;
10257 }
10258 }
10259 }
10260
10261 if (soundset != "")
10262 {
10263 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
10265 }
10266 }
10267 }
10268 }
10269
10271}
10272
10274{
10276 if (entity)
10277 {
10278 bool is_item = entity.IsInherited(
ItemBase);
10279 if (is_item && full_quantity)
10280 {
10283 }
10284 }
10285 else
10286 {
10288 return NULL;
10289 }
10290 return entity;
10291}
10292
10294{
10295 if (item)
10296 {
10297 if (health > 0)
10298 item.SetHealth("", "", health);
10299
10300 if (item.CanHaveTemperature())
10301 {
10303 if (item.CanFreeze())
10304 item.SetFrozen(false);
10305 }
10306
10307 if (item.HasEnergyManager())
10308 {
10309 if (quantity >= 0)
10310 {
10311 item.GetCompEM().SetEnergy0To1(quantity);
10312 }
10313 else
10314 {
10316 }
10317 }
10318 else if (item.IsMagazine())
10319 {
10320 Magazine mag = Magazine.Cast(item);
10321 if (quantity >= 0)
10322 {
10323 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
10324 }
10325 else
10326 {
10328 }
10329
10330 }
10331 else
10332 {
10333 if (quantity >= 0)
10334 {
10335 item.SetQuantityNormalized(quantity, false);
10336 }
10337 else
10338 {
10340 }
10341
10342 }
10343 }
10344}
10345
10346#ifdef DEVELOPER
10348#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.