5462{
5464 {
5465 return true;
5466 }
5467};
5468
5470{
5471
5472};
5473
5474
5475
5477{
5481
5483
5486
5487
5488
5489
5490
5499
5505
5510
5515
5536 protected bool m_IsResultOfSplit
5537
5539
5544
5545
5546
5548
5552
5553
5554
5556
5559
5560
5561
5567
5568
5576
5579
5580
5582
5583
5585
5586
5591
5592
5597
5599
5600
5602
5603
5605 {
5610
5611 if (!
g_Game.IsDedicatedServer())
5612 {
5614 {
5616
5618 {
5620 }
5621 }
5622
5625 }
5626
5627 m_OldLocation = null;
5628
5630 {
5632 }
5633
5634 if (ConfigIsExisting("headSelectionsToHide"))
5635 {
5638 }
5639
5641 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
5642 {
5644 }
5645
5647
5648 m_IsResultOfSplit = false;
5649
5651 }
5652
5654 {
5655 super.InitItemVariables();
5656
5662 m_Count = ConfigGetInt(
"count");
5663
5666
5671
5674
5679
5691
5695
5696
5699 if (ConfigIsExisting("canBeSplit"))
5700 {
5703 }
5704
5706 if (ConfigIsExisting("itemBehaviour"))
5708
5709
5712 RegisterNetSyncVariableInt("m_VarLiquidType");
5713 RegisterNetSyncVariableInt("m_Cleanness",0,1);
5714
5715 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
5716 RegisterNetSyncVariableFloat("m_ImpactSpeed");
5717 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
5718
5719 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
5720 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
5721 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
5722 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
5723
5724 RegisterNetSyncVariableBool("m_IsBeingPlaced");
5725 RegisterNetSyncVariableBool("m_IsTakeable");
5726 RegisterNetSyncVariableBool("m_IsHologram");
5727
5730 {
5733 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
5734 }
5735
5737
5739 if (ConfigIsExisting("temperaturePerQuantityWeight"))
5741
5743 }
5744
5746 {
5748 }
5749
5751 {
5754 {
5759 }
5760 }
5761
5762 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
5763 {
5765 {
5768 }
5769
5771 }
5772
5774 {
5780 }
5781
5783
5785 {
5787
5788 if (!action)
5789 {
5790 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
5791 return;
5792 }
5793
5795 if (!ai)
5796 {
5798 return;
5799 }
5800
5802 if (!action_array)
5803 {
5804 action_array = new array<ActionBase_Basic>;
5806 }
5807 if (LogManager.IsActionLogEnable())
5808 {
5809 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
5810 }
5811
5812 if (action_array.Find(action) != -1)
5813 {
5814 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
5815 }
5816 else
5817 {
5818 action_array.Insert(action);
5819 }
5820 }
5821
5823 {
5824 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
5825 ActionBase action = player.GetActionManager().GetAction(actionName);
5828
5829 if (action_array)
5830 {
5831 action_array.RemoveItem(action);
5832 }
5833 }
5834
5835
5836
5838 {
5839 ActionOverrideData overrideData = new ActionOverrideData();
5843
5845 if (!actionMap)
5846 {
5849 }
5850
5851 actionMap.Insert(this.
Type(), overrideData);
5852
5853 }
5854
5856
5858
5859
5861 {
5864
5867
5868 string config_to_search = "CfgVehicles";
5869 string muzzle_owner_config;
5870
5872 {
5873 if (IsInherited(Weapon))
5874 config_to_search = "CfgWeapons";
5875
5876 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
5877
5878 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
5879
5880 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
5881
5882 if (config_OnFire_subclass_count > 0)
5883 {
5884 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
5885
5886 for (int i = 0; i < config_OnFire_subclass_count; i++)
5887 {
5888 string particle_class = "";
5889 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
5890 string config_OnFire_entry = config_OnFire_class + particle_class;
5891 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
5892 WPOF_array.Insert(WPOF);
5893 }
5894
5895
5897 }
5898 }
5899
5901 {
5902 config_to_search = "CfgWeapons";
5903 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
5904
5905 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
5906
5907 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
5908
5909 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
5910 {
5911 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
5912
5913 for (i = 0; i < config_OnBulletCasingEject_count; i++)
5914 {
5915 string particle_class2 = "";
5916 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
5917 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
5918 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
5919 WPOBE_array.Insert(WPOBE);
5920 }
5921
5922
5924 }
5925 }
5926 }
5927
5928
5930 {
5933
5935 {
5936 string config_to_search = "CfgVehicles";
5937
5938 if (IsInherited(Weapon))
5939 config_to_search = "CfgWeapons";
5940
5941 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
5942 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
5943
5944 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
5945 {
5946
5948
5950 {
5952 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
5954 return;
5955 }
5956
5959
5960
5961
5962 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
5963 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
5964
5965 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
5966 {
5967 string particle_class = "";
5968 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
5969 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
5970 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
5971
5972 if (entry_type == CT_CLASS)
5973 {
5974 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
5975 WPOOH_array.Insert(WPOF);
5976 }
5977 }
5978
5979
5981 }
5982 }
5983 }
5984
5986 {
5988 }
5989
5991 {
5993 {
5995
5998
6001
6002 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6003 }
6004 }
6005
6007 {
6009 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6010
6012 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6013
6015 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6016
6018 {
6020 }
6021 }
6022
6024 {
6026 }
6027
6029 {
6032 else
6034
6036 {
6039 }
6040 else
6041 {
6044
6047 }
6048
6050 }
6051
6053 {
6055 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6056 }
6057
6059 {
6061 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6063 }
6064
6066 {
6068 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6069 }
6070
6072 {
6075
6076 OverheatingParticle OP = new OverheatingParticle();
6081
6083 }
6084
6086 {
6089
6090 return -1;
6091 }
6092
6094 {
6096 {
6099
6100 for (int i = count; i > 0; --i)
6101 {
6102 int id = i - 1;
6105
6108
6109 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
6110 {
6111 if (p)
6112 {
6115 }
6116 }
6117 }
6118 }
6119 }
6120
6122 {
6124 {
6126 {
6127 int id = i - 1;
6129
6130 if (OP)
6131 {
6133
6134 if (p)
6135 {
6137 }
6138
6139 delete OP;
6140 }
6141 }
6142
6145 }
6146 }
6147
6150 {
6151 return 0.0;
6152 }
6153
6154
6156 {
6157 return 250;
6158 }
6159
6161 {
6162 return 0;
6163 }
6164
6167 {
6169 return true;
6170
6171 return false;
6172 }
6173
6176 {
6179
6181 {
6183 }
6184 else
6185 {
6186
6188 }
6189
6191 }
6192
6199 {
6200 return -1;
6201 }
6202
6203
6204
6205
6207 {
6209 {
6210 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6211 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6212
6213 if (r_index >= 0)
6214 {
6215 InventoryLocation r_il = new InventoryLocation;
6216 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6217
6218 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6221 {
6222 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6223 }
6225 {
6226 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6227 }
6228
6229 }
6230
6231 player.GetHumanInventory().ClearUserReservedLocation(this);
6232 }
6233
6236 }
6237
6238
6239
6240
6242 {
6243 return ItemBase.m_DebugActionsMask;
6244 }
6245
6247 {
6248 return ItemBase.m_DebugActionsMask & mask;
6249 }
6250
6252 {
6253 ItemBase.m_DebugActionsMask = mask;
6254 }
6255
6257 {
6258 ItemBase.m_DebugActionsMask |= mask;
6259 }
6260
6262 {
6263 ItemBase.m_DebugActionsMask &= ~mask;
6264 }
6265
6267 {
6269 {
6271 }
6272 else
6273 {
6275 }
6276 }
6277
6278
6280 {
6281 if (GetEconomyProfile())
6282 {
6283 float q_max = GetEconomyProfile().GetQuantityMax();
6284 if (q_max > 0)
6285 {
6286 float q_min = GetEconomyProfile().GetQuantityMin();
6287 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
6288
6290 {
6291 ComponentEnergyManager comp = GetCompEM();
6293 {
6295 }
6296 }
6298 {
6300
6301 }
6302
6303 }
6304 }
6305 }
6306
6309 {
6310 EntityAI parent = GetHierarchyParent();
6311
6312 if (parent)
6313 {
6314 InventoryLocation inventory_location_to_lock = new InventoryLocation;
6315 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
6316 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
6317 }
6318 }
6319
6322 {
6323 EntityAI parent = GetHierarchyParent();
6324
6325 if (parent)
6326 {
6327 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
6328 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
6329 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
6330 }
6331 }
6332
6334 {
6335
6336
6337
6338
6340
6342 {
6343 if (ScriptInputUserData.CanStoreInputUserData())
6344 {
6345 ScriptInputUserData ctx = new ScriptInputUserData;
6351 ctx.
Write(use_stack_max);
6354
6356 {
6357 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
6358 }
6359 }
6360 }
6361 else if (!
g_Game.IsMultiplayer())
6362 {
6364 }
6365 }
6366
6368 {
6370 }
6371
6373 {
6375 }
6376
6378 {
6380 }
6381
6383 {
6384
6385 return false;
6386 }
6387
6389 {
6390 return false;
6391 }
6392
6396 {
6397 return false;
6398 }
6399
6401 {
6402 return "";
6403 }
6404
6406
6408 {
6409 return false;
6410 }
6411
6413 {
6414 return true;
6415 }
6416
6417
6418
6420 {
6421 return true;
6422 }
6423
6425 {
6426 return true;
6427 }
6428
6430 {
6431 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6433 }
6434
6436 {
6438 }
6439
6441 {
6443 if (!is_being_placed)
6445 SetSynchDirty();
6446 }
6447
6448
6450
6452 {
6454 }
6455
6457 {
6459 }
6460
6462 {
6463 return 1;
6464 }
6465
6467 {
6468 return false;
6469 }
6470
6472 {
6474 SetSynchDirty();
6475 }
6476
6477
6478
6479
6480
6481
6482
6483
6484
6485
6486
6487
6488
6489
6490
6491
6492
6493
6494
6495
6496
6497
6498
6499
6500
6501
6502
6503
6504
6505
6506
6507
6508
6509
6510
6512 {
6513 super.OnMovedInsideCargo(container);
6514
6515 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6516 }
6517
6518 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
6519 {
6520 super.EEItemLocationChanged(oldLoc, newLoc);
6521
6522 PlayerBase newPlayer = null;
6523 PlayerBase oldPlayer = null;
6524
6525 if (newLoc.GetParent())
6526 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
6527
6528 if (oldLoc.GetParent())
6529 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
6530
6532 {
6533 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
6534
6535 if (rIndex >= 0)
6536 {
6537 InventoryLocation rIl = new InventoryLocation;
6538 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
6539
6540 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
6543 {
6544 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
6545 }
6547 {
6549 }
6550
6551 }
6552 }
6553
6555 {
6556 if (newPlayer)
6557 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
6558
6559 if (newPlayer == oldPlayer)
6560 {
6561 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
6562 {
6564 {
6565 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
6566 {
6567 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6568 }
6569 }
6570 else
6571 {
6572 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6573 }
6574 }
6575
6576 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
6577 {
6578 int type = oldLoc.GetType();
6580 {
6581 oldLoc.GetParent().GetOnSetLock().Invoke(this);
6582 }
6584 {
6585 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
6586 }
6587 }
6588 if (!m_OldLocation)
6589 {
6590 m_OldLocation = new InventoryLocation;
6591 }
6592 m_OldLocation.Copy(oldLoc);
6593 }
6594 else
6595 {
6596 if (m_OldLocation)
6597 {
6598 m_OldLocation.Reset();
6599 }
6600 }
6601
6602 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
6603 }
6604 else
6605 {
6606 if (newPlayer)
6607 {
6608 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
6609 if (resIndex >= 0)
6610 {
6611 InventoryLocation il = new InventoryLocation;
6612 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
6614 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
6617 {
6618 il.
GetParent().GetOnReleaseLock().Invoke(it);
6619 }
6621 {
6623 }
6624
6625 }
6626 }
6628 {
6629
6631 }
6632
6633 if (m_OldLocation)
6634 {
6635 m_OldLocation.Reset();
6636 }
6637 }
6638
6640 {
6641 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
6642 }
6643
6645 {
6646 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
6647 }
6648 }
6649
6650 override void EOnContact(IEntity other, Contact extra)
6651 {
6653 {
6654 int liquidType = -1;
6656 if (impactSpeed > 0.0)
6657 {
6659 #ifndef SERVER
6661 #else
6663 SetSynchDirty();
6664 #endif
6666 }
6667 }
6668
6669 #ifdef SERVER
6670 if (GetCompEM() && GetCompEM().IsPlugged())
6671 {
6672 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
6673 GetCompEM().UnplugThis();
6674 }
6675 #endif
6676 }
6677
6679
6681 {
6683 }
6684
6686 {
6687
6688 }
6689
6691 {
6692 super.OnItemLocationChanged(old_owner, new_owner);
6693
6694 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
6695 PlayerBase playerNew = PlayerBase.Cast(new_owner);
6696
6697 if (!relatedPlayer && playerNew)
6698 relatedPlayer = playerNew;
6699
6700 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
6701 {
6703 if (actionMgr)
6704 {
6705 ActionBase currentAction = actionMgr.GetRunningAction();
6706 if (currentAction)
6708 }
6709 }
6710
6711 Man ownerPlayerOld = null;
6712 Man ownerPlayerNew = null;
6713
6714 if (old_owner)
6715 {
6716 if (old_owner.
IsMan())
6717 {
6718 ownerPlayerOld = Man.Cast(old_owner);
6719 }
6720 else
6721 {
6722 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
6723 }
6724 }
6725 else
6726 {
6728 {
6730
6731 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
6732 {
6733 GetCompEM().UnplugThis();
6734 }
6735 }
6736 }
6737
6738 if (new_owner)
6739 {
6740 if (new_owner.
IsMan())
6741 {
6742 ownerPlayerNew = Man.Cast(new_owner);
6743 }
6744 else
6745 {
6746 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
6747 }
6748 }
6749
6750 if (ownerPlayerOld != ownerPlayerNew)
6751 {
6752 if (ownerPlayerOld)
6753 {
6754 array<EntityAI> subItemsExit = new array<EntityAI>;
6756 for (int i = 0; i < subItemsExit.Count(); i++)
6757 {
6760 }
6761 }
6762
6763 if (ownerPlayerNew)
6764 {
6765 array<EntityAI> subItemsEnter = new array<EntityAI>;
6767 for (int j = 0; j < subItemsEnter.Count(); j++)
6768 {
6771 }
6772 }
6773 }
6774 else if (ownerPlayerNew != null)
6775 {
6776 PlayerBase nplayer;
6777 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
6778 {
6779 array<EntityAI> subItemsUpdate = new array<EntityAI>;
6781 for (int k = 0; k < subItemsUpdate.Count(); k++)
6782 {
6784 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
6785 }
6786 }
6787 }
6788
6789 if (old_owner)
6790 old_owner.OnChildItemRemoved(this);
6791 if (new_owner)
6792 new_owner.OnChildItemReceived(this);
6793 }
6794
6795
6797 {
6798 super.EEDelete(parent);
6799 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
6800 if (player)
6801 {
6803
6804 if (player.IsAlive())
6805 {
6806 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6807 if (r_index >= 0)
6808 {
6809 InventoryLocation r_il = new InventoryLocation;
6810 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6811
6812 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6815 {
6816 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6817 }
6819 {
6820 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6821 }
6822
6823 }
6824
6825 player.RemoveQuickBarEntityShortcut(this);
6826 }
6827 }
6828 }
6829
6831 {
6832 super.EEKilled(killer);
6833
6836 {
6837 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
6838 {
6839 if (IsMagazine())
6840 {
6841 if (Magazine.Cast(this).GetAmmoCount() > 0)
6842 {
6844 }
6845 }
6846 else
6847 {
6849 }
6850 }
6851 }
6852 }
6853
6855 {
6856 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6857
6858 super.OnWasAttached(parent, slot_id);
6859
6862
6865 }
6866
6868 {
6869 super.OnWasDetached(parent, slot_id);
6870
6873
6876 }
6877
6879 {
6880 int idx;
6883
6884 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
6885 if (inventory_slots.Count() < 1)
6886 {
6887 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
6888 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
6889 }
6890 else
6891 {
6892 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
6893 }
6894
6895 idx = inventory_slots.Find(slot);
6896 if (idx < 0)
6897 return "";
6898
6899 return attach_types.Get(idx);
6900 }
6901
6903 {
6904 int idx = -1;
6905 string slot;
6906
6909
6910 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
6911 if (inventory_slots.Count() < 1)
6912 {
6913 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
6914 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
6915 }
6916 else
6917 {
6918 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
6919 if (detach_types.Count() < 1)
6920 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
6921 }
6922
6923 for (int i = 0; i < inventory_slots.Count(); i++)
6924 {
6925 slot = inventory_slots.Get(i);
6926 }
6927
6928 if (slot != "")
6929 {
6930 if (detach_types.Count() == 1)
6931 idx = 0;
6932 else
6933 idx = inventory_slots.Find(slot);
6934 }
6935 if (idx < 0)
6936 return "";
6937
6938 return detach_types.Get(idx);
6939 }
6940
6942 {
6943
6945
6946
6947 float min_time = 1;
6948 float max_time = 3;
6949 float delay = Math.RandomFloat(min_time, max_time);
6950
6951 explode_timer.Run(delay, this, "DoAmmoExplosion");
6952 }
6953
6955 {
6956 Magazine magazine = Magazine.Cast(this);
6957 int pop_sounds_count = 6;
6958 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
6959
6960
6961 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
6962 string sound_name = pop_sounds[ sound_idx ];
6963 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
6964
6965
6966 magazine.ServerAddAmmoCount(-1);
6967
6968
6969 float min_temp_to_explode = 100;
6970
6971 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
6972 {
6974 }
6975 }
6976
6977
6978 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
6979 {
6980 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
6981
6982 const int CHANCE_DAMAGE_CARGO = 4;
6983 const int CHANCE_DAMAGE_ATTACHMENT = 1;
6984 const int CHANCE_DAMAGE_NOTHING = 2;
6985
6987 {
6988 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
6989 int chances;
6990 int rnd;
6991
6992 if (GetInventory().GetCargo())
6993 {
6994 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
6995 rnd = Math.RandomInt(0,chances);
6996
6997 if (rnd < CHANCE_DAMAGE_CARGO)
6998 {
7000 }
7001 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
7002 {
7004 }
7005 }
7006 else
7007 {
7008 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7009 rnd = Math.RandomInt(0,chances);
7010
7011 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
7012 {
7014 }
7015 }
7016 }
7017 }
7018
7020 {
7021 CargoBase cargo = GetInventory().GetCargo();
7022 if (cargo)
7023 {
7025 if (item_count > 0)
7026 {
7027 int random_pick = Math.RandomInt(0, item_count);
7029 if (!item.IsExplosive())
7030 {
7031 item.AddHealth("","",damage);
7032 return true;
7033 }
7034 }
7035 }
7036 return false;
7037 }
7038
7040 {
7041 GameInventory inventory = GetInventory();
7043 if (attachment_count > 0)
7044 {
7045 int random_pick = Math.RandomInt(0, attachment_count);
7047 if (!attachment.IsExplosive())
7048 {
7049 attachment.AddHealth("","",damage);
7050 return true;
7051 }
7052 }
7053 return false;
7054 }
7055
7057 {
7059 }
7060
7062 {
7064 return GetInventory().CanRemoveEntity();
7065
7066 return false;
7067 }
7068
7070 {
7071
7073 return false;
7074
7075
7077 return false;
7078
7079
7080
7082 if (delta == 0)
7083 return false;
7084
7085
7086 return true;
7087 }
7088
7090 {
7092 {
7093 if (ScriptInputUserData.CanStoreInputUserData())
7094 {
7095 ScriptInputUserData ctx = new ScriptInputUserData;
7100 ctx.
Write(destination_entity);
7104 }
7105 }
7106 else if (!
g_Game.IsMultiplayer())
7107 {
7109 }
7110 }
7111
7113 {
7114 float split_quantity_new;
7118 InventoryLocation loc = new InventoryLocation;
7119
7120 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7121 {
7123 split_quantity_new = stack_max;
7124 else
7126
7128 {
7129 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7130 if (new_item)
7131 {
7132 new_item.SetResultOfSplit(true);
7133 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7135 new_item.
SetQuantity(split_quantity_new,
false,
true);
7136 }
7137 }
7138 }
7139 else if (destination_entity && slot_id == -1)
7140 {
7141 if (quantity > stack_max)
7142 split_quantity_new = stack_max;
7143 else
7144 split_quantity_new = quantity;
7145
7147 {
7148 GameInventory destinationInventory = destination_entity.GetInventory();
7150 {
7153 }
7154
7155 if (new_item)
7156 {
7157 new_item.SetResultOfSplit(true);
7158 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7160 new_item.
SetQuantity(split_quantity_new,
false,
true);
7161 }
7162 }
7163 }
7164 else
7165 {
7166 if (stack_max != 0)
7167 {
7169 {
7171 }
7172
7173 if (split_quantity_new == 0)
7174 {
7175 if (!
g_Game.IsMultiplayer())
7176 player.PhysicalPredictiveDropItem(this);
7177 else
7178 player.ServerDropEntity(this);
7179 return;
7180 }
7181
7183 {
7185
7186 if (new_item)
7187 {
7188 new_item.SetResultOfSplit(true);
7189 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7192 new_item.PlaceOnSurface();
7193 }
7194 }
7195 }
7196 }
7197 }
7198
7200 {
7201 float split_quantity_new;
7205 InventoryLocation loc = new InventoryLocation;
7206
7207 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7208 {
7210 split_quantity_new = stack_max;
7211 else
7213
7215 {
7216 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7217 if (new_item)
7218 {
7219 new_item.SetResultOfSplit(true);
7220 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7222 new_item.
SetQuantity(split_quantity_new,
false,
true);
7223 }
7224 }
7225 }
7226 else if (destination_entity && slot_id == -1)
7227 {
7228 if (quantity > stack_max)
7229 split_quantity_new = stack_max;
7230 else
7231 split_quantity_new = quantity;
7232
7234 {
7235 GameInventory destinationInventory = destination_entity.GetInventory();
7237 {
7240 }
7241
7242 if (new_item)
7243 {
7244 new_item.SetResultOfSplit(true);
7245 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7247 new_item.
SetQuantity(split_quantity_new,
false,
true);
7248 }
7249 }
7250 }
7251 else
7252 {
7253 if (stack_max != 0)
7254 {
7256 {
7258 }
7259
7261 {
7263
7264 if (new_item)
7265 {
7266 new_item.SetResultOfSplit(true);
7267 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7270 new_item.PlaceOnSurface();
7271 }
7272 }
7273 }
7274 }
7275 }
7276
7278 {
7280 {
7281 if (ScriptInputUserData.CanStoreInputUserData())
7282 {
7283 ScriptInputUserData ctx = new ScriptInputUserData;
7288 dst.WriteToContext(ctx);
7290 }
7291 }
7292 else if (!
g_Game.IsMultiplayer())
7293 {
7295 }
7296 }
7297
7299 {
7301 {
7302 if (ScriptInputUserData.CanStoreInputUserData())
7303 {
7304 ScriptInputUserData ctx = new ScriptInputUserData;
7309 ctx.
Write(destination_entity);
7315 }
7316 }
7317 else if (!
g_Game.IsMultiplayer())
7318 {
7320 }
7321 }
7322
7324 {
7326 }
7327
7329 {
7331 float split_quantity_new;
7333 if (dst.IsValid())
7334 {
7335 int slot_id = dst.GetSlot();
7337
7338 if (quantity > stack_max)
7339 split_quantity_new = stack_max;
7340 else
7341 split_quantity_new = quantity;
7342
7344 {
7346
7347 if (new_item)
7348 {
7349 new_item.SetResultOfSplit(true);
7350 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7352 new_item.
SetQuantity(split_quantity_new,
false,
true);
7353 }
7354
7355 return new_item;
7356 }
7357 }
7358
7359 return null;
7360 }
7361
7363 {
7365 float split_quantity_new;
7367 if (destination_entity)
7368 {
7370 if (quantity > stackable)
7371 split_quantity_new = stackable;
7372 else
7373 split_quantity_new = quantity;
7374
7376 {
7377 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
7378 if (new_item)
7379 {
7380 new_item.SetResultOfSplit(true);
7381 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7383 new_item.
SetQuantity(split_quantity_new,
false,
true);
7384 }
7385 }
7386 }
7387 }
7388
7390 {
7392 {
7393 if (ScriptInputUserData.CanStoreInputUserData())
7394 {
7395 ScriptInputUserData ctx = new ScriptInputUserData;
7400 ItemBase destination_entity =
this;
7401 ctx.
Write(destination_entity);
7405 }
7406 }
7407 else if (!
g_Game.IsMultiplayer())
7408 {
7410 }
7411 }
7412
7414 {
7416 float split_quantity_new;
7418 if (player)
7419 {
7421 if (quantity > stackable)
7422 split_quantity_new = stackable;
7423 else
7424 split_quantity_new = quantity;
7425
7427 {
7428 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
7429 new_item =
ItemBase.Cast(in_hands);
7430 if (new_item)
7431 {
7432 new_item.SetResultOfSplit(true);
7433 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7435 new_item.SetQuantity(split_quantity_new, false, true);
7436 }
7437 }
7438 }
7439 }
7440
7442 {
7444 float split_quantity_new = Math.Floor(quantity * 0.5);
7445
7447 return;
7448
7450
7451 if (new_item)
7452 {
7453 if (new_item.GetQuantityMax() < split_quantity_new)
7454 {
7455 split_quantity_new = new_item.GetQuantityMax();
7456 }
7457
7458 new_item.SetResultOfSplit(true);
7459 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7460
7462 {
7465 }
7466 else
7467 {
7469 new_item.
SetQuantity(split_quantity_new,
false,
true);
7470 }
7471 }
7472 }
7473
7475 {
7477 float split_quantity_new = Math.Floor(quantity / 2);
7478
7480 return;
7481
7482 InventoryLocation invloc = new InventoryLocation;
7484
7486 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
7487
7488 if (new_item)
7489 {
7490 if (new_item.GetQuantityMax() < split_quantity_new)
7491 {
7492 split_quantity_new = new_item.GetQuantityMax();
7493 }
7495 {
7498 }
7499 else if (split_quantity_new > 1)
7500 {
7502 new_item.
SetQuantity(split_quantity_new,
false,
true);
7503 }
7504 }
7505 }
7506
7509 {
7510 SetWeightDirty();
7512
7513 if (parent)
7514 parent.OnAttachmentQuantityChangedEx(this, delta);
7515
7517 {
7519 {
7521 }
7523 {
7524 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
7526 }
7527 }
7528 }
7529
7532 {
7533
7534 }
7535
7538 {
7540 }
7541
7543 {
7544 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
7545
7547 {
7548 if (newLevel == GameConstants.STATE_RUINED)
7549 {
7551 EntityAI parent = GetHierarchyParent();
7552 if (parent && parent.IsFireplace())
7553 {
7554 CargoBase cargo = GetInventory().GetCargo();
7555 if (cargo)
7556 {
7558 {
7560 }
7561 }
7562 }
7563 }
7564
7566 {
7567
7569 return;
7570 }
7571
7572 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
7573 {
7575 }
7576 }
7577 }
7578
7579
7581 {
7582 super.OnRightClick();
7583
7585 {
7587 {
7588 if (ScriptInputUserData.CanStoreInputUserData())
7589 {
7590 EntityAI root = GetHierarchyRoot();
7591 Man playerOwner = GetHierarchyRootPlayer();
7592 InventoryLocation dst = new InventoryLocation;
7593
7594
7595 if (!playerOwner && root && root == this)
7596 {
7598 }
7599 else
7600 {
7601
7602 GetInventory().GetCurrentInventoryLocation(dst);
7604 {
7605 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7607 {
7609 }
7610 else
7611 {
7613
7614
7615 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
7616 {
7618 }
7619 else
7620 {
7621 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
7622 }
7623 }
7624 }
7625 }
7626
7627 ScriptInputUserData ctx = new ScriptInputUserData;
7635 }
7636 }
7637 else if (!
g_Game.IsMultiplayer())
7638 {
7640 }
7641 }
7642 }
7643
7645 {
7646 if (root)
7647 {
7648 vector m4[4];
7649 root.GetTransform(m4);
7650 dst.SetGround(this, m4);
7651 }
7652 else
7653 {
7654 GetInventory().GetCurrentInventoryLocation(dst);
7655 }
7656 }
7657
7658 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
7659 {
7660
7661 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
7662 return false;
7663
7664 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
7665 return false;
7666
7667
7669 return false;
7670
7671
7672 Magazine mag = Magazine.Cast(this);
7673 if (mag)
7674 {
7675 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
7676 return false;
7677
7678 if (stack_max_limit)
7679 {
7680 Magazine other_mag = Magazine.Cast(other_item);
7681 if (other_item)
7682 {
7683 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
7684 return false;
7685 }
7686
7687 }
7688 }
7689 else
7690 {
7691
7693 return false;
7694
7696 return false;
7697 }
7698
7699 PlayerBase player = null;
7700 if (CastTo(player, GetHierarchyRootPlayer()))
7701 {
7702 if (player.GetInventory().HasAttachment(this))
7703 return false;
7704
7705 if (player.IsItemsToDelete())
7706 return false;
7707 }
7708
7709 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
7710 return false;
7711
7712 int slotID;
7714 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
7715 return false;
7716
7717 return true;
7718 }
7719
7721 {
7723 }
7724
7726 {
7727 return m_IsResultOfSplit;
7728 }
7729
7731 {
7732 m_IsResultOfSplit = value;
7733 }
7734
7736 {
7738 }
7739
7741 {
7742 float other_item_quantity = other_item.GetQuantity();
7743 float this_free_space;
7744
7746
7748
7749 if (other_item_quantity > this_free_space)
7750 {
7751 return this_free_space;
7752 }
7753 else
7754 {
7755 return other_item_quantity;
7756 }
7757 }
7758
7760 {
7762 }
7763
7765 {
7767 return;
7768
7769 if (!IsMagazine() && other_item)
7770 {
7772 if (quantity_used != 0)
7773 {
7774 float hp1 = GetHealth01("","");
7775 float hp2 = other_item.GetHealth01("","");
7776 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
7777 hpResult = hpResult / (
GetQuantity() + quantity_used);
7778
7779 hpResult *= GetMaxHealth();
7780 Math.Round(hpResult);
7781 SetHealth("", "Health", hpResult);
7782
7784 other_item.AddQuantity(-quantity_used);
7785 }
7786 }
7788 }
7789
7791 {
7792 #ifdef SERVER
7793 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
7794 GetHierarchyParent().IncreaseLifetimeUp();
7795 #endif
7796 };
7797
7799 {
7800 PlayerBase p = PlayerBase.Cast(player);
7801
7802 array<int> recipesIds = p.m_Recipes;
7803 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
7804 if (moduleRecipesManager)
7805 {
7806 EntityAI itemInHands = player.GetEntityInHands();
7807 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
7808 }
7809
7810 for (int i = 0;i < recipesIds.Count(); i++)
7811 {
7812 int key = recipesIds.Get(i);
7813 string recipeName = moduleRecipesManager.GetRecipeName(key);
7815 }
7816 }
7817
7818
7819 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
7820 {
7821 super.GetDebugActions(outputList);
7822
7823
7829
7830
7835
7840
7841
7845
7846
7848 {
7852 }
7853
7856
7857
7861
7863
7864 InventoryLocation loc = new InventoryLocation();
7865 GetInventory().GetCurrentInventoryLocation(loc);
7867 {
7868 if (Gizmo_IsSupported())
7871 }
7872
7874 }
7875
7876
7877
7878
7880 {
7881 super.OnAction(action_id, player, ctx);
7882
7884 {
7885 switch (action_id)
7886 {
7890 return true;
7894 return true;
7895 }
7896 }
7897
7899 {
7900 switch (action_id)
7901 {
7903 Delete();
7904 return true;
7905 }
7906 }
7907
7908 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
7909 {
7910 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
7911 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
7912 PlayerBase p = PlayerBase.Cast(player);
7913 if (
EActions.RECIPES_RANGE_START < 1000)
7914 {
7915 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
7916 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
7917 }
7918 }
7919 #ifndef SERVER
7920 else if (action_id ==
EActions.WATCH_PLAYER)
7921 {
7922 PluginDeveloper.SetDeveloperItemClientEx(player);
7923 }
7924 #endif
7926 {
7927 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
7928 {
7929 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
7930 OnDebugButtonPressServer(id + 1);
7931 }
7932
7933 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
7934 {
7935 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
7937 }
7938
7939 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
7940 {
7941 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
7943 }
7944
7945 else if (action_id ==
EActions.ADD_QUANTITY)
7946 {
7947 if (IsMagazine())
7948 {
7949 Magazine mag = Magazine.Cast(this);
7950 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
7951 }
7952 else
7953 {
7955 }
7956
7957 if (m_EM)
7958 {
7959 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
7960 }
7961
7962 }
7963
7964 else if (action_id ==
EActions.REMOVE_QUANTITY)
7965 {
7966 if (IsMagazine())
7967 {
7968 Magazine mag2 = Magazine.Cast(this);
7969 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
7970 }
7971 else
7972 {
7974 }
7975 if (m_EM)
7976 {
7977 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
7978 }
7979
7980 }
7981
7982 else if (action_id ==
EActions.SET_QUANTITY_0)
7983 {
7985
7986 if (m_EM)
7987 {
7988 m_EM.SetEnergy(0);
7989 }
7990 }
7991
7992 else if (action_id ==
EActions.SET_MAX_QUANTITY)
7993 {
7995
7996 if (m_EM)
7997 {
7998 m_EM.SetEnergy(m_EM.GetEnergyMax());
7999 }
8000 }
8001
8002 else if (action_id ==
EActions.ADD_HEALTH)
8003 {
8004 AddHealth("","",GetMaxHealth("","Health")/5);
8005 }
8006 else if (action_id ==
EActions.REMOVE_HEALTH)
8007 {
8008 AddHealth("","",-GetMaxHealth("","Health")/5);
8009 }
8010 else if (action_id ==
EActions.DESTROY_HEALTH)
8011 {
8012 SetHealth01("","",0);
8013 }
8014 else if (action_id ==
EActions.WATCH_ITEM)
8015 {
8017 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
8018 #ifdef DEVELOPER
8019 SetDebugDeveloper_item(this);
8020 #endif
8021 }
8022
8023 else if (action_id ==
EActions.ADD_TEMPERATURE)
8024 {
8025 AddTemperature(20);
8026
8027 }
8028
8029 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
8030 {
8031 AddTemperature(-20);
8032
8033 }
8034
8035 else if (action_id ==
EActions.FLIP_FROZEN)
8036 {
8037 SetFrozen(!GetIsFrozen());
8038
8039 }
8040
8041 else if (action_id ==
EActions.ADD_WETNESS)
8042 {
8044
8045 }
8046
8047 else if (action_id ==
EActions.REMOVE_WETNESS)
8048 {
8050
8051 }
8052
8053 else if (action_id ==
EActions.LIQUIDTYPE_UP)
8054 {
8057
8058
8059 }
8060
8061 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
8062 {
8065 }
8066
8067 else if (action_id ==
EActions.MAKE_SPECIAL)
8068 {
8069 auto debugParams = DebugSpawnParams.WithPlayer(player);
8070 OnDebugSpawnEx(debugParams);
8071 }
8072
8073 }
8074
8075
8076 return false;
8077 }
8078
8079
8080
8081
8085
8088
8089
8090
8092 {
8093 return false;
8094 }
8095
8096
8098 {
8099 return true;
8100 }
8101
8102
8104 {
8105 return true;
8106 }
8107
8108
8109
8111 {
8112 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
8113 return g_Game.ConfigIsExisting(config_path);
8114 }
8115
8118 {
8119 return null;
8120 }
8121
8123 {
8124 return false;
8125 }
8126
8128 {
8129 return false;
8130 }
8131
8135
8136
8138 {
8139 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8140 return module_repairing.CanRepair(this, item_repair_kit);
8141 }
8142
8143
8144 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
8145 {
8146 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8147 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
8148 }
8149
8150
8152 {
8153
8154
8155
8156
8157
8158
8159
8160
8161 return 1;
8162 }
8163
8164
8165
8167 {
8169 }
8170
8171
8172
8174 {
8176 }
8177
8178
8187 {
8188 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8189
8190 if (player)
8191 {
8192 player.MessageStatus(text);
8193 }
8194 }
8195
8196
8205 {
8206 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8207
8208 if (player)
8209 {
8210 player.MessageAction(text);
8211 }
8212 }
8213
8214
8223 {
8224 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8225
8226 if (player)
8227 {
8228 player.MessageFriendly(text);
8229 }
8230 }
8231
8232
8241 {
8242 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8243
8244 if (player)
8245 {
8246 player.MessageImportant(text);
8247 }
8248 }
8249
8251 {
8252 return true;
8253 }
8254
8255
8256 override bool KindOf(
string tag)
8257 {
8258 bool found = false;
8259 string item_name = this.
GetType();
8261 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
8262
8263 int array_size = item_tag_array.Count();
8264 for (int i = 0; i < array_size; i++)
8265 {
8266 if (item_tag_array.Get(i) == tag)
8267 {
8268 found = true;
8269 break;
8270 }
8271 }
8272 return found;
8273 }
8274
8275
8277 {
8278
8279 super.OnRPC(sender, rpc_type,ctx);
8280
8281
8282 switch (rpc_type)
8283 {
8284 #ifndef SERVER
8285 case ERPCs.RPC_SOUND_LOCK_ATTACH:
8286 Param2<bool, string> p = new Param2<bool, string>(false, "");
8287
8289 return;
8290
8291 bool play = p.param1;
8292 string soundSet = p.param2;
8293
8294 if (play)
8295 {
8297 {
8299 {
8301 }
8302 }
8303 else
8304 {
8306 }
8307 }
8308 else
8309 {
8311 }
8312
8313 break;
8314 #endif
8315
8316 }
8317
8319 {
8321 }
8322 }
8323
8324
8325
8326
8328 {
8329 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8330 return plugin.GetID(
name);
8331 }
8332
8334 {
8335 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8336 return plugin.GetName(id);
8337 }
8338
8341 {
8342
8343
8344 int varFlags;
8345 if (!ctx.
Read(varFlags))
8346 return;
8347
8348 if (varFlags & ItemVariableFlags.FLOAT)
8349 {
8351 }
8352 }
8353
8355 {
8356
8357 super.SerializeNumericalVars(floats_out);
8358
8359
8360
8362 {
8364 }
8365
8367 {
8369 }
8370
8372 {
8374 }
8375
8377 {
8382 }
8383
8385 {
8387 }
8388 }
8389
8391 {
8392
8393 super.DeSerializeNumericalVars(floats);
8394
8395
8396 int index = 0;
8397 int mask = Math.Round(floats.Get(index));
8398
8399 index++;
8400
8402 {
8404 {
8406 }
8407 else
8408 {
8409 float quantity = floats.Get(index);
8411 }
8412 index++;
8413 }
8414
8416 {
8417 float wet = floats.Get(index);
8419 index++;
8420 }
8421
8423 {
8424 int liquidtype = Math.Round(floats.Get(index));
8426 index++;
8427 }
8428
8430 {
8432 index++;
8434 index++;
8436 index++;
8438 index++;
8439 }
8440
8442 {
8443 int cleanness = Math.Round(floats.Get(index));
8445 index++;
8446 }
8447 }
8448
8450 {
8451 super.WriteVarsToCTX(ctx);
8452
8453
8455 {
8457 }
8458
8460 {
8462 }
8463
8465 {
8467 }
8468
8470 {
8471 int r,g,b,a;
8477 }
8478
8480 {
8482 }
8483 }
8484
8486 {
8487 if (!super.ReadVarsFromCTX(ctx,version))
8488 return false;
8489
8490 int intValue;
8491 float value;
8492
8493 if (version < 140)
8494 {
8495 if (!ctx.
Read(intValue))
8496 return false;
8497
8498 m_VariablesMask = intValue;
8499 }
8500
8502 {
8503 if (!ctx.
Read(value))
8504 return false;
8505
8507 {
8509 }
8510 else
8511 {
8513 }
8514 }
8515
8516 if (version < 140)
8517 {
8519 {
8520 if (!ctx.
Read(value))
8521 return false;
8522 SetTemperatureDirect(value);
8523 }
8524 }
8525
8527 {
8528 if (!ctx.
Read(value))
8529 return false;
8531 }
8532
8534 {
8535 if (!ctx.
Read(intValue))
8536 return false;
8538 }
8539
8541 {
8542 int r,g,b,a;
8544 return false;
8546 return false;
8548 return false;
8550 return false;
8551
8553 }
8554
8556 {
8557 if (!ctx.
Read(intValue))
8558 return false;
8560 }
8561
8562 if (version >= 138 && version < 140)
8563 {
8565 {
8566 if (!ctx.
Read(intValue))
8567 return false;
8568 SetFrozen(intValue);
8569 }
8570 }
8571
8572 return true;
8573 }
8574
8575
8577 {
8580 {
8582 }
8583
8584 if (!super.OnStoreLoad(ctx, version))
8585 {
8587 return false;
8588 }
8589
8590 if (version >= 114)
8591 {
8592 bool hasQuickBarIndexSaved;
8593
8594 if (!ctx.
Read(hasQuickBarIndexSaved))
8595 {
8597 return false;
8598 }
8599
8600 if (hasQuickBarIndexSaved)
8601 {
8602 int itmQBIndex;
8603
8604
8605 if (!ctx.
Read(itmQBIndex))
8606 {
8608 return false;
8609 }
8610
8611 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
8612 if (itmQBIndex != -1 && parentPlayer)
8613 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
8614 }
8615 }
8616 else
8617 {
8618
8619 PlayerBase player;
8620 int itemQBIndex;
8621 if (version ==
int.
MAX)
8622 {
8623 if (!ctx.
Read(itemQBIndex))
8624 {
8626 return false;
8627 }
8628 }
8629 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
8630 {
8631
8632 if (!ctx.
Read(itemQBIndex))
8633 {
8635 return false;
8636 }
8637 if (itemQBIndex != -1 && player)
8638 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
8639 }
8640 }
8641
8642 if (version < 140)
8643 {
8644
8645 if (!LoadVariables(ctx, version))
8646 {
8648 return false;
8649 }
8650 }
8651
8652
8654 {
8656 return false;
8657 }
8658 if (version >= 132)
8659 {
8661 if (raib)
8662 {
8664 {
8666 return false;
8667 }
8668 }
8669 }
8670
8672 return true;
8673 }
8674
8675
8676
8678 {
8679 super.OnStoreSave(ctx);
8680
8681 PlayerBase player;
8682 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
8683 {
8685
8686 int itemQBIndex = -1;
8687 itemQBIndex = player.FindQuickBarEntityIndex(this);
8688 ctx.
Write(itemQBIndex);
8689 }
8690 else
8691 {
8693 }
8694
8696
8698 if (raib)
8699 {
8701 }
8702 }
8703
8704
8706 {
8707 super.AfterStoreLoad();
8708
8710 {
8712 }
8713
8715 {
8718 }
8719 }
8720
8722 {
8723 super.EEOnAfterLoad();
8724
8726 {
8728 }
8729
8732 }
8733
8735 {
8736 return false;
8737 }
8738
8739
8740
8742 {
8744 {
8745 #ifdef PLATFORM_CONSOLE
8746
8748 {
8750 if (menu)
8751 {
8753 }
8754 }
8755 #endif
8756 }
8757
8759 {
8762 }
8763
8765 {
8766 SetWeightDirty();
8768 }
8770 {
8773 }
8774
8776 {
8779
8782 }
8784 {
8788 }
8789
8790 super.OnVariablesSynchronized();
8791 }
8792
8793
8794
8796 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
8797 {
8798 if (!IsServerCheck(allow_client))
8799 return false;
8800
8802 return false;
8803
8806
8807 if (value <= (min + 0.001))
8808 value = min;
8809
8810 if (value == min)
8811 {
8812 if (destroy_config)
8813 {
8814 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
8815 if (dstr)
8816 {
8818 this.Delete();
8819 return true;
8820 }
8821 }
8822 else if (destroy_forced)
8823 {
8825 this.Delete();
8826 return true;
8827 }
8828
8830 }
8831
8834
8836 {
8837 EntityAI parent = GetHierarchyRoot();
8838 InventoryLocation iLoc = new InventoryLocation();
8839 GetInventory().GetCurrentInventoryLocation(iLoc);
8841 {
8842 int iLocSlot = iLoc.
GetSlot();
8844 {
8846 }
8848 {
8850 }
8851 }
8852 }
8853
8855 {
8857
8858 if (delta)
8860 }
8861
8863
8864 return false;
8865 }
8866
8867
8869 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
8870 {
8872 }
8873
8875 {
8878 }
8879
8881 {
8884 }
8885
8887 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
8888 {
8889 float value_clamped = Math.Clamp(value, 0, 1);
8891 SetQuantity(result, destroy_config, destroy_forced);
8892 }
8893
8894
8897 {
8899 }
8900
8902 {
8904 }
8905
8906
8907
8908
8909
8910
8911
8912
8913
8914
8916 {
8917 int slot = -1;
8918 GameInventory inventory = GetInventory();
8919 if (inventory)
8920 {
8921 InventoryLocation il = new InventoryLocation;
8924 }
8925
8927 }
8928
8930 {
8931 float quantity_max = 0;
8932
8934 {
8935 if (attSlotID != -1)
8936 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
8937
8938 if (quantity_max <= 0)
8940 }
8941
8942 if (quantity_max <= 0)
8944
8945 return quantity_max;
8946 }
8947
8949 {
8951 }
8952
8954 {
8956 }
8957
8958
8960 {
8962 }
8963
8965 {
8967 }
8968
8970 {
8972 }
8973
8974
8976 {
8977
8978 float weightEx = GetWeightEx();
8979 float special = GetInventoryAndCargoWeight();
8980 return weightEx - special;
8981 }
8982
8983
8985 {
8987 }
8988
8990 {
8992 {
8993 #ifdef DEVELOPER
8994 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
8995 {
8996 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
8998 }
8999 #endif
9000
9002 }
9003 else if (HasEnergyManager())
9004 {
9005 #ifdef DEVELOPER
9006 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9007 {
9008 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
9009 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
9010 }
9011 #endif
9012 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
9013 }
9014 else
9015 {
9016 #ifdef DEVELOPER
9017 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9018 {
9019 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
9020 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
9021 }
9022 #endif
9023 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
9024 }
9025 }
9026
9029 {
9030 int item_count = 0;
9032
9033 GameInventory inventory = GetInventory();
9034 CargoBase cargo = inventory.
GetCargo();
9035 if (cargo != NULL)
9036 {
9038 }
9039
9041 for (int i = 0; i < nAttachments; ++i)
9042 {
9044 if (item)
9045 item_count += item.GetNumberOfItems();
9046 }
9047 return item_count;
9048 }
9049
9052 {
9053 float weight = 0;
9054 float wetness = 1;
9055 if (include_wetness)
9058 {
9059 weight = wetness * m_ConfigWeight;
9060 }
9062 {
9063 weight = 1;
9064 }
9065 return weight;
9066 }
9067
9068
9069
9071 {
9072 GameInventory inventory = GetInventory();
9073 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
9074 {
9075 array<EntityAI> items = new array<EntityAI>;
9077 for (int i = 0; i < items.Count(); ++i)
9078 {
9080 if (item)
9081 {
9082 g_Game.ObjectDelete(item);
9083 }
9084 }
9085 }
9086 }
9087
9088
9089
9090
9092 {
9093 float energy = 0;
9094 if (HasEnergyManager())
9095 {
9096 energy = GetCompEM().GetEnergy();
9097 }
9098 return energy;
9099 }
9100
9101
9103 {
9104 super.OnEnergyConsumed();
9105
9107 }
9108
9110 {
9111 super.OnEnergyAdded();
9112
9114 }
9115
9116
9118 {
9119 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
9120 {
9122 {
9123 float energy_0to1 = GetCompEM().GetEnergy0To1();
9125 }
9126 }
9127 }
9128
9129
9131 {
9132 return ConfigGetFloat("heatIsolation");
9133 }
9134
9136 {
9138 }
9139
9141 {
9142 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
9143 if (
g_Game.ConfigIsExisting(paramPath))
9144 return g_Game.ConfigGetFloat(paramPath);
9145
9146 return 0.0;
9147 }
9148
9150 {
9151 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
9152 if (
g_Game.ConfigIsExisting(paramPath))
9153 return g_Game.ConfigGetFloat(paramPath);
9154
9155 return 0.0;
9156 }
9157
9158 override void SetWet(
float value,
bool allow_client =
false)
9159 {
9160 if (!IsServerCheck(allow_client))
9161 return;
9162
9165
9167
9168 m_VarWet = Math.Clamp(value, min, max);
9169
9171 {
9174 }
9175 }
9176
9177 override void AddWet(
float value)
9178 {
9180 }
9181
9183 {
9185 }
9186
9188 {
9190 }
9191
9193 {
9195 }
9196
9198 {
9200 }
9201
9203 {
9205 }
9206
9208 {
9211 if (newLevel != oldLevel)
9212 {
9214 }
9215 }
9216
9218 {
9219 SetWeightDirty();
9220 }
9221
9223 {
9224 return GetWetLevelInternal(
m_VarWet);
9225 }
9226
9227
9228
9230 {
9232 }
9233
9235 {
9237 }
9238
9240 {
9242 }
9243
9245 {
9247 }
9248
9249
9250
9252 {
9253 if (ConfigIsExisting("itemModelLength"))
9254 {
9255 return ConfigGetFloat("itemModelLength");
9256 }
9257 return 0;
9258 }
9259
9261 {
9262 if (ConfigIsExisting("itemAttachOffset"))
9263 {
9264 return ConfigGetFloat("itemAttachOffset");
9265 }
9266 return 0;
9267 }
9268
9269 override void SetCleanness(
int value,
bool allow_client =
false)
9270 {
9271 if (!IsServerCheck(allow_client))
9272 return;
9273
9275
9277
9280 }
9281
9283 {
9285 }
9286
9288 {
9289 return true;
9290 }
9291
9292
9293
9294
9296 {
9298 }
9299
9301 {
9303 }
9304
9305
9306
9307
9308 override void SetColor(
int r,
int g,
int b,
int a)
9309 {
9315 }
9317 override void GetColor(out
int r,out
int g,out
int b,out
int a)
9318 {
9323 }
9324
9326 {
9328 }
9329
9332 {
9333 int r,g,b,a;
9335 r = r/255;
9336 g = g/255;
9337 b = b/255;
9338 a = a/255;
9339 return MiscGameplayFunctions.GetColorString(r, g, b, a);
9340 }
9341
9342
9343
9344 override void SetLiquidType(
int value,
bool allow_client =
false)
9345 {
9346 if (!IsServerCheck(allow_client))
9347 return;
9348
9353 }
9354
9356 {
9357 return ConfigGetInt("varLiquidTypeInit");
9358 }
9359
9361 {
9363 }
9364
9366 {
9368 SetFrozen(false);
9369 }
9370
9373 {
9374 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9375 }
9376
9377
9380 {
9381 PlayerBase nplayer;
9382 if (PlayerBase.CastTo(nplayer, player))
9383 {
9385 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9386 }
9387 }
9388
9389
9392 {
9393 PlayerBase nplayer;
9394 if (PlayerBase.CastTo(nplayer,player))
9395 {
9396 nplayer.SetEnableQuickBarEntityShortcut(this, false);
9397 }
9398
9399 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
9400
9401 if (HasEnergyManager())
9402 {
9403 GetCompEM().UpdatePlugState();
9404 }
9405 }
9406
9407
9409 {
9410 super.OnPlacementStarted(player);
9411
9413 }
9414
9415 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
9416 {
9418 {
9419 m_AdminLog.OnPlacementComplete(player,
this);
9420 }
9421
9422 super.OnPlacementComplete(player, position, orientation);
9423 }
9424
9425
9426
9427
9428
9430 {
9432 {
9433 return true;
9434 }
9435 else
9436 {
9437 return false;
9438 }
9439 }
9440
9441
9443 {
9445 {
9447 }
9448 }
9449
9450
9452 {
9454 }
9455
9457 {
9459 }
9460
9461 override void InsertAgent(
int agent,
float count = 1)
9462 {
9463 if (count < 1)
9464 return;
9465
9467 }
9468
9471 {
9473 }
9474
9475
9477 {
9479 }
9480
9481
9482
9483
9484
9485
9486
9487
9488
9489
9490
9491
9492
9493
9494
9495
9496
9497
9498
9499
9500
9501
9502
9503
9504
9505
9506
9507
9508
9509
9510
9511
9512
9513
9514
9515
9516
9517
9518
9519
9520
9521
9523 {
9525 return false;
9526 return true;
9527 }
9528
9530 {
9531
9533 }
9534
9535
9538 {
9539 super.CheckForRoofLimited(timeTresholdMS);
9540
9541 float time =
g_Game.GetTime();
9542 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
9543 {
9544 m_PreviousRoofTestTime = time;
9545 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
9546 }
9547 }
9548
9549
9551 {
9553 {
9554 return 0;
9555 }
9556
9557 if (GetInventory().GetAttachmentSlotsCount() != 0)
9558 {
9559 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
9560 if (filter)
9561 return filter.GetProtectionLevel(type, false, system);
9562 else
9563 return 0;
9564 }
9565
9566 string subclassPath, entryName;
9567
9568 switch (type)
9569 {
9571 entryName = "biological";
9572 break;
9574 entryName = "chemical";
9575 break;
9576 default:
9577 entryName = "biological";
9578 break;
9579 }
9580
9581 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
9582
9583 return g_Game.ConfigGetFloat(subclassPath + entryName);
9584 }
9585
9586
9587
9590 {
9591 if (!IsMagazine())
9593
9595 }
9596
9597
9598
9599
9600
9605 {
9606 return true;
9607 }
9608
9610 {
9612 }
9613
9614
9615
9616
9617
9619 {
9620 if (parent)
9621 {
9622 if (parent.IsInherited(DayZInfected))
9623 return true;
9624
9625 if (!parent.IsRuined())
9626 return true;
9627 }
9628
9629 return true;
9630 }
9631
9633 {
9634 if (!super.CanPutAsAttachment(parent))
9635 {
9636 return false;
9637 }
9638
9639 if (!IsRuined() && !parent.IsRuined())
9640 {
9641 return true;
9642 }
9643
9644 return false;
9645 }
9646
9648 {
9649
9650
9651
9652
9653 return super.CanReceiveItemIntoCargo(item);
9654 }
9655
9657 {
9658
9659
9660
9661
9662 GameInventory attachmentInv = attachment.GetInventory();
9664 {
9665 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
9666 return false;
9667 }
9668
9669 InventoryLocation loc = new InventoryLocation();
9670 attachment.GetInventory().GetCurrentInventoryLocation(loc);
9671 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
9672 return false;
9673
9674 return super.CanReceiveAttachment(attachment, slotId);
9675 }
9676
9678 {
9679 if (!super.CanReleaseAttachment(attachment))
9680 return false;
9681
9682 return GetInventory().AreChildrenAccessible();
9683 }
9684
9685
9686
9687
9688
9689
9690
9691
9692
9693
9694
9695
9696
9697
9698
9699
9700
9701
9702
9703
9704
9706 {
9707 int id = muzzle_owner.GetMuzzleID();
9708 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
9709
9710 if (WPOF_array)
9711 {
9712 for (int i = 0; i < WPOF_array.Count(); i++)
9713 {
9714 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
9715
9716 if (WPOF)
9717 {
9718 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
9719 }
9720 }
9721 }
9722 }
9723
9724
9726 {
9727 int id = muzzle_owner.GetMuzzleID();
9729
9730 if (WPOBE_array)
9731 {
9732 for (int i = 0; i < WPOBE_array.Count(); i++)
9733 {
9734 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
9735
9736 if (WPOBE)
9737 {
9738 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
9739 }
9740 }
9741 }
9742 }
9743
9744
9746 {
9747 int id = muzzle_owner.GetMuzzleID();
9748 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9749
9750 if (WPOOH_array)
9751 {
9752 for (int i = 0; i < WPOOH_array.Count(); i++)
9753 {
9754 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9755
9756 if (WPOOH)
9757 {
9758 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
9759 }
9760 }
9761 }
9762 }
9763
9764
9766 {
9767 int id = muzzle_owner.GetMuzzleID();
9768 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9769
9770 if (WPOOH_array)
9771 {
9772 for (int i = 0; i < WPOOH_array.Count(); i++)
9773 {
9774 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9775
9776 if (WPOOH)
9777 {
9778 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9779 }
9780 }
9781 }
9782 }
9783
9784
9786 {
9787 int id = muzzle_owner.GetMuzzleID();
9788 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9789
9790 if (WPOOH_array)
9791 {
9792 for (int i = 0; i < WPOOH_array.Count(); i++)
9793 {
9794 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9795
9796 if (WPOOH)
9797 {
9798 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9799 }
9800 }
9801 }
9802 }
9803
9804
9805
9807 {
9809 {
9810 return true;
9811 }
9812
9813 return false;
9814 }
9815
9817 {
9819 {
9820 return true;
9821 }
9822
9823 return false;
9824 }
9825
9827 {
9829 {
9830 return true;
9831 }
9832
9833 return false;
9834 }
9835
9837 {
9838 return false;
9839 }
9840
9843 {
9844 return UATimeSpent.DEFAULT_DEPLOY;
9845 }
9846
9847
9848
9849
9851 {
9853 SetSynchDirty();
9854 }
9855
9857 {
9859 }
9860
9861
9863 {
9864 return false;
9865 }
9866
9869 {
9870 string att_type = "None";
9871
9872 if (ConfigIsExisting("soundAttType"))
9873 {
9874 att_type = ConfigGetString("soundAttType");
9875 }
9876
9878 }
9879
9881 {
9883 }
9884
9885
9886
9887
9888
9894
9896 {
9899
9901 }
9902
9903
9905 {
9907 return;
9908
9910
9913
9916
9917 SoundParameters params = new SoundParameters();
9921 }
9922
9923
9925 {
9927 {
9930
9931 SetSynchDirty();
9932
9935 }
9936 }
9937
9939 {
9941 }
9942
9943
9945 {
9947 return;
9948
9950 SetSynchDirty();
9951
9954 }
9955
9957 {
9960 }
9961
9963 {
9965 }
9966
9967 void OnApply(PlayerBase player);
9968
9970 {
9971 return 1.0;
9972 };
9973
9975 {
9977 }
9978
9980 {
9982 }
9983
9985
9987 {
9988 SetDynamicPhysicsLifeTime(0.01);
9990 }
9991
9993 {
9994 array<string> zone_names = new array<string>;
9995 GetDamageZones(zone_names);
9996 for (int i = 0; i < zone_names.Count(); i++)
9997 {
9998 SetHealthMax(zone_names.Get(i),"Health");
9999 }
10000 SetHealthMax("","Health");
10001 }
10002
10005 {
10006 float global_health = GetHealth01("","Health");
10007 array<string> zones = new array<string>;
10008 GetDamageZones(zones);
10009
10010 for (int i = 0; i < zones.Count(); i++)
10011 {
10012 SetHealth01(zones.Get(i),"Health",global_health);
10013 }
10014 }
10015
10018 {
10019 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
10020 }
10021
10023 {
10024 if (!hasRootAsPlayer)
10025 {
10026 if (refParentIB)
10027 {
10028
10029 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
10030 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
10031
10032 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
10033 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
10034
10037 }
10038 else
10039 {
10040
10043 }
10044 }
10045 }
10046
10048 {
10050 {
10051 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
10052 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
10053 {
10054 float heatPermCoef = 1.0;
10056 while (ent)
10057 {
10058 heatPermCoef *= ent.GetHeatPermeabilityCoef();
10059 ent = ent.GetHierarchyParent();
10060 }
10061
10062 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
10063 }
10064 }
10065 }
10066
10068 {
10069
10070 EntityAI parent = GetHierarchyParent();
10071 if (!parent)
10072 {
10073 hasParent = false;
10074 hasRootAsPlayer = false;
10075 }
10076 else
10077 {
10078 hasParent = true;
10079 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
10080 refParentIB =
ItemBase.Cast(parent);
10081 }
10082 }
10083
10084 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
10085 {
10086
10087 }
10088
10090 {
10091
10092 return false;
10093 }
10094
10096 {
10097
10098
10099 return false;
10100 }
10101
10103 {
10104
10105 return false;
10106 }
10107
10110 {
10111 return !GetIsFrozen() &&
IsOpen();
10112 }
10113
10115 {
10116 bool hasParent = false, hasRootAsPlayer = false;
10118
10119 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
10120 bool foodDecay =
g_Game.IsFoodDecayEnabled();
10121
10122 if (wwtu || foodDecay)
10123 {
10127
10128 if (processWetness || processTemperature || processDecay)
10129 {
10131
10132 if (processWetness)
10133 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
10134
10135 if (processTemperature)
10137
10138 if (processDecay)
10139 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
10140 }
10141 }
10142 }
10143
10146 {
10148 }
10149
10151 {
10154
10155 return super.GetTemperatureFreezeThreshold();
10156 }
10157
10159 {
10162
10163 return super.GetTemperatureThawThreshold();
10164 }
10165
10167 {
10170
10171 return super.GetItemOverheatThreshold();
10172 }
10173
10175 {
10177 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
10178
10179 return super.GetTemperatureFreezeTime();
10180 }
10181
10183 {
10185 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
10186
10187 return super.GetTemperatureThawTime();
10188 }
10189
10194
10196 {
10197 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
10198 }
10199
10201 {
10202 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
10203 }
10204
10207 {
10209 }
10210
10212 {
10214 }
10215
10217 {
10219 }
10220
10223 {
10224 return null;
10225 }
10226
10229 {
10230 return false;
10231 }
10232
10234 {
10236 {
10239 if (!trg)
10240 {
10242 explosive = this;
10243 }
10244
10245 explosive.PairRemote(trg);
10247
10248 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
10249 trg.SetPersistentPairID(persistentID);
10250 explosive.SetPersistentPairID(persistentID);
10251
10252 return true;
10253 }
10254 return false;
10255 }
10256
10259 {
10260 float ret = 1.0;
10263 ret *= GetHealth01();
10264
10265 return ret;
10266 }
10267
10268 #ifdef DEVELOPER
10269 override void SetDebugItem()
10270 {
10271 super.SetDebugItem();
10272 _itemBase = this;
10273 }
10274
10276 {
10277 string text = super.GetDebugText();
10278
10280 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
10281
10282 return text;
10283 }
10284 #endif
10285
10287 {
10288 return true;
10289 }
10290
10292
10294
10296 {
10299 }
10300
10301
10309
10325
10326 [
Obsolete(
"Use ItemSoundHandler instead")]
10329 {
10330 if (!
g_Game.IsDedicatedServer())
10331 {
10332 if (ConfigIsExisting("attachSoundSet"))
10333 {
10334 string cfg_path = "";
10335 string soundset = "";
10336 string type_name =
GetType();
10337
10340 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
10341 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
10342
10343 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
10344 {
10345 for (int i = 0; i < cfg_soundset_array.Count(); i++)
10346 {
10347 if (cfg_slot_array[i] == slot_type)
10348 {
10349 soundset = cfg_soundset_array[i];
10350 break;
10351 }
10352 }
10353 }
10354
10355 if (soundset != "")
10356 {
10357 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
10359 }
10360 }
10361 }
10362 }
10363
10365}
10366
10368{
10370 if (entity)
10371 {
10372 bool is_item = entity.IsInherited(
ItemBase);
10373 if (is_item && full_quantity)
10374 {
10377 }
10378 }
10379 else
10380 {
10382 return NULL;
10383 }
10384 return entity;
10385}
10386
10388{
10389 if (item)
10390 {
10391 if (health > 0)
10392 item.SetHealth("", "", health);
10393
10394 if (item.CanHaveTemperature())
10395 {
10397 if (item.CanFreeze())
10398 item.SetFrozen(false);
10399 }
10400
10401 if (item.HasEnergyManager())
10402 {
10403 if (quantity >= 0)
10404 {
10405 item.GetCompEM().SetEnergy0To1(quantity);
10406 }
10407 else
10408 {
10410 }
10411 }
10412 else if (item.IsMagazine())
10413 {
10414 Magazine mag = Magazine.Cast(item);
10415 if (quantity >= 0)
10416 {
10417 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
10418 }
10419 else
10420 {
10422 }
10423
10424 }
10425 else
10426 {
10427 if (quantity >= 0)
10428 {
10429 item.SetQuantityNormalized(quantity, false);
10430 }
10431 else
10432 {
10434 }
10435
10436 }
10437 }
10438}
10439
10440#ifdef DEVELOPER
10442#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.