Unlocks this item from its attachment slot of its parent.
5760{
5762 {
5763 return true;
5764 }
5765};
5766
5768{
5769
5770};
5771
5772
5773
5775{
5779
5781
5784
5785
5786
5787
5788
5797
5803
5808
5813
5834 protected bool m_IsResultOfSplit
5835
5837
5842
5843
5844
5846
5850
5851
5852
5854
5857
5858
5859
5865
5866
5874
5877
5878
5880
5881
5883
5884
5889
5890
5895
5897
5898
5900
5901
5903 {
5908
5909 if (!
g_Game.IsDedicatedServer())
5910 {
5912 {
5914
5916 {
5918 }
5919 }
5920
5923 }
5924
5925 m_OldLocation = null;
5926
5928 {
5930 }
5931
5932 if (ConfigIsExisting("headSelectionsToHide"))
5933 {
5936 }
5937
5939 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
5940 {
5942 }
5943
5945
5946 m_IsResultOfSplit = false;
5947
5949 }
5950
5952 {
5953 super.InitItemVariables();
5954
5960 m_Count = ConfigGetInt(
"count");
5961
5964
5969
5972
5977
5989
5993
5994
5997 if (ConfigIsExisting("canBeSplit"))
5998 {
6001 }
6002
6004 if (ConfigIsExisting("itemBehaviour"))
6006
6007
6010 RegisterNetSyncVariableInt("m_VarLiquidType");
6011 RegisterNetSyncVariableInt("m_Cleanness",0,1);
6012
6013 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
6014 RegisterNetSyncVariableFloat("m_ImpactSpeed");
6015 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
6016
6017 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
6018 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
6019 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
6020 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
6021
6022 RegisterNetSyncVariableBool("m_IsBeingPlaced");
6023 RegisterNetSyncVariableBool("m_IsTakeable");
6024 RegisterNetSyncVariableBool("m_IsHologram");
6025
6028 {
6031 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
6032 }
6033
6035
6037 if (ConfigIsExisting("temperaturePerQuantityWeight"))
6039
6041 }
6042
6044 {
6046 }
6047
6049 {
6052 {
6057 }
6058 }
6059
6060 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
6061 {
6063 {
6066 }
6067
6069 }
6070
6072 {
6078 }
6079
6081
6083 {
6085
6086 if (!action)
6087 {
6088 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
6089 return;
6090 }
6091
6093 if (!ai)
6094 {
6096 return;
6097 }
6098
6100 if (!action_array)
6101 {
6102 action_array = new array<ActionBase_Basic>;
6104 }
6105 if (LogManager.IsActionLogEnable())
6106 {
6107 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
6108 }
6109
6110 if (action_array.Find(action) != -1)
6111 {
6112 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
6113 }
6114 else
6115 {
6116 action_array.Insert(action);
6117 }
6118 }
6119
6121 {
6122 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6123 ActionBase action = player.GetActionManager().GetAction(actionName);
6126
6127 if (action_array)
6128 {
6129 action_array.RemoveItem(action);
6130 }
6131 }
6132
6133
6134
6136 {
6137 ActionOverrideData overrideData = new ActionOverrideData();
6141
6143 if (!actionMap)
6144 {
6147 }
6148
6149 actionMap.Insert(this.
Type(), overrideData);
6150
6151 }
6152
6154
6156
6157
6159 {
6162
6165
6166 string config_to_search = "CfgVehicles";
6167 string muzzle_owner_config;
6168
6170 {
6171 if (IsInherited(Weapon))
6172 config_to_search = "CfgWeapons";
6173
6174 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6175
6176 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
6177
6178 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
6179
6180 if (config_OnFire_subclass_count > 0)
6181 {
6182 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
6183
6184 for (int i = 0; i < config_OnFire_subclass_count; i++)
6185 {
6186 string particle_class = "";
6187 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
6188 string config_OnFire_entry = config_OnFire_class + particle_class;
6189 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
6190 WPOF_array.Insert(WPOF);
6191 }
6192
6193
6195 }
6196 }
6197
6199 {
6200 config_to_search = "CfgWeapons";
6201 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6202
6203 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
6204
6205 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
6206
6207 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
6208 {
6209 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
6210
6211 for (i = 0; i < config_OnBulletCasingEject_count; i++)
6212 {
6213 string particle_class2 = "";
6214 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
6215 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
6216 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
6217 WPOBE_array.Insert(WPOBE);
6218 }
6219
6220
6222 }
6223 }
6224 }
6225
6226
6228 {
6231
6233 {
6234 string config_to_search = "CfgVehicles";
6235
6236 if (IsInherited(Weapon))
6237 config_to_search = "CfgWeapons";
6238
6239 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6240 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
6241
6242 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
6243 {
6244
6246
6248 {
6250 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
6252 return;
6253 }
6254
6257
6258
6259
6260 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
6261 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
6262
6263 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
6264 {
6265 string particle_class = "";
6266 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
6267 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
6268 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
6269
6270 if (entry_type == CT_CLASS)
6271 {
6272 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
6273 WPOOH_array.Insert(WPOF);
6274 }
6275 }
6276
6277
6279 }
6280 }
6281 }
6282
6284 {
6286 }
6287
6289 {
6291 {
6293
6296
6299
6300 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6301 }
6302 }
6303
6305 {
6307 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6308
6310 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6311
6313 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6314
6316 {
6318 }
6319 }
6320
6322 {
6324 }
6325
6327 {
6330 else
6332
6334 {
6337 }
6338 else
6339 {
6342
6345 }
6346
6348 }
6349
6351 {
6353 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6354 }
6355
6357 {
6359 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6361 }
6362
6364 {
6366 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6367 }
6368
6370 {
6373
6374 OverheatingParticle OP = new OverheatingParticle();
6379
6381 }
6382
6384 {
6387
6388 return -1;
6389 }
6390
6392 {
6394 {
6397
6398 for (int i = count; i > 0; --i)
6399 {
6400 int id = i - 1;
6403
6406
6407 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
6408 {
6409 if (p)
6410 {
6413 }
6414 }
6415 }
6416 }
6417 }
6418
6420 {
6422 {
6424 {
6425 int id = i - 1;
6427
6428 if (OP)
6429 {
6431
6432 if (p)
6433 {
6435 }
6436
6437 delete OP;
6438 }
6439 }
6440
6443 }
6444 }
6445
6448 {
6449 return 0.0;
6450 }
6451
6452
6454 {
6455 return 250;
6456 }
6457
6459 {
6460 return 0;
6461 }
6462
6465 {
6467 return true;
6468
6469 return false;
6470 }
6471
6474 {
6477
6479 {
6481 }
6482 else
6483 {
6484
6486 }
6487
6489 }
6490
6497 {
6498 return -1;
6499 }
6500
6501
6502
6503
6505 {
6507 {
6508 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6509 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6510
6511 if (r_index >= 0)
6512 {
6513 InventoryLocation r_il = new InventoryLocation;
6514 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6515
6516 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6519 {
6520 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6521 }
6523 {
6524 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6525 }
6526
6527 }
6528
6529 player.GetHumanInventory().ClearUserReservedLocation(this);
6530 }
6531
6534 }
6535
6536
6537
6538
6540 {
6541 return ItemBase.m_DebugActionsMask;
6542 }
6543
6545 {
6546 return ItemBase.m_DebugActionsMask & mask;
6547 }
6548
6550 {
6551 ItemBase.m_DebugActionsMask = mask;
6552 }
6553
6555 {
6556 ItemBase.m_DebugActionsMask |= mask;
6557 }
6558
6560 {
6561 ItemBase.m_DebugActionsMask &= ~mask;
6562 }
6563
6565 {
6567 {
6569 }
6570 else
6571 {
6573 }
6574 }
6575
6576
6578 {
6579 if (GetEconomyProfile())
6580 {
6581 float q_max = GetEconomyProfile().GetQuantityMax();
6582 if (q_max > 0)
6583 {
6584 float q_min = GetEconomyProfile().GetQuantityMin();
6585 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
6586
6588 {
6589 ComponentEnergyManager comp = GetCompEM();
6591 {
6593 }
6594 }
6596 {
6598
6599 }
6600
6601 }
6602 }
6603 }
6604
6607 {
6608 EntityAI parent = GetHierarchyParent();
6609
6610 if (parent)
6611 {
6612 InventoryLocation inventory_location_to_lock = new InventoryLocation;
6613 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
6614 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
6615 }
6616 }
6617
6620 {
6621 EntityAI parent = GetHierarchyParent();
6622
6623 if (parent)
6624 {
6625 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
6626 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
6627 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
6628 }
6629 }
6630
6632 {
6633
6634
6635
6636
6638
6640 {
6641 if (ScriptInputUserData.CanStoreInputUserData())
6642 {
6643 ScriptInputUserData ctx = new ScriptInputUserData;
6649 ctx.
Write(use_stack_max);
6652
6654 {
6655 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
6656 }
6657 }
6658 }
6659 else if (!
g_Game.IsMultiplayer())
6660 {
6662 }
6663 }
6664
6666 {
6668 }
6669
6671 {
6673 }
6674
6676 {
6678 }
6679
6681 {
6682
6683 return false;
6684 }
6685
6687 {
6688 return false;
6689 }
6690
6694 {
6695 return false;
6696 }
6697
6699 {
6700 return "";
6701 }
6702
6704
6706 {
6707 return false;
6708 }
6709
6711 {
6712 return true;
6713 }
6714
6715
6716
6718 {
6719 return true;
6720 }
6721
6723 {
6724 return true;
6725 }
6726
6728 {
6729 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6731 }
6732
6734 {
6736 }
6737
6739 {
6741 if (!is_being_placed)
6743 SetSynchDirty();
6744 }
6745
6746
6748
6750 {
6752 }
6753
6755 {
6757 }
6758
6760 {
6761 return 1;
6762 }
6763
6765 {
6766 return false;
6767 }
6768
6770 {
6772 SetSynchDirty();
6773 }
6774
6775
6776
6777
6778
6779
6780
6781
6782
6783
6784
6785
6786
6787
6788
6789
6790
6791
6792
6793
6794
6795
6796
6797
6798
6799
6800
6801
6802
6803
6804
6805
6806
6807
6808
6810 {
6811 super.OnMovedInsideCargo(container);
6812
6813 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6814 }
6815
6816 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
6817 {
6818 super.EEItemLocationChanged(oldLoc, newLoc);
6819
6820 PlayerBase newPlayer = null;
6821 PlayerBase oldPlayer = null;
6822
6823 if (newLoc.GetParent())
6824 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
6825
6826 if (oldLoc.GetParent())
6827 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
6828
6830 {
6831 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
6832
6833 if (rIndex >= 0)
6834 {
6835 InventoryLocation rIl = new InventoryLocation;
6836 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
6837
6838 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
6841 {
6842 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
6843 }
6845 {
6847 }
6848
6849 }
6850 }
6851
6853 {
6854 if (newPlayer)
6855 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
6856
6857 if (newPlayer == oldPlayer)
6858 {
6859 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
6860 {
6862 {
6863 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
6864 {
6865 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6866 }
6867 }
6868 else
6869 {
6870 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6871 }
6872 }
6873
6874 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
6875 {
6876 int type = oldLoc.GetType();
6878 {
6879 oldLoc.GetParent().GetOnSetLock().Invoke(this);
6880 }
6882 {
6883 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
6884 }
6885 }
6886 if (!m_OldLocation)
6887 {
6888 m_OldLocation = new InventoryLocation;
6889 }
6890 m_OldLocation.Copy(oldLoc);
6891 }
6892 else
6893 {
6894 if (m_OldLocation)
6895 {
6896 m_OldLocation.Reset();
6897 }
6898 }
6899
6900 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
6901 }
6902 else
6903 {
6904 if (newPlayer)
6905 {
6906 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
6907 if (resIndex >= 0)
6908 {
6909 InventoryLocation il = new InventoryLocation;
6910 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
6912 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
6915 {
6916 il.
GetParent().GetOnReleaseLock().Invoke(it);
6917 }
6919 {
6921 }
6922
6923 }
6924 }
6926 {
6927
6929 }
6930
6931 if (m_OldLocation)
6932 {
6933 m_OldLocation.Reset();
6934 }
6935 }
6936
6938 {
6939 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
6940 }
6941
6943 {
6944 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
6945 }
6946 }
6947
6948 override void EOnContact(IEntity other, Contact extra)
6949 {
6951 {
6952 int liquidType = -1;
6954 if (impactSpeed > 0.0)
6955 {
6957 #ifndef SERVER
6959 #else
6961 SetSynchDirty();
6962 #endif
6964 }
6965 }
6966
6967 #ifdef SERVER
6968 if (GetCompEM() && GetCompEM().IsPlugged())
6969 {
6970 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
6971 GetCompEM().UnplugThis();
6972 }
6973 #endif
6974 }
6975
6977
6979 {
6981 }
6982
6984 {
6985
6986 }
6987
6989 {
6990 super.OnItemLocationChanged(old_owner, new_owner);
6991
6992 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
6993 PlayerBase playerNew = PlayerBase.Cast(new_owner);
6994
6995 if (!relatedPlayer && playerNew)
6996 relatedPlayer = playerNew;
6997
6998 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
6999 {
7001 if (actionMgr)
7002 {
7003 ActionBase currentAction = actionMgr.GetRunningAction();
7004 if (currentAction)
7006 }
7007 }
7008
7009 Man ownerPlayerOld = null;
7010 Man ownerPlayerNew = null;
7011
7012 if (old_owner)
7013 {
7014 if (old_owner.
IsMan())
7015 {
7016 ownerPlayerOld = Man.Cast(old_owner);
7017 }
7018 else
7019 {
7020 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
7021 }
7022 }
7023 else
7024 {
7026 {
7028
7029 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
7030 {
7031 GetCompEM().UnplugThis();
7032 }
7033 }
7034 }
7035
7036 if (new_owner)
7037 {
7038 if (new_owner.
IsMan())
7039 {
7040 ownerPlayerNew = Man.Cast(new_owner);
7041 }
7042 else
7043 {
7044 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
7045 }
7046 }
7047
7048 if (ownerPlayerOld != ownerPlayerNew)
7049 {
7050 if (ownerPlayerOld)
7051 {
7052 array<EntityAI> subItemsExit = new array<EntityAI>;
7054 for (int i = 0; i < subItemsExit.Count(); i++)
7055 {
7058 }
7059 }
7060
7061 if (ownerPlayerNew)
7062 {
7063 array<EntityAI> subItemsEnter = new array<EntityAI>;
7065 for (int j = 0; j < subItemsEnter.Count(); j++)
7066 {
7069 }
7070 }
7071 }
7072 else if (ownerPlayerNew != null)
7073 {
7074 PlayerBase nplayer;
7075 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
7076 {
7077 array<EntityAI> subItemsUpdate = new array<EntityAI>;
7079 for (int k = 0; k < subItemsUpdate.Count(); k++)
7080 {
7082 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
7083 }
7084 }
7085 }
7086
7087 if (old_owner)
7088 old_owner.OnChildItemRemoved(this);
7089 if (new_owner)
7090 new_owner.OnChildItemReceived(this);
7091 }
7092
7093
7095 {
7096 super.EEDelete(parent);
7097 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
7098 if (player)
7099 {
7101
7102 if (player.IsAlive())
7103 {
7104 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7105 if (r_index >= 0)
7106 {
7107 InventoryLocation r_il = new InventoryLocation;
7108 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7109
7110 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7113 {
7114 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7115 }
7117 {
7118 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7119 }
7120
7121 }
7122
7123 player.RemoveQuickBarEntityShortcut(this);
7124 }
7125 }
7126 }
7127
7129 {
7130 super.EEKilled(killer);
7131
7134 {
7135 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
7136 {
7137 if (IsMagazine())
7138 {
7139 if (Magazine.Cast(this).GetAmmoCount() > 0)
7140 {
7142 }
7143 }
7144 else
7145 {
7147 }
7148 }
7149 }
7150 }
7151
7153 {
7154 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7155
7156 super.OnWasAttached(parent, slot_id);
7157
7160
7163 }
7164
7166 {
7167 super.OnWasDetached(parent, slot_id);
7168
7171
7174 }
7175
7177 {
7178 int idx;
7181
7182 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7183 if (inventory_slots.Count() < 1)
7184 {
7185 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
7186 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
7187 }
7188 else
7189 {
7190 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
7191 }
7192
7193 idx = inventory_slots.Find(slot);
7194 if (idx < 0)
7195 return "";
7196
7197 return attach_types.Get(idx);
7198 }
7199
7201 {
7202 int idx = -1;
7203 string slot;
7204
7207
7208 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7209 if (inventory_slots.Count() < 1)
7210 {
7211 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
7212 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7213 }
7214 else
7215 {
7216 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
7217 if (detach_types.Count() < 1)
7218 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7219 }
7220
7221 for (int i = 0; i < inventory_slots.Count(); i++)
7222 {
7223 slot = inventory_slots.Get(i);
7224 }
7225
7226 if (slot != "")
7227 {
7228 if (detach_types.Count() == 1)
7229 idx = 0;
7230 else
7231 idx = inventory_slots.Find(slot);
7232 }
7233 if (idx < 0)
7234 return "";
7235
7236 return detach_types.Get(idx);
7237 }
7238
7240 {
7241
7243
7244
7245 float min_time = 1;
7246 float max_time = 3;
7247 float delay = Math.RandomFloat(min_time, max_time);
7248
7249 explode_timer.Run(delay, this, "DoAmmoExplosion");
7250 }
7251
7253 {
7254 Magazine magazine = Magazine.Cast(this);
7255 int pop_sounds_count = 6;
7256 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
7257
7258
7259 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
7260 string sound_name = pop_sounds[ sound_idx ];
7261 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
7262
7263
7264 magazine.ServerAddAmmoCount(-1);
7265
7266
7267 float min_temp_to_explode = 100;
7268
7269 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
7270 {
7272 }
7273 }
7274
7275
7276 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
7277 {
7278 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
7279
7280 const int CHANCE_DAMAGE_CARGO = 4;
7281 const int CHANCE_DAMAGE_ATTACHMENT = 1;
7282 const int CHANCE_DAMAGE_NOTHING = 2;
7283
7285 {
7286 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
7287 int chances;
7288 int rnd;
7289
7290 if (GetInventory().GetCargo())
7291 {
7292 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7293 rnd = Math.RandomInt(0,chances);
7294
7295 if (rnd < CHANCE_DAMAGE_CARGO)
7296 {
7298 }
7299 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
7300 {
7302 }
7303 }
7304 else
7305 {
7306 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7307 rnd = Math.RandomInt(0,chances);
7308
7309 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
7310 {
7312 }
7313 }
7314 }
7315 }
7316
7318 {
7319 CargoBase cargo = GetInventory().GetCargo();
7320 if (cargo)
7321 {
7323 if (item_count > 0)
7324 {
7325 int random_pick = Math.RandomInt(0, item_count);
7327 if (!item.IsExplosive())
7328 {
7329 item.AddHealth("","",damage);
7330 return true;
7331 }
7332 }
7333 }
7334 return false;
7335 }
7336
7338 {
7339 GameInventory inventory = GetInventory();
7341 if (attachment_count > 0)
7342 {
7343 int random_pick = Math.RandomInt(0, attachment_count);
7345 if (!attachment.IsExplosive())
7346 {
7347 attachment.AddHealth("","",damage);
7348 return true;
7349 }
7350 }
7351 return false;
7352 }
7353
7355 {
7357 }
7358
7360 {
7362 return GetInventory().CanRemoveEntity();
7363
7364 return false;
7365 }
7366
7368 {
7369
7371 return false;
7372
7373
7375 return false;
7376
7377
7378
7380 if (delta == 0)
7381 return false;
7382
7383
7384 return true;
7385 }
7386
7388 {
7390 {
7391 if (ScriptInputUserData.CanStoreInputUserData())
7392 {
7393 ScriptInputUserData ctx = new ScriptInputUserData;
7398 ctx.
Write(destination_entity);
7402 }
7403 }
7404 else if (!
g_Game.IsMultiplayer())
7405 {
7407 }
7408 }
7409
7411 {
7412 float split_quantity_new;
7416 InventoryLocation loc = new InventoryLocation;
7417
7418 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7419 {
7421 split_quantity_new = stack_max;
7422 else
7424
7426 {
7427 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7428 if (new_item)
7429 {
7430 new_item.SetResultOfSplit(true);
7431 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7433 new_item.
SetQuantity(split_quantity_new,
false,
true);
7434 }
7435 }
7436 }
7437 else if (destination_entity && slot_id == -1)
7438 {
7439 if (quantity > stack_max)
7440 split_quantity_new = stack_max;
7441 else
7442 split_quantity_new = quantity;
7443
7445 {
7446 GameInventory destinationInventory = destination_entity.GetInventory();
7448 {
7451 }
7452
7453 if (new_item)
7454 {
7455 new_item.SetResultOfSplit(true);
7456 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7458 new_item.
SetQuantity(split_quantity_new,
false,
true);
7459 }
7460 }
7461 }
7462 else
7463 {
7464 if (stack_max != 0)
7465 {
7467 {
7469 }
7470
7471 if (split_quantity_new == 0)
7472 {
7473 if (!
g_Game.IsMultiplayer())
7474 player.PhysicalPredictiveDropItem(this);
7475 else
7476 player.ServerDropEntity(this);
7477 return;
7478 }
7479
7481 {
7483
7484 if (new_item)
7485 {
7486 new_item.SetResultOfSplit(true);
7487 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7490 new_item.PlaceOnSurface();
7491 }
7492 }
7493 }
7494 }
7495 }
7496
7498 {
7499 float split_quantity_new;
7503 InventoryLocation loc = new InventoryLocation;
7504
7505 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7506 {
7508 split_quantity_new = stack_max;
7509 else
7511
7513 {
7514 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7515 if (new_item)
7516 {
7517 new_item.SetResultOfSplit(true);
7518 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7520 new_item.
SetQuantity(split_quantity_new,
false,
true);
7521 }
7522 }
7523 }
7524 else if (destination_entity && slot_id == -1)
7525 {
7526 if (quantity > stack_max)
7527 split_quantity_new = stack_max;
7528 else
7529 split_quantity_new = quantity;
7530
7532 {
7533 GameInventory destinationInventory = destination_entity.GetInventory();
7535 {
7538 }
7539
7540 if (new_item)
7541 {
7542 new_item.SetResultOfSplit(true);
7543 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7545 new_item.
SetQuantity(split_quantity_new,
false,
true);
7546 }
7547 }
7548 }
7549 else
7550 {
7551 if (stack_max != 0)
7552 {
7554 {
7556 }
7557
7559 {
7561
7562 if (new_item)
7563 {
7564 new_item.SetResultOfSplit(true);
7565 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7568 new_item.PlaceOnSurface();
7569 }
7570 }
7571 }
7572 }
7573 }
7574
7576 {
7578 {
7579 if (ScriptInputUserData.CanStoreInputUserData())
7580 {
7581 ScriptInputUserData ctx = new ScriptInputUserData;
7586 dst.WriteToContext(ctx);
7588 }
7589 }
7590 else if (!
g_Game.IsMultiplayer())
7591 {
7593 }
7594 }
7595
7597 {
7599 {
7600 if (ScriptInputUserData.CanStoreInputUserData())
7601 {
7602 ScriptInputUserData ctx = new ScriptInputUserData;
7607 ctx.
Write(destination_entity);
7613 }
7614 }
7615 else if (!
g_Game.IsMultiplayer())
7616 {
7618 }
7619 }
7620
7622 {
7624 }
7625
7627 {
7629 float split_quantity_new;
7631 if (dst.IsValid())
7632 {
7633 int slot_id = dst.GetSlot();
7635
7636 if (quantity > stack_max)
7637 split_quantity_new = stack_max;
7638 else
7639 split_quantity_new = quantity;
7640
7642 {
7644
7645 if (new_item)
7646 {
7647 new_item.SetResultOfSplit(true);
7648 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7650 new_item.
SetQuantity(split_quantity_new,
false,
true);
7651 }
7652
7653 return new_item;
7654 }
7655 }
7656
7657 return null;
7658 }
7659
7661 {
7663 float split_quantity_new;
7665 if (destination_entity)
7666 {
7668 if (quantity > stackable)
7669 split_quantity_new = stackable;
7670 else
7671 split_quantity_new = quantity;
7672
7674 {
7675 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
7676 if (new_item)
7677 {
7678 new_item.SetResultOfSplit(true);
7679 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7681 new_item.
SetQuantity(split_quantity_new,
false,
true);
7682 }
7683 }
7684 }
7685 }
7686
7688 {
7690 {
7691 if (ScriptInputUserData.CanStoreInputUserData())
7692 {
7693 ScriptInputUserData ctx = new ScriptInputUserData;
7698 ItemBase destination_entity =
this;
7699 ctx.
Write(destination_entity);
7703 }
7704 }
7705 else if (!
g_Game.IsMultiplayer())
7706 {
7708 }
7709 }
7710
7712 {
7714 float split_quantity_new;
7716 if (player)
7717 {
7719 if (quantity > stackable)
7720 split_quantity_new = stackable;
7721 else
7722 split_quantity_new = quantity;
7723
7725 {
7726 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
7727 new_item =
ItemBase.Cast(in_hands);
7728 if (new_item)
7729 {
7730 new_item.SetResultOfSplit(true);
7731 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7733 new_item.SetQuantity(split_quantity_new, false, true);
7734 }
7735 }
7736 }
7737 }
7738
7740 {
7742 float split_quantity_new = Math.Floor(quantity * 0.5);
7743
7745 return;
7746
7748
7749 if (new_item)
7750 {
7751 if (new_item.GetQuantityMax() < split_quantity_new)
7752 {
7753 split_quantity_new = new_item.GetQuantityMax();
7754 }
7755
7756 new_item.SetResultOfSplit(true);
7757 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7758
7760 {
7763 }
7764 else
7765 {
7767 new_item.
SetQuantity(split_quantity_new,
false,
true);
7768 }
7769 }
7770 }
7771
7773 {
7775 float split_quantity_new = Math.Floor(quantity / 2);
7776
7778 return;
7779
7780 InventoryLocation invloc = new InventoryLocation;
7782
7784 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
7785
7786 if (new_item)
7787 {
7788 if (new_item.GetQuantityMax() < split_quantity_new)
7789 {
7790 split_quantity_new = new_item.GetQuantityMax();
7791 }
7793 {
7796 }
7797 else if (split_quantity_new > 1)
7798 {
7800 new_item.
SetQuantity(split_quantity_new,
false,
true);
7801 }
7802 }
7803 }
7804
7807 {
7808 SetWeightDirty();
7810
7811 if (parent)
7812 parent.OnAttachmentQuantityChangedEx(this, delta);
7813
7815 {
7817 {
7819 }
7821 {
7822 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
7824 }
7825 }
7826 }
7827
7830 {
7831
7832 }
7833
7836 {
7838 }
7839
7841 {
7842 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
7843
7845 {
7846 if (newLevel == GameConstants.STATE_RUINED)
7847 {
7849 EntityAI parent = GetHierarchyParent();
7850 if (parent && parent.IsFireplace())
7851 {
7852 CargoBase cargo = GetInventory().GetCargo();
7853 if (cargo)
7854 {
7856 {
7858 }
7859 }
7860 }
7861 }
7862
7864 {
7865
7867 return;
7868 }
7869
7870 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
7871 {
7873 }
7874 }
7875 }
7876
7877
7879 {
7880 super.OnRightClick();
7881
7883 {
7885 {
7886 if (ScriptInputUserData.CanStoreInputUserData())
7887 {
7888 EntityAI root = GetHierarchyRoot();
7889 Man playerOwner = GetHierarchyRootPlayer();
7890 InventoryLocation dst = new InventoryLocation;
7891
7892
7893 if (!playerOwner && root && root == this)
7894 {
7896 }
7897 else
7898 {
7899
7900 GetInventory().GetCurrentInventoryLocation(dst);
7902 {
7903 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7905 {
7907 }
7908 else
7909 {
7911
7912
7913 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
7914 {
7916 }
7917 else
7918 {
7919 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
7920 }
7921 }
7922 }
7923 }
7924
7925 ScriptInputUserData ctx = new ScriptInputUserData;
7933 }
7934 }
7935 else if (!
g_Game.IsMultiplayer())
7936 {
7938 }
7939 }
7940 }
7941
7943 {
7944 if (root)
7945 {
7946 vector m4[4];
7947 root.GetTransform(m4);
7948 dst.SetGround(this, m4);
7949 }
7950 else
7951 {
7952 GetInventory().GetCurrentInventoryLocation(dst);
7953 }
7954 }
7955
7956 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
7957 {
7958
7959 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
7960 return false;
7961
7962 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
7963 return false;
7964
7965
7967 return false;
7968
7969
7970 Magazine mag = Magazine.Cast(this);
7971 if (mag)
7972 {
7973 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
7974 return false;
7975
7976 if (stack_max_limit)
7977 {
7978 Magazine other_mag = Magazine.Cast(other_item);
7979 if (other_item)
7980 {
7981 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
7982 return false;
7983 }
7984
7985 }
7986 }
7987 else
7988 {
7989
7991 return false;
7992
7994 return false;
7995 }
7996
7997 PlayerBase player = null;
7998 if (CastTo(player, GetHierarchyRootPlayer()))
7999 {
8000 if (player.GetInventory().HasAttachment(this))
8001 return false;
8002
8003 if (player.IsItemsToDelete())
8004 return false;
8005 }
8006
8007 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
8008 return false;
8009
8010 int slotID;
8012 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
8013 return false;
8014
8015 return true;
8016 }
8017
8019 {
8021 }
8022
8024 {
8025 return m_IsResultOfSplit;
8026 }
8027
8029 {
8030 m_IsResultOfSplit = value;
8031 }
8032
8034 {
8036 }
8037
8039 {
8040 float other_item_quantity = other_item.GetQuantity();
8041 float this_free_space;
8042
8044
8046
8047 if (other_item_quantity > this_free_space)
8048 {
8049 return this_free_space;
8050 }
8051 else
8052 {
8053 return other_item_quantity;
8054 }
8055 }
8056
8058 {
8060 }
8061
8063 {
8065 return;
8066
8067 if (!IsMagazine() && other_item)
8068 {
8070 if (quantity_used != 0)
8071 {
8072 float hp1 = GetHealth01("","");
8073 float hp2 = other_item.GetHealth01("","");
8074 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
8075 hpResult = hpResult / (
GetQuantity() + quantity_used);
8076
8077 hpResult *= GetMaxHealth();
8078 Math.Round(hpResult);
8079 SetHealth("", "Health", hpResult);
8080
8082 other_item.AddQuantity(-quantity_used);
8083 }
8084 }
8086 }
8087
8089 {
8090 #ifdef SERVER
8091 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
8092 GetHierarchyParent().IncreaseLifetimeUp();
8093 #endif
8094 };
8095
8097 {
8098 PlayerBase p = PlayerBase.Cast(player);
8099
8100 array<int> recipesIds = p.m_Recipes;
8101 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8102 if (moduleRecipesManager)
8103 {
8104 EntityAI itemInHands = player.GetEntityInHands();
8105 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
8106 }
8107
8108 for (int i = 0;i < recipesIds.Count(); i++)
8109 {
8110 int key = recipesIds.Get(i);
8111 string recipeName = moduleRecipesManager.GetRecipeName(key);
8113 }
8114 }
8115
8116
8117 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
8118 {
8119 super.GetDebugActions(outputList);
8120
8121
8127
8128
8133
8138
8139
8143
8144
8146 {
8150 }
8151
8154
8155
8159
8161
8162 InventoryLocation loc = new InventoryLocation();
8163 GetInventory().GetCurrentInventoryLocation(loc);
8165 {
8166 if (Gizmo_IsSupported())
8169 }
8170
8172 }
8173
8174
8175
8176
8178 {
8179 super.OnAction(action_id, player, ctx);
8180
8182 {
8183 switch (action_id)
8184 {
8188 return true;
8192 return true;
8193 }
8194 }
8195
8197 {
8198 switch (action_id)
8199 {
8201 Delete();
8202 return true;
8203 }
8204 }
8205
8206 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
8207 {
8208 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8209 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
8210 PlayerBase p = PlayerBase.Cast(player);
8211 if (
EActions.RECIPES_RANGE_START < 1000)
8212 {
8213 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
8214 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
8215 }
8216 }
8217 #ifndef SERVER
8218 else if (action_id ==
EActions.WATCH_PLAYER)
8219 {
8220 PluginDeveloper.SetDeveloperItemClientEx(player);
8221 }
8222 #endif
8224 {
8225 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
8226 {
8227 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
8228 OnDebugButtonPressServer(id + 1);
8229 }
8230
8231 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
8232 {
8233 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
8235 }
8236
8237 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
8238 {
8239 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
8241 }
8242
8243 else if (action_id ==
EActions.ADD_QUANTITY)
8244 {
8245 if (IsMagazine())
8246 {
8247 Magazine mag = Magazine.Cast(this);
8248 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
8249 }
8250 else
8251 {
8253 }
8254
8255 if (m_EM)
8256 {
8257 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
8258 }
8259
8260 }
8261
8262 else if (action_id ==
EActions.REMOVE_QUANTITY)
8263 {
8264 if (IsMagazine())
8265 {
8266 Magazine mag2 = Magazine.Cast(this);
8267 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
8268 }
8269 else
8270 {
8272 }
8273 if (m_EM)
8274 {
8275 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
8276 }
8277
8278 }
8279
8280 else if (action_id ==
EActions.SET_QUANTITY_0)
8281 {
8283
8284 if (m_EM)
8285 {
8286 m_EM.SetEnergy(0);
8287 }
8288 }
8289
8290 else if (action_id ==
EActions.SET_MAX_QUANTITY)
8291 {
8293
8294 if (m_EM)
8295 {
8296 m_EM.SetEnergy(m_EM.GetEnergyMax());
8297 }
8298 }
8299
8300 else if (action_id ==
EActions.ADD_HEALTH)
8301 {
8302 AddHealth("","",GetMaxHealth("","Health")/5);
8303 }
8304 else if (action_id ==
EActions.REMOVE_HEALTH)
8305 {
8306 AddHealth("","",-GetMaxHealth("","Health")/5);
8307 }
8308 else if (action_id ==
EActions.DESTROY_HEALTH)
8309 {
8310 SetHealth01("","",0);
8311 }
8312 else if (action_id ==
EActions.WATCH_ITEM)
8313 {
8315 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
8316 #ifdef DEVELOPER
8317 SetDebugDeveloper_item(this);
8318 #endif
8319 }
8320
8321 else if (action_id ==
EActions.ADD_TEMPERATURE)
8322 {
8323 AddTemperature(20);
8324
8325 }
8326
8327 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
8328 {
8329 AddTemperature(-20);
8330
8331 }
8332
8333 else if (action_id ==
EActions.FLIP_FROZEN)
8334 {
8335 SetFrozen(!GetIsFrozen());
8336
8337 }
8338
8339 else if (action_id ==
EActions.ADD_WETNESS)
8340 {
8342
8343 }
8344
8345 else if (action_id ==
EActions.REMOVE_WETNESS)
8346 {
8348
8349 }
8350
8351 else if (action_id ==
EActions.LIQUIDTYPE_UP)
8352 {
8355
8356
8357 }
8358
8359 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
8360 {
8363 }
8364
8365 else if (action_id ==
EActions.MAKE_SPECIAL)
8366 {
8367 auto debugParams = DebugSpawnParams.WithPlayer(player);
8368 OnDebugSpawnEx(debugParams);
8369 }
8370
8371 }
8372
8373
8374 return false;
8375 }
8376
8377
8378
8379
8383
8386
8387
8388
8390 {
8391 return false;
8392 }
8393
8394
8396 {
8397 return true;
8398 }
8399
8400
8402 {
8403 return true;
8404 }
8405
8406
8407
8409 {
8410 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
8411 return g_Game.ConfigIsExisting(config_path);
8412 }
8413
8416 {
8417 return null;
8418 }
8419
8421 {
8422 return false;
8423 }
8424
8426 {
8427 return false;
8428 }
8429
8433
8434
8436 {
8437 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8438 return module_repairing.CanRepair(this, item_repair_kit);
8439 }
8440
8441
8442 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
8443 {
8444 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8445 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
8446 }
8447
8448
8450 {
8451
8452
8453
8454
8455
8456
8457
8458
8459 return 1;
8460 }
8461
8462
8463
8465 {
8467 }
8468
8469
8470
8472 {
8474 }
8475
8476
8485 {
8486 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8487
8488 if (player)
8489 {
8490 player.MessageStatus(text);
8491 }
8492 }
8493
8494
8503 {
8504 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8505
8506 if (player)
8507 {
8508 player.MessageAction(text);
8509 }
8510 }
8511
8512
8521 {
8522 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8523
8524 if (player)
8525 {
8526 player.MessageFriendly(text);
8527 }
8528 }
8529
8530
8539 {
8540 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8541
8542 if (player)
8543 {
8544 player.MessageImportant(text);
8545 }
8546 }
8547
8549 {
8550 return true;
8551 }
8552
8553
8554 override bool KindOf(
string tag)
8555 {
8556 bool found = false;
8557 string item_name = this.
GetType();
8559 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
8560
8561 int array_size = item_tag_array.Count();
8562 for (int i = 0; i < array_size; i++)
8563 {
8564 if (item_tag_array.Get(i) == tag)
8565 {
8566 found = true;
8567 break;
8568 }
8569 }
8570 return found;
8571 }
8572
8573
8575 {
8576
8577 super.OnRPC(sender, rpc_type,ctx);
8578
8579
8580 switch (rpc_type)
8581 {
8582 #ifndef SERVER
8583 case ERPCs.RPC_SOUND_LOCK_ATTACH:
8584 Param2<bool, string> p = new Param2<bool, string>(false, "");
8585
8587 return;
8588
8589 bool play = p.param1;
8590 string soundSet = p.param2;
8591
8592 if (play)
8593 {
8595 {
8597 {
8599 }
8600 }
8601 else
8602 {
8604 }
8605 }
8606 else
8607 {
8609 }
8610
8611 break;
8612 #endif
8613
8614 }
8615
8617 {
8619 }
8620 }
8621
8622
8623
8624
8626 {
8627 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8628 return plugin.GetID(
name);
8629 }
8630
8632 {
8633 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8634 return plugin.GetName(id);
8635 }
8636
8639 {
8640
8641
8642 int varFlags;
8643 if (!ctx.
Read(varFlags))
8644 return;
8645
8646 if (varFlags & ItemVariableFlags.FLOAT)
8647 {
8649 }
8650 }
8651
8653 {
8654
8655 super.SerializeNumericalVars(floats_out);
8656
8657
8658
8660 {
8662 }
8663
8665 {
8667 }
8668
8670 {
8672 }
8673
8675 {
8680 }
8681
8683 {
8685 }
8686 }
8687
8689 {
8690
8691 super.DeSerializeNumericalVars(floats);
8692
8693
8694 int index = 0;
8695 int mask = Math.Round(floats.Get(index));
8696
8697 index++;
8698
8700 {
8702 {
8704 }
8705 else
8706 {
8707 float quantity = floats.Get(index);
8709 }
8710 index++;
8711 }
8712
8714 {
8715 float wet = floats.Get(index);
8717 index++;
8718 }
8719
8721 {
8722 int liquidtype = Math.Round(floats.Get(index));
8724 index++;
8725 }
8726
8728 {
8730 index++;
8732 index++;
8734 index++;
8736 index++;
8737 }
8738
8740 {
8741 int cleanness = Math.Round(floats.Get(index));
8743 index++;
8744 }
8745 }
8746
8748 {
8749 super.WriteVarsToCTX(ctx);
8750
8751
8753 {
8755 }
8756
8758 {
8760 }
8761
8763 {
8765 }
8766
8768 {
8769 int r,g,b,a;
8775 }
8776
8778 {
8780 }
8781 }
8782
8784 {
8785 if (!super.ReadVarsFromCTX(ctx,version))
8786 return false;
8787
8788 int intValue;
8789 float value;
8790
8791 if (version < 140)
8792 {
8793 if (!ctx.
Read(intValue))
8794 return false;
8795
8796 m_VariablesMask = intValue;
8797 }
8798
8800 {
8801 if (!ctx.
Read(value))
8802 return false;
8803
8805 {
8807 }
8808 else
8809 {
8811 }
8812 }
8813
8814 if (version < 140)
8815 {
8817 {
8818 if (!ctx.
Read(value))
8819 return false;
8820 SetTemperatureDirect(value);
8821 }
8822 }
8823
8825 {
8826 if (!ctx.
Read(value))
8827 return false;
8829 }
8830
8832 {
8833 if (!ctx.
Read(intValue))
8834 return false;
8836 }
8837
8839 {
8840 int r,g,b,a;
8842 return false;
8844 return false;
8846 return false;
8848 return false;
8849
8851 }
8852
8854 {
8855 if (!ctx.
Read(intValue))
8856 return false;
8858 }
8859
8860 if (version >= 138 && version < 140)
8861 {
8863 {
8864 if (!ctx.
Read(intValue))
8865 return false;
8866 SetFrozen(intValue);
8867 }
8868 }
8869
8870 return true;
8871 }
8872
8873
8875 {
8878 {
8880 }
8881
8882 if (!super.OnStoreLoad(ctx, version))
8883 {
8885 return false;
8886 }
8887
8888 if (version >= 114)
8889 {
8890 bool hasQuickBarIndexSaved;
8891
8892 if (!ctx.
Read(hasQuickBarIndexSaved))
8893 {
8895 return false;
8896 }
8897
8898 if (hasQuickBarIndexSaved)
8899 {
8900 int itmQBIndex;
8901
8902
8903 if (!ctx.
Read(itmQBIndex))
8904 {
8906 return false;
8907 }
8908
8909 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
8910 if (itmQBIndex != -1 && parentPlayer)
8911 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
8912 }
8913 }
8914 else
8915 {
8916
8917 PlayerBase player;
8918 int itemQBIndex;
8919 if (version ==
int.
MAX)
8920 {
8921 if (!ctx.
Read(itemQBIndex))
8922 {
8924 return false;
8925 }
8926 }
8927 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
8928 {
8929
8930 if (!ctx.
Read(itemQBIndex))
8931 {
8933 return false;
8934 }
8935 if (itemQBIndex != -1 && player)
8936 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
8937 }
8938 }
8939
8940 if (version < 140)
8941 {
8942
8943 if (!LoadVariables(ctx, version))
8944 {
8946 return false;
8947 }
8948 }
8949
8950
8952 {
8954 return false;
8955 }
8956 if (version >= 132)
8957 {
8959 if (raib)
8960 {
8962 {
8964 return false;
8965 }
8966 }
8967 }
8968
8970 return true;
8971 }
8972
8973
8974
8976 {
8977 super.OnStoreSave(ctx);
8978
8979 PlayerBase player;
8980 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
8981 {
8983
8984 int itemQBIndex = -1;
8985 itemQBIndex = player.FindQuickBarEntityIndex(this);
8986 ctx.
Write(itemQBIndex);
8987 }
8988 else
8989 {
8991 }
8992
8994
8996 if (raib)
8997 {
8999 }
9000 }
9001
9002
9004 {
9005 super.AfterStoreLoad();
9006
9008 {
9010 }
9011
9013 {
9016 }
9017 }
9018
9020 {
9021 super.EEOnAfterLoad();
9022
9024 {
9026 }
9027
9030 }
9031
9033 {
9034 return false;
9035 }
9036
9037
9038
9040 {
9042 {
9043 #ifdef PLATFORM_CONSOLE
9044
9046 {
9048 if (menu)
9049 {
9051 }
9052 }
9053 #endif
9054 }
9055
9057 {
9060 }
9061
9063 {
9064 SetWeightDirty();
9066 }
9068 {
9071 }
9072
9074 {
9077
9080 }
9082 {
9086 }
9087
9088 super.OnVariablesSynchronized();
9089 }
9090
9091
9092
9094 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
9095 {
9096 if (!IsServerCheck(allow_client))
9097 return false;
9098
9100 return false;
9101
9104
9105 if (value <= (min + 0.001))
9106 value = min;
9107
9108 if (value == min)
9109 {
9110 if (destroy_config)
9111 {
9112 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
9113 if (dstr)
9114 {
9116 this.Delete();
9117 return true;
9118 }
9119 }
9120 else if (destroy_forced)
9121 {
9123 this.Delete();
9124 return true;
9125 }
9126
9128 }
9129
9132
9134 {
9135 EntityAI parent = GetHierarchyRoot();
9136 InventoryLocation iLoc = new InventoryLocation();
9137 GetInventory().GetCurrentInventoryLocation(iLoc);
9139 {
9140 int iLocSlot = iLoc.
GetSlot();
9142 {
9144 }
9146 {
9148 }
9149 }
9150 }
9151
9153 {
9155
9156 if (delta)
9158 }
9159
9161
9162 return false;
9163 }
9164
9165
9167 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9168 {
9170 }
9171
9173 {
9176 }
9177
9179 {
9182 }
9183
9185 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9186 {
9187 float value_clamped = Math.Clamp(value, 0, 1);
9189 SetQuantity(result, destroy_config, destroy_forced);
9190 }
9191
9192
9195 {
9197 }
9198
9200 {
9202 }
9203
9204
9205
9206
9207
9208
9209
9210
9211
9212
9214 {
9215 int slot = -1;
9216 GameInventory inventory = GetInventory();
9217 if (inventory)
9218 {
9219 InventoryLocation il = new InventoryLocation;
9222 }
9223
9225 }
9226
9228 {
9229 float quantity_max = 0;
9230
9232 {
9233 if (attSlotID != -1)
9234 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
9235
9236 if (quantity_max <= 0)
9238 }
9239
9240 if (quantity_max <= 0)
9242
9243 return quantity_max;
9244 }
9245
9247 {
9249 }
9250
9252 {
9254 }
9255
9256
9258 {
9260 }
9261
9263 {
9265 }
9266
9268 {
9270 }
9271
9272
9274 {
9275
9276 float weightEx = GetWeightEx();
9277 float special = GetInventoryAndCargoWeight();
9278 return weightEx - special;
9279 }
9280
9281
9283 {
9285 }
9286
9288 {
9290 {
9291 #ifdef DEVELOPER
9292 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9293 {
9294 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
9296 }
9297 #endif
9298
9300 }
9301 else if (HasEnergyManager())
9302 {
9303 #ifdef DEVELOPER
9304 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9305 {
9306 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
9307 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
9308 }
9309 #endif
9310 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
9311 }
9312 else
9313 {
9314 #ifdef DEVELOPER
9315 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9316 {
9317 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
9318 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
9319 }
9320 #endif
9321 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
9322 }
9323 }
9324
9327 {
9328 int item_count = 0;
9330
9331 GameInventory inventory = GetInventory();
9332 CargoBase cargo = inventory.
GetCargo();
9333 if (cargo != NULL)
9334 {
9336 }
9337
9339 for (int i = 0; i < nAttachments; ++i)
9340 {
9342 if (item)
9343 item_count += item.GetNumberOfItems();
9344 }
9345 return item_count;
9346 }
9347
9350 {
9351 float weight = 0;
9352 float wetness = 1;
9353 if (include_wetness)
9356 {
9357 weight = wetness * m_ConfigWeight;
9358 }
9360 {
9361 weight = 1;
9362 }
9363 return weight;
9364 }
9365
9366
9367
9369 {
9370 GameInventory inventory = GetInventory();
9371 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
9372 {
9373 array<EntityAI> items = new array<EntityAI>;
9375 for (int i = 0; i < items.Count(); ++i)
9376 {
9378 if (item)
9379 {
9380 g_Game.ObjectDelete(item);
9381 }
9382 }
9383 }
9384 }
9385
9386
9387
9388
9390 {
9391 float energy = 0;
9392 if (HasEnergyManager())
9393 {
9394 energy = GetCompEM().GetEnergy();
9395 }
9396 return energy;
9397 }
9398
9399
9401 {
9402 super.OnEnergyConsumed();
9403
9405 }
9406
9408 {
9409 super.OnEnergyAdded();
9410
9412 }
9413
9414
9416 {
9417 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
9418 {
9420 {
9421 float energy_0to1 = GetCompEM().GetEnergy0To1();
9423 }
9424 }
9425 }
9426
9427
9429 {
9430 return ConfigGetFloat("heatIsolation");
9431 }
9432
9434 {
9436 }
9437
9439 {
9440 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
9441 if (
g_Game.ConfigIsExisting(paramPath))
9442 return g_Game.ConfigGetFloat(paramPath);
9443
9444 return 0.0;
9445 }
9446
9448 {
9449 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
9450 if (
g_Game.ConfigIsExisting(paramPath))
9451 return g_Game.ConfigGetFloat(paramPath);
9452
9453 return 0.0;
9454 }
9455
9456 override void SetWet(
float value,
bool allow_client =
false)
9457 {
9458 if (!IsServerCheck(allow_client))
9459 return;
9460
9463
9465
9466 m_VarWet = Math.Clamp(value, min, max);
9467
9469 {
9472 }
9473 }
9474
9475 override void AddWet(
float value)
9476 {
9478 }
9479
9481 {
9483 }
9484
9486 {
9488 }
9489
9491 {
9493 }
9494
9496 {
9498 }
9499
9501 {
9503 }
9504
9506 {
9509 if (newLevel != oldLevel)
9510 {
9512 }
9513 }
9514
9516 {
9517 SetWeightDirty();
9518 }
9519
9521 {
9522 return GetWetLevelInternal(
m_VarWet);
9523 }
9524
9525
9526
9528 {
9530 }
9531
9533 {
9535 }
9536
9538 {
9540 }
9541
9543 {
9545 }
9546
9547
9548
9550 {
9551 if (ConfigIsExisting("itemModelLength"))
9552 {
9553 return ConfigGetFloat("itemModelLength");
9554 }
9555 return 0;
9556 }
9557
9559 {
9560 if (ConfigIsExisting("itemAttachOffset"))
9561 {
9562 return ConfigGetFloat("itemAttachOffset");
9563 }
9564 return 0;
9565 }
9566
9567 override void SetCleanness(
int value,
bool allow_client =
false)
9568 {
9569 if (!IsServerCheck(allow_client))
9570 return;
9571
9573
9575
9578 }
9579
9581 {
9583 }
9584
9586 {
9587 return true;
9588 }
9589
9590
9591
9592
9594 {
9596 }
9597
9599 {
9601 }
9602
9603
9604
9605
9606 override void SetColor(
int r,
int g,
int b,
int a)
9607 {
9613 }
9615 override void GetColor(out
int r,out
int g,out
int b,out
int a)
9616 {
9621 }
9622
9624 {
9626 }
9627
9630 {
9631 int r,g,b,a;
9633 r = r/255;
9634 g = g/255;
9635 b = b/255;
9636 a = a/255;
9637 return MiscGameplayFunctions.GetColorString(r, g, b, a);
9638 }
9639
9640
9641
9642 override void SetLiquidType(
int value,
bool allow_client =
false)
9643 {
9644 if (!IsServerCheck(allow_client))
9645 return;
9646
9651 }
9652
9654 {
9655 return ConfigGetInt("varLiquidTypeInit");
9656 }
9657
9659 {
9661 }
9662
9664 {
9666 SetFrozen(false);
9667 }
9668
9671 {
9672 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9673 }
9674
9675
9678 {
9679 PlayerBase nplayer;
9680 if (PlayerBase.CastTo(nplayer, player))
9681 {
9683 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9684 }
9685 }
9686
9687
9690 {
9691 PlayerBase nplayer;
9692 if (PlayerBase.CastTo(nplayer,player))
9693 {
9694 nplayer.SetEnableQuickBarEntityShortcut(this, false);
9695 }
9696
9697 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
9698
9699 if (HasEnergyManager())
9700 {
9701 GetCompEM().UpdatePlugState();
9702 }
9703 }
9704
9705
9707 {
9708 super.OnPlacementStarted(player);
9709
9711 }
9712
9713 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
9714 {
9716 {
9717 m_AdminLog.OnPlacementComplete(player,
this);
9718 }
9719
9720 super.OnPlacementComplete(player, position, orientation);
9721 }
9722
9723
9724
9725
9726
9728 {
9730 {
9731 return true;
9732 }
9733 else
9734 {
9735 return false;
9736 }
9737 }
9738
9739
9741 {
9743 {
9745 }
9746 }
9747
9748
9750 {
9752 }
9753
9755 {
9757 }
9758
9759 override void InsertAgent(
int agent,
float count = 1)
9760 {
9761 if (count < 1)
9762 return;
9763
9765 }
9766
9769 {
9771 }
9772
9773
9775 {
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
9807
9808
9809
9810
9811
9812
9813
9814
9815
9816
9817
9818
9819
9821 {
9823 return false;
9824 return true;
9825 }
9826
9828 {
9829
9831 }
9832
9833
9836 {
9837 super.CheckForRoofLimited(timeTresholdMS);
9838
9839 float time =
g_Game.GetTime();
9840 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
9841 {
9842 m_PreviousRoofTestTime = time;
9843 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
9844 }
9845 }
9846
9847
9849 {
9851 {
9852 return 0;
9853 }
9854
9855 if (GetInventory().GetAttachmentSlotsCount() != 0)
9856 {
9857 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
9858 if (filter)
9859 return filter.GetProtectionLevel(type, false, system);
9860 else
9861 return 0;
9862 }
9863
9864 string subclassPath, entryName;
9865
9866 switch (type)
9867 {
9869 entryName = "biological";
9870 break;
9872 entryName = "chemical";
9873 break;
9874 default:
9875 entryName = "biological";
9876 break;
9877 }
9878
9879 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
9880
9881 return g_Game.ConfigGetFloat(subclassPath + entryName);
9882 }
9883
9884
9885
9888 {
9889 if (!IsMagazine())
9891
9893 }
9894
9895
9896
9897
9898
9903 {
9904 return true;
9905 }
9906
9908 {
9910 }
9911
9912
9913
9914
9915
9917 {
9918 if (parent)
9919 {
9920 if (parent.IsInherited(DayZInfected))
9921 return true;
9922
9923 if (!parent.IsRuined())
9924 return true;
9925 }
9926
9927 return true;
9928 }
9929
9931 {
9932 if (!super.CanPutAsAttachment(parent))
9933 {
9934 return false;
9935 }
9936
9937 if (!IsRuined() && !parent.IsRuined())
9938 {
9939 return true;
9940 }
9941
9942 return false;
9943 }
9944
9946 {
9947
9948
9949
9950
9951 return super.CanReceiveItemIntoCargo(item);
9952 }
9953
9955 {
9956
9957
9958
9959
9960 GameInventory attachmentInv = attachment.GetInventory();
9962 {
9963 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
9964 return false;
9965 }
9966
9967 InventoryLocation loc = new InventoryLocation();
9968 attachment.GetInventory().GetCurrentInventoryLocation(loc);
9969 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
9970 return false;
9971
9972 return super.CanReceiveAttachment(attachment, slotId);
9973 }
9974
9976 {
9977 if (!super.CanReleaseAttachment(attachment))
9978 return false;
9979
9980 return GetInventory().AreChildrenAccessible();
9981 }
9982
9983
9984
9985
9986
9987
9988
9989
9990
9991
9992
9993
9994
9995
9996
9997
9998
9999
10000
10001
10002
10004 {
10005 int id = muzzle_owner.GetMuzzleID();
10006 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
10007
10008 if (WPOF_array)
10009 {
10010 for (int i = 0; i < WPOF_array.Count(); i++)
10011 {
10012 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
10013
10014 if (WPOF)
10015 {
10016 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
10017 }
10018 }
10019 }
10020 }
10021
10022
10024 {
10025 int id = muzzle_owner.GetMuzzleID();
10027
10028 if (WPOBE_array)
10029 {
10030 for (int i = 0; i < WPOBE_array.Count(); i++)
10031 {
10032 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
10033
10034 if (WPOBE)
10035 {
10036 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10037 }
10038 }
10039 }
10040 }
10041
10042
10044 {
10045 int id = muzzle_owner.GetMuzzleID();
10046 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10047
10048 if (WPOOH_array)
10049 {
10050 for (int i = 0; i < WPOOH_array.Count(); i++)
10051 {
10052 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10053
10054 if (WPOOH)
10055 {
10056 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10057 }
10058 }
10059 }
10060 }
10061
10062
10064 {
10065 int id = muzzle_owner.GetMuzzleID();
10066 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10067
10068 if (WPOOH_array)
10069 {
10070 for (int i = 0; i < WPOOH_array.Count(); i++)
10071 {
10072 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10073
10074 if (WPOOH)
10075 {
10076 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10077 }
10078 }
10079 }
10080 }
10081
10082
10084 {
10085 int id = muzzle_owner.GetMuzzleID();
10086 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10087
10088 if (WPOOH_array)
10089 {
10090 for (int i = 0; i < WPOOH_array.Count(); i++)
10091 {
10092 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10093
10094 if (WPOOH)
10095 {
10096 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10097 }
10098 }
10099 }
10100 }
10101
10102
10103
10105 {
10107 {
10108 return true;
10109 }
10110
10111 return false;
10112 }
10113
10115 {
10117 {
10118 return true;
10119 }
10120
10121 return false;
10122 }
10123
10125 {
10127 {
10128 return true;
10129 }
10130
10131 return false;
10132 }
10133
10135 {
10136 return false;
10137 }
10138
10141 {
10142 return UATimeSpent.DEFAULT_DEPLOY;
10143 }
10144
10145
10146
10147
10149 {
10151 SetSynchDirty();
10152 }
10153
10155 {
10157 }
10158
10159
10161 {
10162 return false;
10163 }
10164
10167 {
10168 string att_type = "None";
10169
10170 if (ConfigIsExisting("soundAttType"))
10171 {
10172 att_type = ConfigGetString("soundAttType");
10173 }
10174
10176 }
10177
10179 {
10181 }
10182
10183
10184
10185
10186
10192
10194 {
10197
10199 }
10200
10201
10203 {
10205 return;
10206
10208
10211
10214
10215 SoundParameters params = new SoundParameters();
10219 }
10220
10221
10223 {
10225 {
10228
10229 SetSynchDirty();
10230
10233 }
10234 }
10235
10237 {
10239 }
10240
10241
10243 {
10245 return;
10246
10248 SetSynchDirty();
10249
10252 }
10253
10255 {
10258 }
10259
10261 {
10263 }
10264
10265 void OnApply(PlayerBase player);
10266
10268 {
10269 return 1.0;
10270 };
10271
10273 {
10275 }
10276
10278 {
10280 }
10281
10283
10285 {
10286 SetDynamicPhysicsLifeTime(0.01);
10288 }
10289
10291 {
10292 array<string> zone_names = new array<string>;
10293 GetDamageZones(zone_names);
10294 for (int i = 0; i < zone_names.Count(); i++)
10295 {
10296 SetHealthMax(zone_names.Get(i),"Health");
10297 }
10298 SetHealthMax("","Health");
10299 }
10300
10303 {
10304 float global_health = GetHealth01("","Health");
10305 array<string> zones = new array<string>;
10306 GetDamageZones(zones);
10307
10308 for (int i = 0; i < zones.Count(); i++)
10309 {
10310 SetHealth01(zones.Get(i),"Health",global_health);
10311 }
10312 }
10313
10316 {
10317 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
10318 }
10319
10321 {
10322 if (!hasRootAsPlayer)
10323 {
10324 if (refParentIB)
10325 {
10326
10327 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
10328 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
10329
10330 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
10331 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
10332
10335 }
10336 else
10337 {
10338
10341 }
10342 }
10343 }
10344
10346 {
10348 {
10349 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
10350 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
10351 {
10352 float heatPermCoef = 1.0;
10354 while (ent)
10355 {
10356 heatPermCoef *= ent.GetHeatPermeabilityCoef();
10357 ent = ent.GetHierarchyParent();
10358 }
10359
10360 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
10361 }
10362 }
10363 }
10364
10366 {
10367
10368 EntityAI parent = GetHierarchyParent();
10369 if (!parent)
10370 {
10371 hasParent = false;
10372 hasRootAsPlayer = false;
10373 }
10374 else
10375 {
10376 hasParent = true;
10377 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
10378 refParentIB =
ItemBase.Cast(parent);
10379 }
10380 }
10381
10382 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
10383 {
10384
10385 }
10386
10388 {
10389
10390 return false;
10391 }
10392
10394 {
10395
10396
10397 return false;
10398 }
10399
10401 {
10402
10403 return false;
10404 }
10405
10408 {
10409 return !GetIsFrozen() &&
IsOpen();
10410 }
10411
10413 {
10414 bool hasParent = false, hasRootAsPlayer = false;
10416
10417 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
10418 bool foodDecay =
g_Game.IsFoodDecayEnabled();
10419
10420 if (wwtu || foodDecay)
10421 {
10425
10426 if (processWetness || processTemperature || processDecay)
10427 {
10429
10430 if (processWetness)
10431 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
10432
10433 if (processTemperature)
10435
10436 if (processDecay)
10437 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
10438 }
10439 }
10440 }
10441
10444 {
10446 }
10447
10449 {
10452
10453 return super.GetTemperatureFreezeThreshold();
10454 }
10455
10457 {
10460
10461 return super.GetTemperatureThawThreshold();
10462 }
10463
10465 {
10468
10469 return super.GetItemOverheatThreshold();
10470 }
10471
10473 {
10475 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
10476
10477 return super.GetTemperatureFreezeTime();
10478 }
10479
10481 {
10483 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
10484
10485 return super.GetTemperatureThawTime();
10486 }
10487
10492
10494 {
10495 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
10496 }
10497
10499 {
10500 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
10501 }
10502
10505 {
10507 }
10508
10510 {
10512 }
10513
10515 {
10517 }
10518
10521 {
10522 return null;
10523 }
10524
10527 {
10528 return false;
10529 }
10530
10532 {
10534 {
10537 if (!trg)
10538 {
10540 explosive = this;
10541 }
10542
10543 explosive.PairRemote(trg);
10545
10546 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
10547 trg.SetPersistentPairID(persistentID);
10548 explosive.SetPersistentPairID(persistentID);
10549
10550 return true;
10551 }
10552 return false;
10553 }
10554
10557 {
10558 float ret = 1.0;
10561 ret *= GetHealth01();
10562
10563 return ret;
10564 }
10565
10566 #ifdef DEVELOPER
10567 override void SetDebugItem()
10568 {
10569 super.SetDebugItem();
10570 _itemBase = this;
10571 }
10572
10574 {
10575 string text = super.GetDebugText();
10576
10578 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
10579
10580 return text;
10581 }
10582 #endif
10583
10585 {
10586 return true;
10587 }
10588
10590
10592
10594 {
10597 }
10598
10599
10607
10623
10624 [
Obsolete(
"Use ItemSoundHandler instead")]
10627 {
10628 if (!
g_Game.IsDedicatedServer())
10629 {
10630 if (ConfigIsExisting("attachSoundSet"))
10631 {
10632 string cfg_path = "";
10633 string soundset = "";
10634 string type_name =
GetType();
10635
10638 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
10639 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
10640
10641 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
10642 {
10643 for (int i = 0; i < cfg_soundset_array.Count(); i++)
10644 {
10645 if (cfg_slot_array[i] == slot_type)
10646 {
10647 soundset = cfg_soundset_array[i];
10648 break;
10649 }
10650 }
10651 }
10652
10653 if (soundset != "")
10654 {
10655 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
10657 }
10658 }
10659 }
10660 }
10661
10663}
10664
10666{
10668 if (entity)
10669 {
10670 bool is_item = entity.IsInherited(
ItemBase);
10671 if (is_item && full_quantity)
10672 {
10675 }
10676 }
10677 else
10678 {
10680 return NULL;
10681 }
10682 return entity;
10683}
10684
10686{
10687 if (item)
10688 {
10689 if (health > 0)
10690 item.SetHealth("", "", health);
10691
10692 if (item.CanHaveTemperature())
10693 {
10695 if (item.CanFreeze())
10696 item.SetFrozen(false);
10697 }
10698
10699 if (item.HasEnergyManager())
10700 {
10701 if (quantity >= 0)
10702 {
10703 item.GetCompEM().SetEnergy0To1(quantity);
10704 }
10705 else
10706 {
10708 }
10709 }
10710 else if (item.IsMagazine())
10711 {
10712 Magazine mag = Magazine.Cast(item);
10713 if (quantity >= 0)
10714 {
10715 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
10716 }
10717 else
10718 {
10720 }
10721
10722 }
10723 else
10724 {
10725 if (quantity >= 0)
10726 {
10727 item.SetQuantityNormalized(quantity, false);
10728 }
10729 else
10730 {
10732 }
10733
10734 }
10735 }
10736}
10737
10738#ifdef DEVELOPER
10740#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.