5772{
5774 {
5775 return true;
5776 }
5777};
5778
5780{
5781
5782};
5783
5784
5785
5787{
5791
5793
5796
5797
5798
5799
5800
5809
5815
5820
5825
5846 protected bool m_IsResultOfSplit
5847
5849
5854
5855
5856
5858
5862
5863
5864
5866
5869
5870
5871
5877
5878
5886
5889
5890
5892
5893
5895
5896
5901
5902
5907
5909
5910
5912
5913
5915 {
5920
5921 if (!
g_Game.IsDedicatedServer())
5922 {
5924 {
5926
5928 {
5930 }
5931 }
5932
5935 }
5936
5937 m_OldLocation = null;
5938
5940 {
5942 }
5943
5944 if (ConfigIsExisting("headSelectionsToHide"))
5945 {
5948 }
5949
5951 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
5952 {
5954 }
5955
5957
5958 m_IsResultOfSplit = false;
5959
5961 }
5962
5964 {
5965 super.InitItemVariables();
5966
5972 m_Count = ConfigGetInt(
"count");
5973
5976
5981
5984
5989
6001
6005
6006
6009 if (ConfigIsExisting("canBeSplit"))
6010 {
6013 }
6014
6016 if (ConfigIsExisting("itemBehaviour"))
6018
6019
6022 RegisterNetSyncVariableInt("m_VarLiquidType");
6023 RegisterNetSyncVariableInt("m_Cleanness",0,1);
6024
6025 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
6026 RegisterNetSyncVariableFloat("m_ImpactSpeed");
6027 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
6028
6029 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
6030 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
6031 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
6032 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
6033
6034 RegisterNetSyncVariableBool("m_IsBeingPlaced");
6035 RegisterNetSyncVariableBool("m_IsTakeable");
6036 RegisterNetSyncVariableBool("m_IsHologram");
6037
6040 {
6043 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
6044 }
6045
6047
6049 if (ConfigIsExisting("temperaturePerQuantityWeight"))
6051
6053 }
6054
6056 {
6058 }
6059
6061 {
6064 {
6069 }
6070 }
6071
6072 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
6073 {
6075 {
6078 }
6079
6081 }
6082
6084 {
6090 }
6091
6093
6095 {
6097
6098 if (!action)
6099 {
6100 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
6101 return;
6102 }
6103
6105 if (!ai)
6106 {
6108 return;
6109 }
6110
6112 if (!action_array)
6113 {
6114 action_array = new array<ActionBase_Basic>;
6116 }
6117 if (LogManager.IsActionLogEnable())
6118 {
6119 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
6120 }
6121
6122 if (action_array.Find(action) != -1)
6123 {
6124 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
6125 }
6126 else
6127 {
6128 action_array.Insert(action);
6129 }
6130 }
6131
6133 {
6134 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6135 ActionBase action = player.GetActionManager().GetAction(actionName);
6138
6139 if (action_array)
6140 {
6141 action_array.RemoveItem(action);
6142 }
6143 }
6144
6145
6146
6148 {
6149 ActionOverrideData overrideData = new ActionOverrideData();
6153
6155 if (!actionMap)
6156 {
6159 }
6160
6161 actionMap.Insert(this.
Type(), overrideData);
6162
6163 }
6164
6166
6168
6169
6171 {
6174
6177
6178 string config_to_search = "CfgVehicles";
6179 string muzzle_owner_config;
6180
6182 {
6183 if (IsInherited(Weapon))
6184 config_to_search = "CfgWeapons";
6185
6186 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6187
6188 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
6189
6190 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
6191
6192 if (config_OnFire_subclass_count > 0)
6193 {
6194 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
6195
6196 for (int i = 0; i < config_OnFire_subclass_count; i++)
6197 {
6198 string particle_class = "";
6199 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
6200 string config_OnFire_entry = config_OnFire_class + particle_class;
6201 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
6202 WPOF_array.Insert(WPOF);
6203 }
6204
6205
6207 }
6208 }
6209
6211 {
6212 config_to_search = "CfgWeapons";
6213 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6214
6215 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
6216
6217 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
6218
6219 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
6220 {
6221 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
6222
6223 for (i = 0; i < config_OnBulletCasingEject_count; i++)
6224 {
6225 string particle_class2 = "";
6226 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
6227 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
6228 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
6229 WPOBE_array.Insert(WPOBE);
6230 }
6231
6232
6234 }
6235 }
6236 }
6237
6238
6240 {
6243
6245 {
6246 string config_to_search = "CfgVehicles";
6247
6248 if (IsInherited(Weapon))
6249 config_to_search = "CfgWeapons";
6250
6251 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6252 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
6253
6254 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
6255 {
6256
6258
6260 {
6262 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
6264 return;
6265 }
6266
6269
6270
6271
6272 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
6273 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
6274
6275 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
6276 {
6277 string particle_class = "";
6278 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
6279 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
6280 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
6281
6282 if (entry_type == CT_CLASS)
6283 {
6284 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
6285 WPOOH_array.Insert(WPOF);
6286 }
6287 }
6288
6289
6291 }
6292 }
6293 }
6294
6296 {
6298 }
6299
6301 {
6303 {
6305
6308
6311
6312 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6313 }
6314 }
6315
6317 {
6319 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6320
6322 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6323
6325 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6326
6328 {
6330 }
6331 }
6332
6334 {
6336 }
6337
6339 {
6342 else
6344
6346 {
6349 }
6350 else
6351 {
6354
6357 }
6358
6360 }
6361
6363 {
6365 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6366 }
6367
6369 {
6371 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6373 }
6374
6376 {
6378 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6379 }
6380
6382 {
6385
6386 OverheatingParticle OP = new OverheatingParticle();
6391
6393 }
6394
6396 {
6399
6400 return -1;
6401 }
6402
6404 {
6406 {
6409
6410 for (int i = count; i > 0; --i)
6411 {
6412 int id = i - 1;
6415
6418
6419 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
6420 {
6421 if (p)
6422 {
6425 }
6426 }
6427 }
6428 }
6429 }
6430
6432 {
6434 {
6436 {
6437 int id = i - 1;
6439
6440 if (OP)
6441 {
6443
6444 if (p)
6445 {
6447 }
6448
6449 delete OP;
6450 }
6451 }
6452
6455 }
6456 }
6457
6460 {
6461 return 0.0;
6462 }
6463
6464
6466 {
6467 return 250;
6468 }
6469
6471 {
6472 return 0;
6473 }
6474
6477 {
6479 return true;
6480
6481 return false;
6482 }
6483
6486 {
6489
6491 {
6493 }
6494 else
6495 {
6496
6498 }
6499
6501 }
6502
6509 {
6510 return -1;
6511 }
6512
6513
6514
6515
6517 {
6519 {
6520 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6521 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6522
6523 if (r_index >= 0)
6524 {
6525 InventoryLocation r_il = new InventoryLocation;
6526 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6527
6528 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6531 {
6532 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6533 }
6535 {
6536 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6537 }
6538
6539 }
6540
6541 player.GetHumanInventory().ClearUserReservedLocation(this);
6542 }
6543
6546 }
6547
6548
6549
6550
6552 {
6553 return ItemBase.m_DebugActionsMask;
6554 }
6555
6557 {
6558 return ItemBase.m_DebugActionsMask & mask;
6559 }
6560
6562 {
6563 ItemBase.m_DebugActionsMask = mask;
6564 }
6565
6567 {
6568 ItemBase.m_DebugActionsMask |= mask;
6569 }
6570
6572 {
6573 ItemBase.m_DebugActionsMask &= ~mask;
6574 }
6575
6577 {
6579 {
6581 }
6582 else
6583 {
6585 }
6586 }
6587
6588
6590 {
6591 if (GetEconomyProfile())
6592 {
6593 float q_max = GetEconomyProfile().GetQuantityMax();
6594 if (q_max > 0)
6595 {
6596 float q_min = GetEconomyProfile().GetQuantityMin();
6597 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
6598
6600 {
6601 ComponentEnergyManager comp = GetCompEM();
6603 {
6605 }
6606 }
6608 {
6610
6611 }
6612
6613 }
6614 }
6615 }
6616
6619 {
6620 EntityAI parent = GetHierarchyParent();
6621
6622 if (parent)
6623 {
6624 InventoryLocation inventory_location_to_lock = new InventoryLocation;
6625 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
6626 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
6627 }
6628 }
6629
6632 {
6633 EntityAI parent = GetHierarchyParent();
6634
6635 if (parent)
6636 {
6637 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
6638 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
6639 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
6640 }
6641 }
6642
6644 {
6645
6646
6647
6648
6650
6652 {
6653 if (ScriptInputUserData.CanStoreInputUserData())
6654 {
6655 ScriptInputUserData ctx = new ScriptInputUserData;
6661 ctx.
Write(use_stack_max);
6664
6666 {
6667 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
6668 }
6669 }
6670 }
6671 else if (!
g_Game.IsMultiplayer())
6672 {
6674 }
6675 }
6676
6678 {
6680 }
6681
6683 {
6685 }
6686
6688 {
6690 }
6691
6693 {
6694
6695 return false;
6696 }
6697
6699 {
6700 return false;
6701 }
6702
6706 {
6707 return false;
6708 }
6709
6711 {
6712 return "";
6713 }
6714
6716
6718 {
6719 return false;
6720 }
6721
6723 {
6724 return true;
6725 }
6726
6727
6728
6730 {
6731 return true;
6732 }
6733
6735 {
6736 return true;
6737 }
6738
6740 {
6741 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6743 }
6744
6746 {
6748 }
6749
6751 {
6753 if (!is_being_placed)
6755 SetSynchDirty();
6756 }
6757
6758
6760
6762 {
6764 }
6765
6767 {
6769 }
6770
6772 {
6773 return 1;
6774 }
6775
6777 {
6778 return false;
6779 }
6780
6782 {
6784 SetSynchDirty();
6785 }
6786
6787
6788
6789
6790
6791
6792
6793
6794
6795
6796
6797
6798
6799
6800
6801
6802
6803
6804
6805
6806
6807
6808
6809
6810
6811
6812
6813
6814
6815
6816
6817
6818
6819
6820
6822 {
6823 super.OnMovedInsideCargo(container);
6824
6825 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6826 }
6827
6828 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
6829 {
6830 super.EEItemLocationChanged(oldLoc, newLoc);
6831
6832 PlayerBase newPlayer = null;
6833 PlayerBase oldPlayer = null;
6834
6835 if (newLoc.GetParent())
6836 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
6837
6838 if (oldLoc.GetParent())
6839 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
6840
6842 {
6843 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
6844
6845 if (rIndex >= 0)
6846 {
6847 InventoryLocation rIl = new InventoryLocation;
6848 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
6849
6850 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
6853 {
6854 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
6855 }
6857 {
6859 }
6860
6861 }
6862 }
6863
6865 {
6866 if (newPlayer)
6867 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
6868
6869 if (newPlayer == oldPlayer)
6870 {
6871 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
6872 {
6874 {
6875 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
6876 {
6877 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6878 }
6879 }
6880 else
6881 {
6882 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6883 }
6884 }
6885
6886 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
6887 {
6888 int type = oldLoc.GetType();
6890 {
6891 oldLoc.GetParent().GetOnSetLock().Invoke(this);
6892 }
6894 {
6895 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
6896 }
6897 }
6898 if (!m_OldLocation)
6899 {
6900 m_OldLocation = new InventoryLocation;
6901 }
6902 m_OldLocation.Copy(oldLoc);
6903 }
6904 else
6905 {
6906 if (m_OldLocation)
6907 {
6908 m_OldLocation.Reset();
6909 }
6910 }
6911
6912 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
6913 }
6914 else
6915 {
6916 if (newPlayer)
6917 {
6918 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
6919 if (resIndex >= 0)
6920 {
6921 InventoryLocation il = new InventoryLocation;
6922 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
6924 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
6927 {
6928 il.
GetParent().GetOnReleaseLock().Invoke(it);
6929 }
6931 {
6933 }
6934
6935 }
6936 }
6938 {
6939
6941 }
6942
6943 if (m_OldLocation)
6944 {
6945 m_OldLocation.Reset();
6946 }
6947 }
6948
6950 {
6951 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
6952 }
6953
6955 {
6956 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
6957 }
6958 }
6959
6960 override void EOnContact(IEntity other, Contact extra)
6961 {
6963 {
6964 int liquidType = -1;
6966 if (impactSpeed > 0.0)
6967 {
6969 #ifndef SERVER
6971 #else
6973 SetSynchDirty();
6974 #endif
6976 }
6977 }
6978
6979 #ifdef SERVER
6980 if (GetCompEM() && GetCompEM().IsPlugged())
6981 {
6982 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
6983 GetCompEM().UnplugThis();
6984 }
6985 #endif
6986 }
6987
6989
6991 {
6993 }
6994
6996 {
6997
6998 }
6999
7001 {
7002 super.OnItemLocationChanged(old_owner, new_owner);
7003
7004 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
7005 PlayerBase playerNew = PlayerBase.Cast(new_owner);
7006
7007 if (!relatedPlayer && playerNew)
7008 relatedPlayer = playerNew;
7009
7010 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
7011 {
7013 if (actionMgr)
7014 {
7015 ActionBase currentAction = actionMgr.GetRunningAction();
7016 if (currentAction)
7018 }
7019 }
7020
7021 Man ownerPlayerOld = null;
7022 Man ownerPlayerNew = null;
7023
7024 if (old_owner)
7025 {
7026 if (old_owner.
IsMan())
7027 {
7028 ownerPlayerOld = Man.Cast(old_owner);
7029 }
7030 else
7031 {
7032 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
7033 }
7034 }
7035 else
7036 {
7038 {
7040
7041 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
7042 {
7043 GetCompEM().UnplugThis();
7044 }
7045 }
7046 }
7047
7048 if (new_owner)
7049 {
7050 if (new_owner.
IsMan())
7051 {
7052 ownerPlayerNew = Man.Cast(new_owner);
7053 }
7054 else
7055 {
7056 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
7057 }
7058 }
7059
7060 if (ownerPlayerOld != ownerPlayerNew)
7061 {
7062 if (ownerPlayerOld)
7063 {
7064 array<EntityAI> subItemsExit = new array<EntityAI>;
7066 for (int i = 0; i < subItemsExit.Count(); i++)
7067 {
7070 }
7071 }
7072
7073 if (ownerPlayerNew)
7074 {
7075 array<EntityAI> subItemsEnter = new array<EntityAI>;
7077 for (int j = 0; j < subItemsEnter.Count(); j++)
7078 {
7081 }
7082 }
7083 }
7084 else if (ownerPlayerNew != null)
7085 {
7086 PlayerBase nplayer;
7087 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
7088 {
7089 array<EntityAI> subItemsUpdate = new array<EntityAI>;
7091 for (int k = 0; k < subItemsUpdate.Count(); k++)
7092 {
7094 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
7095 }
7096 }
7097 }
7098
7099 if (old_owner)
7100 old_owner.OnChildItemRemoved(this);
7101 if (new_owner)
7102 new_owner.OnChildItemReceived(this);
7103 }
7104
7105
7107 {
7108 super.EEDelete(parent);
7109 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
7110 if (player)
7111 {
7113
7114 if (player.IsAlive())
7115 {
7116 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7117 if (r_index >= 0)
7118 {
7119 InventoryLocation r_il = new InventoryLocation;
7120 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7121
7122 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7125 {
7126 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7127 }
7129 {
7130 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7131 }
7132
7133 }
7134
7135 player.RemoveQuickBarEntityShortcut(this);
7136 }
7137 }
7138 }
7139
7141 {
7142 super.EEKilled(killer);
7143
7146 {
7147 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
7148 {
7149 if (IsMagazine())
7150 {
7151 if (Magazine.Cast(this).GetAmmoCount() > 0)
7152 {
7154 }
7155 }
7156 else
7157 {
7159 }
7160 }
7161 }
7162 }
7163
7165 {
7166 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7167
7168 super.OnWasAttached(parent, slot_id);
7169
7172
7175 }
7176
7178 {
7179 super.OnWasDetached(parent, slot_id);
7180
7183
7186 }
7187
7189 {
7190 int idx;
7193
7194 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7195 if (inventory_slots.Count() < 1)
7196 {
7197 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
7198 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
7199 }
7200 else
7201 {
7202 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
7203 }
7204
7205 idx = inventory_slots.Find(slot);
7206 if (idx < 0)
7207 return "";
7208
7209 return attach_types.Get(idx);
7210 }
7211
7213 {
7214 int idx = -1;
7215 string slot;
7216
7219
7220 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7221 if (inventory_slots.Count() < 1)
7222 {
7223 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
7224 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7225 }
7226 else
7227 {
7228 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
7229 if (detach_types.Count() < 1)
7230 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7231 }
7232
7233 for (int i = 0; i < inventory_slots.Count(); i++)
7234 {
7235 slot = inventory_slots.Get(i);
7236 }
7237
7238 if (slot != "")
7239 {
7240 if (detach_types.Count() == 1)
7241 idx = 0;
7242 else
7243 idx = inventory_slots.Find(slot);
7244 }
7245 if (idx < 0)
7246 return "";
7247
7248 return detach_types.Get(idx);
7249 }
7250
7252 {
7253
7255
7256
7257 float min_time = 1;
7258 float max_time = 3;
7259 float delay = Math.RandomFloat(min_time, max_time);
7260
7261 explode_timer.Run(delay, this, "DoAmmoExplosion");
7262 }
7263
7265 {
7266 Magazine magazine = Magazine.Cast(this);
7267 int pop_sounds_count = 6;
7268 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
7269
7270
7271 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
7272 string sound_name = pop_sounds[ sound_idx ];
7273 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
7274
7275
7276 magazine.ServerAddAmmoCount(-1);
7277
7278
7279 float min_temp_to_explode = 100;
7280
7281 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
7282 {
7284 }
7285 }
7286
7287
7288 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
7289 {
7290 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
7291
7292 const int CHANCE_DAMAGE_CARGO = 4;
7293 const int CHANCE_DAMAGE_ATTACHMENT = 1;
7294 const int CHANCE_DAMAGE_NOTHING = 2;
7295
7297 {
7298 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
7299 int chances;
7300 int rnd;
7301
7302 if (GetInventory().GetCargo())
7303 {
7304 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7305 rnd = Math.RandomInt(0,chances);
7306
7307 if (rnd < CHANCE_DAMAGE_CARGO)
7308 {
7310 }
7311 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
7312 {
7314 }
7315 }
7316 else
7317 {
7318 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7319 rnd = Math.RandomInt(0,chances);
7320
7321 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
7322 {
7324 }
7325 }
7326 }
7327 }
7328
7330 {
7331 CargoBase cargo = GetInventory().GetCargo();
7332 if (cargo)
7333 {
7335 if (item_count > 0)
7336 {
7337 int random_pick = Math.RandomInt(0, item_count);
7339 if (!item.IsExplosive())
7340 {
7341 item.AddHealth("","",damage);
7342 return true;
7343 }
7344 }
7345 }
7346 return false;
7347 }
7348
7350 {
7351 GameInventory inventory = GetInventory();
7353 if (attachment_count > 0)
7354 {
7355 int random_pick = Math.RandomInt(0, attachment_count);
7357 if (!attachment.IsExplosive())
7358 {
7359 attachment.AddHealth("","",damage);
7360 return true;
7361 }
7362 }
7363 return false;
7364 }
7365
7367 {
7369 }
7370
7372 {
7374 return GetInventory().CanRemoveEntity();
7375
7376 return false;
7377 }
7378
7380 {
7381
7383 return false;
7384
7385
7387 return false;
7388
7389
7390
7392 if (delta == 0)
7393 return false;
7394
7395
7396 return true;
7397 }
7398
7400 {
7402 {
7403 if (ScriptInputUserData.CanStoreInputUserData())
7404 {
7405 ScriptInputUserData ctx = new ScriptInputUserData;
7410 ctx.
Write(destination_entity);
7414 }
7415 }
7416 else if (!
g_Game.IsMultiplayer())
7417 {
7419 }
7420 }
7421
7423 {
7424 float split_quantity_new;
7428 InventoryLocation loc = new InventoryLocation;
7429
7430 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7431 {
7433 split_quantity_new = stack_max;
7434 else
7436
7438 {
7439 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7440 if (new_item)
7441 {
7442 new_item.SetResultOfSplit(true);
7443 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7445 new_item.
SetQuantity(split_quantity_new,
false,
true);
7446 }
7447 }
7448 }
7449 else if (destination_entity && slot_id == -1)
7450 {
7451 if (quantity > stack_max)
7452 split_quantity_new = stack_max;
7453 else
7454 split_quantity_new = quantity;
7455
7457 {
7458 GameInventory destinationInventory = destination_entity.GetInventory();
7460 {
7463 }
7464
7465 if (new_item)
7466 {
7467 new_item.SetResultOfSplit(true);
7468 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7470 new_item.
SetQuantity(split_quantity_new,
false,
true);
7471 }
7472 }
7473 }
7474 else
7475 {
7476 if (stack_max != 0)
7477 {
7479 {
7481 }
7482
7483 if (split_quantity_new == 0)
7484 {
7485 if (!
g_Game.IsMultiplayer())
7486 player.PhysicalPredictiveDropItem(this);
7487 else
7488 player.ServerDropEntity(this);
7489 return;
7490 }
7491
7493 {
7495
7496 if (new_item)
7497 {
7498 new_item.SetResultOfSplit(true);
7499 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7502 new_item.PlaceOnSurface();
7503 }
7504 }
7505 }
7506 }
7507 }
7508
7510 {
7511 float split_quantity_new;
7515 InventoryLocation loc = new InventoryLocation;
7516
7517 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7518 {
7520 split_quantity_new = stack_max;
7521 else
7523
7525 {
7526 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7527 if (new_item)
7528 {
7529 new_item.SetResultOfSplit(true);
7530 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7532 new_item.
SetQuantity(split_quantity_new,
false,
true);
7533 }
7534 }
7535 }
7536 else if (destination_entity && slot_id == -1)
7537 {
7538 if (quantity > stack_max)
7539 split_quantity_new = stack_max;
7540 else
7541 split_quantity_new = quantity;
7542
7544 {
7545 GameInventory destinationInventory = destination_entity.GetInventory();
7547 {
7550 }
7551
7552 if (new_item)
7553 {
7554 new_item.SetResultOfSplit(true);
7555 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7557 new_item.
SetQuantity(split_quantity_new,
false,
true);
7558 }
7559 }
7560 }
7561 else
7562 {
7563 if (stack_max != 0)
7564 {
7566 {
7568 }
7569
7571 {
7573
7574 if (new_item)
7575 {
7576 new_item.SetResultOfSplit(true);
7577 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7580 new_item.PlaceOnSurface();
7581 }
7582 }
7583 }
7584 }
7585 }
7586
7588 {
7590 {
7591 if (ScriptInputUserData.CanStoreInputUserData())
7592 {
7593 ScriptInputUserData ctx = new ScriptInputUserData;
7598 dst.WriteToContext(ctx);
7600 }
7601 }
7602 else if (!
g_Game.IsMultiplayer())
7603 {
7605 }
7606 }
7607
7609 {
7611 {
7612 if (ScriptInputUserData.CanStoreInputUserData())
7613 {
7614 ScriptInputUserData ctx = new ScriptInputUserData;
7619 ctx.
Write(destination_entity);
7625 }
7626 }
7627 else if (!
g_Game.IsMultiplayer())
7628 {
7630 }
7631 }
7632
7634 {
7636 }
7637
7639 {
7641 float split_quantity_new;
7643 if (dst.IsValid())
7644 {
7645 int slot_id = dst.GetSlot();
7647
7648 if (quantity > stack_max)
7649 split_quantity_new = stack_max;
7650 else
7651 split_quantity_new = quantity;
7652
7654 {
7656
7657 if (new_item)
7658 {
7659 new_item.SetResultOfSplit(true);
7660 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7662 new_item.
SetQuantity(split_quantity_new,
false,
true);
7663 }
7664
7665 return new_item;
7666 }
7667 }
7668
7669 return null;
7670 }
7671
7673 {
7675 float split_quantity_new;
7677 if (destination_entity)
7678 {
7680 if (quantity > stackable)
7681 split_quantity_new = stackable;
7682 else
7683 split_quantity_new = quantity;
7684
7686 {
7687 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
7688 if (new_item)
7689 {
7690 new_item.SetResultOfSplit(true);
7691 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7693 new_item.
SetQuantity(split_quantity_new,
false,
true);
7694 }
7695 }
7696 }
7697 }
7698
7700 {
7702 {
7703 if (ScriptInputUserData.CanStoreInputUserData())
7704 {
7705 ScriptInputUserData ctx = new ScriptInputUserData;
7710 ItemBase destination_entity =
this;
7711 ctx.
Write(destination_entity);
7715 }
7716 }
7717 else if (!
g_Game.IsMultiplayer())
7718 {
7720 }
7721 }
7722
7724 {
7726 float split_quantity_new;
7728 if (player)
7729 {
7731 if (quantity > stackable)
7732 split_quantity_new = stackable;
7733 else
7734 split_quantity_new = quantity;
7735
7737 {
7738 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
7739 new_item =
ItemBase.Cast(in_hands);
7740 if (new_item)
7741 {
7742 new_item.SetResultOfSplit(true);
7743 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7745 new_item.SetQuantity(split_quantity_new, false, true);
7746 }
7747 }
7748 }
7749 }
7750
7752 {
7754 float split_quantity_new = Math.Floor(quantity * 0.5);
7755
7757 return;
7758
7760
7761 if (new_item)
7762 {
7763 if (new_item.GetQuantityMax() < split_quantity_new)
7764 {
7765 split_quantity_new = new_item.GetQuantityMax();
7766 }
7767
7768 new_item.SetResultOfSplit(true);
7769 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7770
7772 {
7775 }
7776 else
7777 {
7779 new_item.
SetQuantity(split_quantity_new,
false,
true);
7780 }
7781 }
7782 }
7783
7785 {
7787 float split_quantity_new = Math.Floor(quantity / 2);
7788
7790 return;
7791
7792 InventoryLocation invloc = new InventoryLocation;
7794
7796 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
7797
7798 if (new_item)
7799 {
7800 if (new_item.GetQuantityMax() < split_quantity_new)
7801 {
7802 split_quantity_new = new_item.GetQuantityMax();
7803 }
7805 {
7808 }
7809 else if (split_quantity_new > 1)
7810 {
7812 new_item.
SetQuantity(split_quantity_new,
false,
true);
7813 }
7814 }
7815 }
7816
7819 {
7820 SetWeightDirty();
7822
7823 if (parent)
7824 parent.OnAttachmentQuantityChangedEx(this, delta);
7825
7827 {
7829 {
7831 }
7833 {
7834 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
7836 }
7837 }
7838 }
7839
7842 {
7843
7844 }
7845
7848 {
7850 }
7851
7853 {
7854 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
7855
7857 {
7858 if (newLevel == GameConstants.STATE_RUINED)
7859 {
7861 EntityAI parent = GetHierarchyParent();
7862 if (parent && parent.IsFireplace())
7863 {
7864 CargoBase cargo = GetInventory().GetCargo();
7865 if (cargo)
7866 {
7868 {
7870 }
7871 }
7872 }
7873 }
7874
7876 {
7877
7879 return;
7880 }
7881
7882 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
7883 {
7885 }
7886 }
7887 }
7888
7889
7891 {
7892 super.OnRightClick();
7893
7895 {
7897 {
7898 if (ScriptInputUserData.CanStoreInputUserData())
7899 {
7900 EntityAI root = GetHierarchyRoot();
7901 Man playerOwner = GetHierarchyRootPlayer();
7902 InventoryLocation dst = new InventoryLocation;
7903
7904
7905 if (!playerOwner && root && root == this)
7906 {
7908 }
7909 else
7910 {
7911
7912 GetInventory().GetCurrentInventoryLocation(dst);
7914 {
7915 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7917 {
7919 }
7920 else
7921 {
7923
7924
7925 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
7926 {
7928 }
7929 else
7930 {
7931 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
7932 }
7933 }
7934 }
7935 }
7936
7937 ScriptInputUserData ctx = new ScriptInputUserData;
7945 }
7946 }
7947 else if (!
g_Game.IsMultiplayer())
7948 {
7950 }
7951 }
7952 }
7953
7955 {
7956 if (root)
7957 {
7958 vector m4[4];
7959 root.GetTransform(m4);
7960 dst.SetGround(this, m4);
7961 }
7962 else
7963 {
7964 GetInventory().GetCurrentInventoryLocation(dst);
7965 }
7966 }
7967
7968 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
7969 {
7970
7971 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
7972 return false;
7973
7974 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
7975 return false;
7976
7977
7979 return false;
7980
7981
7982 Magazine mag = Magazine.Cast(this);
7983 if (mag)
7984 {
7985 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
7986 return false;
7987
7988 if (stack_max_limit)
7989 {
7990 Magazine other_mag = Magazine.Cast(other_item);
7991 if (other_item)
7992 {
7993 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
7994 return false;
7995 }
7996
7997 }
7998 }
7999 else
8000 {
8001
8003 return false;
8004
8006 return false;
8007 }
8008
8009 PlayerBase player = null;
8010 if (CastTo(player, GetHierarchyRootPlayer()))
8011 {
8012 if (player.GetInventory().HasAttachment(this))
8013 return false;
8014
8015 if (player.IsItemsToDelete())
8016 return false;
8017 }
8018
8019 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
8020 return false;
8021
8022 int slotID;
8024 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
8025 return false;
8026
8027 return true;
8028 }
8029
8031 {
8033 }
8034
8036 {
8037 return m_IsResultOfSplit;
8038 }
8039
8041 {
8042 m_IsResultOfSplit = value;
8043 }
8044
8046 {
8048 }
8049
8051 {
8052 float other_item_quantity = other_item.GetQuantity();
8053 float this_free_space;
8054
8056
8058
8059 if (other_item_quantity > this_free_space)
8060 {
8061 return this_free_space;
8062 }
8063 else
8064 {
8065 return other_item_quantity;
8066 }
8067 }
8068
8070 {
8072 }
8073
8075 {
8077 return;
8078
8079 if (!IsMagazine() && other_item)
8080 {
8082 if (quantity_used != 0)
8083 {
8084 float hp1 = GetHealth01("","");
8085 float hp2 = other_item.GetHealth01("","");
8086 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
8087 hpResult = hpResult / (
GetQuantity() + quantity_used);
8088
8089 hpResult *= GetMaxHealth();
8090 Math.Round(hpResult);
8091 SetHealth("", "Health", hpResult);
8092
8094 other_item.AddQuantity(-quantity_used);
8095 }
8096 }
8098 }
8099
8101 {
8102 #ifdef SERVER
8103 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
8104 GetHierarchyParent().IncreaseLifetimeUp();
8105 #endif
8106 };
8107
8109 {
8110 PlayerBase p = PlayerBase.Cast(player);
8111
8112 array<int> recipesIds = p.m_Recipes;
8113 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8114 if (moduleRecipesManager)
8115 {
8116 EntityAI itemInHands = player.GetEntityInHands();
8117 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
8118 }
8119
8120 for (int i = 0;i < recipesIds.Count(); i++)
8121 {
8122 int key = recipesIds.Get(i);
8123 string recipeName = moduleRecipesManager.GetRecipeName(key);
8125 }
8126 }
8127
8128
8129 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
8130 {
8131 super.GetDebugActions(outputList);
8132
8133
8139
8140
8145
8150
8151
8155
8156
8158 {
8162 }
8163
8166
8167
8171
8173
8174 InventoryLocation loc = new InventoryLocation();
8175 GetInventory().GetCurrentInventoryLocation(loc);
8177 {
8178 if (Gizmo_IsSupported())
8181 }
8182
8184 }
8185
8186
8187
8188
8190 {
8191 super.OnAction(action_id, player, ctx);
8192
8194 {
8195 switch (action_id)
8196 {
8200 return true;
8204 return true;
8205 }
8206 }
8207
8209 {
8210 switch (action_id)
8211 {
8213 Delete();
8214 return true;
8215 }
8216 }
8217
8218 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
8219 {
8220 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8221 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
8222 PlayerBase p = PlayerBase.Cast(player);
8223 if (
EActions.RECIPES_RANGE_START < 1000)
8224 {
8225 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
8226 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
8227 }
8228 }
8229 #ifndef SERVER
8230 else if (action_id ==
EActions.WATCH_PLAYER)
8231 {
8232 PluginDeveloper.SetDeveloperItemClientEx(player);
8233 }
8234 #endif
8236 {
8237 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
8238 {
8239 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
8240 OnDebugButtonPressServer(id + 1);
8241 }
8242
8243 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
8244 {
8245 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
8247 }
8248
8249 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
8250 {
8251 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
8253 }
8254
8255 else if (action_id ==
EActions.ADD_QUANTITY)
8256 {
8257 if (IsMagazine())
8258 {
8259 Magazine mag = Magazine.Cast(this);
8260 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
8261 }
8262 else
8263 {
8265 }
8266
8267 if (m_EM)
8268 {
8269 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
8270 }
8271
8272 }
8273
8274 else if (action_id ==
EActions.REMOVE_QUANTITY)
8275 {
8276 if (IsMagazine())
8277 {
8278 Magazine mag2 = Magazine.Cast(this);
8279 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
8280 }
8281 else
8282 {
8284 }
8285 if (m_EM)
8286 {
8287 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
8288 }
8289
8290 }
8291
8292 else if (action_id ==
EActions.SET_QUANTITY_0)
8293 {
8295
8296 if (m_EM)
8297 {
8298 m_EM.SetEnergy(0);
8299 }
8300 }
8301
8302 else if (action_id ==
EActions.SET_MAX_QUANTITY)
8303 {
8305
8306 if (m_EM)
8307 {
8308 m_EM.SetEnergy(m_EM.GetEnergyMax());
8309 }
8310 }
8311
8312 else if (action_id ==
EActions.ADD_HEALTH)
8313 {
8314 AddHealth("","",GetMaxHealth("","Health")/5);
8315 }
8316 else if (action_id ==
EActions.REMOVE_HEALTH)
8317 {
8318 AddHealth("","",-GetMaxHealth("","Health")/5);
8319 }
8320 else if (action_id ==
EActions.DESTROY_HEALTH)
8321 {
8322 SetHealth01("","",0);
8323 }
8324 else if (action_id ==
EActions.WATCH_ITEM)
8325 {
8327 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
8328 #ifdef DEVELOPER
8329 SetDebugDeveloper_item(this);
8330 #endif
8331 }
8332
8333 else if (action_id ==
EActions.ADD_TEMPERATURE)
8334 {
8335 AddTemperature(20);
8336
8337 }
8338
8339 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
8340 {
8341 AddTemperature(-20);
8342
8343 }
8344
8345 else if (action_id ==
EActions.FLIP_FROZEN)
8346 {
8347 SetFrozen(!GetIsFrozen());
8348
8349 }
8350
8351 else if (action_id ==
EActions.ADD_WETNESS)
8352 {
8354
8355 }
8356
8357 else if (action_id ==
EActions.REMOVE_WETNESS)
8358 {
8360
8361 }
8362
8363 else if (action_id ==
EActions.LIQUIDTYPE_UP)
8364 {
8367
8368
8369 }
8370
8371 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
8372 {
8375 }
8376
8377 else if (action_id ==
EActions.MAKE_SPECIAL)
8378 {
8379 auto debugParams = DebugSpawnParams.WithPlayer(player);
8380 OnDebugSpawnEx(debugParams);
8381 }
8382
8383 }
8384
8385
8386 return false;
8387 }
8388
8389
8390
8391
8395
8398
8399
8400
8402 {
8403 return false;
8404 }
8405
8406
8408 {
8409 return true;
8410 }
8411
8412
8414 {
8415 return true;
8416 }
8417
8418
8419
8421 {
8422 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
8423 return g_Game.ConfigIsExisting(config_path);
8424 }
8425
8428 {
8429 return null;
8430 }
8431
8433 {
8434 return false;
8435 }
8436
8438 {
8439 return false;
8440 }
8441
8445
8446
8448 {
8449 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8450 return module_repairing.CanRepair(this, item_repair_kit);
8451 }
8452
8453
8454 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
8455 {
8456 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8457 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
8458 }
8459
8460
8462 {
8463
8464
8465
8466
8467
8468
8469
8470
8471 return 1;
8472 }
8473
8474
8475
8477 {
8479 }
8480
8481
8482
8484 {
8486 }
8487
8488
8497 {
8498 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8499
8500 if (player)
8501 {
8502 player.MessageStatus(text);
8503 }
8504 }
8505
8506
8515 {
8516 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8517
8518 if (player)
8519 {
8520 player.MessageAction(text);
8521 }
8522 }
8523
8524
8533 {
8534 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8535
8536 if (player)
8537 {
8538 player.MessageFriendly(text);
8539 }
8540 }
8541
8542
8551 {
8552 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8553
8554 if (player)
8555 {
8556 player.MessageImportant(text);
8557 }
8558 }
8559
8561 {
8562 return true;
8563 }
8564
8565
8566 override bool KindOf(
string tag)
8567 {
8568 bool found = false;
8569 string item_name = this.
GetType();
8571 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
8572
8573 int array_size = item_tag_array.Count();
8574 for (int i = 0; i < array_size; i++)
8575 {
8576 if (item_tag_array.Get(i) == tag)
8577 {
8578 found = true;
8579 break;
8580 }
8581 }
8582 return found;
8583 }
8584
8585
8587 {
8588
8589 super.OnRPC(sender, rpc_type,ctx);
8590
8591
8592 switch (rpc_type)
8593 {
8594 #ifndef SERVER
8595 case ERPCs.RPC_SOUND_LOCK_ATTACH:
8596 Param2<bool, string> p = new Param2<bool, string>(false, "");
8597
8599 return;
8600
8601 bool play = p.param1;
8602 string soundSet = p.param2;
8603
8604 if (play)
8605 {
8607 {
8609 {
8611 }
8612 }
8613 else
8614 {
8616 }
8617 }
8618 else
8619 {
8621 }
8622
8623 break;
8624 #endif
8625
8626 }
8627
8629 {
8631 }
8632 }
8633
8634
8635
8636
8638 {
8639 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8640 return plugin.GetID(
name);
8641 }
8642
8644 {
8645 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8646 return plugin.GetName(id);
8647 }
8648
8651 {
8652
8653
8654 int varFlags;
8655 if (!ctx.
Read(varFlags))
8656 return;
8657
8658 if (varFlags & ItemVariableFlags.FLOAT)
8659 {
8661 }
8662 }
8663
8665 {
8666
8667 super.SerializeNumericalVars(floats_out);
8668
8669
8670
8672 {
8674 }
8675
8677 {
8679 }
8680
8682 {
8684 }
8685
8687 {
8692 }
8693
8695 {
8697 }
8698 }
8699
8701 {
8702
8703 super.DeSerializeNumericalVars(floats);
8704
8705
8706 int index = 0;
8707 int mask = Math.Round(floats.Get(index));
8708
8709 index++;
8710
8712 {
8714 {
8716 }
8717 else
8718 {
8719 float quantity = floats.Get(index);
8721 }
8722 index++;
8723 }
8724
8726 {
8727 float wet = floats.Get(index);
8729 index++;
8730 }
8731
8733 {
8734 int liquidtype = Math.Round(floats.Get(index));
8736 index++;
8737 }
8738
8740 {
8742 index++;
8744 index++;
8746 index++;
8748 index++;
8749 }
8750
8752 {
8753 int cleanness = Math.Round(floats.Get(index));
8755 index++;
8756 }
8757 }
8758
8760 {
8761 super.WriteVarsToCTX(ctx);
8762
8763
8765 {
8767 }
8768
8770 {
8772 }
8773
8775 {
8777 }
8778
8780 {
8781 int r,g,b,a;
8787 }
8788
8790 {
8792 }
8793 }
8794
8796 {
8797 if (!super.ReadVarsFromCTX(ctx,version))
8798 return false;
8799
8800 int intValue;
8801 float value;
8802
8803 if (version < 140)
8804 {
8805 if (!ctx.
Read(intValue))
8806 return false;
8807
8808 m_VariablesMask = intValue;
8809 }
8810
8812 {
8813 if (!ctx.
Read(value))
8814 return false;
8815
8817 {
8819 }
8820 else
8821 {
8823 }
8824 }
8825
8826 if (version < 140)
8827 {
8829 {
8830 if (!ctx.
Read(value))
8831 return false;
8832 SetTemperatureDirect(value);
8833 }
8834 }
8835
8837 {
8838 if (!ctx.
Read(value))
8839 return false;
8841 }
8842
8844 {
8845 if (!ctx.
Read(intValue))
8846 return false;
8848 }
8849
8851 {
8852 int r,g,b,a;
8854 return false;
8856 return false;
8858 return false;
8860 return false;
8861
8863 }
8864
8866 {
8867 if (!ctx.
Read(intValue))
8868 return false;
8870 }
8871
8872 if (version >= 138 && version < 140)
8873 {
8875 {
8876 if (!ctx.
Read(intValue))
8877 return false;
8878 SetFrozen(intValue);
8879 }
8880 }
8881
8882 return true;
8883 }
8884
8885
8887 {
8890 {
8892 }
8893
8894 if (!super.OnStoreLoad(ctx, version))
8895 {
8897 return false;
8898 }
8899
8900 if (version >= 114)
8901 {
8902 bool hasQuickBarIndexSaved;
8903
8904 if (!ctx.
Read(hasQuickBarIndexSaved))
8905 {
8907 return false;
8908 }
8909
8910 if (hasQuickBarIndexSaved)
8911 {
8912 int itmQBIndex;
8913
8914
8915 if (!ctx.
Read(itmQBIndex))
8916 {
8918 return false;
8919 }
8920
8921 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
8922 if (itmQBIndex != -1 && parentPlayer)
8923 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
8924 }
8925 }
8926 else
8927 {
8928
8929 PlayerBase player;
8930 int itemQBIndex;
8931 if (version ==
int.
MAX)
8932 {
8933 if (!ctx.
Read(itemQBIndex))
8934 {
8936 return false;
8937 }
8938 }
8939 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
8940 {
8941
8942 if (!ctx.
Read(itemQBIndex))
8943 {
8945 return false;
8946 }
8947 if (itemQBIndex != -1 && player)
8948 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
8949 }
8950 }
8951
8952 if (version < 140)
8953 {
8954
8955 if (!LoadVariables(ctx, version))
8956 {
8958 return false;
8959 }
8960 }
8961
8962
8964 {
8966 return false;
8967 }
8968 if (version >= 132)
8969 {
8971 if (raib)
8972 {
8974 {
8976 return false;
8977 }
8978 }
8979 }
8980
8982 return true;
8983 }
8984
8985
8986
8988 {
8989 super.OnStoreSave(ctx);
8990
8991 PlayerBase player;
8992 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
8993 {
8995
8996 int itemQBIndex = -1;
8997 itemQBIndex = player.FindQuickBarEntityIndex(this);
8998 ctx.
Write(itemQBIndex);
8999 }
9000 else
9001 {
9003 }
9004
9006
9008 if (raib)
9009 {
9011 }
9012 }
9013
9014
9016 {
9017 super.AfterStoreLoad();
9018
9020 {
9022 }
9023
9025 {
9028 }
9029 }
9030
9032 {
9033 super.EEOnAfterLoad();
9034
9036 {
9038 }
9039
9042 }
9043
9045 {
9046 return false;
9047 }
9048
9049
9050
9052 {
9054 {
9055 #ifdef PLATFORM_CONSOLE
9056
9058 {
9060 if (menu)
9061 {
9063 }
9064 }
9065 #endif
9066 }
9067
9069 {
9072 }
9073
9075 {
9076 SetWeightDirty();
9078 }
9080 {
9083 }
9084
9086 {
9089
9092 }
9094 {
9098 }
9099
9100 super.OnVariablesSynchronized();
9101 }
9102
9103
9104
9106 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
9107 {
9108 if (!IsServerCheck(allow_client))
9109 return false;
9110
9112 return false;
9113
9116
9117 if (value <= (min + 0.001))
9118 value = min;
9119
9120 if (value == min)
9121 {
9122 if (destroy_config)
9123 {
9124 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
9125 if (dstr)
9126 {
9128 this.Delete();
9129 return true;
9130 }
9131 }
9132 else if (destroy_forced)
9133 {
9135 this.Delete();
9136 return true;
9137 }
9138
9140 }
9141
9144
9146 {
9147 EntityAI parent = GetHierarchyRoot();
9148 InventoryLocation iLoc = new InventoryLocation();
9149 GetInventory().GetCurrentInventoryLocation(iLoc);
9151 {
9152 int iLocSlot = iLoc.
GetSlot();
9154 {
9156 }
9158 {
9160 }
9161 }
9162 }
9163
9165 {
9167
9168 if (delta)
9170 }
9171
9173
9174 return false;
9175 }
9176
9177
9179 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9180 {
9182 }
9183
9185 {
9188 }
9189
9191 {
9194 }
9195
9197 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9198 {
9199 float value_clamped = Math.Clamp(value, 0, 1);
9201 SetQuantity(result, destroy_config, destroy_forced);
9202 }
9203
9204
9207 {
9209 }
9210
9212 {
9214 }
9215
9216
9217
9218
9219
9220
9221
9222
9223
9224
9226 {
9227 int slot = -1;
9228 GameInventory inventory = GetInventory();
9229 if (inventory)
9230 {
9231 InventoryLocation il = new InventoryLocation;
9234 }
9235
9237 }
9238
9240 {
9241 float quantity_max = 0;
9242
9244 {
9245 if (attSlotID != -1)
9246 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
9247
9248 if (quantity_max <= 0)
9250 }
9251
9252 if (quantity_max <= 0)
9254
9255 return quantity_max;
9256 }
9257
9259 {
9261 }
9262
9264 {
9266 }
9267
9268
9270 {
9272 }
9273
9275 {
9277 }
9278
9280 {
9282 }
9283
9284
9286 {
9287
9288 float weightEx = GetWeightEx();
9289 float special = GetInventoryAndCargoWeight();
9290 return weightEx - special;
9291 }
9292
9293
9295 {
9297 }
9298
9300 {
9302 {
9303 #ifdef DEVELOPER
9304 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9305 {
9306 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
9308 }
9309 #endif
9310
9312 }
9313 else if (HasEnergyManager())
9314 {
9315 #ifdef DEVELOPER
9316 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9317 {
9318 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
9319 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
9320 }
9321 #endif
9322 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
9323 }
9324 else
9325 {
9326 #ifdef DEVELOPER
9327 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9328 {
9329 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
9330 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
9331 }
9332 #endif
9333 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
9334 }
9335 }
9336
9339 {
9340 int item_count = 0;
9342
9343 GameInventory inventory = GetInventory();
9344 CargoBase cargo = inventory.
GetCargo();
9345 if (cargo != NULL)
9346 {
9348 }
9349
9351 for (int i = 0; i < nAttachments; ++i)
9352 {
9354 if (item)
9355 item_count += item.GetNumberOfItems();
9356 }
9357 return item_count;
9358 }
9359
9362 {
9363 float weight = 0;
9364 float wetness = 1;
9365 if (include_wetness)
9368 {
9369 weight = wetness * m_ConfigWeight;
9370 }
9372 {
9373 weight = 1;
9374 }
9375 return weight;
9376 }
9377
9378
9379
9381 {
9382 GameInventory inventory = GetInventory();
9383 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
9384 {
9385 array<EntityAI> items = new array<EntityAI>;
9387 for (int i = 0; i < items.Count(); ++i)
9388 {
9390 if (item)
9391 {
9392 g_Game.ObjectDelete(item);
9393 }
9394 }
9395 }
9396 }
9397
9398
9399
9400
9402 {
9403 float energy = 0;
9404 if (HasEnergyManager())
9405 {
9406 energy = GetCompEM().GetEnergy();
9407 }
9408 return energy;
9409 }
9410
9411
9413 {
9414 super.OnEnergyConsumed();
9415
9417 }
9418
9420 {
9421 super.OnEnergyAdded();
9422
9424 }
9425
9426
9428 {
9429 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
9430 {
9432 {
9433 float energy_0to1 = GetCompEM().GetEnergy0To1();
9435 }
9436 }
9437 }
9438
9439
9441 {
9442 return ConfigGetFloat("heatIsolation");
9443 }
9444
9446 {
9448 }
9449
9451 {
9452 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
9453 if (
g_Game.ConfigIsExisting(paramPath))
9454 return g_Game.ConfigGetFloat(paramPath);
9455
9456 return 0.0;
9457 }
9458
9460 {
9461 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
9462 if (
g_Game.ConfigIsExisting(paramPath))
9463 return g_Game.ConfigGetFloat(paramPath);
9464
9465 return 0.0;
9466 }
9467
9468 override void SetWet(
float value,
bool allow_client =
false)
9469 {
9470 if (!IsServerCheck(allow_client))
9471 return;
9472
9475
9477
9478 m_VarWet = Math.Clamp(value, min, max);
9479
9481 {
9484 }
9485 }
9486
9487 override void AddWet(
float value)
9488 {
9490 }
9491
9493 {
9495 }
9496
9498 {
9500 }
9501
9503 {
9505 }
9506
9508 {
9510 }
9511
9513 {
9515 }
9516
9518 {
9521 if (newLevel != oldLevel)
9522 {
9524 }
9525 }
9526
9528 {
9529 SetWeightDirty();
9530 }
9531
9533 {
9534 return GetWetLevelInternal(
m_VarWet);
9535 }
9536
9537
9538
9540 {
9542 }
9543
9545 {
9547 }
9548
9550 {
9552 }
9553
9555 {
9557 }
9558
9559
9560
9562 {
9563 if (ConfigIsExisting("itemModelLength"))
9564 {
9565 return ConfigGetFloat("itemModelLength");
9566 }
9567 return 0;
9568 }
9569
9571 {
9572 if (ConfigIsExisting("itemAttachOffset"))
9573 {
9574 return ConfigGetFloat("itemAttachOffset");
9575 }
9576 return 0;
9577 }
9578
9579 override void SetCleanness(
int value,
bool allow_client =
false)
9580 {
9581 if (!IsServerCheck(allow_client))
9582 return;
9583
9585
9587
9590 }
9591
9593 {
9595 }
9596
9598 {
9599 return true;
9600 }
9601
9602
9603
9604
9606 {
9608 }
9609
9611 {
9613 }
9614
9615
9616
9617
9618 override void SetColor(
int r,
int g,
int b,
int a)
9619 {
9625 }
9627 override void GetColor(out
int r,out
int g,out
int b,out
int a)
9628 {
9633 }
9634
9636 {
9638 }
9639
9642 {
9643 int r,g,b,a;
9645 r = r/255;
9646 g = g/255;
9647 b = b/255;
9648 a = a/255;
9649 return MiscGameplayFunctions.GetColorString(r, g, b, a);
9650 }
9651
9652
9653
9654 override void SetLiquidType(
int value,
bool allow_client =
false)
9655 {
9656 if (!IsServerCheck(allow_client))
9657 return;
9658
9663 }
9664
9666 {
9667 return ConfigGetInt("varLiquidTypeInit");
9668 }
9669
9671 {
9673 }
9674
9676 {
9678 SetFrozen(false);
9679 }
9680
9683 {
9684 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9685 }
9686
9687
9690 {
9691 PlayerBase nplayer;
9692 if (PlayerBase.CastTo(nplayer, player))
9693 {
9695 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9696 }
9697 }
9698
9699
9702 {
9703 PlayerBase nplayer;
9704 if (PlayerBase.CastTo(nplayer,player))
9705 {
9706 nplayer.SetEnableQuickBarEntityShortcut(this, false);
9707 }
9708
9709 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
9710
9711 if (HasEnergyManager())
9712 {
9713 GetCompEM().UpdatePlugState();
9714 }
9715 }
9716
9717
9719 {
9720 super.OnPlacementStarted(player);
9721
9723 }
9724
9725 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
9726 {
9728 {
9729 m_AdminLog.OnPlacementComplete(player,
this);
9730 }
9731
9732 super.OnPlacementComplete(player, position, orientation);
9733 }
9734
9735
9736
9737
9738
9740 {
9742 {
9743 return true;
9744 }
9745 else
9746 {
9747 return false;
9748 }
9749 }
9750
9751
9753 {
9755 {
9757 }
9758 }
9759
9760
9762 {
9764 }
9765
9767 {
9769 }
9770
9771 override void InsertAgent(
int agent,
float count = 1)
9772 {
9773 if (count < 1)
9774 return;
9775
9777 }
9778
9781 {
9783 }
9784
9785
9787 {
9789 }
9790
9791
9792
9793
9794
9795
9796
9797
9798
9799
9800
9801
9802
9803
9804
9805
9806
9807
9808
9809
9810
9811
9812
9813
9814
9815
9816
9817
9818
9819
9820
9821
9822
9823
9824
9825
9826
9827
9828
9829
9830
9831
9833 {
9835 return false;
9836 return true;
9837 }
9838
9840 {
9841
9843 }
9844
9845
9848 {
9849 super.CheckForRoofLimited(timeTresholdMS);
9850
9851 float time =
g_Game.GetTime();
9852 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
9853 {
9854 m_PreviousRoofTestTime = time;
9855 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
9856 }
9857 }
9858
9859
9861 {
9863 {
9864 return 0;
9865 }
9866
9867 if (GetInventory().GetAttachmentSlotsCount() != 0)
9868 {
9869 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
9870 if (filter)
9871 return filter.GetProtectionLevel(type, false, system);
9872 else
9873 return 0;
9874 }
9875
9876 string subclassPath, entryName;
9877
9878 switch (type)
9879 {
9881 entryName = "biological";
9882 break;
9884 entryName = "chemical";
9885 break;
9886 default:
9887 entryName = "biological";
9888 break;
9889 }
9890
9891 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
9892
9893 return g_Game.ConfigGetFloat(subclassPath + entryName);
9894 }
9895
9896
9897
9900 {
9901 if (!IsMagazine())
9903
9905 }
9906
9907
9908
9909
9910
9915 {
9916 return true;
9917 }
9918
9920 {
9922 }
9923
9924
9925
9926
9927
9929 {
9930 if (parent)
9931 {
9932 if (parent.IsInherited(DayZInfected))
9933 return true;
9934
9935 if (!parent.IsRuined())
9936 return true;
9937 }
9938
9939 return true;
9940 }
9941
9943 {
9944 if (!super.CanPutAsAttachment(parent))
9945 {
9946 return false;
9947 }
9948
9949 if (!IsRuined() && !parent.IsRuined())
9950 {
9951 return true;
9952 }
9953
9954 return false;
9955 }
9956
9958 {
9959
9960
9961
9962
9963 return super.CanReceiveItemIntoCargo(item);
9964 }
9965
9967 {
9968
9969
9970
9971
9972 GameInventory attachmentInv = attachment.GetInventory();
9974 {
9975 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
9976 return false;
9977 }
9978
9979 InventoryLocation loc = new InventoryLocation();
9980 attachment.GetInventory().GetCurrentInventoryLocation(loc);
9981 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
9982 return false;
9983
9984 return super.CanReceiveAttachment(attachment, slotId);
9985 }
9986
9988 {
9989 if (!super.CanReleaseAttachment(attachment))
9990 return false;
9991
9992 return GetInventory().AreChildrenAccessible();
9993 }
9994
9995
9996
9997
9998
9999
10000
10001
10002
10003
10004
10005
10006
10007
10008
10009
10010
10011
10012
10013
10014
10016 {
10017 int id = muzzle_owner.GetMuzzleID();
10018 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
10019
10020 if (WPOF_array)
10021 {
10022 for (int i = 0; i < WPOF_array.Count(); i++)
10023 {
10024 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
10025
10026 if (WPOF)
10027 {
10028 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
10029 }
10030 }
10031 }
10032 }
10033
10034
10036 {
10037 int id = muzzle_owner.GetMuzzleID();
10039
10040 if (WPOBE_array)
10041 {
10042 for (int i = 0; i < WPOBE_array.Count(); i++)
10043 {
10044 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
10045
10046 if (WPOBE)
10047 {
10048 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10049 }
10050 }
10051 }
10052 }
10053
10054
10056 {
10057 int id = muzzle_owner.GetMuzzleID();
10058 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10059
10060 if (WPOOH_array)
10061 {
10062 for (int i = 0; i < WPOOH_array.Count(); i++)
10063 {
10064 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10065
10066 if (WPOOH)
10067 {
10068 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10069 }
10070 }
10071 }
10072 }
10073
10074
10076 {
10077 int id = muzzle_owner.GetMuzzleID();
10078 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10079
10080 if (WPOOH_array)
10081 {
10082 for (int i = 0; i < WPOOH_array.Count(); i++)
10083 {
10084 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10085
10086 if (WPOOH)
10087 {
10088 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10089 }
10090 }
10091 }
10092 }
10093
10094
10096 {
10097 int id = muzzle_owner.GetMuzzleID();
10098 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10099
10100 if (WPOOH_array)
10101 {
10102 for (int i = 0; i < WPOOH_array.Count(); i++)
10103 {
10104 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10105
10106 if (WPOOH)
10107 {
10108 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10109 }
10110 }
10111 }
10112 }
10113
10114
10115
10117 {
10119 {
10120 return true;
10121 }
10122
10123 return false;
10124 }
10125
10127 {
10129 {
10130 return true;
10131 }
10132
10133 return false;
10134 }
10135
10137 {
10139 {
10140 return true;
10141 }
10142
10143 return false;
10144 }
10145
10147 {
10148 return false;
10149 }
10150
10153 {
10154 return UATimeSpent.DEFAULT_DEPLOY;
10155 }
10156
10157
10158
10159
10161 {
10163 SetSynchDirty();
10164 }
10165
10167 {
10169 }
10170
10171
10173 {
10174 return false;
10175 }
10176
10179 {
10180 string att_type = "None";
10181
10182 if (ConfigIsExisting("soundAttType"))
10183 {
10184 att_type = ConfigGetString("soundAttType");
10185 }
10186
10188 }
10189
10191 {
10193 }
10194
10195
10196
10197
10198
10204
10206 {
10209
10211 }
10212
10213
10215 {
10217 return;
10218
10220
10223
10226
10227 SoundParameters params = new SoundParameters();
10231 }
10232
10233
10235 {
10237 {
10240
10241 SetSynchDirty();
10242
10245 }
10246 }
10247
10249 {
10251 }
10252
10253
10255 {
10257 return;
10258
10260 SetSynchDirty();
10261
10264 }
10265
10267 {
10270 }
10271
10273 {
10275 }
10276
10277 void OnApply(PlayerBase player);
10278
10280 {
10281 return 1.0;
10282 };
10283
10285 {
10287 }
10288
10290 {
10292 }
10293
10295
10297 {
10298 SetDynamicPhysicsLifeTime(0.01);
10300 }
10301
10303 {
10304 array<string> zone_names = new array<string>;
10305 GetDamageZones(zone_names);
10306 for (int i = 0; i < zone_names.Count(); i++)
10307 {
10308 SetHealthMax(zone_names.Get(i),"Health");
10309 }
10310 SetHealthMax("","Health");
10311 }
10312
10315 {
10316 float global_health = GetHealth01("","Health");
10317 array<string> zones = new array<string>;
10318 GetDamageZones(zones);
10319
10320 for (int i = 0; i < zones.Count(); i++)
10321 {
10322 SetHealth01(zones.Get(i),"Health",global_health);
10323 }
10324 }
10325
10328 {
10329 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
10330 }
10331
10333 {
10334 if (!hasRootAsPlayer)
10335 {
10336 if (refParentIB)
10337 {
10338
10339 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
10340 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
10341
10342 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
10343 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
10344
10347 }
10348 else
10349 {
10350
10353 }
10354 }
10355 }
10356
10358 {
10360 {
10361 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
10362 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
10363 {
10364 float heatPermCoef = 1.0;
10366 while (ent)
10367 {
10368 heatPermCoef *= ent.GetHeatPermeabilityCoef();
10369 ent = ent.GetHierarchyParent();
10370 }
10371
10372 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
10373 }
10374 }
10375 }
10376
10378 {
10379
10380 EntityAI parent = GetHierarchyParent();
10381 if (!parent)
10382 {
10383 hasParent = false;
10384 hasRootAsPlayer = false;
10385 }
10386 else
10387 {
10388 hasParent = true;
10389 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
10390 refParentIB =
ItemBase.Cast(parent);
10391 }
10392 }
10393
10394 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
10395 {
10396
10397 }
10398
10400 {
10401
10402 return false;
10403 }
10404
10406 {
10407
10408
10409 return false;
10410 }
10411
10413 {
10414
10415 return false;
10416 }
10417
10420 {
10421 return !GetIsFrozen() &&
IsOpen();
10422 }
10423
10425 {
10426 bool hasParent = false, hasRootAsPlayer = false;
10428
10429 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
10430 bool foodDecay =
g_Game.IsFoodDecayEnabled();
10431
10432 if (wwtu || foodDecay)
10433 {
10437
10438 if (processWetness || processTemperature || processDecay)
10439 {
10441
10442 if (processWetness)
10443 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
10444
10445 if (processTemperature)
10447
10448 if (processDecay)
10449 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
10450 }
10451 }
10452 }
10453
10456 {
10458 }
10459
10461 {
10464
10465 return super.GetTemperatureFreezeThreshold();
10466 }
10467
10469 {
10472
10473 return super.GetTemperatureThawThreshold();
10474 }
10475
10477 {
10480
10481 return super.GetItemOverheatThreshold();
10482 }
10483
10485 {
10487 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
10488
10489 return super.GetTemperatureFreezeTime();
10490 }
10491
10493 {
10495 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
10496
10497 return super.GetTemperatureThawTime();
10498 }
10499
10504
10506 {
10507 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
10508 }
10509
10511 {
10512 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
10513 }
10514
10517 {
10519 }
10520
10522 {
10524 }
10525
10527 {
10529 }
10530
10533 {
10534 return null;
10535 }
10536
10539 {
10540 return false;
10541 }
10542
10544 {
10546 {
10549 if (!trg)
10550 {
10552 explosive = this;
10553 }
10554
10555 explosive.PairRemote(trg);
10557
10558 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
10559 trg.SetPersistentPairID(persistentID);
10560 explosive.SetPersistentPairID(persistentID);
10561
10562 return true;
10563 }
10564 return false;
10565 }
10566
10569 {
10570 float ret = 1.0;
10573 ret *= GetHealth01();
10574
10575 return ret;
10576 }
10577
10578 #ifdef DEVELOPER
10579 override void SetDebugItem()
10580 {
10581 super.SetDebugItem();
10582 _itemBase = this;
10583 }
10584
10586 {
10587 string text = super.GetDebugText();
10588
10590 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
10591
10592 return text;
10593 }
10594 #endif
10595
10597 {
10598 return true;
10599 }
10600
10602
10604
10606 {
10609 }
10610
10611
10619
10635
10636 [
Obsolete(
"Use ItemSoundHandler instead")]
10639 {
10640 if (!
g_Game.IsDedicatedServer())
10641 {
10642 if (ConfigIsExisting("attachSoundSet"))
10643 {
10644 string cfg_path = "";
10645 string soundset = "";
10646 string type_name =
GetType();
10647
10650 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
10651 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
10652
10653 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
10654 {
10655 for (int i = 0; i < cfg_soundset_array.Count(); i++)
10656 {
10657 if (cfg_slot_array[i] == slot_type)
10658 {
10659 soundset = cfg_soundset_array[i];
10660 break;
10661 }
10662 }
10663 }
10664
10665 if (soundset != "")
10666 {
10667 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
10669 }
10670 }
10671 }
10672 }
10673
10675}
10676
10678{
10680 if (entity)
10681 {
10682 bool is_item = entity.IsInherited(
ItemBase);
10683 if (is_item && full_quantity)
10684 {
10687 }
10688 }
10689 else
10690 {
10692 return NULL;
10693 }
10694 return entity;
10695}
10696
10698{
10699 if (item)
10700 {
10701 if (health > 0)
10702 item.SetHealth("", "", health);
10703
10704 if (item.CanHaveTemperature())
10705 {
10707 if (item.CanFreeze())
10708 item.SetFrozen(false);
10709 }
10710
10711 if (item.HasEnergyManager())
10712 {
10713 if (quantity >= 0)
10714 {
10715 item.GetCompEM().SetEnergy0To1(quantity);
10716 }
10717 else
10718 {
10720 }
10721 }
10722 else if (item.IsMagazine())
10723 {
10724 Magazine mag = Magazine.Cast(item);
10725 if (quantity >= 0)
10726 {
10727 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
10728 }
10729 else
10730 {
10732 }
10733
10734 }
10735 else
10736 {
10737 if (quantity >= 0)
10738 {
10739 item.SetQuantityNormalized(quantity, false);
10740 }
10741 else
10742 {
10744 }
10745
10746 }
10747 }
10748}
10749
10750#ifdef DEVELOPER
10752#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.