5695{
5697 {
5698 return true;
5699 }
5700};
5701
5703{
5704
5705};
5706
5707
5708
5710{
5714
5716
5719
5720
5721
5722
5723
5732
5738
5743
5748
5769 protected bool m_IsResultOfSplit
5770
5772
5777
5778
5779
5781
5785
5786
5787
5789
5792
5793
5794
5800
5801
5809
5812
5813
5815
5816
5818
5819
5824
5825
5830
5832
5833
5835
5836
5838 {
5843
5844 if (!
g_Game.IsDedicatedServer())
5845 {
5847 {
5849
5851 {
5853 }
5854 }
5855
5858 }
5859
5860 m_OldLocation = null;
5861
5863 {
5865 }
5866
5867 if (ConfigIsExisting("headSelectionsToHide"))
5868 {
5871 }
5872
5874 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
5875 {
5877 }
5878
5880
5881 m_IsResultOfSplit = false;
5882
5884 }
5885
5887 {
5888 super.InitItemVariables();
5889
5895 m_Count = ConfigGetInt(
"count");
5896
5899
5904
5907
5912
5924
5928
5929
5932 if (ConfigIsExisting("canBeSplit"))
5933 {
5936 }
5937
5939 if (ConfigIsExisting("itemBehaviour"))
5941
5942
5945 RegisterNetSyncVariableInt("m_VarLiquidType");
5946 RegisterNetSyncVariableInt("m_Cleanness",0,1);
5947
5948 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
5949 RegisterNetSyncVariableFloat("m_ImpactSpeed");
5950 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
5951
5952 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
5953 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
5954 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
5955 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
5956
5957 RegisterNetSyncVariableBool("m_IsBeingPlaced");
5958 RegisterNetSyncVariableBool("m_IsTakeable");
5959 RegisterNetSyncVariableBool("m_IsHologram");
5960
5963 {
5966 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
5967 }
5968
5970
5972 if (ConfigIsExisting("temperaturePerQuantityWeight"))
5974
5976 }
5977
5979 {
5981 }
5982
5984 {
5987 {
5992 }
5993 }
5994
5995 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
5996 {
5998 {
6001 }
6002
6004 }
6005
6007 {
6013 }
6014
6016
6018 {
6020
6021 if (!action)
6022 {
6023 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
6024 return;
6025 }
6026
6028 if (!ai)
6029 {
6031 return;
6032 }
6033
6035 if (!action_array)
6036 {
6037 action_array = new array<ActionBase_Basic>;
6039 }
6040 if (LogManager.IsActionLogEnable())
6041 {
6042 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
6043 }
6044
6045 if (action_array.Find(action) != -1)
6046 {
6047 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
6048 }
6049 else
6050 {
6051 action_array.Insert(action);
6052 }
6053 }
6054
6056 {
6057 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6058 ActionBase action = player.GetActionManager().GetAction(actionName);
6061
6062 if (action_array)
6063 {
6064 action_array.RemoveItem(action);
6065 }
6066 }
6067
6068
6069
6071 {
6072 ActionOverrideData overrideData = new ActionOverrideData();
6076
6078 if (!actionMap)
6079 {
6082 }
6083
6084 actionMap.Insert(this.
Type(), overrideData);
6085
6086 }
6087
6089
6091
6092
6094 {
6097
6100
6101 string config_to_search = "CfgVehicles";
6102 string muzzle_owner_config;
6103
6105 {
6106 if (IsInherited(Weapon))
6107 config_to_search = "CfgWeapons";
6108
6109 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6110
6111 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
6112
6113 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
6114
6115 if (config_OnFire_subclass_count > 0)
6116 {
6117 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
6118
6119 for (int i = 0; i < config_OnFire_subclass_count; i++)
6120 {
6121 string particle_class = "";
6122 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
6123 string config_OnFire_entry = config_OnFire_class + particle_class;
6124 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
6125 WPOF_array.Insert(WPOF);
6126 }
6127
6128
6130 }
6131 }
6132
6134 {
6135 config_to_search = "CfgWeapons";
6136 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6137
6138 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
6139
6140 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
6141
6142 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
6143 {
6144 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
6145
6146 for (i = 0; i < config_OnBulletCasingEject_count; i++)
6147 {
6148 string particle_class2 = "";
6149 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
6150 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
6151 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
6152 WPOBE_array.Insert(WPOBE);
6153 }
6154
6155
6157 }
6158 }
6159 }
6160
6161
6163 {
6166
6168 {
6169 string config_to_search = "CfgVehicles";
6170
6171 if (IsInherited(Weapon))
6172 config_to_search = "CfgWeapons";
6173
6174 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6175 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
6176
6177 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
6178 {
6179
6181
6183 {
6185 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
6187 return;
6188 }
6189
6192
6193
6194
6195 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
6196 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
6197
6198 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
6199 {
6200 string particle_class = "";
6201 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
6202 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
6203 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
6204
6205 if (entry_type == CT_CLASS)
6206 {
6207 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
6208 WPOOH_array.Insert(WPOF);
6209 }
6210 }
6211
6212
6214 }
6215 }
6216 }
6217
6219 {
6221 }
6222
6224 {
6226 {
6228
6231
6234
6235 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6236 }
6237 }
6238
6240 {
6242 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6243
6245 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6246
6248 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6249
6251 {
6253 }
6254 }
6255
6257 {
6259 }
6260
6262 {
6265 else
6267
6269 {
6272 }
6273 else
6274 {
6277
6280 }
6281
6283 }
6284
6286 {
6288 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6289 }
6290
6292 {
6294 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6296 }
6297
6299 {
6301 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6302 }
6303
6305 {
6308
6309 OverheatingParticle OP = new OverheatingParticle();
6314
6316 }
6317
6319 {
6322
6323 return -1;
6324 }
6325
6327 {
6329 {
6332
6333 for (int i = count; i > 0; --i)
6334 {
6335 int id = i - 1;
6338
6341
6342 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
6343 {
6344 if (p)
6345 {
6348 }
6349 }
6350 }
6351 }
6352 }
6353
6355 {
6357 {
6359 {
6360 int id = i - 1;
6362
6363 if (OP)
6364 {
6366
6367 if (p)
6368 {
6370 }
6371
6372 delete OP;
6373 }
6374 }
6375
6378 }
6379 }
6380
6383 {
6384 return 0.0;
6385 }
6386
6387
6389 {
6390 return 250;
6391 }
6392
6394 {
6395 return 0;
6396 }
6397
6400 {
6402 return true;
6403
6404 return false;
6405 }
6406
6409 {
6412
6414 {
6416 }
6417 else
6418 {
6419
6421 }
6422
6424 }
6425
6432 {
6433 return -1;
6434 }
6435
6436
6437
6438
6440 {
6442 {
6443 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6444 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6445
6446 if (r_index >= 0)
6447 {
6448 InventoryLocation r_il = new InventoryLocation;
6449 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6450
6451 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6454 {
6455 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6456 }
6458 {
6459 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6460 }
6461
6462 }
6463
6464 player.GetHumanInventory().ClearUserReservedLocation(this);
6465 }
6466
6469 }
6470
6471
6472
6473
6475 {
6476 return ItemBase.m_DebugActionsMask;
6477 }
6478
6480 {
6481 return ItemBase.m_DebugActionsMask & mask;
6482 }
6483
6485 {
6486 ItemBase.m_DebugActionsMask = mask;
6487 }
6488
6490 {
6491 ItemBase.m_DebugActionsMask |= mask;
6492 }
6493
6495 {
6496 ItemBase.m_DebugActionsMask &= ~mask;
6497 }
6498
6500 {
6502 {
6504 }
6505 else
6506 {
6508 }
6509 }
6510
6511
6513 {
6514 if (GetEconomyProfile())
6515 {
6516 float q_max = GetEconomyProfile().GetQuantityMax();
6517 if (q_max > 0)
6518 {
6519 float q_min = GetEconomyProfile().GetQuantityMin();
6520 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
6521
6523 {
6524 ComponentEnergyManager comp = GetCompEM();
6526 {
6528 }
6529 }
6531 {
6533
6534 }
6535
6536 }
6537 }
6538 }
6539
6542 {
6543 EntityAI parent = GetHierarchyParent();
6544
6545 if (parent)
6546 {
6547 InventoryLocation inventory_location_to_lock = new InventoryLocation;
6548 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
6549 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
6550 }
6551 }
6552
6555 {
6556 EntityAI parent = GetHierarchyParent();
6557
6558 if (parent)
6559 {
6560 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
6561 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
6562 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
6563 }
6564 }
6565
6567 {
6568
6569
6570
6571
6573
6575 {
6576 if (ScriptInputUserData.CanStoreInputUserData())
6577 {
6578 ScriptInputUserData ctx = new ScriptInputUserData;
6584 ctx.
Write(use_stack_max);
6587
6589 {
6590 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
6591 }
6592 }
6593 }
6594 else if (!
g_Game.IsMultiplayer())
6595 {
6597 }
6598 }
6599
6601 {
6603 }
6604
6606 {
6608 }
6609
6611 {
6613 }
6614
6616 {
6617
6618 return false;
6619 }
6620
6622 {
6623 return false;
6624 }
6625
6629 {
6630 return false;
6631 }
6632
6634 {
6635 return "";
6636 }
6637
6639
6641 {
6642 return false;
6643 }
6644
6646 {
6647 return true;
6648 }
6649
6650
6651
6653 {
6654 return true;
6655 }
6656
6658 {
6659 return true;
6660 }
6661
6663 {
6664 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6666 }
6667
6669 {
6671 }
6672
6674 {
6676 if (!is_being_placed)
6678 SetSynchDirty();
6679 }
6680
6681
6683
6685 {
6687 }
6688
6690 {
6692 }
6693
6695 {
6696 return 1;
6697 }
6698
6700 {
6701 return false;
6702 }
6703
6705 {
6707 SetSynchDirty();
6708 }
6709
6710
6711
6712
6713
6714
6715
6716
6717
6718
6719
6720
6721
6722
6723
6724
6725
6726
6727
6728
6729
6730
6731
6732
6733
6734
6735
6736
6737
6738
6739
6740
6741
6742
6743
6745 {
6746 super.OnMovedInsideCargo(container);
6747
6748 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6749 }
6750
6751 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
6752 {
6753 super.EEItemLocationChanged(oldLoc, newLoc);
6754
6755 PlayerBase newPlayer = null;
6756 PlayerBase oldPlayer = null;
6757
6758 if (newLoc.GetParent())
6759 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
6760
6761 if (oldLoc.GetParent())
6762 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
6763
6765 {
6766 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
6767
6768 if (rIndex >= 0)
6769 {
6770 InventoryLocation rIl = new InventoryLocation;
6771 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
6772
6773 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
6776 {
6777 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
6778 }
6780 {
6782 }
6783
6784 }
6785 }
6786
6788 {
6789 if (newPlayer)
6790 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
6791
6792 if (newPlayer == oldPlayer)
6793 {
6794 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
6795 {
6797 {
6798 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
6799 {
6800 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6801 }
6802 }
6803 else
6804 {
6805 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6806 }
6807 }
6808
6809 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
6810 {
6811 int type = oldLoc.GetType();
6813 {
6814 oldLoc.GetParent().GetOnSetLock().Invoke(this);
6815 }
6817 {
6818 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
6819 }
6820 }
6821 if (!m_OldLocation)
6822 {
6823 m_OldLocation = new InventoryLocation;
6824 }
6825 m_OldLocation.Copy(oldLoc);
6826 }
6827 else
6828 {
6829 if (m_OldLocation)
6830 {
6831 m_OldLocation.Reset();
6832 }
6833 }
6834
6835 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
6836 }
6837 else
6838 {
6839 if (newPlayer)
6840 {
6841 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
6842 if (resIndex >= 0)
6843 {
6844 InventoryLocation il = new InventoryLocation;
6845 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
6847 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
6850 {
6851 il.
GetParent().GetOnReleaseLock().Invoke(it);
6852 }
6854 {
6856 }
6857
6858 }
6859 }
6861 {
6862
6864 }
6865
6866 if (m_OldLocation)
6867 {
6868 m_OldLocation.Reset();
6869 }
6870 }
6871
6873 {
6874 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
6875 }
6876
6878 {
6879 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
6880 }
6881 }
6882
6883 override void EOnContact(IEntity other, Contact extra)
6884 {
6886 {
6887 int liquidType = -1;
6889 if (impactSpeed > 0.0)
6890 {
6892 #ifndef SERVER
6894 #else
6896 SetSynchDirty();
6897 #endif
6899 }
6900 }
6901
6902 #ifdef SERVER
6903 if (GetCompEM() && GetCompEM().IsPlugged())
6904 {
6905 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
6906 GetCompEM().UnplugThis();
6907 }
6908 #endif
6909 }
6910
6912
6914 {
6916 }
6917
6919 {
6920
6921 }
6922
6924 {
6925 super.OnItemLocationChanged(old_owner, new_owner);
6926
6927 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
6928 PlayerBase playerNew = PlayerBase.Cast(new_owner);
6929
6930 if (!relatedPlayer && playerNew)
6931 relatedPlayer = playerNew;
6932
6933 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
6934 {
6936 if (actionMgr)
6937 {
6938 ActionBase currentAction = actionMgr.GetRunningAction();
6939 if (currentAction)
6941 }
6942 }
6943
6944 Man ownerPlayerOld = null;
6945 Man ownerPlayerNew = null;
6946
6947 if (old_owner)
6948 {
6949 if (old_owner.
IsMan())
6950 {
6951 ownerPlayerOld = Man.Cast(old_owner);
6952 }
6953 else
6954 {
6955 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
6956 }
6957 }
6958 else
6959 {
6961 {
6963
6964 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
6965 {
6966 GetCompEM().UnplugThis();
6967 }
6968 }
6969 }
6970
6971 if (new_owner)
6972 {
6973 if (new_owner.
IsMan())
6974 {
6975 ownerPlayerNew = Man.Cast(new_owner);
6976 }
6977 else
6978 {
6979 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
6980 }
6981 }
6982
6983 if (ownerPlayerOld != ownerPlayerNew)
6984 {
6985 if (ownerPlayerOld)
6986 {
6987 array<EntityAI> subItemsExit = new array<EntityAI>;
6989 for (int i = 0; i < subItemsExit.Count(); i++)
6990 {
6993 }
6994 }
6995
6996 if (ownerPlayerNew)
6997 {
6998 array<EntityAI> subItemsEnter = new array<EntityAI>;
7000 for (int j = 0; j < subItemsEnter.Count(); j++)
7001 {
7004 }
7005 }
7006 }
7007 else if (ownerPlayerNew != null)
7008 {
7009 PlayerBase nplayer;
7010 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
7011 {
7012 array<EntityAI> subItemsUpdate = new array<EntityAI>;
7014 for (int k = 0; k < subItemsUpdate.Count(); k++)
7015 {
7017 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
7018 }
7019 }
7020 }
7021
7022 if (old_owner)
7023 old_owner.OnChildItemRemoved(this);
7024 if (new_owner)
7025 new_owner.OnChildItemReceived(this);
7026 }
7027
7028
7030 {
7031 super.EEDelete(parent);
7032 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
7033 if (player)
7034 {
7036
7037 if (player.IsAlive())
7038 {
7039 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7040 if (r_index >= 0)
7041 {
7042 InventoryLocation r_il = new InventoryLocation;
7043 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7044
7045 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7048 {
7049 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7050 }
7052 {
7053 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7054 }
7055
7056 }
7057
7058 player.RemoveQuickBarEntityShortcut(this);
7059 }
7060 }
7061 }
7062
7064 {
7065 super.EEKilled(killer);
7066
7069 {
7070 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
7071 {
7072 if (IsMagazine())
7073 {
7074 if (Magazine.Cast(this).GetAmmoCount() > 0)
7075 {
7077 }
7078 }
7079 else
7080 {
7082 }
7083 }
7084 }
7085 }
7086
7088 {
7089 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7090
7091 super.OnWasAttached(parent, slot_id);
7092
7095
7098 }
7099
7101 {
7102 super.OnWasDetached(parent, slot_id);
7103
7106
7109 }
7110
7112 {
7113 int idx;
7116
7117 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7118 if (inventory_slots.Count() < 1)
7119 {
7120 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
7121 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
7122 }
7123 else
7124 {
7125 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
7126 }
7127
7128 idx = inventory_slots.Find(slot);
7129 if (idx < 0)
7130 return "";
7131
7132 return attach_types.Get(idx);
7133 }
7134
7136 {
7137 int idx = -1;
7138 string slot;
7139
7142
7143 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7144 if (inventory_slots.Count() < 1)
7145 {
7146 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
7147 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7148 }
7149 else
7150 {
7151 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
7152 if (detach_types.Count() < 1)
7153 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7154 }
7155
7156 for (int i = 0; i < inventory_slots.Count(); i++)
7157 {
7158 slot = inventory_slots.Get(i);
7159 }
7160
7161 if (slot != "")
7162 {
7163 if (detach_types.Count() == 1)
7164 idx = 0;
7165 else
7166 idx = inventory_slots.Find(slot);
7167 }
7168 if (idx < 0)
7169 return "";
7170
7171 return detach_types.Get(idx);
7172 }
7173
7175 {
7176
7178
7179
7180 float min_time = 1;
7181 float max_time = 3;
7182 float delay = Math.RandomFloat(min_time, max_time);
7183
7184 explode_timer.Run(delay, this, "DoAmmoExplosion");
7185 }
7186
7188 {
7189 Magazine magazine = Magazine.Cast(this);
7190 int pop_sounds_count = 6;
7191 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
7192
7193
7194 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
7195 string sound_name = pop_sounds[ sound_idx ];
7196 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
7197
7198
7199 magazine.ServerAddAmmoCount(-1);
7200
7201
7202 float min_temp_to_explode = 100;
7203
7204 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
7205 {
7207 }
7208 }
7209
7210
7211 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
7212 {
7213 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
7214
7215 const int CHANCE_DAMAGE_CARGO = 4;
7216 const int CHANCE_DAMAGE_ATTACHMENT = 1;
7217 const int CHANCE_DAMAGE_NOTHING = 2;
7218
7220 {
7221 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
7222 int chances;
7223 int rnd;
7224
7225 if (GetInventory().GetCargo())
7226 {
7227 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7228 rnd = Math.RandomInt(0,chances);
7229
7230 if (rnd < CHANCE_DAMAGE_CARGO)
7231 {
7233 }
7234 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
7235 {
7237 }
7238 }
7239 else
7240 {
7241 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7242 rnd = Math.RandomInt(0,chances);
7243
7244 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
7245 {
7247 }
7248 }
7249 }
7250 }
7251
7253 {
7254 CargoBase cargo = GetInventory().GetCargo();
7255 if (cargo)
7256 {
7258 if (item_count > 0)
7259 {
7260 int random_pick = Math.RandomInt(0, item_count);
7262 if (!item.IsExplosive())
7263 {
7264 item.AddHealth("","",damage);
7265 return true;
7266 }
7267 }
7268 }
7269 return false;
7270 }
7271
7273 {
7274 GameInventory inventory = GetInventory();
7276 if (attachment_count > 0)
7277 {
7278 int random_pick = Math.RandomInt(0, attachment_count);
7280 if (!attachment.IsExplosive())
7281 {
7282 attachment.AddHealth("","",damage);
7283 return true;
7284 }
7285 }
7286 return false;
7287 }
7288
7290 {
7292 }
7293
7295 {
7297 return GetInventory().CanRemoveEntity();
7298
7299 return false;
7300 }
7301
7303 {
7304
7306 return false;
7307
7308
7310 return false;
7311
7312
7313
7315 if (delta == 0)
7316 return false;
7317
7318
7319 return true;
7320 }
7321
7323 {
7325 {
7326 if (ScriptInputUserData.CanStoreInputUserData())
7327 {
7328 ScriptInputUserData ctx = new ScriptInputUserData;
7333 ctx.
Write(destination_entity);
7337 }
7338 }
7339 else if (!
g_Game.IsMultiplayer())
7340 {
7342 }
7343 }
7344
7346 {
7347 float split_quantity_new;
7351 InventoryLocation loc = new InventoryLocation;
7352
7353 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7354 {
7356 split_quantity_new = stack_max;
7357 else
7359
7361 {
7362 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7363 if (new_item)
7364 {
7365 new_item.SetResultOfSplit(true);
7366 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7368 new_item.
SetQuantity(split_quantity_new,
false,
true);
7369 }
7370 }
7371 }
7372 else if (destination_entity && slot_id == -1)
7373 {
7374 if (quantity > stack_max)
7375 split_quantity_new = stack_max;
7376 else
7377 split_quantity_new = quantity;
7378
7380 {
7381 GameInventory destinationInventory = destination_entity.GetInventory();
7383 {
7386 }
7387
7388 if (new_item)
7389 {
7390 new_item.SetResultOfSplit(true);
7391 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7393 new_item.
SetQuantity(split_quantity_new,
false,
true);
7394 }
7395 }
7396 }
7397 else
7398 {
7399 if (stack_max != 0)
7400 {
7402 {
7404 }
7405
7406 if (split_quantity_new == 0)
7407 {
7408 if (!
g_Game.IsMultiplayer())
7409 player.PhysicalPredictiveDropItem(this);
7410 else
7411 player.ServerDropEntity(this);
7412 return;
7413 }
7414
7416 {
7418
7419 if (new_item)
7420 {
7421 new_item.SetResultOfSplit(true);
7422 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7425 new_item.PlaceOnSurface();
7426 }
7427 }
7428 }
7429 }
7430 }
7431
7433 {
7434 float split_quantity_new;
7438 InventoryLocation loc = new InventoryLocation;
7439
7440 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7441 {
7443 split_quantity_new = stack_max;
7444 else
7446
7448 {
7449 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7450 if (new_item)
7451 {
7452 new_item.SetResultOfSplit(true);
7453 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7455 new_item.
SetQuantity(split_quantity_new,
false,
true);
7456 }
7457 }
7458 }
7459 else if (destination_entity && slot_id == -1)
7460 {
7461 if (quantity > stack_max)
7462 split_quantity_new = stack_max;
7463 else
7464 split_quantity_new = quantity;
7465
7467 {
7468 GameInventory destinationInventory = destination_entity.GetInventory();
7470 {
7473 }
7474
7475 if (new_item)
7476 {
7477 new_item.SetResultOfSplit(true);
7478 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7480 new_item.
SetQuantity(split_quantity_new,
false,
true);
7481 }
7482 }
7483 }
7484 else
7485 {
7486 if (stack_max != 0)
7487 {
7489 {
7491 }
7492
7494 {
7496
7497 if (new_item)
7498 {
7499 new_item.SetResultOfSplit(true);
7500 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7503 new_item.PlaceOnSurface();
7504 }
7505 }
7506 }
7507 }
7508 }
7509
7511 {
7513 {
7514 if (ScriptInputUserData.CanStoreInputUserData())
7515 {
7516 ScriptInputUserData ctx = new ScriptInputUserData;
7521 dst.WriteToContext(ctx);
7523 }
7524 }
7525 else if (!
g_Game.IsMultiplayer())
7526 {
7528 }
7529 }
7530
7532 {
7534 {
7535 if (ScriptInputUserData.CanStoreInputUserData())
7536 {
7537 ScriptInputUserData ctx = new ScriptInputUserData;
7542 ctx.
Write(destination_entity);
7548 }
7549 }
7550 else if (!
g_Game.IsMultiplayer())
7551 {
7553 }
7554 }
7555
7557 {
7559 }
7560
7562 {
7564 float split_quantity_new;
7566 if (dst.IsValid())
7567 {
7568 int slot_id = dst.GetSlot();
7570
7571 if (quantity > stack_max)
7572 split_quantity_new = stack_max;
7573 else
7574 split_quantity_new = quantity;
7575
7577 {
7579
7580 if (new_item)
7581 {
7582 new_item.SetResultOfSplit(true);
7583 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7585 new_item.
SetQuantity(split_quantity_new,
false,
true);
7586 }
7587
7588 return new_item;
7589 }
7590 }
7591
7592 return null;
7593 }
7594
7596 {
7598 float split_quantity_new;
7600 if (destination_entity)
7601 {
7603 if (quantity > stackable)
7604 split_quantity_new = stackable;
7605 else
7606 split_quantity_new = quantity;
7607
7609 {
7610 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
7611 if (new_item)
7612 {
7613 new_item.SetResultOfSplit(true);
7614 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7616 new_item.
SetQuantity(split_quantity_new,
false,
true);
7617 }
7618 }
7619 }
7620 }
7621
7623 {
7625 {
7626 if (ScriptInputUserData.CanStoreInputUserData())
7627 {
7628 ScriptInputUserData ctx = new ScriptInputUserData;
7633 ItemBase destination_entity =
this;
7634 ctx.
Write(destination_entity);
7638 }
7639 }
7640 else if (!
g_Game.IsMultiplayer())
7641 {
7643 }
7644 }
7645
7647 {
7649 float split_quantity_new;
7651 if (player)
7652 {
7654 if (quantity > stackable)
7655 split_quantity_new = stackable;
7656 else
7657 split_quantity_new = quantity;
7658
7660 {
7661 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
7662 new_item =
ItemBase.Cast(in_hands);
7663 if (new_item)
7664 {
7665 new_item.SetResultOfSplit(true);
7666 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7668 new_item.SetQuantity(split_quantity_new, false, true);
7669 }
7670 }
7671 }
7672 }
7673
7675 {
7677 float split_quantity_new = Math.Floor(quantity * 0.5);
7678
7680 return;
7681
7683
7684 if (new_item)
7685 {
7686 if (new_item.GetQuantityMax() < split_quantity_new)
7687 {
7688 split_quantity_new = new_item.GetQuantityMax();
7689 }
7690
7691 new_item.SetResultOfSplit(true);
7692 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7693
7695 {
7698 }
7699 else
7700 {
7702 new_item.
SetQuantity(split_quantity_new,
false,
true);
7703 }
7704 }
7705 }
7706
7708 {
7710 float split_quantity_new = Math.Floor(quantity / 2);
7711
7713 return;
7714
7715 InventoryLocation invloc = new InventoryLocation;
7717
7719 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
7720
7721 if (new_item)
7722 {
7723 if (new_item.GetQuantityMax() < split_quantity_new)
7724 {
7725 split_quantity_new = new_item.GetQuantityMax();
7726 }
7728 {
7731 }
7732 else if (split_quantity_new > 1)
7733 {
7735 new_item.
SetQuantity(split_quantity_new,
false,
true);
7736 }
7737 }
7738 }
7739
7742 {
7743 SetWeightDirty();
7745
7746 if (parent)
7747 parent.OnAttachmentQuantityChangedEx(this, delta);
7748
7750 {
7752 {
7754 }
7756 {
7757 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
7759 }
7760 }
7761 }
7762
7765 {
7766
7767 }
7768
7771 {
7773 }
7774
7776 {
7777 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
7778
7780 {
7781 if (newLevel == GameConstants.STATE_RUINED)
7782 {
7784 EntityAI parent = GetHierarchyParent();
7785 if (parent && parent.IsFireplace())
7786 {
7787 CargoBase cargo = GetInventory().GetCargo();
7788 if (cargo)
7789 {
7791 {
7793 }
7794 }
7795 }
7796 }
7797
7799 {
7800
7802 return;
7803 }
7804
7805 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
7806 {
7808 }
7809 }
7810 }
7811
7812
7814 {
7815 super.OnRightClick();
7816
7818 {
7820 {
7821 if (ScriptInputUserData.CanStoreInputUserData())
7822 {
7823 EntityAI root = GetHierarchyRoot();
7824 Man playerOwner = GetHierarchyRootPlayer();
7825 InventoryLocation dst = new InventoryLocation;
7826
7827
7828 if (!playerOwner && root && root == this)
7829 {
7831 }
7832 else
7833 {
7834
7835 GetInventory().GetCurrentInventoryLocation(dst);
7837 {
7838 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7840 {
7842 }
7843 else
7844 {
7846
7847
7848 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
7849 {
7851 }
7852 else
7853 {
7854 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
7855 }
7856 }
7857 }
7858 }
7859
7860 ScriptInputUserData ctx = new ScriptInputUserData;
7868 }
7869 }
7870 else if (!
g_Game.IsMultiplayer())
7871 {
7873 }
7874 }
7875 }
7876
7878 {
7879 if (root)
7880 {
7881 vector m4[4];
7882 root.GetTransform(m4);
7883 dst.SetGround(this, m4);
7884 }
7885 else
7886 {
7887 GetInventory().GetCurrentInventoryLocation(dst);
7888 }
7889 }
7890
7891 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
7892 {
7893
7894 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
7895 return false;
7896
7897 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
7898 return false;
7899
7900
7902 return false;
7903
7904
7905 Magazine mag = Magazine.Cast(this);
7906 if (mag)
7907 {
7908 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
7909 return false;
7910
7911 if (stack_max_limit)
7912 {
7913 Magazine other_mag = Magazine.Cast(other_item);
7914 if (other_item)
7915 {
7916 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
7917 return false;
7918 }
7919
7920 }
7921 }
7922 else
7923 {
7924
7926 return false;
7927
7929 return false;
7930 }
7931
7932 PlayerBase player = null;
7933 if (CastTo(player, GetHierarchyRootPlayer()))
7934 {
7935 if (player.GetInventory().HasAttachment(this))
7936 return false;
7937
7938 if (player.IsItemsToDelete())
7939 return false;
7940 }
7941
7942 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
7943 return false;
7944
7945 int slotID;
7947 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
7948 return false;
7949
7950 return true;
7951 }
7952
7954 {
7956 }
7957
7959 {
7960 return m_IsResultOfSplit;
7961 }
7962
7964 {
7965 m_IsResultOfSplit = value;
7966 }
7967
7969 {
7971 }
7972
7974 {
7975 float other_item_quantity = other_item.GetQuantity();
7976 float this_free_space;
7977
7979
7981
7982 if (other_item_quantity > this_free_space)
7983 {
7984 return this_free_space;
7985 }
7986 else
7987 {
7988 return other_item_quantity;
7989 }
7990 }
7991
7993 {
7995 }
7996
7998 {
8000 return;
8001
8002 if (!IsMagazine() && other_item)
8003 {
8005 if (quantity_used != 0)
8006 {
8007 float hp1 = GetHealth01("","");
8008 float hp2 = other_item.GetHealth01("","");
8009 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
8010 hpResult = hpResult / (
GetQuantity() + quantity_used);
8011
8012 hpResult *= GetMaxHealth();
8013 Math.Round(hpResult);
8014 SetHealth("", "Health", hpResult);
8015
8017 other_item.AddQuantity(-quantity_used);
8018 }
8019 }
8021 }
8022
8024 {
8025 #ifdef SERVER
8026 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
8027 GetHierarchyParent().IncreaseLifetimeUp();
8028 #endif
8029 };
8030
8032 {
8033 PlayerBase p = PlayerBase.Cast(player);
8034
8035 array<int> recipesIds = p.m_Recipes;
8036 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8037 if (moduleRecipesManager)
8038 {
8039 EntityAI itemInHands = player.GetEntityInHands();
8040 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
8041 }
8042
8043 for (int i = 0;i < recipesIds.Count(); i++)
8044 {
8045 int key = recipesIds.Get(i);
8046 string recipeName = moduleRecipesManager.GetRecipeName(key);
8048 }
8049 }
8050
8051
8052 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
8053 {
8054 super.GetDebugActions(outputList);
8055
8056
8062
8063
8068
8073
8074
8078
8079
8081 {
8085 }
8086
8089
8090
8094
8096
8097 InventoryLocation loc = new InventoryLocation();
8098 GetInventory().GetCurrentInventoryLocation(loc);
8100 {
8101 if (Gizmo_IsSupported())
8104 }
8105
8107 }
8108
8109
8110
8111
8113 {
8114 super.OnAction(action_id, player, ctx);
8115
8117 {
8118 switch (action_id)
8119 {
8123 return true;
8127 return true;
8128 }
8129 }
8130
8132 {
8133 switch (action_id)
8134 {
8136 Delete();
8137 return true;
8138 }
8139 }
8140
8141 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
8142 {
8143 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8144 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
8145 PlayerBase p = PlayerBase.Cast(player);
8146 if (
EActions.RECIPES_RANGE_START < 1000)
8147 {
8148 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
8149 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
8150 }
8151 }
8152 #ifndef SERVER
8153 else if (action_id ==
EActions.WATCH_PLAYER)
8154 {
8155 PluginDeveloper.SetDeveloperItemClientEx(player);
8156 }
8157 #endif
8159 {
8160 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
8161 {
8162 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
8163 OnDebugButtonPressServer(id + 1);
8164 }
8165
8166 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
8167 {
8168 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
8170 }
8171
8172 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
8173 {
8174 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
8176 }
8177
8178 else if (action_id ==
EActions.ADD_QUANTITY)
8179 {
8180 if (IsMagazine())
8181 {
8182 Magazine mag = Magazine.Cast(this);
8183 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
8184 }
8185 else
8186 {
8188 }
8189
8190 if (m_EM)
8191 {
8192 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
8193 }
8194
8195 }
8196
8197 else if (action_id ==
EActions.REMOVE_QUANTITY)
8198 {
8199 if (IsMagazine())
8200 {
8201 Magazine mag2 = Magazine.Cast(this);
8202 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
8203 }
8204 else
8205 {
8207 }
8208 if (m_EM)
8209 {
8210 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
8211 }
8212
8213 }
8214
8215 else if (action_id ==
EActions.SET_QUANTITY_0)
8216 {
8218
8219 if (m_EM)
8220 {
8221 m_EM.SetEnergy(0);
8222 }
8223 }
8224
8225 else if (action_id ==
EActions.SET_MAX_QUANTITY)
8226 {
8228
8229 if (m_EM)
8230 {
8231 m_EM.SetEnergy(m_EM.GetEnergyMax());
8232 }
8233 }
8234
8235 else if (action_id ==
EActions.ADD_HEALTH)
8236 {
8237 AddHealth("","",GetMaxHealth("","Health")/5);
8238 }
8239 else if (action_id ==
EActions.REMOVE_HEALTH)
8240 {
8241 AddHealth("","",-GetMaxHealth("","Health")/5);
8242 }
8243 else if (action_id ==
EActions.DESTROY_HEALTH)
8244 {
8245 SetHealth01("","",0);
8246 }
8247 else if (action_id ==
EActions.WATCH_ITEM)
8248 {
8250 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
8251 #ifdef DEVELOPER
8252 SetDebugDeveloper_item(this);
8253 #endif
8254 }
8255
8256 else if (action_id ==
EActions.ADD_TEMPERATURE)
8257 {
8258 AddTemperature(20);
8259
8260 }
8261
8262 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
8263 {
8264 AddTemperature(-20);
8265
8266 }
8267
8268 else if (action_id ==
EActions.FLIP_FROZEN)
8269 {
8270 SetFrozen(!GetIsFrozen());
8271
8272 }
8273
8274 else if (action_id ==
EActions.ADD_WETNESS)
8275 {
8277
8278 }
8279
8280 else if (action_id ==
EActions.REMOVE_WETNESS)
8281 {
8283
8284 }
8285
8286 else if (action_id ==
EActions.LIQUIDTYPE_UP)
8287 {
8290
8291
8292 }
8293
8294 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
8295 {
8298 }
8299
8300 else if (action_id ==
EActions.MAKE_SPECIAL)
8301 {
8302 auto debugParams = DebugSpawnParams.WithPlayer(player);
8303 OnDebugSpawnEx(debugParams);
8304 }
8305
8306 }
8307
8308
8309 return false;
8310 }
8311
8312
8313
8314
8318
8321
8322
8323
8325 {
8326 return false;
8327 }
8328
8329
8331 {
8332 return true;
8333 }
8334
8335
8337 {
8338 return true;
8339 }
8340
8341
8342
8344 {
8345 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
8346 return g_Game.ConfigIsExisting(config_path);
8347 }
8348
8351 {
8352 return null;
8353 }
8354
8356 {
8357 return false;
8358 }
8359
8361 {
8362 return false;
8363 }
8364
8368
8369
8371 {
8372 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8373 return module_repairing.CanRepair(this, item_repair_kit);
8374 }
8375
8376
8377 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
8378 {
8379 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8380 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
8381 }
8382
8383
8385 {
8386
8387
8388
8389
8390
8391
8392
8393
8394 return 1;
8395 }
8396
8397
8398
8400 {
8402 }
8403
8404
8405
8407 {
8409 }
8410
8411
8420 {
8421 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8422
8423 if (player)
8424 {
8425 player.MessageStatus(text);
8426 }
8427 }
8428
8429
8438 {
8439 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8440
8441 if (player)
8442 {
8443 player.MessageAction(text);
8444 }
8445 }
8446
8447
8456 {
8457 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8458
8459 if (player)
8460 {
8461 player.MessageFriendly(text);
8462 }
8463 }
8464
8465
8474 {
8475 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8476
8477 if (player)
8478 {
8479 player.MessageImportant(text);
8480 }
8481 }
8482
8484 {
8485 return true;
8486 }
8487
8488
8489 override bool KindOf(
string tag)
8490 {
8491 bool found = false;
8492 string item_name = this.
GetType();
8494 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
8495
8496 int array_size = item_tag_array.Count();
8497 for (int i = 0; i < array_size; i++)
8498 {
8499 if (item_tag_array.Get(i) == tag)
8500 {
8501 found = true;
8502 break;
8503 }
8504 }
8505 return found;
8506 }
8507
8508
8510 {
8511
8512 super.OnRPC(sender, rpc_type,ctx);
8513
8514
8515 switch (rpc_type)
8516 {
8517 #ifndef SERVER
8518 case ERPCs.RPC_SOUND_LOCK_ATTACH:
8519 Param2<bool, string> p = new Param2<bool, string>(false, "");
8520
8522 return;
8523
8524 bool play = p.param1;
8525 string soundSet = p.param2;
8526
8527 if (play)
8528 {
8530 {
8532 {
8534 }
8535 }
8536 else
8537 {
8539 }
8540 }
8541 else
8542 {
8544 }
8545
8546 break;
8547 #endif
8548
8549 }
8550
8552 {
8554 }
8555 }
8556
8557
8558
8559
8561 {
8562 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8563 return plugin.GetID(
name);
8564 }
8565
8567 {
8568 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8569 return plugin.GetName(id);
8570 }
8571
8574 {
8575
8576
8577 int varFlags;
8578 if (!ctx.
Read(varFlags))
8579 return;
8580
8581 if (varFlags & ItemVariableFlags.FLOAT)
8582 {
8584 }
8585 }
8586
8588 {
8589
8590 super.SerializeNumericalVars(floats_out);
8591
8592
8593
8595 {
8597 }
8598
8600 {
8602 }
8603
8605 {
8607 }
8608
8610 {
8615 }
8616
8618 {
8620 }
8621 }
8622
8624 {
8625
8626 super.DeSerializeNumericalVars(floats);
8627
8628
8629 int index = 0;
8630 int mask = Math.Round(floats.Get(index));
8631
8632 index++;
8633
8635 {
8637 {
8639 }
8640 else
8641 {
8642 float quantity = floats.Get(index);
8644 }
8645 index++;
8646 }
8647
8649 {
8650 float wet = floats.Get(index);
8652 index++;
8653 }
8654
8656 {
8657 int liquidtype = Math.Round(floats.Get(index));
8659 index++;
8660 }
8661
8663 {
8665 index++;
8667 index++;
8669 index++;
8671 index++;
8672 }
8673
8675 {
8676 int cleanness = Math.Round(floats.Get(index));
8678 index++;
8679 }
8680 }
8681
8683 {
8684 super.WriteVarsToCTX(ctx);
8685
8686
8688 {
8690 }
8691
8693 {
8695 }
8696
8698 {
8700 }
8701
8703 {
8704 int r,g,b,a;
8710 }
8711
8713 {
8715 }
8716 }
8717
8719 {
8720 if (!super.ReadVarsFromCTX(ctx,version))
8721 return false;
8722
8723 int intValue;
8724 float value;
8725
8726 if (version < 140)
8727 {
8728 if (!ctx.
Read(intValue))
8729 return false;
8730
8731 m_VariablesMask = intValue;
8732 }
8733
8735 {
8736 if (!ctx.
Read(value))
8737 return false;
8738
8740 {
8742 }
8743 else
8744 {
8746 }
8747 }
8748
8749 if (version < 140)
8750 {
8752 {
8753 if (!ctx.
Read(value))
8754 return false;
8755 SetTemperatureDirect(value);
8756 }
8757 }
8758
8760 {
8761 if (!ctx.
Read(value))
8762 return false;
8764 }
8765
8767 {
8768 if (!ctx.
Read(intValue))
8769 return false;
8771 }
8772
8774 {
8775 int r,g,b,a;
8777 return false;
8779 return false;
8781 return false;
8783 return false;
8784
8786 }
8787
8789 {
8790 if (!ctx.
Read(intValue))
8791 return false;
8793 }
8794
8795 if (version >= 138 && version < 140)
8796 {
8798 {
8799 if (!ctx.
Read(intValue))
8800 return false;
8801 SetFrozen(intValue);
8802 }
8803 }
8804
8805 return true;
8806 }
8807
8808
8810 {
8813 {
8815 }
8816
8817 if (!super.OnStoreLoad(ctx, version))
8818 {
8820 return false;
8821 }
8822
8823 if (version >= 114)
8824 {
8825 bool hasQuickBarIndexSaved;
8826
8827 if (!ctx.
Read(hasQuickBarIndexSaved))
8828 {
8830 return false;
8831 }
8832
8833 if (hasQuickBarIndexSaved)
8834 {
8835 int itmQBIndex;
8836
8837
8838 if (!ctx.
Read(itmQBIndex))
8839 {
8841 return false;
8842 }
8843
8844 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
8845 if (itmQBIndex != -1 && parentPlayer)
8846 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
8847 }
8848 }
8849 else
8850 {
8851
8852 PlayerBase player;
8853 int itemQBIndex;
8854 if (version ==
int.
MAX)
8855 {
8856 if (!ctx.
Read(itemQBIndex))
8857 {
8859 return false;
8860 }
8861 }
8862 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
8863 {
8864
8865 if (!ctx.
Read(itemQBIndex))
8866 {
8868 return false;
8869 }
8870 if (itemQBIndex != -1 && player)
8871 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
8872 }
8873 }
8874
8875 if (version < 140)
8876 {
8877
8878 if (!LoadVariables(ctx, version))
8879 {
8881 return false;
8882 }
8883 }
8884
8885
8887 {
8889 return false;
8890 }
8891 if (version >= 132)
8892 {
8894 if (raib)
8895 {
8897 {
8899 return false;
8900 }
8901 }
8902 }
8903
8905 return true;
8906 }
8907
8908
8909
8911 {
8912 super.OnStoreSave(ctx);
8913
8914 PlayerBase player;
8915 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
8916 {
8918
8919 int itemQBIndex = -1;
8920 itemQBIndex = player.FindQuickBarEntityIndex(this);
8921 ctx.
Write(itemQBIndex);
8922 }
8923 else
8924 {
8926 }
8927
8929
8931 if (raib)
8932 {
8934 }
8935 }
8936
8937
8939 {
8940 super.AfterStoreLoad();
8941
8943 {
8945 }
8946
8948 {
8951 }
8952 }
8953
8955 {
8956 super.EEOnAfterLoad();
8957
8959 {
8961 }
8962
8965 }
8966
8968 {
8969 return false;
8970 }
8971
8972
8973
8975 {
8977 {
8978 #ifdef PLATFORM_CONSOLE
8979
8981 {
8983 if (menu)
8984 {
8986 }
8987 }
8988 #endif
8989 }
8990
8992 {
8995 }
8996
8998 {
8999 SetWeightDirty();
9001 }
9003 {
9006 }
9007
9009 {
9012
9015 }
9017 {
9021 }
9022
9023 super.OnVariablesSynchronized();
9024 }
9025
9026
9027
9029 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
9030 {
9031 if (!IsServerCheck(allow_client))
9032 return false;
9033
9035 return false;
9036
9039
9040 if (value <= (min + 0.001))
9041 value = min;
9042
9043 if (value == min)
9044 {
9045 if (destroy_config)
9046 {
9047 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
9048 if (dstr)
9049 {
9051 this.Delete();
9052 return true;
9053 }
9054 }
9055 else if (destroy_forced)
9056 {
9058 this.Delete();
9059 return true;
9060 }
9061
9063 }
9064
9067
9069 {
9070 EntityAI parent = GetHierarchyRoot();
9071 InventoryLocation iLoc = new InventoryLocation();
9072 GetInventory().GetCurrentInventoryLocation(iLoc);
9074 {
9075 int iLocSlot = iLoc.
GetSlot();
9077 {
9079 }
9081 {
9083 }
9084 }
9085 }
9086
9088 {
9090
9091 if (delta)
9093 }
9094
9096
9097 return false;
9098 }
9099
9100
9102 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9103 {
9105 }
9106
9108 {
9111 }
9112
9114 {
9117 }
9118
9120 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9121 {
9122 float value_clamped = Math.Clamp(value, 0, 1);
9124 SetQuantity(result, destroy_config, destroy_forced);
9125 }
9126
9127
9130 {
9132 }
9133
9135 {
9137 }
9138
9139
9140
9141
9142
9143
9144
9145
9146
9147
9149 {
9150 int slot = -1;
9151 GameInventory inventory = GetInventory();
9152 if (inventory)
9153 {
9154 InventoryLocation il = new InventoryLocation;
9157 }
9158
9160 }
9161
9163 {
9164 float quantity_max = 0;
9165
9167 {
9168 if (attSlotID != -1)
9169 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
9170
9171 if (quantity_max <= 0)
9173 }
9174
9175 if (quantity_max <= 0)
9177
9178 return quantity_max;
9179 }
9180
9182 {
9184 }
9185
9187 {
9189 }
9190
9191
9193 {
9195 }
9196
9198 {
9200 }
9201
9203 {
9205 }
9206
9207
9209 {
9210
9211 float weightEx = GetWeightEx();
9212 float special = GetInventoryAndCargoWeight();
9213 return weightEx - special;
9214 }
9215
9216
9218 {
9220 }
9221
9223 {
9225 {
9226 #ifdef DEVELOPER
9227 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9228 {
9229 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
9231 }
9232 #endif
9233
9235 }
9236 else if (HasEnergyManager())
9237 {
9238 #ifdef DEVELOPER
9239 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9240 {
9241 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
9242 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
9243 }
9244 #endif
9245 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
9246 }
9247 else
9248 {
9249 #ifdef DEVELOPER
9250 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9251 {
9252 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
9253 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
9254 }
9255 #endif
9256 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
9257 }
9258 }
9259
9262 {
9263 int item_count = 0;
9265
9266 GameInventory inventory = GetInventory();
9267 CargoBase cargo = inventory.
GetCargo();
9268 if (cargo != NULL)
9269 {
9271 }
9272
9274 for (int i = 0; i < nAttachments; ++i)
9275 {
9277 if (item)
9278 item_count += item.GetNumberOfItems();
9279 }
9280 return item_count;
9281 }
9282
9285 {
9286 float weight = 0;
9287 float wetness = 1;
9288 if (include_wetness)
9291 {
9292 weight = wetness * m_ConfigWeight;
9293 }
9295 {
9296 weight = 1;
9297 }
9298 return weight;
9299 }
9300
9301
9302
9304 {
9305 GameInventory inventory = GetInventory();
9306 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
9307 {
9308 array<EntityAI> items = new array<EntityAI>;
9310 for (int i = 0; i < items.Count(); ++i)
9311 {
9313 if (item)
9314 {
9315 g_Game.ObjectDelete(item);
9316 }
9317 }
9318 }
9319 }
9320
9321
9322
9323
9325 {
9326 float energy = 0;
9327 if (HasEnergyManager())
9328 {
9329 energy = GetCompEM().GetEnergy();
9330 }
9331 return energy;
9332 }
9333
9334
9336 {
9337 super.OnEnergyConsumed();
9338
9340 }
9341
9343 {
9344 super.OnEnergyAdded();
9345
9347 }
9348
9349
9351 {
9352 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
9353 {
9355 {
9356 float energy_0to1 = GetCompEM().GetEnergy0To1();
9358 }
9359 }
9360 }
9361
9362
9364 {
9365 return ConfigGetFloat("heatIsolation");
9366 }
9367
9369 {
9371 }
9372
9374 {
9375 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
9376 if (
g_Game.ConfigIsExisting(paramPath))
9377 return g_Game.ConfigGetFloat(paramPath);
9378
9379 return 0.0;
9380 }
9381
9383 {
9384 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
9385 if (
g_Game.ConfigIsExisting(paramPath))
9386 return g_Game.ConfigGetFloat(paramPath);
9387
9388 return 0.0;
9389 }
9390
9391 override void SetWet(
float value,
bool allow_client =
false)
9392 {
9393 if (!IsServerCheck(allow_client))
9394 return;
9395
9398
9400
9401 m_VarWet = Math.Clamp(value, min, max);
9402
9404 {
9407 }
9408 }
9409
9410 override void AddWet(
float value)
9411 {
9413 }
9414
9416 {
9418 }
9419
9421 {
9423 }
9424
9426 {
9428 }
9429
9431 {
9433 }
9434
9436 {
9438 }
9439
9441 {
9444 if (newLevel != oldLevel)
9445 {
9447 }
9448 }
9449
9451 {
9452 SetWeightDirty();
9453 }
9454
9456 {
9457 return GetWetLevelInternal(
m_VarWet);
9458 }
9459
9460
9461
9463 {
9465 }
9466
9468 {
9470 }
9471
9473 {
9475 }
9476
9478 {
9480 }
9481
9482
9483
9485 {
9486 if (ConfigIsExisting("itemModelLength"))
9487 {
9488 return ConfigGetFloat("itemModelLength");
9489 }
9490 return 0;
9491 }
9492
9494 {
9495 if (ConfigIsExisting("itemAttachOffset"))
9496 {
9497 return ConfigGetFloat("itemAttachOffset");
9498 }
9499 return 0;
9500 }
9501
9502 override void SetCleanness(
int value,
bool allow_client =
false)
9503 {
9504 if (!IsServerCheck(allow_client))
9505 return;
9506
9508
9510
9513 }
9514
9516 {
9518 }
9519
9521 {
9522 return true;
9523 }
9524
9525
9526
9527
9529 {
9531 }
9532
9534 {
9536 }
9537
9538
9539
9540
9541 override void SetColor(
int r,
int g,
int b,
int a)
9542 {
9548 }
9550 override void GetColor(out
int r,out
int g,out
int b,out
int a)
9551 {
9556 }
9557
9559 {
9561 }
9562
9565 {
9566 int r,g,b,a;
9568 r = r/255;
9569 g = g/255;
9570 b = b/255;
9571 a = a/255;
9572 return MiscGameplayFunctions.GetColorString(r, g, b, a);
9573 }
9574
9575
9576
9577 override void SetLiquidType(
int value,
bool allow_client =
false)
9578 {
9579 if (!IsServerCheck(allow_client))
9580 return;
9581
9586 }
9587
9589 {
9590 return ConfigGetInt("varLiquidTypeInit");
9591 }
9592
9594 {
9596 }
9597
9599 {
9601 SetFrozen(false);
9602 }
9603
9606 {
9607 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9608 }
9609
9610
9613 {
9614 PlayerBase nplayer;
9615 if (PlayerBase.CastTo(nplayer, player))
9616 {
9618 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9619 }
9620 }
9621
9622
9625 {
9626 PlayerBase nplayer;
9627 if (PlayerBase.CastTo(nplayer,player))
9628 {
9629 nplayer.SetEnableQuickBarEntityShortcut(this, false);
9630 }
9631
9632 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
9633
9634 if (HasEnergyManager())
9635 {
9636 GetCompEM().UpdatePlugState();
9637 }
9638 }
9639
9640
9642 {
9643 super.OnPlacementStarted(player);
9644
9646 }
9647
9648 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
9649 {
9651 {
9652 m_AdminLog.OnPlacementComplete(player,
this);
9653 }
9654
9655 super.OnPlacementComplete(player, position, orientation);
9656 }
9657
9658
9659
9660
9661
9663 {
9665 {
9666 return true;
9667 }
9668 else
9669 {
9670 return false;
9671 }
9672 }
9673
9674
9676 {
9678 {
9680 }
9681 }
9682
9683
9685 {
9687 }
9688
9690 {
9692 }
9693
9694 override void InsertAgent(
int agent,
float count = 1)
9695 {
9696 if (count < 1)
9697 return;
9698
9700 }
9701
9704 {
9706 }
9707
9708
9710 {
9712 }
9713
9714
9715
9716
9717
9718
9719
9720
9721
9722
9723
9724
9725
9726
9727
9728
9729
9730
9731
9732
9733
9734
9735
9736
9737
9738
9739
9740
9741
9742
9743
9744
9745
9746
9747
9748
9749
9750
9751
9752
9753
9754
9756 {
9758 return false;
9759 return true;
9760 }
9761
9763 {
9764
9766 }
9767
9768
9771 {
9772 super.CheckForRoofLimited(timeTresholdMS);
9773
9774 float time =
g_Game.GetTime();
9775 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
9776 {
9777 m_PreviousRoofTestTime = time;
9778 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
9779 }
9780 }
9781
9782
9784 {
9786 {
9787 return 0;
9788 }
9789
9790 if (GetInventory().GetAttachmentSlotsCount() != 0)
9791 {
9792 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
9793 if (filter)
9794 return filter.GetProtectionLevel(type, false, system);
9795 else
9796 return 0;
9797 }
9798
9799 string subclassPath, entryName;
9800
9801 switch (type)
9802 {
9804 entryName = "biological";
9805 break;
9807 entryName = "chemical";
9808 break;
9809 default:
9810 entryName = "biological";
9811 break;
9812 }
9813
9814 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
9815
9816 return g_Game.ConfigGetFloat(subclassPath + entryName);
9817 }
9818
9819
9820
9823 {
9824 if (!IsMagazine())
9826
9828 }
9829
9830
9831
9832
9833
9838 {
9839 return true;
9840 }
9841
9843 {
9845 }
9846
9847
9848
9849
9850
9852 {
9853 if (parent)
9854 {
9855 if (parent.IsInherited(DayZInfected))
9856 return true;
9857
9858 if (!parent.IsRuined())
9859 return true;
9860 }
9861
9862 return true;
9863 }
9864
9866 {
9867 if (!super.CanPutAsAttachment(parent))
9868 {
9869 return false;
9870 }
9871
9872 if (!IsRuined() && !parent.IsRuined())
9873 {
9874 return true;
9875 }
9876
9877 return false;
9878 }
9879
9881 {
9882
9883
9884
9885
9886 return super.CanReceiveItemIntoCargo(item);
9887 }
9888
9890 {
9891
9892
9893
9894
9895 GameInventory attachmentInv = attachment.GetInventory();
9897 {
9898 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
9899 return false;
9900 }
9901
9902 InventoryLocation loc = new InventoryLocation();
9903 attachment.GetInventory().GetCurrentInventoryLocation(loc);
9904 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
9905 return false;
9906
9907 return super.CanReceiveAttachment(attachment, slotId);
9908 }
9909
9911 {
9912 if (!super.CanReleaseAttachment(attachment))
9913 return false;
9914
9915 return GetInventory().AreChildrenAccessible();
9916 }
9917
9918
9919
9920
9921
9922
9923
9924
9925
9926
9927
9928
9929
9930
9931
9932
9933
9934
9935
9936
9937
9939 {
9940 int id = muzzle_owner.GetMuzzleID();
9941 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
9942
9943 if (WPOF_array)
9944 {
9945 for (int i = 0; i < WPOF_array.Count(); i++)
9946 {
9947 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
9948
9949 if (WPOF)
9950 {
9951 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
9952 }
9953 }
9954 }
9955 }
9956
9957
9959 {
9960 int id = muzzle_owner.GetMuzzleID();
9962
9963 if (WPOBE_array)
9964 {
9965 for (int i = 0; i < WPOBE_array.Count(); i++)
9966 {
9967 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
9968
9969 if (WPOBE)
9970 {
9971 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
9972 }
9973 }
9974 }
9975 }
9976
9977
9979 {
9980 int id = muzzle_owner.GetMuzzleID();
9981 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9982
9983 if (WPOOH_array)
9984 {
9985 for (int i = 0; i < WPOOH_array.Count(); i++)
9986 {
9987 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9988
9989 if (WPOOH)
9990 {
9991 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
9992 }
9993 }
9994 }
9995 }
9996
9997
9999 {
10000 int id = muzzle_owner.GetMuzzleID();
10001 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10002
10003 if (WPOOH_array)
10004 {
10005 for (int i = 0; i < WPOOH_array.Count(); i++)
10006 {
10007 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10008
10009 if (WPOOH)
10010 {
10011 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10012 }
10013 }
10014 }
10015 }
10016
10017
10019 {
10020 int id = muzzle_owner.GetMuzzleID();
10021 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10022
10023 if (WPOOH_array)
10024 {
10025 for (int i = 0; i < WPOOH_array.Count(); i++)
10026 {
10027 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10028
10029 if (WPOOH)
10030 {
10031 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10032 }
10033 }
10034 }
10035 }
10036
10037
10038
10040 {
10042 {
10043 return true;
10044 }
10045
10046 return false;
10047 }
10048
10050 {
10052 {
10053 return true;
10054 }
10055
10056 return false;
10057 }
10058
10060 {
10062 {
10063 return true;
10064 }
10065
10066 return false;
10067 }
10068
10070 {
10071 return false;
10072 }
10073
10076 {
10077 return UATimeSpent.DEFAULT_DEPLOY;
10078 }
10079
10080
10081
10082
10084 {
10086 SetSynchDirty();
10087 }
10088
10090 {
10092 }
10093
10094
10096 {
10097 return false;
10098 }
10099
10102 {
10103 string att_type = "None";
10104
10105 if (ConfigIsExisting("soundAttType"))
10106 {
10107 att_type = ConfigGetString("soundAttType");
10108 }
10109
10111 }
10112
10114 {
10116 }
10117
10118
10119
10120
10121
10127
10129 {
10132
10134 }
10135
10136
10138 {
10140 return;
10141
10143
10146
10149
10150 SoundParameters params = new SoundParameters();
10154 }
10155
10156
10158 {
10160 {
10163
10164 SetSynchDirty();
10165
10168 }
10169 }
10170
10172 {
10174 }
10175
10176
10178 {
10180 return;
10181
10183 SetSynchDirty();
10184
10187 }
10188
10190 {
10193 }
10194
10196 {
10198 }
10199
10200 void OnApply(PlayerBase player);
10201
10203 {
10204 return 1.0;
10205 };
10206
10208 {
10210 }
10211
10213 {
10215 }
10216
10218
10220 {
10221 SetDynamicPhysicsLifeTime(0.01);
10223 }
10224
10226 {
10227 array<string> zone_names = new array<string>;
10228 GetDamageZones(zone_names);
10229 for (int i = 0; i < zone_names.Count(); i++)
10230 {
10231 SetHealthMax(zone_names.Get(i),"Health");
10232 }
10233 SetHealthMax("","Health");
10234 }
10235
10238 {
10239 float global_health = GetHealth01("","Health");
10240 array<string> zones = new array<string>;
10241 GetDamageZones(zones);
10242
10243 for (int i = 0; i < zones.Count(); i++)
10244 {
10245 SetHealth01(zones.Get(i),"Health",global_health);
10246 }
10247 }
10248
10251 {
10252 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
10253 }
10254
10256 {
10257 if (!hasRootAsPlayer)
10258 {
10259 if (refParentIB)
10260 {
10261
10262 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
10263 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
10264
10265 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
10266 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
10267
10270 }
10271 else
10272 {
10273
10276 }
10277 }
10278 }
10279
10281 {
10283 {
10284 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
10285 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
10286 {
10287 float heatPermCoef = 1.0;
10289 while (ent)
10290 {
10291 heatPermCoef *= ent.GetHeatPermeabilityCoef();
10292 ent = ent.GetHierarchyParent();
10293 }
10294
10295 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
10296 }
10297 }
10298 }
10299
10301 {
10302
10303 EntityAI parent = GetHierarchyParent();
10304 if (!parent)
10305 {
10306 hasParent = false;
10307 hasRootAsPlayer = false;
10308 }
10309 else
10310 {
10311 hasParent = true;
10312 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
10313 refParentIB =
ItemBase.Cast(parent);
10314 }
10315 }
10316
10317 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
10318 {
10319
10320 }
10321
10323 {
10324
10325 return false;
10326 }
10327
10329 {
10330
10331
10332 return false;
10333 }
10334
10336 {
10337
10338 return false;
10339 }
10340
10343 {
10344 return !GetIsFrozen() &&
IsOpen();
10345 }
10346
10348 {
10349 bool hasParent = false, hasRootAsPlayer = false;
10351
10352 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
10353 bool foodDecay =
g_Game.IsFoodDecayEnabled();
10354
10355 if (wwtu || foodDecay)
10356 {
10360
10361 if (processWetness || processTemperature || processDecay)
10362 {
10364
10365 if (processWetness)
10366 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
10367
10368 if (processTemperature)
10370
10371 if (processDecay)
10372 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
10373 }
10374 }
10375 }
10376
10379 {
10381 }
10382
10384 {
10387
10388 return super.GetTemperatureFreezeThreshold();
10389 }
10390
10392 {
10395
10396 return super.GetTemperatureThawThreshold();
10397 }
10398
10400 {
10403
10404 return super.GetItemOverheatThreshold();
10405 }
10406
10408 {
10410 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
10411
10412 return super.GetTemperatureFreezeTime();
10413 }
10414
10416 {
10418 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
10419
10420 return super.GetTemperatureThawTime();
10421 }
10422
10427
10429 {
10430 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
10431 }
10432
10434 {
10435 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
10436 }
10437
10440 {
10442 }
10443
10445 {
10447 }
10448
10450 {
10452 }
10453
10456 {
10457 return null;
10458 }
10459
10462 {
10463 return false;
10464 }
10465
10467 {
10469 {
10472 if (!trg)
10473 {
10475 explosive = this;
10476 }
10477
10478 explosive.PairRemote(trg);
10480
10481 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
10482 trg.SetPersistentPairID(persistentID);
10483 explosive.SetPersistentPairID(persistentID);
10484
10485 return true;
10486 }
10487 return false;
10488 }
10489
10492 {
10493 float ret = 1.0;
10496 ret *= GetHealth01();
10497
10498 return ret;
10499 }
10500
10501 #ifdef DEVELOPER
10502 override void SetDebugItem()
10503 {
10504 super.SetDebugItem();
10505 _itemBase = this;
10506 }
10507
10509 {
10510 string text = super.GetDebugText();
10511
10513 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
10514
10515 return text;
10516 }
10517 #endif
10518
10520 {
10521 return true;
10522 }
10523
10525
10527
10529 {
10532 }
10533
10534
10542
10558
10559 [
Obsolete(
"Use ItemSoundHandler instead")]
10562 {
10563 if (!
g_Game.IsDedicatedServer())
10564 {
10565 if (ConfigIsExisting("attachSoundSet"))
10566 {
10567 string cfg_path = "";
10568 string soundset = "";
10569 string type_name =
GetType();
10570
10573 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
10574 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
10575
10576 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
10577 {
10578 for (int i = 0; i < cfg_soundset_array.Count(); i++)
10579 {
10580 if (cfg_slot_array[i] == slot_type)
10581 {
10582 soundset = cfg_soundset_array[i];
10583 break;
10584 }
10585 }
10586 }
10587
10588 if (soundset != "")
10589 {
10590 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
10592 }
10593 }
10594 }
10595 }
10596
10598}
10599
10601{
10603 if (entity)
10604 {
10605 bool is_item = entity.IsInherited(
ItemBase);
10606 if (is_item && full_quantity)
10607 {
10610 }
10611 }
10612 else
10613 {
10615 return NULL;
10616 }
10617 return entity;
10618}
10619
10621{
10622 if (item)
10623 {
10624 if (health > 0)
10625 item.SetHealth("", "", health);
10626
10627 if (item.CanHaveTemperature())
10628 {
10630 if (item.CanFreeze())
10631 item.SetFrozen(false);
10632 }
10633
10634 if (item.HasEnergyManager())
10635 {
10636 if (quantity >= 0)
10637 {
10638 item.GetCompEM().SetEnergy0To1(quantity);
10639 }
10640 else
10641 {
10643 }
10644 }
10645 else if (item.IsMagazine())
10646 {
10647 Magazine mag = Magazine.Cast(item);
10648 if (quantity >= 0)
10649 {
10650 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
10651 }
10652 else
10653 {
10655 }
10656
10657 }
10658 else
10659 {
10660 if (quantity >= 0)
10661 {
10662 item.SetQuantityNormalized(quantity, false);
10663 }
10664 else
10665 {
10667 }
10668
10669 }
10670 }
10671}
10672
10673#ifdef DEVELOPER
10675#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.