Locks this item in it's current attachment slot of its parent. This makes the "locked" icon visible in inventory over this item.
5747{
5749 {
5750 return true;
5751 }
5752};
5753
5755{
5756
5757};
5758
5759
5760
5762{
5766
5768
5771
5772
5773
5774
5775
5784
5790
5795
5800
5821 protected bool m_IsResultOfSplit
5822
5824
5829
5830
5831
5833
5837
5838
5839
5841
5844
5845
5846
5852
5853
5861
5864
5865
5867
5868
5870
5871
5876
5877
5882
5884
5885
5887
5888
5890 {
5895
5896 if (!
g_Game.IsDedicatedServer())
5897 {
5899 {
5901
5903 {
5905 }
5906 }
5907
5910 }
5911
5912 m_OldLocation = null;
5913
5915 {
5917 }
5918
5919 if (ConfigIsExisting("headSelectionsToHide"))
5920 {
5923 }
5924
5926 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
5927 {
5929 }
5930
5932
5933 m_IsResultOfSplit = false;
5934
5936 }
5937
5939 {
5940 super.InitItemVariables();
5941
5947 m_Count = ConfigGetInt(
"count");
5948
5951
5956
5959
5964
5976
5980
5981
5984 if (ConfigIsExisting("canBeSplit"))
5985 {
5988 }
5989
5991 if (ConfigIsExisting("itemBehaviour"))
5993
5994
5997 RegisterNetSyncVariableInt("m_VarLiquidType");
5998 RegisterNetSyncVariableInt("m_Cleanness",0,1);
5999
6000 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
6001 RegisterNetSyncVariableFloat("m_ImpactSpeed");
6002 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
6003
6004 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
6005 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
6006 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
6007 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
6008
6009 RegisterNetSyncVariableBool("m_IsBeingPlaced");
6010 RegisterNetSyncVariableBool("m_IsTakeable");
6011 RegisterNetSyncVariableBool("m_IsHologram");
6012
6015 {
6018 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
6019 }
6020
6022
6024 if (ConfigIsExisting("temperaturePerQuantityWeight"))
6026
6028 }
6029
6031 {
6033 }
6034
6036 {
6039 {
6044 }
6045 }
6046
6047 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
6048 {
6050 {
6053 }
6054
6056 }
6057
6059 {
6065 }
6066
6068
6070 {
6072
6073 if (!action)
6074 {
6075 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
6076 return;
6077 }
6078
6080 if (!ai)
6081 {
6083 return;
6084 }
6085
6087 if (!action_array)
6088 {
6089 action_array = new array<ActionBase_Basic>;
6091 }
6092 if (LogManager.IsActionLogEnable())
6093 {
6094 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
6095 }
6096
6097 if (action_array.Find(action) != -1)
6098 {
6099 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
6100 }
6101 else
6102 {
6103 action_array.Insert(action);
6104 }
6105 }
6106
6108 {
6109 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6110 ActionBase action = player.GetActionManager().GetAction(actionName);
6113
6114 if (action_array)
6115 {
6116 action_array.RemoveItem(action);
6117 }
6118 }
6119
6120
6121
6123 {
6124 ActionOverrideData overrideData = new ActionOverrideData();
6128
6130 if (!actionMap)
6131 {
6134 }
6135
6136 actionMap.Insert(this.
Type(), overrideData);
6137
6138 }
6139
6141
6143
6144
6146 {
6149
6152
6153 string config_to_search = "CfgVehicles";
6154 string muzzle_owner_config;
6155
6157 {
6158 if (IsInherited(Weapon))
6159 config_to_search = "CfgWeapons";
6160
6161 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6162
6163 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
6164
6165 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
6166
6167 if (config_OnFire_subclass_count > 0)
6168 {
6169 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
6170
6171 for (int i = 0; i < config_OnFire_subclass_count; i++)
6172 {
6173 string particle_class = "";
6174 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
6175 string config_OnFire_entry = config_OnFire_class + particle_class;
6176 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
6177 WPOF_array.Insert(WPOF);
6178 }
6179
6180
6182 }
6183 }
6184
6186 {
6187 config_to_search = "CfgWeapons";
6188 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6189
6190 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
6191
6192 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
6193
6194 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
6195 {
6196 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
6197
6198 for (i = 0; i < config_OnBulletCasingEject_count; i++)
6199 {
6200 string particle_class2 = "";
6201 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
6202 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
6203 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
6204 WPOBE_array.Insert(WPOBE);
6205 }
6206
6207
6209 }
6210 }
6211 }
6212
6213
6215 {
6218
6220 {
6221 string config_to_search = "CfgVehicles";
6222
6223 if (IsInherited(Weapon))
6224 config_to_search = "CfgWeapons";
6225
6226 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6227 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
6228
6229 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
6230 {
6231
6233
6235 {
6237 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
6239 return;
6240 }
6241
6244
6245
6246
6247 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
6248 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
6249
6250 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
6251 {
6252 string particle_class = "";
6253 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
6254 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
6255 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
6256
6257 if (entry_type == CT_CLASS)
6258 {
6259 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
6260 WPOOH_array.Insert(WPOF);
6261 }
6262 }
6263
6264
6266 }
6267 }
6268 }
6269
6271 {
6273 }
6274
6276 {
6278 {
6280
6283
6286
6287 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6288 }
6289 }
6290
6292 {
6294 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6295
6297 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6298
6300 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6301
6303 {
6305 }
6306 }
6307
6309 {
6311 }
6312
6314 {
6317 else
6319
6321 {
6324 }
6325 else
6326 {
6329
6332 }
6333
6335 }
6336
6338 {
6340 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6341 }
6342
6344 {
6346 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6348 }
6349
6351 {
6353 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6354 }
6355
6357 {
6360
6361 OverheatingParticle OP = new OverheatingParticle();
6366
6368 }
6369
6371 {
6374
6375 return -1;
6376 }
6377
6379 {
6381 {
6384
6385 for (int i = count; i > 0; --i)
6386 {
6387 int id = i - 1;
6390
6393
6394 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
6395 {
6396 if (p)
6397 {
6400 }
6401 }
6402 }
6403 }
6404 }
6405
6407 {
6409 {
6411 {
6412 int id = i - 1;
6414
6415 if (OP)
6416 {
6418
6419 if (p)
6420 {
6422 }
6423
6424 delete OP;
6425 }
6426 }
6427
6430 }
6431 }
6432
6435 {
6436 return 0.0;
6437 }
6438
6439
6441 {
6442 return 250;
6443 }
6444
6446 {
6447 return 0;
6448 }
6449
6452 {
6454 return true;
6455
6456 return false;
6457 }
6458
6461 {
6464
6466 {
6468 }
6469 else
6470 {
6471
6473 }
6474
6476 }
6477
6484 {
6485 return -1;
6486 }
6487
6488
6489
6490
6492 {
6494 {
6495 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6496 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6497
6498 if (r_index >= 0)
6499 {
6500 InventoryLocation r_il = new InventoryLocation;
6501 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6502
6503 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6506 {
6507 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6508 }
6510 {
6511 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6512 }
6513
6514 }
6515
6516 player.GetHumanInventory().ClearUserReservedLocation(this);
6517 }
6518
6521 }
6522
6523
6524
6525
6527 {
6528 return ItemBase.m_DebugActionsMask;
6529 }
6530
6532 {
6533 return ItemBase.m_DebugActionsMask & mask;
6534 }
6535
6537 {
6538 ItemBase.m_DebugActionsMask = mask;
6539 }
6540
6542 {
6543 ItemBase.m_DebugActionsMask |= mask;
6544 }
6545
6547 {
6548 ItemBase.m_DebugActionsMask &= ~mask;
6549 }
6550
6552 {
6554 {
6556 }
6557 else
6558 {
6560 }
6561 }
6562
6563
6565 {
6566 if (GetEconomyProfile())
6567 {
6568 float q_max = GetEconomyProfile().GetQuantityMax();
6569 if (q_max > 0)
6570 {
6571 float q_min = GetEconomyProfile().GetQuantityMin();
6572 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
6573
6575 {
6576 ComponentEnergyManager comp = GetCompEM();
6578 {
6580 }
6581 }
6583 {
6585
6586 }
6587
6588 }
6589 }
6590 }
6591
6594 {
6595 EntityAI parent = GetHierarchyParent();
6596
6597 if (parent)
6598 {
6599 InventoryLocation inventory_location_to_lock = new InventoryLocation;
6600 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
6601 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
6602 }
6603 }
6604
6607 {
6608 EntityAI parent = GetHierarchyParent();
6609
6610 if (parent)
6611 {
6612 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
6613 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
6614 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
6615 }
6616 }
6617
6619 {
6620
6621
6622
6623
6625
6627 {
6628 if (ScriptInputUserData.CanStoreInputUserData())
6629 {
6630 ScriptInputUserData ctx = new ScriptInputUserData;
6636 ctx.
Write(use_stack_max);
6639
6641 {
6642 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
6643 }
6644 }
6645 }
6646 else if (!
g_Game.IsMultiplayer())
6647 {
6649 }
6650 }
6651
6653 {
6655 }
6656
6658 {
6660 }
6661
6663 {
6665 }
6666
6668 {
6669
6670 return false;
6671 }
6672
6674 {
6675 return false;
6676 }
6677
6681 {
6682 return false;
6683 }
6684
6686 {
6687 return "";
6688 }
6689
6691
6693 {
6694 return false;
6695 }
6696
6698 {
6699 return true;
6700 }
6701
6702
6703
6705 {
6706 return true;
6707 }
6708
6710 {
6711 return true;
6712 }
6713
6715 {
6716 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6718 }
6719
6721 {
6723 }
6724
6726 {
6728 if (!is_being_placed)
6730 SetSynchDirty();
6731 }
6732
6733
6735
6737 {
6739 }
6740
6742 {
6744 }
6745
6747 {
6748 return 1;
6749 }
6750
6752 {
6753 return false;
6754 }
6755
6757 {
6759 SetSynchDirty();
6760 }
6761
6762
6763
6764
6765
6766
6767
6768
6769
6770
6771
6772
6773
6774
6775
6776
6777
6778
6779
6780
6781
6782
6783
6784
6785
6786
6787
6788
6789
6790
6791
6792
6793
6794
6795
6797 {
6798 super.OnMovedInsideCargo(container);
6799
6800 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6801 }
6802
6803 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
6804 {
6805 super.EEItemLocationChanged(oldLoc, newLoc);
6806
6807 PlayerBase newPlayer = null;
6808 PlayerBase oldPlayer = null;
6809
6810 if (newLoc.GetParent())
6811 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
6812
6813 if (oldLoc.GetParent())
6814 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
6815
6817 {
6818 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
6819
6820 if (rIndex >= 0)
6821 {
6822 InventoryLocation rIl = new InventoryLocation;
6823 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
6824
6825 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
6828 {
6829 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
6830 }
6832 {
6834 }
6835
6836 }
6837 }
6838
6840 {
6841 if (newPlayer)
6842 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
6843
6844 if (newPlayer == oldPlayer)
6845 {
6846 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
6847 {
6849 {
6850 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
6851 {
6852 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6853 }
6854 }
6855 else
6856 {
6857 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6858 }
6859 }
6860
6861 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
6862 {
6863 int type = oldLoc.GetType();
6865 {
6866 oldLoc.GetParent().GetOnSetLock().Invoke(this);
6867 }
6869 {
6870 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
6871 }
6872 }
6873 if (!m_OldLocation)
6874 {
6875 m_OldLocation = new InventoryLocation;
6876 }
6877 m_OldLocation.Copy(oldLoc);
6878 }
6879 else
6880 {
6881 if (m_OldLocation)
6882 {
6883 m_OldLocation.Reset();
6884 }
6885 }
6886
6887 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
6888 }
6889 else
6890 {
6891 if (newPlayer)
6892 {
6893 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
6894 if (resIndex >= 0)
6895 {
6896 InventoryLocation il = new InventoryLocation;
6897 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
6899 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
6902 {
6903 il.
GetParent().GetOnReleaseLock().Invoke(it);
6904 }
6906 {
6908 }
6909
6910 }
6911 }
6913 {
6914
6916 }
6917
6918 if (m_OldLocation)
6919 {
6920 m_OldLocation.Reset();
6921 }
6922 }
6923
6925 {
6926 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
6927 }
6928
6930 {
6931 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
6932 }
6933 }
6934
6935 override void EOnContact(IEntity other, Contact extra)
6936 {
6938 {
6939 int liquidType = -1;
6941 if (impactSpeed > 0.0)
6942 {
6944 #ifndef SERVER
6946 #else
6948 SetSynchDirty();
6949 #endif
6951 }
6952 }
6953
6954 #ifdef SERVER
6955 if (GetCompEM() && GetCompEM().IsPlugged())
6956 {
6957 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
6958 GetCompEM().UnplugThis();
6959 }
6960 #endif
6961 }
6962
6964
6966 {
6968 }
6969
6971 {
6972
6973 }
6974
6976 {
6977 super.OnItemLocationChanged(old_owner, new_owner);
6978
6979 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
6980 PlayerBase playerNew = PlayerBase.Cast(new_owner);
6981
6982 if (!relatedPlayer && playerNew)
6983 relatedPlayer = playerNew;
6984
6985 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
6986 {
6988 if (actionMgr)
6989 {
6990 ActionBase currentAction = actionMgr.GetRunningAction();
6991 if (currentAction)
6993 }
6994 }
6995
6996 Man ownerPlayerOld = null;
6997 Man ownerPlayerNew = null;
6998
6999 if (old_owner)
7000 {
7001 if (old_owner.
IsMan())
7002 {
7003 ownerPlayerOld = Man.Cast(old_owner);
7004 }
7005 else
7006 {
7007 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
7008 }
7009 }
7010 else
7011 {
7013 {
7015
7016 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
7017 {
7018 GetCompEM().UnplugThis();
7019 }
7020 }
7021 }
7022
7023 if (new_owner)
7024 {
7025 if (new_owner.
IsMan())
7026 {
7027 ownerPlayerNew = Man.Cast(new_owner);
7028 }
7029 else
7030 {
7031 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
7032 }
7033 }
7034
7035 if (ownerPlayerOld != ownerPlayerNew)
7036 {
7037 if (ownerPlayerOld)
7038 {
7039 array<EntityAI> subItemsExit = new array<EntityAI>;
7041 for (int i = 0; i < subItemsExit.Count(); i++)
7042 {
7045 }
7046 }
7047
7048 if (ownerPlayerNew)
7049 {
7050 array<EntityAI> subItemsEnter = new array<EntityAI>;
7052 for (int j = 0; j < subItemsEnter.Count(); j++)
7053 {
7056 }
7057 }
7058 }
7059 else if (ownerPlayerNew != null)
7060 {
7061 PlayerBase nplayer;
7062 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
7063 {
7064 array<EntityAI> subItemsUpdate = new array<EntityAI>;
7066 for (int k = 0; k < subItemsUpdate.Count(); k++)
7067 {
7069 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
7070 }
7071 }
7072 }
7073
7074 if (old_owner)
7075 old_owner.OnChildItemRemoved(this);
7076 if (new_owner)
7077 new_owner.OnChildItemReceived(this);
7078 }
7079
7080
7082 {
7083 super.EEDelete(parent);
7084 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
7085 if (player)
7086 {
7088
7089 if (player.IsAlive())
7090 {
7091 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7092 if (r_index >= 0)
7093 {
7094 InventoryLocation r_il = new InventoryLocation;
7095 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7096
7097 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7100 {
7101 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7102 }
7104 {
7105 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7106 }
7107
7108 }
7109
7110 player.RemoveQuickBarEntityShortcut(this);
7111 }
7112 }
7113 }
7114
7116 {
7117 super.EEKilled(killer);
7118
7121 {
7122 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
7123 {
7124 if (IsMagazine())
7125 {
7126 if (Magazine.Cast(this).GetAmmoCount() > 0)
7127 {
7129 }
7130 }
7131 else
7132 {
7134 }
7135 }
7136 }
7137 }
7138
7140 {
7141 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7142
7143 super.OnWasAttached(parent, slot_id);
7144
7147
7150 }
7151
7153 {
7154 super.OnWasDetached(parent, slot_id);
7155
7158
7161 }
7162
7164 {
7165 int idx;
7168
7169 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7170 if (inventory_slots.Count() < 1)
7171 {
7172 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
7173 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
7174 }
7175 else
7176 {
7177 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
7178 }
7179
7180 idx = inventory_slots.Find(slot);
7181 if (idx < 0)
7182 return "";
7183
7184 return attach_types.Get(idx);
7185 }
7186
7188 {
7189 int idx = -1;
7190 string slot;
7191
7194
7195 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7196 if (inventory_slots.Count() < 1)
7197 {
7198 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
7199 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7200 }
7201 else
7202 {
7203 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
7204 if (detach_types.Count() < 1)
7205 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7206 }
7207
7208 for (int i = 0; i < inventory_slots.Count(); i++)
7209 {
7210 slot = inventory_slots.Get(i);
7211 }
7212
7213 if (slot != "")
7214 {
7215 if (detach_types.Count() == 1)
7216 idx = 0;
7217 else
7218 idx = inventory_slots.Find(slot);
7219 }
7220 if (idx < 0)
7221 return "";
7222
7223 return detach_types.Get(idx);
7224 }
7225
7227 {
7228
7230
7231
7232 float min_time = 1;
7233 float max_time = 3;
7234 float delay = Math.RandomFloat(min_time, max_time);
7235
7236 explode_timer.Run(delay, this, "DoAmmoExplosion");
7237 }
7238
7240 {
7241 Magazine magazine = Magazine.Cast(this);
7242 int pop_sounds_count = 6;
7243 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
7244
7245
7246 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
7247 string sound_name = pop_sounds[ sound_idx ];
7248 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
7249
7250
7251 magazine.ServerAddAmmoCount(-1);
7252
7253
7254 float min_temp_to_explode = 100;
7255
7256 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
7257 {
7259 }
7260 }
7261
7262
7263 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
7264 {
7265 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
7266
7267 const int CHANCE_DAMAGE_CARGO = 4;
7268 const int CHANCE_DAMAGE_ATTACHMENT = 1;
7269 const int CHANCE_DAMAGE_NOTHING = 2;
7270
7272 {
7273 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
7274 int chances;
7275 int rnd;
7276
7277 if (GetInventory().GetCargo())
7278 {
7279 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7280 rnd = Math.RandomInt(0,chances);
7281
7282 if (rnd < CHANCE_DAMAGE_CARGO)
7283 {
7285 }
7286 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
7287 {
7289 }
7290 }
7291 else
7292 {
7293 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7294 rnd = Math.RandomInt(0,chances);
7295
7296 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
7297 {
7299 }
7300 }
7301 }
7302 }
7303
7305 {
7306 CargoBase cargo = GetInventory().GetCargo();
7307 if (cargo)
7308 {
7310 if (item_count > 0)
7311 {
7312 int random_pick = Math.RandomInt(0, item_count);
7314 if (!item.IsExplosive())
7315 {
7316 item.AddHealth("","",damage);
7317 return true;
7318 }
7319 }
7320 }
7321 return false;
7322 }
7323
7325 {
7326 GameInventory inventory = GetInventory();
7328 if (attachment_count > 0)
7329 {
7330 int random_pick = Math.RandomInt(0, attachment_count);
7332 if (!attachment.IsExplosive())
7333 {
7334 attachment.AddHealth("","",damage);
7335 return true;
7336 }
7337 }
7338 return false;
7339 }
7340
7342 {
7344 }
7345
7347 {
7349 return GetInventory().CanRemoveEntity();
7350
7351 return false;
7352 }
7353
7355 {
7356
7358 return false;
7359
7360
7362 return false;
7363
7364
7365
7367 if (delta == 0)
7368 return false;
7369
7370
7371 return true;
7372 }
7373
7375 {
7377 {
7378 if (ScriptInputUserData.CanStoreInputUserData())
7379 {
7380 ScriptInputUserData ctx = new ScriptInputUserData;
7385 ctx.
Write(destination_entity);
7389 }
7390 }
7391 else if (!
g_Game.IsMultiplayer())
7392 {
7394 }
7395 }
7396
7398 {
7399 float split_quantity_new;
7403 InventoryLocation loc = new InventoryLocation;
7404
7405 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7406 {
7408 split_quantity_new = stack_max;
7409 else
7411
7413 {
7414 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7415 if (new_item)
7416 {
7417 new_item.SetResultOfSplit(true);
7418 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7420 new_item.
SetQuantity(split_quantity_new,
false,
true);
7421 }
7422 }
7423 }
7424 else if (destination_entity && slot_id == -1)
7425 {
7426 if (quantity > stack_max)
7427 split_quantity_new = stack_max;
7428 else
7429 split_quantity_new = quantity;
7430
7432 {
7433 GameInventory destinationInventory = destination_entity.GetInventory();
7435 {
7438 }
7439
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
7450 {
7451 if (stack_max != 0)
7452 {
7454 {
7456 }
7457
7458 if (split_quantity_new == 0)
7459 {
7460 if (!
g_Game.IsMultiplayer())
7461 player.PhysicalPredictiveDropItem(this);
7462 else
7463 player.ServerDropEntity(this);
7464 return;
7465 }
7466
7468 {
7470
7471 if (new_item)
7472 {
7473 new_item.SetResultOfSplit(true);
7474 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7477 new_item.PlaceOnSurface();
7478 }
7479 }
7480 }
7481 }
7482 }
7483
7485 {
7486 float split_quantity_new;
7490 InventoryLocation loc = new InventoryLocation;
7491
7492 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7493 {
7495 split_quantity_new = stack_max;
7496 else
7498
7500 {
7501 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7502 if (new_item)
7503 {
7504 new_item.SetResultOfSplit(true);
7505 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7507 new_item.
SetQuantity(split_quantity_new,
false,
true);
7508 }
7509 }
7510 }
7511 else if (destination_entity && slot_id == -1)
7512 {
7513 if (quantity > stack_max)
7514 split_quantity_new = stack_max;
7515 else
7516 split_quantity_new = quantity;
7517
7519 {
7520 GameInventory destinationInventory = destination_entity.GetInventory();
7522 {
7525 }
7526
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
7537 {
7538 if (stack_max != 0)
7539 {
7541 {
7543 }
7544
7546 {
7548
7549 if (new_item)
7550 {
7551 new_item.SetResultOfSplit(true);
7552 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7555 new_item.PlaceOnSurface();
7556 }
7557 }
7558 }
7559 }
7560 }
7561
7563 {
7565 {
7566 if (ScriptInputUserData.CanStoreInputUserData())
7567 {
7568 ScriptInputUserData ctx = new ScriptInputUserData;
7573 dst.WriteToContext(ctx);
7575 }
7576 }
7577 else if (!
g_Game.IsMultiplayer())
7578 {
7580 }
7581 }
7582
7584 {
7586 {
7587 if (ScriptInputUserData.CanStoreInputUserData())
7588 {
7589 ScriptInputUserData ctx = new ScriptInputUserData;
7594 ctx.
Write(destination_entity);
7600 }
7601 }
7602 else if (!
g_Game.IsMultiplayer())
7603 {
7605 }
7606 }
7607
7609 {
7611 }
7612
7614 {
7616 float split_quantity_new;
7618 if (dst.IsValid())
7619 {
7620 int slot_id = dst.GetSlot();
7622
7623 if (quantity > stack_max)
7624 split_quantity_new = stack_max;
7625 else
7626 split_quantity_new = quantity;
7627
7629 {
7631
7632 if (new_item)
7633 {
7634 new_item.SetResultOfSplit(true);
7635 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7637 new_item.
SetQuantity(split_quantity_new,
false,
true);
7638 }
7639
7640 return new_item;
7641 }
7642 }
7643
7644 return null;
7645 }
7646
7648 {
7650 float split_quantity_new;
7652 if (destination_entity)
7653 {
7655 if (quantity > stackable)
7656 split_quantity_new = stackable;
7657 else
7658 split_quantity_new = quantity;
7659
7661 {
7662 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
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 {
7678 if (ScriptInputUserData.CanStoreInputUserData())
7679 {
7680 ScriptInputUserData ctx = new ScriptInputUserData;
7685 ItemBase destination_entity =
this;
7686 ctx.
Write(destination_entity);
7690 }
7691 }
7692 else if (!
g_Game.IsMultiplayer())
7693 {
7695 }
7696 }
7697
7699 {
7701 float split_quantity_new;
7703 if (player)
7704 {
7706 if (quantity > stackable)
7707 split_quantity_new = stackable;
7708 else
7709 split_quantity_new = quantity;
7710
7712 {
7713 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
7714 new_item =
ItemBase.Cast(in_hands);
7715 if (new_item)
7716 {
7717 new_item.SetResultOfSplit(true);
7718 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7720 new_item.SetQuantity(split_quantity_new, false, true);
7721 }
7722 }
7723 }
7724 }
7725
7727 {
7729 float split_quantity_new = Math.Floor(quantity * 0.5);
7730
7732 return;
7733
7735
7736 if (new_item)
7737 {
7738 if (new_item.GetQuantityMax() < split_quantity_new)
7739 {
7740 split_quantity_new = new_item.GetQuantityMax();
7741 }
7742
7743 new_item.SetResultOfSplit(true);
7744 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7745
7747 {
7750 }
7751 else
7752 {
7754 new_item.
SetQuantity(split_quantity_new,
false,
true);
7755 }
7756 }
7757 }
7758
7760 {
7762 float split_quantity_new = Math.Floor(quantity / 2);
7763
7765 return;
7766
7767 InventoryLocation invloc = new InventoryLocation;
7769
7771 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
7772
7773 if (new_item)
7774 {
7775 if (new_item.GetQuantityMax() < split_quantity_new)
7776 {
7777 split_quantity_new = new_item.GetQuantityMax();
7778 }
7780 {
7783 }
7784 else if (split_quantity_new > 1)
7785 {
7787 new_item.
SetQuantity(split_quantity_new,
false,
true);
7788 }
7789 }
7790 }
7791
7794 {
7795 SetWeightDirty();
7797
7798 if (parent)
7799 parent.OnAttachmentQuantityChangedEx(this, delta);
7800
7802 {
7804 {
7806 }
7808 {
7809 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
7811 }
7812 }
7813 }
7814
7817 {
7818
7819 }
7820
7823 {
7825 }
7826
7828 {
7829 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
7830
7832 {
7833 if (newLevel == GameConstants.STATE_RUINED)
7834 {
7836 EntityAI parent = GetHierarchyParent();
7837 if (parent && parent.IsFireplace())
7838 {
7839 CargoBase cargo = GetInventory().GetCargo();
7840 if (cargo)
7841 {
7843 {
7845 }
7846 }
7847 }
7848 }
7849
7851 {
7852
7854 return;
7855 }
7856
7857 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
7858 {
7860 }
7861 }
7862 }
7863
7864
7866 {
7867 super.OnRightClick();
7868
7870 {
7872 {
7873 if (ScriptInputUserData.CanStoreInputUserData())
7874 {
7875 EntityAI root = GetHierarchyRoot();
7876 Man playerOwner = GetHierarchyRootPlayer();
7877 InventoryLocation dst = new InventoryLocation;
7878
7879
7880 if (!playerOwner && root && root == this)
7881 {
7883 }
7884 else
7885 {
7886
7887 GetInventory().GetCurrentInventoryLocation(dst);
7889 {
7890 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7892 {
7894 }
7895 else
7896 {
7898
7899
7900 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
7901 {
7903 }
7904 else
7905 {
7906 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
7907 }
7908 }
7909 }
7910 }
7911
7912 ScriptInputUserData ctx = new ScriptInputUserData;
7920 }
7921 }
7922 else if (!
g_Game.IsMultiplayer())
7923 {
7925 }
7926 }
7927 }
7928
7930 {
7931 if (root)
7932 {
7933 vector m4[4];
7934 root.GetTransform(m4);
7935 dst.SetGround(this, m4);
7936 }
7937 else
7938 {
7939 GetInventory().GetCurrentInventoryLocation(dst);
7940 }
7941 }
7942
7943 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
7944 {
7945
7946 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
7947 return false;
7948
7949 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
7950 return false;
7951
7952
7954 return false;
7955
7956
7957 Magazine mag = Magazine.Cast(this);
7958 if (mag)
7959 {
7960 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
7961 return false;
7962
7963 if (stack_max_limit)
7964 {
7965 Magazine other_mag = Magazine.Cast(other_item);
7966 if (other_item)
7967 {
7968 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
7969 return false;
7970 }
7971
7972 }
7973 }
7974 else
7975 {
7976
7978 return false;
7979
7981 return false;
7982 }
7983
7984 PlayerBase player = null;
7985 if (CastTo(player, GetHierarchyRootPlayer()))
7986 {
7987 if (player.GetInventory().HasAttachment(this))
7988 return false;
7989
7990 if (player.IsItemsToDelete())
7991 return false;
7992 }
7993
7994 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
7995 return false;
7996
7997 int slotID;
7999 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
8000 return false;
8001
8002 return true;
8003 }
8004
8006 {
8008 }
8009
8011 {
8012 return m_IsResultOfSplit;
8013 }
8014
8016 {
8017 m_IsResultOfSplit = value;
8018 }
8019
8021 {
8023 }
8024
8026 {
8027 float other_item_quantity = other_item.GetQuantity();
8028 float this_free_space;
8029
8031
8033
8034 if (other_item_quantity > this_free_space)
8035 {
8036 return this_free_space;
8037 }
8038 else
8039 {
8040 return other_item_quantity;
8041 }
8042 }
8043
8045 {
8047 }
8048
8050 {
8052 return;
8053
8054 if (!IsMagazine() && other_item)
8055 {
8057 if (quantity_used != 0)
8058 {
8059 float hp1 = GetHealth01("","");
8060 float hp2 = other_item.GetHealth01("","");
8061 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
8062 hpResult = hpResult / (
GetQuantity() + quantity_used);
8063
8064 hpResult *= GetMaxHealth();
8065 Math.Round(hpResult);
8066 SetHealth("", "Health", hpResult);
8067
8069 other_item.AddQuantity(-quantity_used);
8070 }
8071 }
8073 }
8074
8076 {
8077 #ifdef SERVER
8078 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
8079 GetHierarchyParent().IncreaseLifetimeUp();
8080 #endif
8081 };
8082
8084 {
8085 PlayerBase p = PlayerBase.Cast(player);
8086
8087 array<int> recipesIds = p.m_Recipes;
8088 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8089 if (moduleRecipesManager)
8090 {
8091 EntityAI itemInHands = player.GetEntityInHands();
8092 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
8093 }
8094
8095 for (int i = 0;i < recipesIds.Count(); i++)
8096 {
8097 int key = recipesIds.Get(i);
8098 string recipeName = moduleRecipesManager.GetRecipeName(key);
8100 }
8101 }
8102
8103
8104 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
8105 {
8106 super.GetDebugActions(outputList);
8107
8108
8114
8115
8120
8125
8126
8130
8131
8133 {
8137 }
8138
8141
8142
8146
8148
8149 InventoryLocation loc = new InventoryLocation();
8150 GetInventory().GetCurrentInventoryLocation(loc);
8152 {
8153 if (Gizmo_IsSupported())
8156 }
8157
8159 }
8160
8161
8162
8163
8165 {
8166 super.OnAction(action_id, player, ctx);
8167
8169 {
8170 switch (action_id)
8171 {
8175 return true;
8179 return true;
8180 }
8181 }
8182
8184 {
8185 switch (action_id)
8186 {
8188 Delete();
8189 return true;
8190 }
8191 }
8192
8193 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
8194 {
8195 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8196 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
8197 PlayerBase p = PlayerBase.Cast(player);
8198 if (
EActions.RECIPES_RANGE_START < 1000)
8199 {
8200 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
8201 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
8202 }
8203 }
8204 #ifndef SERVER
8205 else if (action_id ==
EActions.WATCH_PLAYER)
8206 {
8207 PluginDeveloper.SetDeveloperItemClientEx(player);
8208 }
8209 #endif
8211 {
8212 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
8213 {
8214 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
8215 OnDebugButtonPressServer(id + 1);
8216 }
8217
8218 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
8219 {
8220 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
8222 }
8223
8224 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
8225 {
8226 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
8228 }
8229
8230 else if (action_id ==
EActions.ADD_QUANTITY)
8231 {
8232 if (IsMagazine())
8233 {
8234 Magazine mag = Magazine.Cast(this);
8235 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
8236 }
8237 else
8238 {
8240 }
8241
8242 if (m_EM)
8243 {
8244 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
8245 }
8246
8247 }
8248
8249 else if (action_id ==
EActions.REMOVE_QUANTITY)
8250 {
8251 if (IsMagazine())
8252 {
8253 Magazine mag2 = Magazine.Cast(this);
8254 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
8255 }
8256 else
8257 {
8259 }
8260 if (m_EM)
8261 {
8262 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
8263 }
8264
8265 }
8266
8267 else if (action_id ==
EActions.SET_QUANTITY_0)
8268 {
8270
8271 if (m_EM)
8272 {
8273 m_EM.SetEnergy(0);
8274 }
8275 }
8276
8277 else if (action_id ==
EActions.SET_MAX_QUANTITY)
8278 {
8280
8281 if (m_EM)
8282 {
8283 m_EM.SetEnergy(m_EM.GetEnergyMax());
8284 }
8285 }
8286
8287 else if (action_id ==
EActions.ADD_HEALTH)
8288 {
8289 AddHealth("","",GetMaxHealth("","Health")/5);
8290 }
8291 else if (action_id ==
EActions.REMOVE_HEALTH)
8292 {
8293 AddHealth("","",-GetMaxHealth("","Health")/5);
8294 }
8295 else if (action_id ==
EActions.DESTROY_HEALTH)
8296 {
8297 SetHealth01("","",0);
8298 }
8299 else if (action_id ==
EActions.WATCH_ITEM)
8300 {
8302 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
8303 #ifdef DEVELOPER
8304 SetDebugDeveloper_item(this);
8305 #endif
8306 }
8307
8308 else if (action_id ==
EActions.ADD_TEMPERATURE)
8309 {
8310 AddTemperature(20);
8311
8312 }
8313
8314 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
8315 {
8316 AddTemperature(-20);
8317
8318 }
8319
8320 else if (action_id ==
EActions.FLIP_FROZEN)
8321 {
8322 SetFrozen(!GetIsFrozen());
8323
8324 }
8325
8326 else if (action_id ==
EActions.ADD_WETNESS)
8327 {
8329
8330 }
8331
8332 else if (action_id ==
EActions.REMOVE_WETNESS)
8333 {
8335
8336 }
8337
8338 else if (action_id ==
EActions.LIQUIDTYPE_UP)
8339 {
8342
8343
8344 }
8345
8346 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
8347 {
8350 }
8351
8352 else if (action_id ==
EActions.MAKE_SPECIAL)
8353 {
8354 auto debugParams = DebugSpawnParams.WithPlayer(player);
8355 OnDebugSpawnEx(debugParams);
8356 }
8357
8358 }
8359
8360
8361 return false;
8362 }
8363
8364
8365
8366
8370
8373
8374
8375
8377 {
8378 return false;
8379 }
8380
8381
8383 {
8384 return true;
8385 }
8386
8387
8389 {
8390 return true;
8391 }
8392
8393
8394
8396 {
8397 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
8398 return g_Game.ConfigIsExisting(config_path);
8399 }
8400
8403 {
8404 return null;
8405 }
8406
8408 {
8409 return false;
8410 }
8411
8413 {
8414 return false;
8415 }
8416
8420
8421
8423 {
8424 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8425 return module_repairing.CanRepair(this, item_repair_kit);
8426 }
8427
8428
8429 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
8430 {
8431 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8432 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
8433 }
8434
8435
8437 {
8438
8439
8440
8441
8442
8443
8444
8445
8446 return 1;
8447 }
8448
8449
8450
8452 {
8454 }
8455
8456
8457
8459 {
8461 }
8462
8463
8472 {
8473 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8474
8475 if (player)
8476 {
8477 player.MessageStatus(text);
8478 }
8479 }
8480
8481
8490 {
8491 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8492
8493 if (player)
8494 {
8495 player.MessageAction(text);
8496 }
8497 }
8498
8499
8508 {
8509 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8510
8511 if (player)
8512 {
8513 player.MessageFriendly(text);
8514 }
8515 }
8516
8517
8526 {
8527 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8528
8529 if (player)
8530 {
8531 player.MessageImportant(text);
8532 }
8533 }
8534
8536 {
8537 return true;
8538 }
8539
8540
8541 override bool KindOf(
string tag)
8542 {
8543 bool found = false;
8544 string item_name = this.
GetType();
8546 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
8547
8548 int array_size = item_tag_array.Count();
8549 for (int i = 0; i < array_size; i++)
8550 {
8551 if (item_tag_array.Get(i) == tag)
8552 {
8553 found = true;
8554 break;
8555 }
8556 }
8557 return found;
8558 }
8559
8560
8562 {
8563
8564 super.OnRPC(sender, rpc_type,ctx);
8565
8566
8567 switch (rpc_type)
8568 {
8569 #ifndef SERVER
8570 case ERPCs.RPC_SOUND_LOCK_ATTACH:
8571 Param2<bool, string> p = new Param2<bool, string>(false, "");
8572
8574 return;
8575
8576 bool play = p.param1;
8577 string soundSet = p.param2;
8578
8579 if (play)
8580 {
8582 {
8584 {
8586 }
8587 }
8588 else
8589 {
8591 }
8592 }
8593 else
8594 {
8596 }
8597
8598 break;
8599 #endif
8600
8601 }
8602
8604 {
8606 }
8607 }
8608
8609
8610
8611
8613 {
8614 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8615 return plugin.GetID(
name);
8616 }
8617
8619 {
8620 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8621 return plugin.GetName(id);
8622 }
8623
8626 {
8627
8628
8629 int varFlags;
8630 if (!ctx.
Read(varFlags))
8631 return;
8632
8633 if (varFlags & ItemVariableFlags.FLOAT)
8634 {
8636 }
8637 }
8638
8640 {
8641
8642 super.SerializeNumericalVars(floats_out);
8643
8644
8645
8647 {
8649 }
8650
8652 {
8654 }
8655
8657 {
8659 }
8660
8662 {
8667 }
8668
8670 {
8672 }
8673 }
8674
8676 {
8677
8678 super.DeSerializeNumericalVars(floats);
8679
8680
8681 int index = 0;
8682 int mask = Math.Round(floats.Get(index));
8683
8684 index++;
8685
8687 {
8689 {
8691 }
8692 else
8693 {
8694 float quantity = floats.Get(index);
8696 }
8697 index++;
8698 }
8699
8701 {
8702 float wet = floats.Get(index);
8704 index++;
8705 }
8706
8708 {
8709 int liquidtype = Math.Round(floats.Get(index));
8711 index++;
8712 }
8713
8715 {
8717 index++;
8719 index++;
8721 index++;
8723 index++;
8724 }
8725
8727 {
8728 int cleanness = Math.Round(floats.Get(index));
8730 index++;
8731 }
8732 }
8733
8735 {
8736 super.WriteVarsToCTX(ctx);
8737
8738
8740 {
8742 }
8743
8745 {
8747 }
8748
8750 {
8752 }
8753
8755 {
8756 int r,g,b,a;
8762 }
8763
8765 {
8767 }
8768 }
8769
8771 {
8772 if (!super.ReadVarsFromCTX(ctx,version))
8773 return false;
8774
8775 int intValue;
8776 float value;
8777
8778 if (version < 140)
8779 {
8780 if (!ctx.
Read(intValue))
8781 return false;
8782
8783 m_VariablesMask = intValue;
8784 }
8785
8787 {
8788 if (!ctx.
Read(value))
8789 return false;
8790
8792 {
8794 }
8795 else
8796 {
8798 }
8799 }
8800
8801 if (version < 140)
8802 {
8804 {
8805 if (!ctx.
Read(value))
8806 return false;
8807 SetTemperatureDirect(value);
8808 }
8809 }
8810
8812 {
8813 if (!ctx.
Read(value))
8814 return false;
8816 }
8817
8819 {
8820 if (!ctx.
Read(intValue))
8821 return false;
8823 }
8824
8826 {
8827 int r,g,b,a;
8829 return false;
8831 return false;
8833 return false;
8835 return false;
8836
8838 }
8839
8841 {
8842 if (!ctx.
Read(intValue))
8843 return false;
8845 }
8846
8847 if (version >= 138 && version < 140)
8848 {
8850 {
8851 if (!ctx.
Read(intValue))
8852 return false;
8853 SetFrozen(intValue);
8854 }
8855 }
8856
8857 return true;
8858 }
8859
8860
8862 {
8865 {
8867 }
8868
8869 if (!super.OnStoreLoad(ctx, version))
8870 {
8872 return false;
8873 }
8874
8875 if (version >= 114)
8876 {
8877 bool hasQuickBarIndexSaved;
8878
8879 if (!ctx.
Read(hasQuickBarIndexSaved))
8880 {
8882 return false;
8883 }
8884
8885 if (hasQuickBarIndexSaved)
8886 {
8887 int itmQBIndex;
8888
8889
8890 if (!ctx.
Read(itmQBIndex))
8891 {
8893 return false;
8894 }
8895
8896 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
8897 if (itmQBIndex != -1 && parentPlayer)
8898 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
8899 }
8900 }
8901 else
8902 {
8903
8904 PlayerBase player;
8905 int itemQBIndex;
8906 if (version ==
int.
MAX)
8907 {
8908 if (!ctx.
Read(itemQBIndex))
8909 {
8911 return false;
8912 }
8913 }
8914 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
8915 {
8916
8917 if (!ctx.
Read(itemQBIndex))
8918 {
8920 return false;
8921 }
8922 if (itemQBIndex != -1 && player)
8923 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
8924 }
8925 }
8926
8927 if (version < 140)
8928 {
8929
8930 if (!LoadVariables(ctx, version))
8931 {
8933 return false;
8934 }
8935 }
8936
8937
8939 {
8941 return false;
8942 }
8943 if (version >= 132)
8944 {
8946 if (raib)
8947 {
8949 {
8951 return false;
8952 }
8953 }
8954 }
8955
8957 return true;
8958 }
8959
8960
8961
8963 {
8964 super.OnStoreSave(ctx);
8965
8966 PlayerBase player;
8967 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
8968 {
8970
8971 int itemQBIndex = -1;
8972 itemQBIndex = player.FindQuickBarEntityIndex(this);
8973 ctx.
Write(itemQBIndex);
8974 }
8975 else
8976 {
8978 }
8979
8981
8983 if (raib)
8984 {
8986 }
8987 }
8988
8989
8991 {
8992 super.AfterStoreLoad();
8993
8995 {
8997 }
8998
9000 {
9003 }
9004 }
9005
9007 {
9008 super.EEOnAfterLoad();
9009
9011 {
9013 }
9014
9017 }
9018
9020 {
9021 return false;
9022 }
9023
9024
9025
9027 {
9029 {
9030 #ifdef PLATFORM_CONSOLE
9031
9033 {
9035 if (menu)
9036 {
9038 }
9039 }
9040 #endif
9041 }
9042
9044 {
9047 }
9048
9050 {
9051 SetWeightDirty();
9053 }
9055 {
9058 }
9059
9061 {
9064
9067 }
9069 {
9073 }
9074
9075 super.OnVariablesSynchronized();
9076 }
9077
9078
9079
9081 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
9082 {
9083 if (!IsServerCheck(allow_client))
9084 return false;
9085
9087 return false;
9088
9091
9092 if (value <= (min + 0.001))
9093 value = min;
9094
9095 if (value == min)
9096 {
9097 if (destroy_config)
9098 {
9099 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
9100 if (dstr)
9101 {
9103 this.Delete();
9104 return true;
9105 }
9106 }
9107 else if (destroy_forced)
9108 {
9110 this.Delete();
9111 return true;
9112 }
9113
9115 }
9116
9119
9121 {
9122 EntityAI parent = GetHierarchyRoot();
9123 InventoryLocation iLoc = new InventoryLocation();
9124 GetInventory().GetCurrentInventoryLocation(iLoc);
9126 {
9127 int iLocSlot = iLoc.
GetSlot();
9129 {
9131 }
9133 {
9135 }
9136 }
9137 }
9138
9140 {
9142
9143 if (delta)
9145 }
9146
9148
9149 return false;
9150 }
9151
9152
9154 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9155 {
9157 }
9158
9160 {
9163 }
9164
9166 {
9169 }
9170
9172 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9173 {
9174 float value_clamped = Math.Clamp(value, 0, 1);
9176 SetQuantity(result, destroy_config, destroy_forced);
9177 }
9178
9179
9182 {
9184 }
9185
9187 {
9189 }
9190
9191
9192
9193
9194
9195
9196
9197
9198
9199
9201 {
9202 int slot = -1;
9203 GameInventory inventory = GetInventory();
9204 if (inventory)
9205 {
9206 InventoryLocation il = new InventoryLocation;
9209 }
9210
9212 }
9213
9215 {
9216 float quantity_max = 0;
9217
9219 {
9220 if (attSlotID != -1)
9221 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
9222
9223 if (quantity_max <= 0)
9225 }
9226
9227 if (quantity_max <= 0)
9229
9230 return quantity_max;
9231 }
9232
9234 {
9236 }
9237
9239 {
9241 }
9242
9243
9245 {
9247 }
9248
9250 {
9252 }
9253
9255 {
9257 }
9258
9259
9261 {
9262
9263 float weightEx = GetWeightEx();
9264 float special = GetInventoryAndCargoWeight();
9265 return weightEx - special;
9266 }
9267
9268
9270 {
9272 }
9273
9275 {
9277 {
9278 #ifdef DEVELOPER
9279 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9280 {
9281 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
9283 }
9284 #endif
9285
9287 }
9288 else if (HasEnergyManager())
9289 {
9290 #ifdef DEVELOPER
9291 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9292 {
9293 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
9294 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
9295 }
9296 #endif
9297 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
9298 }
9299 else
9300 {
9301 #ifdef DEVELOPER
9302 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9303 {
9304 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
9305 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
9306 }
9307 #endif
9308 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
9309 }
9310 }
9311
9314 {
9315 int item_count = 0;
9317
9318 GameInventory inventory = GetInventory();
9319 CargoBase cargo = inventory.
GetCargo();
9320 if (cargo != NULL)
9321 {
9323 }
9324
9326 for (int i = 0; i < nAttachments; ++i)
9327 {
9329 if (item)
9330 item_count += item.GetNumberOfItems();
9331 }
9332 return item_count;
9333 }
9334
9337 {
9338 float weight = 0;
9339 float wetness = 1;
9340 if (include_wetness)
9343 {
9344 weight = wetness * m_ConfigWeight;
9345 }
9347 {
9348 weight = 1;
9349 }
9350 return weight;
9351 }
9352
9353
9354
9356 {
9357 GameInventory inventory = GetInventory();
9358 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
9359 {
9360 array<EntityAI> items = new array<EntityAI>;
9362 for (int i = 0; i < items.Count(); ++i)
9363 {
9365 if (item)
9366 {
9367 g_Game.ObjectDelete(item);
9368 }
9369 }
9370 }
9371 }
9372
9373
9374
9375
9377 {
9378 float energy = 0;
9379 if (HasEnergyManager())
9380 {
9381 energy = GetCompEM().GetEnergy();
9382 }
9383 return energy;
9384 }
9385
9386
9388 {
9389 super.OnEnergyConsumed();
9390
9392 }
9393
9395 {
9396 super.OnEnergyAdded();
9397
9399 }
9400
9401
9403 {
9404 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
9405 {
9407 {
9408 float energy_0to1 = GetCompEM().GetEnergy0To1();
9410 }
9411 }
9412 }
9413
9414
9416 {
9417 return ConfigGetFloat("heatIsolation");
9418 }
9419
9421 {
9423 }
9424
9426 {
9427 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
9428 if (
g_Game.ConfigIsExisting(paramPath))
9429 return g_Game.ConfigGetFloat(paramPath);
9430
9431 return 0.0;
9432 }
9433
9435 {
9436 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
9437 if (
g_Game.ConfigIsExisting(paramPath))
9438 return g_Game.ConfigGetFloat(paramPath);
9439
9440 return 0.0;
9441 }
9442
9443 override void SetWet(
float value,
bool allow_client =
false)
9444 {
9445 if (!IsServerCheck(allow_client))
9446 return;
9447
9450
9452
9453 m_VarWet = Math.Clamp(value, min, max);
9454
9456 {
9459 }
9460 }
9461
9462 override void AddWet(
float value)
9463 {
9465 }
9466
9468 {
9470 }
9471
9473 {
9475 }
9476
9478 {
9480 }
9481
9483 {
9485 }
9486
9488 {
9490 }
9491
9493 {
9496 if (newLevel != oldLevel)
9497 {
9499 }
9500 }
9501
9503 {
9504 SetWeightDirty();
9505 }
9506
9508 {
9509 return GetWetLevelInternal(
m_VarWet);
9510 }
9511
9512
9513
9515 {
9517 }
9518
9520 {
9522 }
9523
9525 {
9527 }
9528
9530 {
9532 }
9533
9534
9535
9537 {
9538 if (ConfigIsExisting("itemModelLength"))
9539 {
9540 return ConfigGetFloat("itemModelLength");
9541 }
9542 return 0;
9543 }
9544
9546 {
9547 if (ConfigIsExisting("itemAttachOffset"))
9548 {
9549 return ConfigGetFloat("itemAttachOffset");
9550 }
9551 return 0;
9552 }
9553
9554 override void SetCleanness(
int value,
bool allow_client =
false)
9555 {
9556 if (!IsServerCheck(allow_client))
9557 return;
9558
9560
9562
9565 }
9566
9568 {
9570 }
9571
9573 {
9574 return true;
9575 }
9576
9577
9578
9579
9581 {
9583 }
9584
9586 {
9588 }
9589
9590
9591
9592
9593 override void SetColor(
int r,
int g,
int b,
int a)
9594 {
9600 }
9602 override void GetColor(out
int r,out
int g,out
int b,out
int a)
9603 {
9608 }
9609
9611 {
9613 }
9614
9617 {
9618 int r,g,b,a;
9620 r = r/255;
9621 g = g/255;
9622 b = b/255;
9623 a = a/255;
9624 return MiscGameplayFunctions.GetColorString(r, g, b, a);
9625 }
9626
9627
9628
9629 override void SetLiquidType(
int value,
bool allow_client =
false)
9630 {
9631 if (!IsServerCheck(allow_client))
9632 return;
9633
9638 }
9639
9641 {
9642 return ConfigGetInt("varLiquidTypeInit");
9643 }
9644
9646 {
9648 }
9649
9651 {
9653 SetFrozen(false);
9654 }
9655
9658 {
9659 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9660 }
9661
9662
9665 {
9666 PlayerBase nplayer;
9667 if (PlayerBase.CastTo(nplayer, player))
9668 {
9670 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9671 }
9672 }
9673
9674
9677 {
9678 PlayerBase nplayer;
9679 if (PlayerBase.CastTo(nplayer,player))
9680 {
9681 nplayer.SetEnableQuickBarEntityShortcut(this, false);
9682 }
9683
9684 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
9685
9686 if (HasEnergyManager())
9687 {
9688 GetCompEM().UpdatePlugState();
9689 }
9690 }
9691
9692
9694 {
9695 super.OnPlacementStarted(player);
9696
9698 }
9699
9700 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
9701 {
9703 {
9704 m_AdminLog.OnPlacementComplete(player,
this);
9705 }
9706
9707 super.OnPlacementComplete(player, position, orientation);
9708 }
9709
9710
9711
9712
9713
9715 {
9717 {
9718 return true;
9719 }
9720 else
9721 {
9722 return false;
9723 }
9724 }
9725
9726
9728 {
9730 {
9732 }
9733 }
9734
9735
9737 {
9739 }
9740
9742 {
9744 }
9745
9746 override void InsertAgent(
int agent,
float count = 1)
9747 {
9748 if (count < 1)
9749 return;
9750
9752 }
9753
9756 {
9758 }
9759
9760
9762 {
9764 }
9765
9766
9767
9768
9769
9770
9771
9772
9773
9774
9775
9776
9777
9778
9779
9780
9781
9782
9783
9784
9785
9786
9787
9788
9789
9790
9791
9792
9793
9794
9795
9796
9797
9798
9799
9800
9801
9802
9803
9804
9805
9806
9808 {
9810 return false;
9811 return true;
9812 }
9813
9815 {
9816
9818 }
9819
9820
9823 {
9824 super.CheckForRoofLimited(timeTresholdMS);
9825
9826 float time =
g_Game.GetTime();
9827 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
9828 {
9829 m_PreviousRoofTestTime = time;
9830 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
9831 }
9832 }
9833
9834
9836 {
9838 {
9839 return 0;
9840 }
9841
9842 if (GetInventory().GetAttachmentSlotsCount() != 0)
9843 {
9844 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
9845 if (filter)
9846 return filter.GetProtectionLevel(type, false, system);
9847 else
9848 return 0;
9849 }
9850
9851 string subclassPath, entryName;
9852
9853 switch (type)
9854 {
9856 entryName = "biological";
9857 break;
9859 entryName = "chemical";
9860 break;
9861 default:
9862 entryName = "biological";
9863 break;
9864 }
9865
9866 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
9867
9868 return g_Game.ConfigGetFloat(subclassPath + entryName);
9869 }
9870
9871
9872
9875 {
9876 if (!IsMagazine())
9878
9880 }
9881
9882
9883
9884
9885
9890 {
9891 return true;
9892 }
9893
9895 {
9897 }
9898
9899
9900
9901
9902
9904 {
9905 if (parent)
9906 {
9907 if (parent.IsInherited(DayZInfected))
9908 return true;
9909
9910 if (!parent.IsRuined())
9911 return true;
9912 }
9913
9914 return true;
9915 }
9916
9918 {
9919 if (!super.CanPutAsAttachment(parent))
9920 {
9921 return false;
9922 }
9923
9924 if (!IsRuined() && !parent.IsRuined())
9925 {
9926 return true;
9927 }
9928
9929 return false;
9930 }
9931
9933 {
9934
9935
9936
9937
9938 return super.CanReceiveItemIntoCargo(item);
9939 }
9940
9942 {
9943
9944
9945
9946
9947 GameInventory attachmentInv = attachment.GetInventory();
9949 {
9950 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
9951 return false;
9952 }
9953
9954 InventoryLocation loc = new InventoryLocation();
9955 attachment.GetInventory().GetCurrentInventoryLocation(loc);
9956 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
9957 return false;
9958
9959 return super.CanReceiveAttachment(attachment, slotId);
9960 }
9961
9963 {
9964 if (!super.CanReleaseAttachment(attachment))
9965 return false;
9966
9967 return GetInventory().AreChildrenAccessible();
9968 }
9969
9970
9971
9972
9973
9974
9975
9976
9977
9978
9979
9980
9981
9982
9983
9984
9985
9986
9987
9988
9989
9991 {
9992 int id = muzzle_owner.GetMuzzleID();
9993 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
9994
9995 if (WPOF_array)
9996 {
9997 for (int i = 0; i < WPOF_array.Count(); i++)
9998 {
9999 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
10000
10001 if (WPOF)
10002 {
10003 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
10004 }
10005 }
10006 }
10007 }
10008
10009
10011 {
10012 int id = muzzle_owner.GetMuzzleID();
10014
10015 if (WPOBE_array)
10016 {
10017 for (int i = 0; i < WPOBE_array.Count(); i++)
10018 {
10019 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
10020
10021 if (WPOBE)
10022 {
10023 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10024 }
10025 }
10026 }
10027 }
10028
10029
10031 {
10032 int id = muzzle_owner.GetMuzzleID();
10033 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10034
10035 if (WPOOH_array)
10036 {
10037 for (int i = 0; i < WPOOH_array.Count(); i++)
10038 {
10039 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10040
10041 if (WPOOH)
10042 {
10043 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10044 }
10045 }
10046 }
10047 }
10048
10049
10051 {
10052 int id = muzzle_owner.GetMuzzleID();
10053 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10054
10055 if (WPOOH_array)
10056 {
10057 for (int i = 0; i < WPOOH_array.Count(); i++)
10058 {
10059 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10060
10061 if (WPOOH)
10062 {
10063 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10064 }
10065 }
10066 }
10067 }
10068
10069
10071 {
10072 int id = muzzle_owner.GetMuzzleID();
10073 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10074
10075 if (WPOOH_array)
10076 {
10077 for (int i = 0; i < WPOOH_array.Count(); i++)
10078 {
10079 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10080
10081 if (WPOOH)
10082 {
10083 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10084 }
10085 }
10086 }
10087 }
10088
10089
10090
10092 {
10094 {
10095 return true;
10096 }
10097
10098 return false;
10099 }
10100
10102 {
10104 {
10105 return true;
10106 }
10107
10108 return false;
10109 }
10110
10112 {
10114 {
10115 return true;
10116 }
10117
10118 return false;
10119 }
10120
10122 {
10123 return false;
10124 }
10125
10128 {
10129 return UATimeSpent.DEFAULT_DEPLOY;
10130 }
10131
10132
10133
10134
10136 {
10138 SetSynchDirty();
10139 }
10140
10142 {
10144 }
10145
10146
10148 {
10149 return false;
10150 }
10151
10154 {
10155 string att_type = "None";
10156
10157 if (ConfigIsExisting("soundAttType"))
10158 {
10159 att_type = ConfigGetString("soundAttType");
10160 }
10161
10163 }
10164
10166 {
10168 }
10169
10170
10171
10172
10173
10179
10181 {
10184
10186 }
10187
10188
10190 {
10192 return;
10193
10195
10198
10201
10202 SoundParameters params = new SoundParameters();
10206 }
10207
10208
10210 {
10212 {
10215
10216 SetSynchDirty();
10217
10220 }
10221 }
10222
10224 {
10226 }
10227
10228
10230 {
10232 return;
10233
10235 SetSynchDirty();
10236
10239 }
10240
10242 {
10245 }
10246
10248 {
10250 }
10251
10252 void OnApply(PlayerBase player);
10253
10255 {
10256 return 1.0;
10257 };
10258
10260 {
10262 }
10263
10265 {
10267 }
10268
10270
10272 {
10273 SetDynamicPhysicsLifeTime(0.01);
10275 }
10276
10278 {
10279 array<string> zone_names = new array<string>;
10280 GetDamageZones(zone_names);
10281 for (int i = 0; i < zone_names.Count(); i++)
10282 {
10283 SetHealthMax(zone_names.Get(i),"Health");
10284 }
10285 SetHealthMax("","Health");
10286 }
10287
10290 {
10291 float global_health = GetHealth01("","Health");
10292 array<string> zones = new array<string>;
10293 GetDamageZones(zones);
10294
10295 for (int i = 0; i < zones.Count(); i++)
10296 {
10297 SetHealth01(zones.Get(i),"Health",global_health);
10298 }
10299 }
10300
10303 {
10304 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
10305 }
10306
10308 {
10309 if (!hasRootAsPlayer)
10310 {
10311 if (refParentIB)
10312 {
10313
10314 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
10315 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
10316
10317 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
10318 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
10319
10322 }
10323 else
10324 {
10325
10328 }
10329 }
10330 }
10331
10333 {
10335 {
10336 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
10337 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
10338 {
10339 float heatPermCoef = 1.0;
10341 while (ent)
10342 {
10343 heatPermCoef *= ent.GetHeatPermeabilityCoef();
10344 ent = ent.GetHierarchyParent();
10345 }
10346
10347 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
10348 }
10349 }
10350 }
10351
10353 {
10354
10355 EntityAI parent = GetHierarchyParent();
10356 if (!parent)
10357 {
10358 hasParent = false;
10359 hasRootAsPlayer = false;
10360 }
10361 else
10362 {
10363 hasParent = true;
10364 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
10365 refParentIB =
ItemBase.Cast(parent);
10366 }
10367 }
10368
10369 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
10370 {
10371
10372 }
10373
10375 {
10376
10377 return false;
10378 }
10379
10381 {
10382
10383
10384 return false;
10385 }
10386
10388 {
10389
10390 return false;
10391 }
10392
10395 {
10396 return !GetIsFrozen() &&
IsOpen();
10397 }
10398
10400 {
10401 bool hasParent = false, hasRootAsPlayer = false;
10403
10404 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
10405 bool foodDecay =
g_Game.IsFoodDecayEnabled();
10406
10407 if (wwtu || foodDecay)
10408 {
10412
10413 if (processWetness || processTemperature || processDecay)
10414 {
10416
10417 if (processWetness)
10418 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
10419
10420 if (processTemperature)
10422
10423 if (processDecay)
10424 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
10425 }
10426 }
10427 }
10428
10431 {
10433 }
10434
10436 {
10439
10440 return super.GetTemperatureFreezeThreshold();
10441 }
10442
10444 {
10447
10448 return super.GetTemperatureThawThreshold();
10449 }
10450
10452 {
10455
10456 return super.GetItemOverheatThreshold();
10457 }
10458
10460 {
10462 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
10463
10464 return super.GetTemperatureFreezeTime();
10465 }
10466
10468 {
10470 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
10471
10472 return super.GetTemperatureThawTime();
10473 }
10474
10479
10481 {
10482 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
10483 }
10484
10486 {
10487 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
10488 }
10489
10492 {
10494 }
10495
10497 {
10499 }
10500
10502 {
10504 }
10505
10508 {
10509 return null;
10510 }
10511
10514 {
10515 return false;
10516 }
10517
10519 {
10521 {
10524 if (!trg)
10525 {
10527 explosive = this;
10528 }
10529
10530 explosive.PairRemote(trg);
10532
10533 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
10534 trg.SetPersistentPairID(persistentID);
10535 explosive.SetPersistentPairID(persistentID);
10536
10537 return true;
10538 }
10539 return false;
10540 }
10541
10544 {
10545 float ret = 1.0;
10548 ret *= GetHealth01();
10549
10550 return ret;
10551 }
10552
10553 #ifdef DEVELOPER
10554 override void SetDebugItem()
10555 {
10556 super.SetDebugItem();
10557 _itemBase = this;
10558 }
10559
10561 {
10562 string text = super.GetDebugText();
10563
10565 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
10566
10567 return text;
10568 }
10569 #endif
10570
10572 {
10573 return true;
10574 }
10575
10577
10579
10581 {
10584 }
10585
10586
10594
10610
10611 [
Obsolete(
"Use ItemSoundHandler instead")]
10614 {
10615 if (!
g_Game.IsDedicatedServer())
10616 {
10617 if (ConfigIsExisting("attachSoundSet"))
10618 {
10619 string cfg_path = "";
10620 string soundset = "";
10621 string type_name =
GetType();
10622
10625 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
10626 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
10627
10628 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
10629 {
10630 for (int i = 0; i < cfg_soundset_array.Count(); i++)
10631 {
10632 if (cfg_slot_array[i] == slot_type)
10633 {
10634 soundset = cfg_soundset_array[i];
10635 break;
10636 }
10637 }
10638 }
10639
10640 if (soundset != "")
10641 {
10642 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
10644 }
10645 }
10646 }
10647 }
10648
10650}
10651
10653{
10655 if (entity)
10656 {
10657 bool is_item = entity.IsInherited(
ItemBase);
10658 if (is_item && full_quantity)
10659 {
10662 }
10663 }
10664 else
10665 {
10667 return NULL;
10668 }
10669 return entity;
10670}
10671
10673{
10674 if (item)
10675 {
10676 if (health > 0)
10677 item.SetHealth("", "", health);
10678
10679 if (item.CanHaveTemperature())
10680 {
10682 if (item.CanFreeze())
10683 item.SetFrozen(false);
10684 }
10685
10686 if (item.HasEnergyManager())
10687 {
10688 if (quantity >= 0)
10689 {
10690 item.GetCompEM().SetEnergy0To1(quantity);
10691 }
10692 else
10693 {
10695 }
10696 }
10697 else if (item.IsMagazine())
10698 {
10699 Magazine mag = Magazine.Cast(item);
10700 if (quantity >= 0)
10701 {
10702 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
10703 }
10704 else
10705 {
10707 }
10708
10709 }
10710 else
10711 {
10712 if (quantity >= 0)
10713 {
10714 item.SetQuantityNormalized(quantity, false);
10715 }
10716 else
10717 {
10719 }
10720
10721 }
10722 }
10723}
10724
10725#ifdef DEVELOPER
10727#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.