Returns global muzzle ID. If not found, then it gets automatically registered.
5614{
5616 {
5617 return true;
5618 }
5619};
5620
5622{
5623
5624};
5625
5626
5627
5629{
5633
5635
5638
5639
5640
5641
5642
5651
5657
5662
5667
5688 protected bool m_IsResultOfSplit
5689
5691
5696
5697
5698
5700
5704
5705
5706
5708
5711
5712
5713
5719
5720
5728
5731
5732
5734
5735
5737
5738
5743
5744
5749
5751
5752
5754
5755
5757 {
5762
5763 if (!
g_Game.IsDedicatedServer())
5764 {
5766 {
5768
5770 {
5772 }
5773 }
5774
5777 }
5778
5779 m_OldLocation = null;
5780
5782 {
5784 }
5785
5786 if (ConfigIsExisting("headSelectionsToHide"))
5787 {
5790 }
5791
5793 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
5794 {
5796 }
5797
5799
5800 m_IsResultOfSplit = false;
5801
5803 }
5804
5806 {
5807 super.InitItemVariables();
5808
5814 m_Count = ConfigGetInt(
"count");
5815
5818
5823
5826
5831
5843
5847
5848
5851 if (ConfigIsExisting("canBeSplit"))
5852 {
5855 }
5856
5858 if (ConfigIsExisting("itemBehaviour"))
5860
5861
5864 RegisterNetSyncVariableInt("m_VarLiquidType");
5865 RegisterNetSyncVariableInt("m_Cleanness",0,1);
5866
5867 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
5868 RegisterNetSyncVariableFloat("m_ImpactSpeed");
5869 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
5870
5871 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
5872 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
5873 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
5874 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
5875
5876 RegisterNetSyncVariableBool("m_IsBeingPlaced");
5877 RegisterNetSyncVariableBool("m_IsTakeable");
5878 RegisterNetSyncVariableBool("m_IsHologram");
5879
5882 {
5885 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
5886 }
5887
5889
5891 if (ConfigIsExisting("temperaturePerQuantityWeight"))
5893
5895 }
5896
5898 {
5900 }
5901
5903 {
5906 {
5911 }
5912 }
5913
5914 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
5915 {
5917 {
5920 }
5921
5923 }
5924
5926 {
5932 }
5933
5935
5937 {
5939
5940 if (!action)
5941 {
5942 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
5943 return;
5944 }
5945
5947 if (!ai)
5948 {
5950 return;
5951 }
5952
5954 if (!action_array)
5955 {
5956 action_array = new array<ActionBase_Basic>;
5958 }
5959 if (LogManager.IsActionLogEnable())
5960 {
5961 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
5962 }
5963
5964 if (action_array.Find(action) != -1)
5965 {
5966 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
5967 }
5968 else
5969 {
5970 action_array.Insert(action);
5971 }
5972 }
5973
5975 {
5976 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
5977 ActionBase action = player.GetActionManager().GetAction(actionName);
5980
5981 if (action_array)
5982 {
5983 action_array.RemoveItem(action);
5984 }
5985 }
5986
5987
5988
5990 {
5991 ActionOverrideData overrideData = new ActionOverrideData();
5995
5997 if (!actionMap)
5998 {
6001 }
6002
6003 actionMap.Insert(this.
Type(), overrideData);
6004
6005 }
6006
6008
6010
6011
6013 {
6016
6019
6020 string config_to_search = "CfgVehicles";
6021 string muzzle_owner_config;
6022
6024 {
6025 if (IsInherited(Weapon))
6026 config_to_search = "CfgWeapons";
6027
6028 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6029
6030 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
6031
6032 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
6033
6034 if (config_OnFire_subclass_count > 0)
6035 {
6036 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
6037
6038 for (int i = 0; i < config_OnFire_subclass_count; i++)
6039 {
6040 string particle_class = "";
6041 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
6042 string config_OnFire_entry = config_OnFire_class + particle_class;
6043 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
6044 WPOF_array.Insert(WPOF);
6045 }
6046
6047
6049 }
6050 }
6051
6053 {
6054 config_to_search = "CfgWeapons";
6055 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6056
6057 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
6058
6059 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
6060
6061 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
6062 {
6063 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
6064
6065 for (i = 0; i < config_OnBulletCasingEject_count; i++)
6066 {
6067 string particle_class2 = "";
6068 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
6069 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
6070 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
6071 WPOBE_array.Insert(WPOBE);
6072 }
6073
6074
6076 }
6077 }
6078 }
6079
6080
6082 {
6085
6087 {
6088 string config_to_search = "CfgVehicles";
6089
6090 if (IsInherited(Weapon))
6091 config_to_search = "CfgWeapons";
6092
6093 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6094 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
6095
6096 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
6097 {
6098
6100
6102 {
6104 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
6106 return;
6107 }
6108
6111
6112
6113
6114 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
6115 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
6116
6117 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
6118 {
6119 string particle_class = "";
6120 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
6121 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
6122 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
6123
6124 if (entry_type == CT_CLASS)
6125 {
6126 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
6127 WPOOH_array.Insert(WPOF);
6128 }
6129 }
6130
6131
6133 }
6134 }
6135 }
6136
6138 {
6140 }
6141
6143 {
6145 {
6147
6150
6153
6154 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6155 }
6156 }
6157
6159 {
6161 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6162
6164 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6165
6167 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6168
6170 {
6172 }
6173 }
6174
6176 {
6178 }
6179
6181 {
6184 else
6186
6188 {
6191 }
6192 else
6193 {
6196
6199 }
6200
6202 }
6203
6205 {
6207 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6208 }
6209
6211 {
6213 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6215 }
6216
6218 {
6220 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6221 }
6222
6224 {
6227
6228 OverheatingParticle OP = new OverheatingParticle();
6233
6235 }
6236
6238 {
6241
6242 return -1;
6243 }
6244
6246 {
6248 {
6251
6252 for (int i = count; i > 0; --i)
6253 {
6254 int id = i - 1;
6257
6260
6261 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
6262 {
6263 if (p)
6264 {
6267 }
6268 }
6269 }
6270 }
6271 }
6272
6274 {
6276 {
6278 {
6279 int id = i - 1;
6281
6282 if (OP)
6283 {
6285
6286 if (p)
6287 {
6289 }
6290
6291 delete OP;
6292 }
6293 }
6294
6297 }
6298 }
6299
6302 {
6303 return 0.0;
6304 }
6305
6306
6308 {
6309 return 250;
6310 }
6311
6313 {
6314 return 0;
6315 }
6316
6319 {
6321 return true;
6322
6323 return false;
6324 }
6325
6328 {
6331
6333 {
6335 }
6336 else
6337 {
6338
6340 }
6341
6343 }
6344
6351 {
6352 return -1;
6353 }
6354
6355
6356
6357
6359 {
6361 {
6362 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6363 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6364
6365 if (r_index >= 0)
6366 {
6367 InventoryLocation r_il = new InventoryLocation;
6368 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6369
6370 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6373 {
6374 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6375 }
6377 {
6378 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6379 }
6380
6381 }
6382
6383 player.GetHumanInventory().ClearUserReservedLocation(this);
6384 }
6385
6388 }
6389
6390
6391
6392
6394 {
6395 return ItemBase.m_DebugActionsMask;
6396 }
6397
6399 {
6400 return ItemBase.m_DebugActionsMask & mask;
6401 }
6402
6404 {
6405 ItemBase.m_DebugActionsMask = mask;
6406 }
6407
6409 {
6410 ItemBase.m_DebugActionsMask |= mask;
6411 }
6412
6414 {
6415 ItemBase.m_DebugActionsMask &= ~mask;
6416 }
6417
6419 {
6421 {
6423 }
6424 else
6425 {
6427 }
6428 }
6429
6430
6432 {
6433 if (GetEconomyProfile())
6434 {
6435 float q_max = GetEconomyProfile().GetQuantityMax();
6436 if (q_max > 0)
6437 {
6438 float q_min = GetEconomyProfile().GetQuantityMin();
6439 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
6440
6442 {
6443 ComponentEnergyManager comp = GetCompEM();
6445 {
6447 }
6448 }
6450 {
6452
6453 }
6454
6455 }
6456 }
6457 }
6458
6461 {
6462 EntityAI parent = GetHierarchyParent();
6463
6464 if (parent)
6465 {
6466 InventoryLocation inventory_location_to_lock = new InventoryLocation;
6467 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
6468 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
6469 }
6470 }
6471
6474 {
6475 EntityAI parent = GetHierarchyParent();
6476
6477 if (parent)
6478 {
6479 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
6480 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
6481 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
6482 }
6483 }
6484
6486 {
6487
6488
6489
6490
6492
6494 {
6495 if (ScriptInputUserData.CanStoreInputUserData())
6496 {
6497 ScriptInputUserData ctx = new ScriptInputUserData;
6503 ctx.
Write(use_stack_max);
6506
6508 {
6509 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
6510 }
6511 }
6512 }
6513 else if (!
g_Game.IsMultiplayer())
6514 {
6516 }
6517 }
6518
6520 {
6522 }
6523
6525 {
6527 }
6528
6530 {
6532 }
6533
6535 {
6536
6537 return false;
6538 }
6539
6541 {
6542 return false;
6543 }
6544
6548 {
6549 return false;
6550 }
6551
6553 {
6554 return "";
6555 }
6556
6558
6560 {
6561 return false;
6562 }
6563
6565 {
6566 return true;
6567 }
6568
6569
6570
6572 {
6573 return true;
6574 }
6575
6577 {
6578 return true;
6579 }
6580
6582 {
6583 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6585 }
6586
6588 {
6590 }
6591
6593 {
6595 if (!is_being_placed)
6597 SetSynchDirty();
6598 }
6599
6600
6602
6604 {
6606 }
6607
6609 {
6611 }
6612
6614 {
6615 return 1;
6616 }
6617
6619 {
6620 return false;
6621 }
6622
6624 {
6626 SetSynchDirty();
6627 }
6628
6629
6630
6631
6632
6633
6634
6635
6636
6637
6638
6639
6640
6641
6642
6643
6644
6645
6646
6647
6648
6649
6650
6651
6652
6653
6654
6655
6656
6657
6658
6659
6660
6661
6662
6664 {
6665 super.OnMovedInsideCargo(container);
6666
6667 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6668 }
6669
6670 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
6671 {
6672 super.EEItemLocationChanged(oldLoc, newLoc);
6673
6674 PlayerBase newPlayer = null;
6675 PlayerBase oldPlayer = null;
6676
6677 if (newLoc.GetParent())
6678 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
6679
6680 if (oldLoc.GetParent())
6681 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
6682
6684 {
6685 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
6686
6687 if (rIndex >= 0)
6688 {
6689 InventoryLocation rIl = new InventoryLocation;
6690 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
6691
6692 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
6695 {
6696 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
6697 }
6699 {
6701 }
6702
6703 }
6704 }
6705
6707 {
6708 if (newPlayer)
6709 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
6710
6711 if (newPlayer == oldPlayer)
6712 {
6713 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
6714 {
6716 {
6717 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
6718 {
6719 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6720 }
6721 }
6722 else
6723 {
6724 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6725 }
6726 }
6727
6728 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
6729 {
6730 int type = oldLoc.GetType();
6732 {
6733 oldLoc.GetParent().GetOnSetLock().Invoke(this);
6734 }
6736 {
6737 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
6738 }
6739 }
6740 if (!m_OldLocation)
6741 {
6742 m_OldLocation = new InventoryLocation;
6743 }
6744 m_OldLocation.Copy(oldLoc);
6745 }
6746 else
6747 {
6748 if (m_OldLocation)
6749 {
6750 m_OldLocation.Reset();
6751 }
6752 }
6753
6754 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
6755 }
6756 else
6757 {
6758 if (newPlayer)
6759 {
6760 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
6761 if (resIndex >= 0)
6762 {
6763 InventoryLocation il = new InventoryLocation;
6764 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
6766 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
6769 {
6770 il.
GetParent().GetOnReleaseLock().Invoke(it);
6771 }
6773 {
6775 }
6776
6777 }
6778 }
6780 {
6781
6783 }
6784
6785 if (m_OldLocation)
6786 {
6787 m_OldLocation.Reset();
6788 }
6789 }
6790
6792 {
6793 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
6794 }
6795
6797 {
6798 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
6799 }
6800 }
6801
6802 override void EOnContact(IEntity other, Contact extra)
6803 {
6805 {
6806 int liquidType = -1;
6808 if (impactSpeed > 0.0)
6809 {
6811 #ifndef SERVER
6813 #else
6815 SetSynchDirty();
6816 #endif
6818 }
6819 }
6820
6821 #ifdef SERVER
6822 if (GetCompEM() && GetCompEM().IsPlugged())
6823 {
6824 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
6825 GetCompEM().UnplugThis();
6826 }
6827 #endif
6828 }
6829
6831
6833 {
6835 }
6836
6838 {
6839
6840 }
6841
6843 {
6844 super.OnItemLocationChanged(old_owner, new_owner);
6845
6846 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
6847 PlayerBase playerNew = PlayerBase.Cast(new_owner);
6848
6849 if (!relatedPlayer && playerNew)
6850 relatedPlayer = playerNew;
6851
6852 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
6853 {
6855 if (actionMgr)
6856 {
6857 ActionBase currentAction = actionMgr.GetRunningAction();
6858 if (currentAction)
6860 }
6861 }
6862
6863 Man ownerPlayerOld = null;
6864 Man ownerPlayerNew = null;
6865
6866 if (old_owner)
6867 {
6868 if (old_owner.
IsMan())
6869 {
6870 ownerPlayerOld = Man.Cast(old_owner);
6871 }
6872 else
6873 {
6874 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
6875 }
6876 }
6877 else
6878 {
6880 {
6882
6883 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
6884 {
6885 GetCompEM().UnplugThis();
6886 }
6887 }
6888 }
6889
6890 if (new_owner)
6891 {
6892 if (new_owner.
IsMan())
6893 {
6894 ownerPlayerNew = Man.Cast(new_owner);
6895 }
6896 else
6897 {
6898 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
6899 }
6900 }
6901
6902 if (ownerPlayerOld != ownerPlayerNew)
6903 {
6904 if (ownerPlayerOld)
6905 {
6906 array<EntityAI> subItemsExit = new array<EntityAI>;
6908 for (int i = 0; i < subItemsExit.Count(); i++)
6909 {
6912 }
6913 }
6914
6915 if (ownerPlayerNew)
6916 {
6917 array<EntityAI> subItemsEnter = new array<EntityAI>;
6919 for (int j = 0; j < subItemsEnter.Count(); j++)
6920 {
6923 }
6924 }
6925 }
6926 else if (ownerPlayerNew != null)
6927 {
6928 PlayerBase nplayer;
6929 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
6930 {
6931 array<EntityAI> subItemsUpdate = new array<EntityAI>;
6933 for (int k = 0; k < subItemsUpdate.Count(); k++)
6934 {
6936 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
6937 }
6938 }
6939 }
6940
6941 if (old_owner)
6942 old_owner.OnChildItemRemoved(this);
6943 if (new_owner)
6944 new_owner.OnChildItemReceived(this);
6945 }
6946
6947
6949 {
6950 super.EEDelete(parent);
6951 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
6952 if (player)
6953 {
6955
6956 if (player.IsAlive())
6957 {
6958 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6959 if (r_index >= 0)
6960 {
6961 InventoryLocation r_il = new InventoryLocation;
6962 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6963
6964 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6967 {
6968 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6969 }
6971 {
6972 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6973 }
6974
6975 }
6976
6977 player.RemoveQuickBarEntityShortcut(this);
6978 }
6979 }
6980 }
6981
6983 {
6984 super.EEKilled(killer);
6985
6988 {
6989 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
6990 {
6991 if (IsMagazine())
6992 {
6993 if (Magazine.Cast(this).GetAmmoCount() > 0)
6994 {
6996 }
6997 }
6998 else
6999 {
7001 }
7002 }
7003 }
7004 }
7005
7007 {
7008 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7009
7010 super.OnWasAttached(parent, slot_id);
7011
7014
7017 }
7018
7020 {
7021 super.OnWasDetached(parent, slot_id);
7022
7025
7028 }
7029
7031 {
7032 int idx;
7035
7036 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7037 if (inventory_slots.Count() < 1)
7038 {
7039 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
7040 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
7041 }
7042 else
7043 {
7044 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
7045 }
7046
7047 idx = inventory_slots.Find(slot);
7048 if (idx < 0)
7049 return "";
7050
7051 return attach_types.Get(idx);
7052 }
7053
7055 {
7056 int idx = -1;
7057 string slot;
7058
7061
7062 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7063 if (inventory_slots.Count() < 1)
7064 {
7065 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
7066 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7067 }
7068 else
7069 {
7070 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
7071 if (detach_types.Count() < 1)
7072 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7073 }
7074
7075 for (int i = 0; i < inventory_slots.Count(); i++)
7076 {
7077 slot = inventory_slots.Get(i);
7078 }
7079
7080 if (slot != "")
7081 {
7082 if (detach_types.Count() == 1)
7083 idx = 0;
7084 else
7085 idx = inventory_slots.Find(slot);
7086 }
7087 if (idx < 0)
7088 return "";
7089
7090 return detach_types.Get(idx);
7091 }
7092
7094 {
7095
7097
7098
7099 float min_time = 1;
7100 float max_time = 3;
7101 float delay = Math.RandomFloat(min_time, max_time);
7102
7103 explode_timer.Run(delay, this, "DoAmmoExplosion");
7104 }
7105
7107 {
7108 Magazine magazine = Magazine.Cast(this);
7109 int pop_sounds_count = 6;
7110 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
7111
7112
7113 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
7114 string sound_name = pop_sounds[ sound_idx ];
7115 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
7116
7117
7118 magazine.ServerAddAmmoCount(-1);
7119
7120
7121 float min_temp_to_explode = 100;
7122
7123 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
7124 {
7126 }
7127 }
7128
7129
7130 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
7131 {
7132 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
7133
7134 const int CHANCE_DAMAGE_CARGO = 4;
7135 const int CHANCE_DAMAGE_ATTACHMENT = 1;
7136 const int CHANCE_DAMAGE_NOTHING = 2;
7137
7139 {
7140 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
7141 int chances;
7142 int rnd;
7143
7144 if (GetInventory().GetCargo())
7145 {
7146 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7147 rnd = Math.RandomInt(0,chances);
7148
7149 if (rnd < CHANCE_DAMAGE_CARGO)
7150 {
7152 }
7153 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
7154 {
7156 }
7157 }
7158 else
7159 {
7160 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7161 rnd = Math.RandomInt(0,chances);
7162
7163 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
7164 {
7166 }
7167 }
7168 }
7169 }
7170
7172 {
7173 CargoBase cargo = GetInventory().GetCargo();
7174 if (cargo)
7175 {
7177 if (item_count > 0)
7178 {
7179 int random_pick = Math.RandomInt(0, item_count);
7181 if (!item.IsExplosive())
7182 {
7183 item.AddHealth("","",damage);
7184 return true;
7185 }
7186 }
7187 }
7188 return false;
7189 }
7190
7192 {
7193 GameInventory inventory = GetInventory();
7195 if (attachment_count > 0)
7196 {
7197 int random_pick = Math.RandomInt(0, attachment_count);
7199 if (!attachment.IsExplosive())
7200 {
7201 attachment.AddHealth("","",damage);
7202 return true;
7203 }
7204 }
7205 return false;
7206 }
7207
7209 {
7211 }
7212
7214 {
7216 return GetInventory().CanRemoveEntity();
7217
7218 return false;
7219 }
7220
7222 {
7223
7225 return false;
7226
7227
7229 return false;
7230
7231
7232
7234 if (delta == 0)
7235 return false;
7236
7237
7238 return true;
7239 }
7240
7242 {
7244 {
7245 if (ScriptInputUserData.CanStoreInputUserData())
7246 {
7247 ScriptInputUserData ctx = new ScriptInputUserData;
7252 ctx.
Write(destination_entity);
7256 }
7257 }
7258 else if (!
g_Game.IsMultiplayer())
7259 {
7261 }
7262 }
7263
7265 {
7266 float split_quantity_new;
7270 InventoryLocation loc = new InventoryLocation;
7271
7272 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7273 {
7275 split_quantity_new = stack_max;
7276 else
7278
7280 {
7281 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7282 if (new_item)
7283 {
7284 new_item.SetResultOfSplit(true);
7285 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7287 new_item.
SetQuantity(split_quantity_new,
false,
true);
7288 }
7289 }
7290 }
7291 else if (destination_entity && slot_id == -1)
7292 {
7293 if (quantity > stack_max)
7294 split_quantity_new = stack_max;
7295 else
7296 split_quantity_new = quantity;
7297
7299 {
7300 GameInventory destinationInventory = destination_entity.GetInventory();
7302 {
7305 }
7306
7307 if (new_item)
7308 {
7309 new_item.SetResultOfSplit(true);
7310 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7312 new_item.
SetQuantity(split_quantity_new,
false,
true);
7313 }
7314 }
7315 }
7316 else
7317 {
7318 if (stack_max != 0)
7319 {
7321 {
7323 }
7324
7325 if (split_quantity_new == 0)
7326 {
7327 if (!
g_Game.IsMultiplayer())
7328 player.PhysicalPredictiveDropItem(this);
7329 else
7330 player.ServerDropEntity(this);
7331 return;
7332 }
7333
7335 {
7337
7338 if (new_item)
7339 {
7340 new_item.SetResultOfSplit(true);
7341 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7344 new_item.PlaceOnSurface();
7345 }
7346 }
7347 }
7348 }
7349 }
7350
7352 {
7353 float split_quantity_new;
7357 InventoryLocation loc = new InventoryLocation;
7358
7359 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7360 {
7362 split_quantity_new = stack_max;
7363 else
7365
7367 {
7368 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7369 if (new_item)
7370 {
7371 new_item.SetResultOfSplit(true);
7372 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7374 new_item.
SetQuantity(split_quantity_new,
false,
true);
7375 }
7376 }
7377 }
7378 else if (destination_entity && slot_id == -1)
7379 {
7380 if (quantity > stack_max)
7381 split_quantity_new = stack_max;
7382 else
7383 split_quantity_new = quantity;
7384
7386 {
7387 GameInventory destinationInventory = destination_entity.GetInventory();
7389 {
7392 }
7393
7394 if (new_item)
7395 {
7396 new_item.SetResultOfSplit(true);
7397 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7399 new_item.
SetQuantity(split_quantity_new,
false,
true);
7400 }
7401 }
7402 }
7403 else
7404 {
7405 if (stack_max != 0)
7406 {
7408 {
7410 }
7411
7413 {
7415
7416 if (new_item)
7417 {
7418 new_item.SetResultOfSplit(true);
7419 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7422 new_item.PlaceOnSurface();
7423 }
7424 }
7425 }
7426 }
7427 }
7428
7430 {
7432 {
7433 if (ScriptInputUserData.CanStoreInputUserData())
7434 {
7435 ScriptInputUserData ctx = new ScriptInputUserData;
7440 dst.WriteToContext(ctx);
7442 }
7443 }
7444 else if (!
g_Game.IsMultiplayer())
7445 {
7447 }
7448 }
7449
7451 {
7453 {
7454 if (ScriptInputUserData.CanStoreInputUserData())
7455 {
7456 ScriptInputUserData ctx = new ScriptInputUserData;
7461 ctx.
Write(destination_entity);
7467 }
7468 }
7469 else if (!
g_Game.IsMultiplayer())
7470 {
7472 }
7473 }
7474
7476 {
7478 }
7479
7481 {
7483 float split_quantity_new;
7485 if (dst.IsValid())
7486 {
7487 int slot_id = dst.GetSlot();
7489
7490 if (quantity > stack_max)
7491 split_quantity_new = stack_max;
7492 else
7493 split_quantity_new = quantity;
7494
7496 {
7498
7499 if (new_item)
7500 {
7501 new_item.SetResultOfSplit(true);
7502 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7504 new_item.
SetQuantity(split_quantity_new,
false,
true);
7505 }
7506
7507 return new_item;
7508 }
7509 }
7510
7511 return null;
7512 }
7513
7515 {
7517 float split_quantity_new;
7519 if (destination_entity)
7520 {
7522 if (quantity > stackable)
7523 split_quantity_new = stackable;
7524 else
7525 split_quantity_new = quantity;
7526
7528 {
7529 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
7530 if (new_item)
7531 {
7532 new_item.SetResultOfSplit(true);
7533 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7535 new_item.
SetQuantity(split_quantity_new,
false,
true);
7536 }
7537 }
7538 }
7539 }
7540
7542 {
7544 {
7545 if (ScriptInputUserData.CanStoreInputUserData())
7546 {
7547 ScriptInputUserData ctx = new ScriptInputUserData;
7552 ItemBase destination_entity =
this;
7553 ctx.
Write(destination_entity);
7557 }
7558 }
7559 else if (!
g_Game.IsMultiplayer())
7560 {
7562 }
7563 }
7564
7566 {
7568 float split_quantity_new;
7570 if (player)
7571 {
7573 if (quantity > stackable)
7574 split_quantity_new = stackable;
7575 else
7576 split_quantity_new = quantity;
7577
7579 {
7580 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
7581 new_item =
ItemBase.Cast(in_hands);
7582 if (new_item)
7583 {
7584 new_item.SetResultOfSplit(true);
7585 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7587 new_item.SetQuantity(split_quantity_new, false, true);
7588 }
7589 }
7590 }
7591 }
7592
7594 {
7596 float split_quantity_new = Math.Floor(quantity * 0.5);
7597
7599 return;
7600
7602
7603 if (new_item)
7604 {
7605 if (new_item.GetQuantityMax() < split_quantity_new)
7606 {
7607 split_quantity_new = new_item.GetQuantityMax();
7608 }
7609
7610 new_item.SetResultOfSplit(true);
7611 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7612
7614 {
7617 }
7618 else
7619 {
7621 new_item.
SetQuantity(split_quantity_new,
false,
true);
7622 }
7623 }
7624 }
7625
7627 {
7629 float split_quantity_new = Math.Floor(quantity / 2);
7630
7632 return;
7633
7634 InventoryLocation invloc = new InventoryLocation;
7636
7638 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
7639
7640 if (new_item)
7641 {
7642 if (new_item.GetQuantityMax() < split_quantity_new)
7643 {
7644 split_quantity_new = new_item.GetQuantityMax();
7645 }
7647 {
7650 }
7651 else if (split_quantity_new > 1)
7652 {
7654 new_item.
SetQuantity(split_quantity_new,
false,
true);
7655 }
7656 }
7657 }
7658
7661 {
7662 SetWeightDirty();
7664
7665 if (parent)
7666 parent.OnAttachmentQuantityChangedEx(this, delta);
7667
7669 {
7671 {
7673 }
7675 {
7676 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
7678 }
7679 }
7680 }
7681
7684 {
7685
7686 }
7687
7690 {
7692 }
7693
7695 {
7696 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
7697
7699 {
7700 if (newLevel == GameConstants.STATE_RUINED)
7701 {
7703 EntityAI parent = GetHierarchyParent();
7704 if (parent && parent.IsFireplace())
7705 {
7706 CargoBase cargo = GetInventory().GetCargo();
7707 if (cargo)
7708 {
7710 {
7712 }
7713 }
7714 }
7715 }
7716
7718 {
7719
7721 return;
7722 }
7723
7724 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
7725 {
7727 }
7728 }
7729 }
7730
7731
7733 {
7734 super.OnRightClick();
7735
7737 {
7739 {
7740 if (ScriptInputUserData.CanStoreInputUserData())
7741 {
7742 EntityAI root = GetHierarchyRoot();
7743 Man playerOwner = GetHierarchyRootPlayer();
7744 InventoryLocation dst = new InventoryLocation;
7745
7746
7747 if (!playerOwner && root && root == this)
7748 {
7750 }
7751 else
7752 {
7753
7754 GetInventory().GetCurrentInventoryLocation(dst);
7756 {
7757 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7759 {
7761 }
7762 else
7763 {
7765
7766
7767 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
7768 {
7770 }
7771 else
7772 {
7773 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
7774 }
7775 }
7776 }
7777 }
7778
7779 ScriptInputUserData ctx = new ScriptInputUserData;
7787 }
7788 }
7789 else if (!
g_Game.IsMultiplayer())
7790 {
7792 }
7793 }
7794 }
7795
7797 {
7798 if (root)
7799 {
7800 vector m4[4];
7801 root.GetTransform(m4);
7802 dst.SetGround(this, m4);
7803 }
7804 else
7805 {
7806 GetInventory().GetCurrentInventoryLocation(dst);
7807 }
7808 }
7809
7810 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
7811 {
7812
7813 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
7814 return false;
7815
7816 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
7817 return false;
7818
7819
7821 return false;
7822
7823
7824 Magazine mag = Magazine.Cast(this);
7825 if (mag)
7826 {
7827 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
7828 return false;
7829
7830 if (stack_max_limit)
7831 {
7832 Magazine other_mag = Magazine.Cast(other_item);
7833 if (other_item)
7834 {
7835 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
7836 return false;
7837 }
7838
7839 }
7840 }
7841 else
7842 {
7843
7845 return false;
7846
7848 return false;
7849 }
7850
7851 PlayerBase player = null;
7852 if (CastTo(player, GetHierarchyRootPlayer()))
7853 {
7854 if (player.GetInventory().HasAttachment(this))
7855 return false;
7856
7857 if (player.IsItemsToDelete())
7858 return false;
7859 }
7860
7861 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
7862 return false;
7863
7864 int slotID;
7866 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
7867 return false;
7868
7869 return true;
7870 }
7871
7873 {
7875 }
7876
7878 {
7879 return m_IsResultOfSplit;
7880 }
7881
7883 {
7884 m_IsResultOfSplit = value;
7885 }
7886
7888 {
7890 }
7891
7893 {
7894 float other_item_quantity = other_item.GetQuantity();
7895 float this_free_space;
7896
7898
7900
7901 if (other_item_quantity > this_free_space)
7902 {
7903 return this_free_space;
7904 }
7905 else
7906 {
7907 return other_item_quantity;
7908 }
7909 }
7910
7912 {
7914 }
7915
7917 {
7919 return;
7920
7921 if (!IsMagazine() && other_item)
7922 {
7924 if (quantity_used != 0)
7925 {
7926 float hp1 = GetHealth01("","");
7927 float hp2 = other_item.GetHealth01("","");
7928 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
7929 hpResult = hpResult / (
GetQuantity() + quantity_used);
7930
7931 hpResult *= GetMaxHealth();
7932 Math.Round(hpResult);
7933 SetHealth("", "Health", hpResult);
7934
7936 other_item.AddQuantity(-quantity_used);
7937 }
7938 }
7940 }
7941
7943 {
7944 #ifdef SERVER
7945 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
7946 GetHierarchyParent().IncreaseLifetimeUp();
7947 #endif
7948 };
7949
7951 {
7952 PlayerBase p = PlayerBase.Cast(player);
7953
7954 array<int> recipesIds = p.m_Recipes;
7955 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
7956 if (moduleRecipesManager)
7957 {
7958 EntityAI itemInHands = player.GetEntityInHands();
7959 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
7960 }
7961
7962 for (int i = 0;i < recipesIds.Count(); i++)
7963 {
7964 int key = recipesIds.Get(i);
7965 string recipeName = moduleRecipesManager.GetRecipeName(key);
7967 }
7968 }
7969
7970
7971 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
7972 {
7973 super.GetDebugActions(outputList);
7974
7975
7981
7982
7987
7992
7993
7997
7998
8000 {
8004 }
8005
8008
8009
8013
8015
8016 InventoryLocation loc = new InventoryLocation();
8017 GetInventory().GetCurrentInventoryLocation(loc);
8019 {
8020 if (Gizmo_IsSupported())
8023 }
8024
8026 }
8027
8028
8029
8030
8032 {
8033 super.OnAction(action_id, player, ctx);
8034
8036 {
8037 switch (action_id)
8038 {
8042 return true;
8046 return true;
8047 }
8048 }
8049
8051 {
8052 switch (action_id)
8053 {
8055 Delete();
8056 return true;
8057 }
8058 }
8059
8060 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
8061 {
8062 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8063 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
8064 PlayerBase p = PlayerBase.Cast(player);
8065 if (
EActions.RECIPES_RANGE_START < 1000)
8066 {
8067 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
8068 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
8069 }
8070 }
8071 #ifndef SERVER
8072 else if (action_id ==
EActions.WATCH_PLAYER)
8073 {
8074 PluginDeveloper.SetDeveloperItemClientEx(player);
8075 }
8076 #endif
8078 {
8079 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
8080 {
8081 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
8082 OnDebugButtonPressServer(id + 1);
8083 }
8084
8085 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
8086 {
8087 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
8089 }
8090
8091 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
8092 {
8093 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
8095 }
8096
8097 else if (action_id ==
EActions.ADD_QUANTITY)
8098 {
8099 if (IsMagazine())
8100 {
8101 Magazine mag = Magazine.Cast(this);
8102 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
8103 }
8104 else
8105 {
8107 }
8108
8109 if (m_EM)
8110 {
8111 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
8112 }
8113
8114 }
8115
8116 else if (action_id ==
EActions.REMOVE_QUANTITY)
8117 {
8118 if (IsMagazine())
8119 {
8120 Magazine mag2 = Magazine.Cast(this);
8121 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
8122 }
8123 else
8124 {
8126 }
8127 if (m_EM)
8128 {
8129 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
8130 }
8131
8132 }
8133
8134 else if (action_id ==
EActions.SET_QUANTITY_0)
8135 {
8137
8138 if (m_EM)
8139 {
8140 m_EM.SetEnergy(0);
8141 }
8142 }
8143
8144 else if (action_id ==
EActions.SET_MAX_QUANTITY)
8145 {
8147
8148 if (m_EM)
8149 {
8150 m_EM.SetEnergy(m_EM.GetEnergyMax());
8151 }
8152 }
8153
8154 else if (action_id ==
EActions.ADD_HEALTH)
8155 {
8156 AddHealth("","",GetMaxHealth("","Health")/5);
8157 }
8158 else if (action_id ==
EActions.REMOVE_HEALTH)
8159 {
8160 AddHealth("","",-GetMaxHealth("","Health")/5);
8161 }
8162 else if (action_id ==
EActions.DESTROY_HEALTH)
8163 {
8164 SetHealth01("","",0);
8165 }
8166 else if (action_id ==
EActions.WATCH_ITEM)
8167 {
8169 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
8170 #ifdef DEVELOPER
8171 SetDebugDeveloper_item(this);
8172 #endif
8173 }
8174
8175 else if (action_id ==
EActions.ADD_TEMPERATURE)
8176 {
8177 AddTemperature(20);
8178
8179 }
8180
8181 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
8182 {
8183 AddTemperature(-20);
8184
8185 }
8186
8187 else if (action_id ==
EActions.FLIP_FROZEN)
8188 {
8189 SetFrozen(!GetIsFrozen());
8190
8191 }
8192
8193 else if (action_id ==
EActions.ADD_WETNESS)
8194 {
8196
8197 }
8198
8199 else if (action_id ==
EActions.REMOVE_WETNESS)
8200 {
8202
8203 }
8204
8205 else if (action_id ==
EActions.LIQUIDTYPE_UP)
8206 {
8209
8210
8211 }
8212
8213 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
8214 {
8217 }
8218
8219 else if (action_id ==
EActions.MAKE_SPECIAL)
8220 {
8221 auto debugParams = DebugSpawnParams.WithPlayer(player);
8222 OnDebugSpawnEx(debugParams);
8223 }
8224
8225 }
8226
8227
8228 return false;
8229 }
8230
8231
8232
8233
8237
8240
8241
8242
8244 {
8245 return false;
8246 }
8247
8248
8250 {
8251 return true;
8252 }
8253
8254
8256 {
8257 return true;
8258 }
8259
8260
8261
8263 {
8264 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
8265 return g_Game.ConfigIsExisting(config_path);
8266 }
8267
8270 {
8271 return null;
8272 }
8273
8275 {
8276 return false;
8277 }
8278
8280 {
8281 return false;
8282 }
8283
8287
8288
8290 {
8291 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8292 return module_repairing.CanRepair(this, item_repair_kit);
8293 }
8294
8295
8296 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
8297 {
8298 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8299 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
8300 }
8301
8302
8304 {
8305
8306
8307
8308
8309
8310
8311
8312
8313 return 1;
8314 }
8315
8316
8317
8319 {
8321 }
8322
8323
8324
8326 {
8328 }
8329
8330
8339 {
8340 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8341
8342 if (player)
8343 {
8344 player.MessageStatus(text);
8345 }
8346 }
8347
8348
8357 {
8358 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8359
8360 if (player)
8361 {
8362 player.MessageAction(text);
8363 }
8364 }
8365
8366
8375 {
8376 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8377
8378 if (player)
8379 {
8380 player.MessageFriendly(text);
8381 }
8382 }
8383
8384
8393 {
8394 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8395
8396 if (player)
8397 {
8398 player.MessageImportant(text);
8399 }
8400 }
8401
8403 {
8404 return true;
8405 }
8406
8407
8408 override bool KindOf(
string tag)
8409 {
8410 bool found = false;
8411 string item_name = this.
GetType();
8413 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
8414
8415 int array_size = item_tag_array.Count();
8416 for (int i = 0; i < array_size; i++)
8417 {
8418 if (item_tag_array.Get(i) == tag)
8419 {
8420 found = true;
8421 break;
8422 }
8423 }
8424 return found;
8425 }
8426
8427
8429 {
8430
8431 super.OnRPC(sender, rpc_type,ctx);
8432
8433
8434 switch (rpc_type)
8435 {
8436 #ifndef SERVER
8437 case ERPCs.RPC_SOUND_LOCK_ATTACH:
8438 Param2<bool, string> p = new Param2<bool, string>(false, "");
8439
8441 return;
8442
8443 bool play = p.param1;
8444 string soundSet = p.param2;
8445
8446 if (play)
8447 {
8449 {
8451 {
8453 }
8454 }
8455 else
8456 {
8458 }
8459 }
8460 else
8461 {
8463 }
8464
8465 break;
8466 #endif
8467
8468 }
8469
8471 {
8473 }
8474 }
8475
8476
8477
8478
8480 {
8481 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8482 return plugin.GetID(
name);
8483 }
8484
8486 {
8487 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8488 return plugin.GetName(id);
8489 }
8490
8493 {
8494
8495
8496 int varFlags;
8497 if (!ctx.
Read(varFlags))
8498 return;
8499
8500 if (varFlags & ItemVariableFlags.FLOAT)
8501 {
8503 }
8504 }
8505
8507 {
8508
8509 super.SerializeNumericalVars(floats_out);
8510
8511
8512
8514 {
8516 }
8517
8519 {
8521 }
8522
8524 {
8526 }
8527
8529 {
8534 }
8535
8537 {
8539 }
8540 }
8541
8543 {
8544
8545 super.DeSerializeNumericalVars(floats);
8546
8547
8548 int index = 0;
8549 int mask = Math.Round(floats.Get(index));
8550
8551 index++;
8552
8554 {
8556 {
8558 }
8559 else
8560 {
8561 float quantity = floats.Get(index);
8563 }
8564 index++;
8565 }
8566
8568 {
8569 float wet = floats.Get(index);
8571 index++;
8572 }
8573
8575 {
8576 int liquidtype = Math.Round(floats.Get(index));
8578 index++;
8579 }
8580
8582 {
8584 index++;
8586 index++;
8588 index++;
8590 index++;
8591 }
8592
8594 {
8595 int cleanness = Math.Round(floats.Get(index));
8597 index++;
8598 }
8599 }
8600
8602 {
8603 super.WriteVarsToCTX(ctx);
8604
8605
8607 {
8609 }
8610
8612 {
8614 }
8615
8617 {
8619 }
8620
8622 {
8623 int r,g,b,a;
8629 }
8630
8632 {
8634 }
8635 }
8636
8638 {
8639 if (!super.ReadVarsFromCTX(ctx,version))
8640 return false;
8641
8642 int intValue;
8643 float value;
8644
8645 if (version < 140)
8646 {
8647 if (!ctx.
Read(intValue))
8648 return false;
8649
8650 m_VariablesMask = intValue;
8651 }
8652
8654 {
8655 if (!ctx.
Read(value))
8656 return false;
8657
8659 {
8661 }
8662 else
8663 {
8665 }
8666 }
8667
8668 if (version < 140)
8669 {
8671 {
8672 if (!ctx.
Read(value))
8673 return false;
8674 SetTemperatureDirect(value);
8675 }
8676 }
8677
8679 {
8680 if (!ctx.
Read(value))
8681 return false;
8683 }
8684
8686 {
8687 if (!ctx.
Read(intValue))
8688 return false;
8690 }
8691
8693 {
8694 int r,g,b,a;
8696 return false;
8698 return false;
8700 return false;
8702 return false;
8703
8705 }
8706
8708 {
8709 if (!ctx.
Read(intValue))
8710 return false;
8712 }
8713
8714 if (version >= 138 && version < 140)
8715 {
8717 {
8718 if (!ctx.
Read(intValue))
8719 return false;
8720 SetFrozen(intValue);
8721 }
8722 }
8723
8724 return true;
8725 }
8726
8727
8729 {
8732 {
8734 }
8735
8736 if (!super.OnStoreLoad(ctx, version))
8737 {
8739 return false;
8740 }
8741
8742 if (version >= 114)
8743 {
8744 bool hasQuickBarIndexSaved;
8745
8746 if (!ctx.
Read(hasQuickBarIndexSaved))
8747 {
8749 return false;
8750 }
8751
8752 if (hasQuickBarIndexSaved)
8753 {
8754 int itmQBIndex;
8755
8756
8757 if (!ctx.
Read(itmQBIndex))
8758 {
8760 return false;
8761 }
8762
8763 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
8764 if (itmQBIndex != -1 && parentPlayer)
8765 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
8766 }
8767 }
8768 else
8769 {
8770
8771 PlayerBase player;
8772 int itemQBIndex;
8773 if (version ==
int.
MAX)
8774 {
8775 if (!ctx.
Read(itemQBIndex))
8776 {
8778 return false;
8779 }
8780 }
8781 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
8782 {
8783
8784 if (!ctx.
Read(itemQBIndex))
8785 {
8787 return false;
8788 }
8789 if (itemQBIndex != -1 && player)
8790 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
8791 }
8792 }
8793
8794 if (version < 140)
8795 {
8796
8797 if (!LoadVariables(ctx, version))
8798 {
8800 return false;
8801 }
8802 }
8803
8804
8806 {
8808 return false;
8809 }
8810 if (version >= 132)
8811 {
8813 if (raib)
8814 {
8816 {
8818 return false;
8819 }
8820 }
8821 }
8822
8824 return true;
8825 }
8826
8827
8828
8830 {
8831 super.OnStoreSave(ctx);
8832
8833 PlayerBase player;
8834 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
8835 {
8837
8838 int itemQBIndex = -1;
8839 itemQBIndex = player.FindQuickBarEntityIndex(this);
8840 ctx.
Write(itemQBIndex);
8841 }
8842 else
8843 {
8845 }
8846
8848
8850 if (raib)
8851 {
8853 }
8854 }
8855
8856
8858 {
8859 super.AfterStoreLoad();
8860
8862 {
8864 }
8865
8867 {
8870 }
8871 }
8872
8874 {
8875 super.EEOnAfterLoad();
8876
8878 {
8880 }
8881
8884 }
8885
8887 {
8888 return false;
8889 }
8890
8891
8892
8894 {
8896 {
8897 #ifdef PLATFORM_CONSOLE
8898
8900 {
8902 if (menu)
8903 {
8905 }
8906 }
8907 #endif
8908 }
8909
8911 {
8914 }
8915
8917 {
8918 SetWeightDirty();
8920 }
8922 {
8925 }
8926
8928 {
8931
8934 }
8936 {
8940 }
8941
8942 super.OnVariablesSynchronized();
8943 }
8944
8945
8946
8948 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
8949 {
8950 if (!IsServerCheck(allow_client))
8951 return false;
8952
8954 return false;
8955
8958
8959 if (value <= (min + 0.001))
8960 value = min;
8961
8962 if (value == min)
8963 {
8964 if (destroy_config)
8965 {
8966 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
8967 if (dstr)
8968 {
8970 this.Delete();
8971 return true;
8972 }
8973 }
8974 else if (destroy_forced)
8975 {
8977 this.Delete();
8978 return true;
8979 }
8980
8982 }
8983
8986
8988 {
8989 EntityAI parent = GetHierarchyRoot();
8990 InventoryLocation iLoc = new InventoryLocation();
8991 GetInventory().GetCurrentInventoryLocation(iLoc);
8993 {
8994 int iLocSlot = iLoc.
GetSlot();
8996 {
8998 }
9000 {
9002 }
9003 }
9004 }
9005
9007 {
9009
9010 if (delta)
9012 }
9013
9015
9016 return false;
9017 }
9018
9019
9021 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9022 {
9024 }
9025
9027 {
9030 }
9031
9033 {
9036 }
9037
9039 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9040 {
9041 float value_clamped = Math.Clamp(value, 0, 1);
9043 SetQuantity(result, destroy_config, destroy_forced);
9044 }
9045
9046
9049 {
9051 }
9052
9054 {
9056 }
9057
9058
9059
9060
9061
9062
9063
9064
9065
9066
9068 {
9069 int slot = -1;
9070 GameInventory inventory = GetInventory();
9071 if (inventory)
9072 {
9073 InventoryLocation il = new InventoryLocation;
9076 }
9077
9079 }
9080
9082 {
9083 float quantity_max = 0;
9084
9086 {
9087 if (attSlotID != -1)
9088 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
9089
9090 if (quantity_max <= 0)
9092 }
9093
9094 if (quantity_max <= 0)
9096
9097 return quantity_max;
9098 }
9099
9101 {
9103 }
9104
9106 {
9108 }
9109
9110
9112 {
9114 }
9115
9117 {
9119 }
9120
9122 {
9124 }
9125
9126
9128 {
9129
9130 float weightEx = GetWeightEx();
9131 float special = GetInventoryAndCargoWeight();
9132 return weightEx - special;
9133 }
9134
9135
9137 {
9139 }
9140
9142 {
9144 {
9145 #ifdef DEVELOPER
9146 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9147 {
9148 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
9150 }
9151 #endif
9152
9154 }
9155 else if (HasEnergyManager())
9156 {
9157 #ifdef DEVELOPER
9158 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9159 {
9160 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
9161 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
9162 }
9163 #endif
9164 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
9165 }
9166 else
9167 {
9168 #ifdef DEVELOPER
9169 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9170 {
9171 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
9172 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
9173 }
9174 #endif
9175 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
9176 }
9177 }
9178
9181 {
9182 int item_count = 0;
9184
9185 GameInventory inventory = GetInventory();
9186 CargoBase cargo = inventory.
GetCargo();
9187 if (cargo != NULL)
9188 {
9190 }
9191
9193 for (int i = 0; i < nAttachments; ++i)
9194 {
9196 if (item)
9197 item_count += item.GetNumberOfItems();
9198 }
9199 return item_count;
9200 }
9201
9204 {
9205 float weight = 0;
9206 float wetness = 1;
9207 if (include_wetness)
9210 {
9211 weight = wetness * m_ConfigWeight;
9212 }
9214 {
9215 weight = 1;
9216 }
9217 return weight;
9218 }
9219
9220
9221
9223 {
9224 GameInventory inventory = GetInventory();
9225 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
9226 {
9227 array<EntityAI> items = new array<EntityAI>;
9229 for (int i = 0; i < items.Count(); ++i)
9230 {
9232 if (item)
9233 {
9234 g_Game.ObjectDelete(item);
9235 }
9236 }
9237 }
9238 }
9239
9240
9241
9242
9244 {
9245 float energy = 0;
9246 if (HasEnergyManager())
9247 {
9248 energy = GetCompEM().GetEnergy();
9249 }
9250 return energy;
9251 }
9252
9253
9255 {
9256 super.OnEnergyConsumed();
9257
9259 }
9260
9262 {
9263 super.OnEnergyAdded();
9264
9266 }
9267
9268
9270 {
9271 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
9272 {
9274 {
9275 float energy_0to1 = GetCompEM().GetEnergy0To1();
9277 }
9278 }
9279 }
9280
9281
9283 {
9284 return ConfigGetFloat("heatIsolation");
9285 }
9286
9288 {
9290 }
9291
9293 {
9294 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
9295 if (
g_Game.ConfigIsExisting(paramPath))
9296 return g_Game.ConfigGetFloat(paramPath);
9297
9298 return 0.0;
9299 }
9300
9302 {
9303 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
9304 if (
g_Game.ConfigIsExisting(paramPath))
9305 return g_Game.ConfigGetFloat(paramPath);
9306
9307 return 0.0;
9308 }
9309
9310 override void SetWet(
float value,
bool allow_client =
false)
9311 {
9312 if (!IsServerCheck(allow_client))
9313 return;
9314
9317
9319
9320 m_VarWet = Math.Clamp(value, min, max);
9321
9323 {
9326 }
9327 }
9328
9329 override void AddWet(
float value)
9330 {
9332 }
9333
9335 {
9337 }
9338
9340 {
9342 }
9343
9345 {
9347 }
9348
9350 {
9352 }
9353
9355 {
9357 }
9358
9360 {
9363 if (newLevel != oldLevel)
9364 {
9366 }
9367 }
9368
9370 {
9371 SetWeightDirty();
9372 }
9373
9375 {
9376 return GetWetLevelInternal(
m_VarWet);
9377 }
9378
9379
9380
9382 {
9384 }
9385
9387 {
9389 }
9390
9392 {
9394 }
9395
9397 {
9399 }
9400
9401
9402
9404 {
9405 if (ConfigIsExisting("itemModelLength"))
9406 {
9407 return ConfigGetFloat("itemModelLength");
9408 }
9409 return 0;
9410 }
9411
9413 {
9414 if (ConfigIsExisting("itemAttachOffset"))
9415 {
9416 return ConfigGetFloat("itemAttachOffset");
9417 }
9418 return 0;
9419 }
9420
9421 override void SetCleanness(
int value,
bool allow_client =
false)
9422 {
9423 if (!IsServerCheck(allow_client))
9424 return;
9425
9427
9429
9432 }
9433
9435 {
9437 }
9438
9440 {
9441 return true;
9442 }
9443
9444
9445
9446
9448 {
9450 }
9451
9453 {
9455 }
9456
9457
9458
9459
9460 override void SetColor(
int r,
int g,
int b,
int a)
9461 {
9467 }
9469 override void GetColor(out
int r,out
int g,out
int b,out
int a)
9470 {
9475 }
9476
9478 {
9480 }
9481
9484 {
9485 int r,g,b,a;
9487 r = r/255;
9488 g = g/255;
9489 b = b/255;
9490 a = a/255;
9491 return MiscGameplayFunctions.GetColorString(r, g, b, a);
9492 }
9493
9494
9495
9496 override void SetLiquidType(
int value,
bool allow_client =
false)
9497 {
9498 if (!IsServerCheck(allow_client))
9499 return;
9500
9505 }
9506
9508 {
9509 return ConfigGetInt("varLiquidTypeInit");
9510 }
9511
9513 {
9515 }
9516
9518 {
9520 SetFrozen(false);
9521 }
9522
9525 {
9526 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9527 }
9528
9529
9532 {
9533 PlayerBase nplayer;
9534 if (PlayerBase.CastTo(nplayer, player))
9535 {
9537 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9538 }
9539 }
9540
9541
9544 {
9545 PlayerBase nplayer;
9546 if (PlayerBase.CastTo(nplayer,player))
9547 {
9548 nplayer.SetEnableQuickBarEntityShortcut(this, false);
9549 }
9550
9551 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
9552
9553 if (HasEnergyManager())
9554 {
9555 GetCompEM().UpdatePlugState();
9556 }
9557 }
9558
9559
9561 {
9562 super.OnPlacementStarted(player);
9563
9565 }
9566
9567 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
9568 {
9570 {
9571 m_AdminLog.OnPlacementComplete(player,
this);
9572 }
9573
9574 super.OnPlacementComplete(player, position, orientation);
9575 }
9576
9577
9578
9579
9580
9582 {
9584 {
9585 return true;
9586 }
9587 else
9588 {
9589 return false;
9590 }
9591 }
9592
9593
9595 {
9597 {
9599 }
9600 }
9601
9602
9604 {
9606 }
9607
9609 {
9611 }
9612
9613 override void InsertAgent(
int agent,
float count = 1)
9614 {
9615 if (count < 1)
9616 return;
9617
9619 }
9620
9623 {
9625 }
9626
9627
9629 {
9631 }
9632
9633
9634
9635
9636
9637
9638
9639
9640
9641
9642
9643
9644
9645
9646
9647
9648
9649
9650
9651
9652
9653
9654
9655
9656
9657
9658
9659
9660
9661
9662
9663
9664
9665
9666
9667
9668
9669
9670
9671
9672
9673
9675 {
9677 return false;
9678 return true;
9679 }
9680
9682 {
9683
9685 }
9686
9687
9690 {
9691 super.CheckForRoofLimited(timeTresholdMS);
9692
9693 float time =
g_Game.GetTime();
9694 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
9695 {
9696 m_PreviousRoofTestTime = time;
9697 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
9698 }
9699 }
9700
9701
9703 {
9705 {
9706 return 0;
9707 }
9708
9709 if (GetInventory().GetAttachmentSlotsCount() != 0)
9710 {
9711 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
9712 if (filter)
9713 return filter.GetProtectionLevel(type, false, system);
9714 else
9715 return 0;
9716 }
9717
9718 string subclassPath, entryName;
9719
9720 switch (type)
9721 {
9723 entryName = "biological";
9724 break;
9726 entryName = "chemical";
9727 break;
9728 default:
9729 entryName = "biological";
9730 break;
9731 }
9732
9733 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
9734
9735 return g_Game.ConfigGetFloat(subclassPath + entryName);
9736 }
9737
9738
9739
9742 {
9743 if (!IsMagazine())
9745
9747 }
9748
9749
9750
9751
9752
9757 {
9758 return true;
9759 }
9760
9762 {
9764 }
9765
9766
9767
9768
9769
9771 {
9772 if (parent)
9773 {
9774 if (parent.IsInherited(DayZInfected))
9775 return true;
9776
9777 if (!parent.IsRuined())
9778 return true;
9779 }
9780
9781 return true;
9782 }
9783
9785 {
9786 if (!super.CanPutAsAttachment(parent))
9787 {
9788 return false;
9789 }
9790
9791 if (!IsRuined() && !parent.IsRuined())
9792 {
9793 return true;
9794 }
9795
9796 return false;
9797 }
9798
9800 {
9801
9802
9803
9804
9805 return super.CanReceiveItemIntoCargo(item);
9806 }
9807
9809 {
9810
9811
9812
9813
9814 GameInventory attachmentInv = attachment.GetInventory();
9816 {
9817 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
9818 return false;
9819 }
9820
9821 InventoryLocation loc = new InventoryLocation();
9822 attachment.GetInventory().GetCurrentInventoryLocation(loc);
9823 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
9824 return false;
9825
9826 return super.CanReceiveAttachment(attachment, slotId);
9827 }
9828
9830 {
9831 if (!super.CanReleaseAttachment(attachment))
9832 return false;
9833
9834 return GetInventory().AreChildrenAccessible();
9835 }
9836
9837
9838
9839
9840
9841
9842
9843
9844
9845
9846
9847
9848
9849
9850
9851
9852
9853
9854
9855
9856
9858 {
9859 int id = muzzle_owner.GetMuzzleID();
9860 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
9861
9862 if (WPOF_array)
9863 {
9864 for (int i = 0; i < WPOF_array.Count(); i++)
9865 {
9866 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
9867
9868 if (WPOF)
9869 {
9870 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
9871 }
9872 }
9873 }
9874 }
9875
9876
9878 {
9879 int id = muzzle_owner.GetMuzzleID();
9881
9882 if (WPOBE_array)
9883 {
9884 for (int i = 0; i < WPOBE_array.Count(); i++)
9885 {
9886 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
9887
9888 if (WPOBE)
9889 {
9890 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
9891 }
9892 }
9893 }
9894 }
9895
9896
9898 {
9899 int id = muzzle_owner.GetMuzzleID();
9900 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9901
9902 if (WPOOH_array)
9903 {
9904 for (int i = 0; i < WPOOH_array.Count(); i++)
9905 {
9906 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9907
9908 if (WPOOH)
9909 {
9910 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
9911 }
9912 }
9913 }
9914 }
9915
9916
9918 {
9919 int id = muzzle_owner.GetMuzzleID();
9920 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9921
9922 if (WPOOH_array)
9923 {
9924 for (int i = 0; i < WPOOH_array.Count(); i++)
9925 {
9926 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9927
9928 if (WPOOH)
9929 {
9930 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9931 }
9932 }
9933 }
9934 }
9935
9936
9938 {
9939 int id = muzzle_owner.GetMuzzleID();
9940 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9941
9942 if (WPOOH_array)
9943 {
9944 for (int i = 0; i < WPOOH_array.Count(); i++)
9945 {
9946 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9947
9948 if (WPOOH)
9949 {
9950 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9951 }
9952 }
9953 }
9954 }
9955
9956
9957
9959 {
9961 {
9962 return true;
9963 }
9964
9965 return false;
9966 }
9967
9969 {
9971 {
9972 return true;
9973 }
9974
9975 return false;
9976 }
9977
9979 {
9981 {
9982 return true;
9983 }
9984
9985 return false;
9986 }
9987
9989 {
9990 return false;
9991 }
9992
9995 {
9996 return UATimeSpent.DEFAULT_DEPLOY;
9997 }
9998
9999
10000
10001
10003 {
10005 SetSynchDirty();
10006 }
10007
10009 {
10011 }
10012
10013
10015 {
10016 return false;
10017 }
10018
10021 {
10022 string att_type = "None";
10023
10024 if (ConfigIsExisting("soundAttType"))
10025 {
10026 att_type = ConfigGetString("soundAttType");
10027 }
10028
10030 }
10031
10033 {
10035 }
10036
10037
10038
10039
10040
10046
10048 {
10051
10053 }
10054
10055
10057 {
10059 return;
10060
10062
10065
10068
10069 SoundParameters params = new SoundParameters();
10073 }
10074
10075
10077 {
10079 {
10082
10083 SetSynchDirty();
10084
10087 }
10088 }
10089
10091 {
10093 }
10094
10095
10097 {
10099 return;
10100
10102 SetSynchDirty();
10103
10106 }
10107
10109 {
10112 }
10113
10115 {
10117 }
10118
10119 void OnApply(PlayerBase player);
10120
10122 {
10123 return 1.0;
10124 };
10125
10127 {
10129 }
10130
10132 {
10134 }
10135
10137
10139 {
10140 SetDynamicPhysicsLifeTime(0.01);
10142 }
10143
10145 {
10146 array<string> zone_names = new array<string>;
10147 GetDamageZones(zone_names);
10148 for (int i = 0; i < zone_names.Count(); i++)
10149 {
10150 SetHealthMax(zone_names.Get(i),"Health");
10151 }
10152 SetHealthMax("","Health");
10153 }
10154
10157 {
10158 float global_health = GetHealth01("","Health");
10159 array<string> zones = new array<string>;
10160 GetDamageZones(zones);
10161
10162 for (int i = 0; i < zones.Count(); i++)
10163 {
10164 SetHealth01(zones.Get(i),"Health",global_health);
10165 }
10166 }
10167
10170 {
10171 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
10172 }
10173
10175 {
10176 if (!hasRootAsPlayer)
10177 {
10178 if (refParentIB)
10179 {
10180
10181 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
10182 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
10183
10184 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
10185 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
10186
10189 }
10190 else
10191 {
10192
10195 }
10196 }
10197 }
10198
10200 {
10202 {
10203 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
10204 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
10205 {
10206 float heatPermCoef = 1.0;
10208 while (ent)
10209 {
10210 heatPermCoef *= ent.GetHeatPermeabilityCoef();
10211 ent = ent.GetHierarchyParent();
10212 }
10213
10214 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
10215 }
10216 }
10217 }
10218
10220 {
10221
10222 EntityAI parent = GetHierarchyParent();
10223 if (!parent)
10224 {
10225 hasParent = false;
10226 hasRootAsPlayer = false;
10227 }
10228 else
10229 {
10230 hasParent = true;
10231 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
10232 refParentIB =
ItemBase.Cast(parent);
10233 }
10234 }
10235
10236 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
10237 {
10238
10239 }
10240
10242 {
10243
10244 return false;
10245 }
10246
10248 {
10249
10250
10251 return false;
10252 }
10253
10255 {
10256
10257 return false;
10258 }
10259
10262 {
10263 return !GetIsFrozen() &&
IsOpen();
10264 }
10265
10267 {
10268 bool hasParent = false, hasRootAsPlayer = false;
10270
10271 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
10272 bool foodDecay =
g_Game.IsFoodDecayEnabled();
10273
10274 if (wwtu || foodDecay)
10275 {
10279
10280 if (processWetness || processTemperature || processDecay)
10281 {
10283
10284 if (processWetness)
10285 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
10286
10287 if (processTemperature)
10289
10290 if (processDecay)
10291 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
10292 }
10293 }
10294 }
10295
10298 {
10300 }
10301
10303 {
10306
10307 return super.GetTemperatureFreezeThreshold();
10308 }
10309
10311 {
10314
10315 return super.GetTemperatureThawThreshold();
10316 }
10317
10319 {
10322
10323 return super.GetItemOverheatThreshold();
10324 }
10325
10327 {
10329 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
10330
10331 return super.GetTemperatureFreezeTime();
10332 }
10333
10335 {
10337 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
10338
10339 return super.GetTemperatureThawTime();
10340 }
10341
10346
10348 {
10349 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
10350 }
10351
10353 {
10354 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
10355 }
10356
10359 {
10361 }
10362
10364 {
10366 }
10367
10369 {
10371 }
10372
10375 {
10376 return null;
10377 }
10378
10381 {
10382 return false;
10383 }
10384
10386 {
10388 {
10391 if (!trg)
10392 {
10394 explosive = this;
10395 }
10396
10397 explosive.PairRemote(trg);
10399
10400 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
10401 trg.SetPersistentPairID(persistentID);
10402 explosive.SetPersistentPairID(persistentID);
10403
10404 return true;
10405 }
10406 return false;
10407 }
10408
10411 {
10412 float ret = 1.0;
10415 ret *= GetHealth01();
10416
10417 return ret;
10418 }
10419
10420 #ifdef DEVELOPER
10421 override void SetDebugItem()
10422 {
10423 super.SetDebugItem();
10424 _itemBase = this;
10425 }
10426
10428 {
10429 string text = super.GetDebugText();
10430
10432 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
10433
10434 return text;
10435 }
10436 #endif
10437
10439 {
10440 return true;
10441 }
10442
10444
10446
10448 {
10451 }
10452
10453
10461
10477
10478 [
Obsolete(
"Use ItemSoundHandler instead")]
10481 {
10482 if (!
g_Game.IsDedicatedServer())
10483 {
10484 if (ConfigIsExisting("attachSoundSet"))
10485 {
10486 string cfg_path = "";
10487 string soundset = "";
10488 string type_name =
GetType();
10489
10492 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
10493 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
10494
10495 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
10496 {
10497 for (int i = 0; i < cfg_soundset_array.Count(); i++)
10498 {
10499 if (cfg_slot_array[i] == slot_type)
10500 {
10501 soundset = cfg_soundset_array[i];
10502 break;
10503 }
10504 }
10505 }
10506
10507 if (soundset != "")
10508 {
10509 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
10511 }
10512 }
10513 }
10514 }
10515
10517}
10518
10520{
10522 if (entity)
10523 {
10524 bool is_item = entity.IsInherited(
ItemBase);
10525 if (is_item && full_quantity)
10526 {
10529 }
10530 }
10531 else
10532 {
10534 return NULL;
10535 }
10536 return entity;
10537}
10538
10540{
10541 if (item)
10542 {
10543 if (health > 0)
10544 item.SetHealth("", "", health);
10545
10546 if (item.CanHaveTemperature())
10547 {
10549 if (item.CanFreeze())
10550 item.SetFrozen(false);
10551 }
10552
10553 if (item.HasEnergyManager())
10554 {
10555 if (quantity >= 0)
10556 {
10557 item.GetCompEM().SetEnergy0To1(quantity);
10558 }
10559 else
10560 {
10562 }
10563 }
10564 else if (item.IsMagazine())
10565 {
10566 Magazine mag = Magazine.Cast(item);
10567 if (quantity >= 0)
10568 {
10569 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
10570 }
10571 else
10572 {
10574 }
10575
10576 }
10577 else
10578 {
10579 if (quantity >= 0)
10580 {
10581 item.SetQuantityNormalized(quantity, false);
10582 }
10583 else
10584 {
10586 }
10587
10588 }
10589 }
10590}
10591
10592#ifdef DEVELOPER
10594#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.