5816{
5818 {
5819 return true;
5820 }
5821};
5822
5824{
5825
5826};
5827
5828
5829
5831{
5835
5837
5840
5841
5842
5843
5844
5853
5859
5864
5869
5890 protected bool m_IsResultOfSplit
5891
5893
5898
5899
5900
5902
5906
5907
5908
5910
5913
5914
5915
5921
5922
5930
5933
5934
5936
5937
5939
5940
5945
5946
5951
5953
5954
5956
5957
5959 {
5964
5965 if (!
g_Game.IsDedicatedServer())
5966 {
5968 {
5970
5972 {
5974 }
5975 }
5976
5979 }
5980
5981 m_OldLocation = null;
5982
5984 {
5986 }
5987
5988 if (ConfigIsExisting("headSelectionsToHide"))
5989 {
5992 }
5993
5995 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
5996 {
5998 }
5999
6001
6002 m_IsResultOfSplit = false;
6003
6005 }
6006
6008 {
6009 super.InitItemVariables();
6010
6016 m_Count = ConfigGetInt(
"count");
6017
6020
6025
6028
6033
6045
6049
6050
6053 if (ConfigIsExisting("canBeSplit"))
6054 {
6057 }
6058
6060 if (ConfigIsExisting("itemBehaviour"))
6062
6063
6066 RegisterNetSyncVariableInt("m_VarLiquidType");
6067 RegisterNetSyncVariableInt("m_Cleanness",0,1);
6068
6069 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
6070 RegisterNetSyncVariableFloat("m_ImpactSpeed");
6071 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
6072
6073 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
6074 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
6075 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
6076 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
6077
6078 RegisterNetSyncVariableBool("m_IsBeingPlaced");
6079 RegisterNetSyncVariableBool("m_IsTakeable");
6080 RegisterNetSyncVariableBool("m_IsHologram");
6081
6084 {
6087 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
6088 }
6089
6091
6093 if (ConfigIsExisting("temperaturePerQuantityWeight"))
6095
6097 }
6098
6100 {
6102 }
6103
6105 {
6108 {
6113 }
6114 }
6115
6116 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
6117 {
6119 {
6122 }
6123
6125 }
6126
6128 {
6134 }
6135
6137
6139 {
6141
6142 if (!action)
6143 {
6144 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
6145 return;
6146 }
6147
6149 if (!ai)
6150 {
6152 return;
6153 }
6154
6156 if (!action_array)
6157 {
6158 action_array = new array<ActionBase_Basic>;
6160 }
6161 if (LogManager.IsActionLogEnable())
6162 {
6163 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
6164 }
6165
6166 if (action_array.Find(action) != -1)
6167 {
6168 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
6169 }
6170 else
6171 {
6172 action_array.Insert(action);
6173 }
6174 }
6175
6177 {
6178 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6179 ActionBase action = player.GetActionManager().GetAction(actionName);
6182
6183 if (action_array)
6184 {
6185 action_array.RemoveItem(action);
6186 }
6187 }
6188
6189
6190
6192 {
6193 ActionOverrideData overrideData = new ActionOverrideData();
6197
6199 if (!actionMap)
6200 {
6203 }
6204
6205 actionMap.Insert(this.
Type(), overrideData);
6206
6207 }
6208
6210
6212
6213
6215 {
6218
6221
6222 string config_to_search = "CfgVehicles";
6223 string muzzle_owner_config;
6224
6226 {
6227 if (IsInherited(Weapon))
6228 config_to_search = "CfgWeapons";
6229
6230 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6231
6232 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
6233
6234 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
6235
6236 if (config_OnFire_subclass_count > 0)
6237 {
6238 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
6239
6240 for (int i = 0; i < config_OnFire_subclass_count; i++)
6241 {
6242 string particle_class = "";
6243 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
6244 string config_OnFire_entry = config_OnFire_class + particle_class;
6245 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
6246 WPOF_array.Insert(WPOF);
6247 }
6248
6249
6251 }
6252 }
6253
6255 {
6256 config_to_search = "CfgWeapons";
6257 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6258
6259 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
6260
6261 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
6262
6263 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
6264 {
6265 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
6266
6267 for (i = 0; i < config_OnBulletCasingEject_count; i++)
6268 {
6269 string particle_class2 = "";
6270 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
6271 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
6272 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
6273 WPOBE_array.Insert(WPOBE);
6274 }
6275
6276
6278 }
6279 }
6280 }
6281
6282
6284 {
6287
6289 {
6290 string config_to_search = "CfgVehicles";
6291
6292 if (IsInherited(Weapon))
6293 config_to_search = "CfgWeapons";
6294
6295 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6296 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
6297
6298 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
6299 {
6300
6302
6304 {
6306 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
6308 return;
6309 }
6310
6313
6314
6315
6316 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
6317 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
6318
6319 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
6320 {
6321 string particle_class = "";
6322 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
6323 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
6324 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
6325
6326 if (entry_type == CT_CLASS)
6327 {
6328 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
6329 WPOOH_array.Insert(WPOF);
6330 }
6331 }
6332
6333
6335 }
6336 }
6337 }
6338
6340 {
6342 }
6343
6345 {
6347 {
6349
6352
6355
6356 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6357 }
6358 }
6359
6361 {
6363 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6364
6366 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6367
6369 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6370
6372 {
6374 }
6375 }
6376
6378 {
6380 }
6381
6383 {
6386 else
6388
6390 {
6393 }
6394 else
6395 {
6398
6401 }
6402
6404 }
6405
6407 {
6409 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6410 }
6411
6413 {
6415 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6417 }
6418
6420 {
6422 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6423 }
6424
6426 {
6429
6430 OverheatingParticle OP = new OverheatingParticle();
6435
6437 }
6438
6440 {
6443
6444 return -1;
6445 }
6446
6448 {
6450 {
6453
6454 for (int i = count; i > 0; --i)
6455 {
6456 int id = i - 1;
6459
6462
6463 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
6464 {
6465 if (p)
6466 {
6469 }
6470 }
6471 }
6472 }
6473 }
6474
6476 {
6478 {
6480 {
6481 int id = i - 1;
6483
6484 if (OP)
6485 {
6487
6488 if (p)
6489 {
6491 }
6492
6493 delete OP;
6494 }
6495 }
6496
6499 }
6500 }
6501
6504 {
6505 return 0.0;
6506 }
6507
6508
6510 {
6511 return 250;
6512 }
6513
6515 {
6516 return 0;
6517 }
6518
6521 {
6523 return true;
6524
6525 return false;
6526 }
6527
6530 {
6533
6535 {
6537 }
6538 else
6539 {
6540
6542 }
6543
6545 }
6546
6553 {
6554 return -1;
6555 }
6556
6557
6558
6559
6561 {
6563 {
6564 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6565 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6566
6567 if (r_index >= 0)
6568 {
6569 InventoryLocation r_il = new InventoryLocation;
6570 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6571
6572 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6575 {
6576 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6577 }
6579 {
6580 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6581 }
6582
6583 }
6584
6585 player.GetHumanInventory().ClearUserReservedLocation(this);
6586 }
6587
6590 }
6591
6592
6593
6594
6596 {
6597 return ItemBase.m_DebugActionsMask;
6598 }
6599
6601 {
6602 return ItemBase.m_DebugActionsMask & mask;
6603 }
6604
6606 {
6607 ItemBase.m_DebugActionsMask = mask;
6608 }
6609
6611 {
6612 ItemBase.m_DebugActionsMask |= mask;
6613 }
6614
6616 {
6617 ItemBase.m_DebugActionsMask &= ~mask;
6618 }
6619
6621 {
6623 {
6625 }
6626 else
6627 {
6629 }
6630 }
6631
6632
6634 {
6635 if (GetEconomyProfile())
6636 {
6637 float q_max = GetEconomyProfile().GetQuantityMax();
6638 if (q_max > 0)
6639 {
6640 float q_min = GetEconomyProfile().GetQuantityMin();
6641 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
6642
6644 {
6645 ComponentEnergyManager comp = GetCompEM();
6647 {
6649 }
6650 }
6652 {
6654
6655 }
6656
6657 }
6658 }
6659 }
6660
6663 {
6664 EntityAI parent = GetHierarchyParent();
6665
6666 if (parent)
6667 {
6668 InventoryLocation inventory_location_to_lock = new InventoryLocation;
6669 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
6670 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
6671 }
6672 }
6673
6676 {
6677 EntityAI parent = GetHierarchyParent();
6678
6679 if (parent)
6680 {
6681 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
6682 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
6683 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
6684 }
6685 }
6686
6688 {
6689
6690
6691
6692
6694
6696 {
6697 if (ScriptInputUserData.CanStoreInputUserData())
6698 {
6699 ScriptInputUserData ctx = new ScriptInputUserData;
6705 ctx.
Write(use_stack_max);
6708
6710 {
6711 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
6712 }
6713 }
6714 }
6715 else if (!
g_Game.IsMultiplayer())
6716 {
6718 }
6719 }
6720
6722 {
6724 }
6725
6727 {
6729 }
6730
6732 {
6734 }
6735
6737 {
6738
6739 return false;
6740 }
6741
6743 {
6744 return false;
6745 }
6746
6750 {
6751 return false;
6752 }
6753
6755 {
6756 return "";
6757 }
6758
6760
6762 {
6763 return false;
6764 }
6765
6767 {
6768 return true;
6769 }
6770
6771
6772
6774 {
6775 return true;
6776 }
6777
6779 {
6780 return true;
6781 }
6782
6784 {
6785 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6787 }
6788
6790 {
6792 }
6793
6795 {
6797 if (!is_being_placed)
6799 SetSynchDirty();
6800 }
6801
6802
6804
6806 {
6808 }
6809
6811 {
6813 }
6814
6816 {
6817 return 1;
6818 }
6819
6821 {
6822 return false;
6823 }
6824
6826 {
6828 SetSynchDirty();
6829 }
6830
6831
6832
6833
6834
6835
6836
6837
6838
6839
6840
6841
6842
6843
6844
6845
6846
6847
6848
6849
6850
6851
6852
6853
6854
6855
6856
6857
6858
6859
6860
6861
6862
6863
6864
6866 {
6867 super.OnMovedInsideCargo(container);
6868
6869 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6870 }
6871
6872 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
6873 {
6874 super.EEItemLocationChanged(oldLoc, newLoc);
6875
6876 PlayerBase newPlayer = null;
6877 PlayerBase oldPlayer = null;
6878
6879 if (newLoc.GetParent())
6880 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
6881
6882 if (oldLoc.GetParent())
6883 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
6884
6886 {
6887 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
6888
6889 if (rIndex >= 0)
6890 {
6891 InventoryLocation rIl = new InventoryLocation;
6892 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
6893
6894 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
6897 {
6898 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
6899 }
6901 {
6903 }
6904
6905 }
6906 }
6907
6909 {
6910 if (newPlayer)
6911 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
6912
6913 if (newPlayer == oldPlayer)
6914 {
6915 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
6916 {
6918 {
6919 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
6920 {
6921 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6922 }
6923 }
6924 else
6925 {
6926 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6927 }
6928 }
6929
6930 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
6931 {
6932 int type = oldLoc.GetType();
6934 {
6935 oldLoc.GetParent().GetOnSetLock().Invoke(this);
6936 }
6938 {
6939 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
6940 }
6941 }
6942 if (!m_OldLocation)
6943 {
6944 m_OldLocation = new InventoryLocation;
6945 }
6946 m_OldLocation.Copy(oldLoc);
6947 }
6948 else
6949 {
6950 if (m_OldLocation)
6951 {
6952 m_OldLocation.Reset();
6953 }
6954 }
6955
6956 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
6957 }
6958 else
6959 {
6960 if (newPlayer)
6961 {
6962 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
6963 if (resIndex >= 0)
6964 {
6965 InventoryLocation il = new InventoryLocation;
6966 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
6968 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
6971 {
6972 il.
GetParent().GetOnReleaseLock().Invoke(it);
6973 }
6975 {
6977 }
6978
6979 }
6980 }
6982 {
6983
6985 }
6986
6987 if (m_OldLocation)
6988 {
6989 m_OldLocation.Reset();
6990 }
6991 }
6992
6994 {
6995 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
6996 }
6997
6999 {
7000 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
7001 }
7002 }
7003
7004 override void EOnContact(IEntity other, Contact extra)
7005 {
7007 {
7008 int liquidType = -1;
7010 if (impactSpeed > 0.0)
7011 {
7013 #ifndef SERVER
7015 #else
7017 SetSynchDirty();
7018 #endif
7020 }
7021 }
7022
7023 #ifdef SERVER
7024 if (GetCompEM() && GetCompEM().IsPlugged())
7025 {
7026 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
7027 GetCompEM().UnplugThis();
7028 }
7029 #endif
7030 }
7031
7033
7035 {
7037 }
7038
7040 {
7041
7042 }
7043
7045 {
7046 super.OnItemLocationChanged(old_owner, new_owner);
7047
7048 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
7049 PlayerBase playerNew = PlayerBase.Cast(new_owner);
7050
7051 if (!relatedPlayer && playerNew)
7052 relatedPlayer = playerNew;
7053
7054 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
7055 {
7057 if (actionMgr)
7058 {
7059 ActionBase currentAction = actionMgr.GetRunningAction();
7060 if (currentAction)
7062 }
7063 }
7064
7065 Man ownerPlayerOld = null;
7066 Man ownerPlayerNew = null;
7067
7068 if (old_owner)
7069 {
7070 if (old_owner.
IsMan())
7071 {
7072 ownerPlayerOld = Man.Cast(old_owner);
7073 }
7074 else
7075 {
7076 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
7077 }
7078 }
7079 else
7080 {
7082 {
7084
7085 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
7086 {
7087 GetCompEM().UnplugThis();
7088 }
7089 }
7090 }
7091
7092 if (new_owner)
7093 {
7094 if (new_owner.
IsMan())
7095 {
7096 ownerPlayerNew = Man.Cast(new_owner);
7097 }
7098 else
7099 {
7100 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
7101 }
7102 }
7103
7104 if (ownerPlayerOld != ownerPlayerNew)
7105 {
7106 if (ownerPlayerOld)
7107 {
7108 array<EntityAI> subItemsExit = new array<EntityAI>;
7110 for (int i = 0; i < subItemsExit.Count(); i++)
7111 {
7114 }
7115 }
7116
7117 if (ownerPlayerNew)
7118 {
7119 array<EntityAI> subItemsEnter = new array<EntityAI>;
7121 for (int j = 0; j < subItemsEnter.Count(); j++)
7122 {
7125 }
7126 }
7127 }
7128 else if (ownerPlayerNew != null)
7129 {
7130 PlayerBase nplayer;
7131 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
7132 {
7133 array<EntityAI> subItemsUpdate = new array<EntityAI>;
7135 for (int k = 0; k < subItemsUpdate.Count(); k++)
7136 {
7138 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
7139 }
7140 }
7141 }
7142
7143 if (old_owner)
7144 old_owner.OnChildItemRemoved(this);
7145 if (new_owner)
7146 new_owner.OnChildItemReceived(this);
7147 }
7148
7149
7151 {
7152 super.EEDelete(parent);
7153 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
7154 if (player)
7155 {
7157
7158 if (player.IsAlive())
7159 {
7160 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7161 if (r_index >= 0)
7162 {
7163 InventoryLocation r_il = new InventoryLocation;
7164 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7165
7166 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7169 {
7170 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7171 }
7173 {
7174 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7175 }
7176
7177 }
7178
7179 player.RemoveQuickBarEntityShortcut(this);
7180 }
7181 }
7182 }
7183
7185 {
7186 super.EEKilled(killer);
7187
7190 {
7191 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
7192 {
7193 if (IsMagazine())
7194 {
7195 if (Magazine.Cast(this).GetAmmoCount() > 0)
7196 {
7198 }
7199 }
7200 else
7201 {
7203 }
7204 }
7205 }
7206 }
7207
7209 {
7210 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7211
7212 super.OnWasAttached(parent, slot_id);
7213
7216
7219 }
7220
7222 {
7223 super.OnWasDetached(parent, slot_id);
7224
7227
7230 }
7231
7233 {
7234 int idx;
7237
7238 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7239 if (inventory_slots.Count() < 1)
7240 {
7241 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
7242 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
7243 }
7244 else
7245 {
7246 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
7247 }
7248
7249 idx = inventory_slots.Find(slot);
7250 if (idx < 0)
7251 return "";
7252
7253 return attach_types.Get(idx);
7254 }
7255
7257 {
7258 int idx = -1;
7259 string slot;
7260
7263
7264 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7265 if (inventory_slots.Count() < 1)
7266 {
7267 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
7268 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7269 }
7270 else
7271 {
7272 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
7273 if (detach_types.Count() < 1)
7274 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7275 }
7276
7277 for (int i = 0; i < inventory_slots.Count(); i++)
7278 {
7279 slot = inventory_slots.Get(i);
7280 }
7281
7282 if (slot != "")
7283 {
7284 if (detach_types.Count() == 1)
7285 idx = 0;
7286 else
7287 idx = inventory_slots.Find(slot);
7288 }
7289 if (idx < 0)
7290 return "";
7291
7292 return detach_types.Get(idx);
7293 }
7294
7296 {
7297
7299
7300
7301 float min_time = 1;
7302 float max_time = 3;
7303 float delay = Math.RandomFloat(min_time, max_time);
7304
7305 explode_timer.Run(delay, this, "DoAmmoExplosion");
7306 }
7307
7309 {
7310 Magazine magazine = Magazine.Cast(this);
7311 int pop_sounds_count = 6;
7312 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
7313
7314
7315 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
7316 string sound_name = pop_sounds[ sound_idx ];
7317 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
7318
7319
7320 magazine.ServerAddAmmoCount(-1);
7321
7322
7323 float min_temp_to_explode = 100;
7324
7325 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
7326 {
7328 }
7329 }
7330
7331
7332 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
7333 {
7334 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
7335
7336 const int CHANCE_DAMAGE_CARGO = 4;
7337 const int CHANCE_DAMAGE_ATTACHMENT = 1;
7338 const int CHANCE_DAMAGE_NOTHING = 2;
7339
7341 {
7342 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
7343 int chances;
7344 int rnd;
7345
7346 if (GetInventory().GetCargo())
7347 {
7348 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7349 rnd = Math.RandomInt(0,chances);
7350
7351 if (rnd < CHANCE_DAMAGE_CARGO)
7352 {
7354 }
7355 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
7356 {
7358 }
7359 }
7360 else
7361 {
7362 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7363 rnd = Math.RandomInt(0,chances);
7364
7365 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
7366 {
7368 }
7369 }
7370 }
7371 }
7372
7374 {
7375 CargoBase cargo = GetInventory().GetCargo();
7376 if (cargo)
7377 {
7379 if (item_count > 0)
7380 {
7381 int random_pick = Math.RandomInt(0, item_count);
7383 if (!item.IsExplosive())
7384 {
7385 item.AddHealth("","",damage);
7386 return true;
7387 }
7388 }
7389 }
7390 return false;
7391 }
7392
7394 {
7395 GameInventory inventory = GetInventory();
7397 if (attachment_count > 0)
7398 {
7399 int random_pick = Math.RandomInt(0, attachment_count);
7401 if (!attachment.IsExplosive())
7402 {
7403 attachment.AddHealth("","",damage);
7404 return true;
7405 }
7406 }
7407 return false;
7408 }
7409
7411 {
7413 }
7414
7416 {
7418 return GetInventory().CanRemoveEntity();
7419
7420 return false;
7421 }
7422
7424 {
7425
7427 return false;
7428
7429
7431 return false;
7432
7433
7434
7436 if (delta == 0)
7437 return false;
7438
7439
7440 return true;
7441 }
7442
7444 {
7446 {
7447 if (ScriptInputUserData.CanStoreInputUserData())
7448 {
7449 ScriptInputUserData ctx = new ScriptInputUserData;
7454 ctx.
Write(destination_entity);
7458 }
7459 }
7460 else if (!
g_Game.IsMultiplayer())
7461 {
7463 }
7464 }
7465
7467 {
7468 float split_quantity_new;
7472 InventoryLocation loc = new InventoryLocation;
7473
7474 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7475 {
7477 split_quantity_new = stack_max;
7478 else
7480
7482 {
7483 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7484 if (new_item)
7485 {
7486 new_item.SetResultOfSplit(true);
7487 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7489 new_item.
SetQuantity(split_quantity_new,
false,
true);
7490 }
7491 }
7492 }
7493 else if (destination_entity && slot_id == -1)
7494 {
7495 if (quantity > stack_max)
7496 split_quantity_new = stack_max;
7497 else
7498 split_quantity_new = quantity;
7499
7501 {
7502 GameInventory destinationInventory = destination_entity.GetInventory();
7504 {
7507 }
7508
7509 if (new_item)
7510 {
7511 new_item.SetResultOfSplit(true);
7512 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7514 new_item.
SetQuantity(split_quantity_new,
false,
true);
7515 }
7516 }
7517 }
7518 else
7519 {
7520 if (stack_max != 0)
7521 {
7523 {
7525 }
7526
7527 if (split_quantity_new == 0)
7528 {
7529 if (!
g_Game.IsMultiplayer())
7530 player.PhysicalPredictiveDropItem(this);
7531 else
7532 player.ServerDropEntity(this);
7533 return;
7534 }
7535
7537 {
7539
7540 if (new_item)
7541 {
7542 new_item.SetResultOfSplit(true);
7543 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7546 new_item.PlaceOnSurface();
7547 }
7548 }
7549 }
7550 }
7551 }
7552
7554 {
7555 float split_quantity_new;
7559 InventoryLocation loc = new InventoryLocation;
7560
7561 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7562 {
7564 split_quantity_new = stack_max;
7565 else
7567
7569 {
7570 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7571 if (new_item)
7572 {
7573 new_item.SetResultOfSplit(true);
7574 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7576 new_item.
SetQuantity(split_quantity_new,
false,
true);
7577 }
7578 }
7579 }
7580 else if (destination_entity && slot_id == -1)
7581 {
7582 if (quantity > stack_max)
7583 split_quantity_new = stack_max;
7584 else
7585 split_quantity_new = quantity;
7586
7588 {
7589 GameInventory destinationInventory = destination_entity.GetInventory();
7591 {
7594 }
7595
7596 if (new_item)
7597 {
7598 new_item.SetResultOfSplit(true);
7599 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7601 new_item.
SetQuantity(split_quantity_new,
false,
true);
7602 }
7603 }
7604 }
7605 else
7606 {
7607 if (stack_max != 0)
7608 {
7610 {
7612 }
7613
7615 {
7617
7618 if (new_item)
7619 {
7620 new_item.SetResultOfSplit(true);
7621 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7624 new_item.PlaceOnSurface();
7625 }
7626 }
7627 }
7628 }
7629 }
7630
7632 {
7634 {
7635 if (ScriptInputUserData.CanStoreInputUserData())
7636 {
7637 ScriptInputUserData ctx = new ScriptInputUserData;
7642 dst.WriteToContext(ctx);
7644 }
7645 }
7646 else if (!
g_Game.IsMultiplayer())
7647 {
7649 }
7650 }
7651
7653 {
7655 {
7656 if (ScriptInputUserData.CanStoreInputUserData())
7657 {
7658 ScriptInputUserData ctx = new ScriptInputUserData;
7663 ctx.
Write(destination_entity);
7669 }
7670 }
7671 else if (!
g_Game.IsMultiplayer())
7672 {
7674 }
7675 }
7676
7678 {
7680 }
7681
7683 {
7685 float split_quantity_new;
7687 if (dst.IsValid())
7688 {
7689 int slot_id = dst.GetSlot();
7691
7692 if (quantity > stack_max)
7693 split_quantity_new = stack_max;
7694 else
7695 split_quantity_new = quantity;
7696
7698 {
7700
7701 if (new_item)
7702 {
7703 new_item.SetResultOfSplit(true);
7704 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7706 new_item.
SetQuantity(split_quantity_new,
false,
true);
7707 }
7708
7709 return new_item;
7710 }
7711 }
7712
7713 return null;
7714 }
7715
7717 {
7719 float split_quantity_new;
7721 if (destination_entity)
7722 {
7724 if (quantity > stackable)
7725 split_quantity_new = stackable;
7726 else
7727 split_quantity_new = quantity;
7728
7730 {
7731 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
7732 if (new_item)
7733 {
7734 new_item.SetResultOfSplit(true);
7735 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7737 new_item.
SetQuantity(split_quantity_new,
false,
true);
7738 }
7739 }
7740 }
7741 }
7742
7744 {
7746 {
7747 if (ScriptInputUserData.CanStoreInputUserData())
7748 {
7749 ScriptInputUserData ctx = new ScriptInputUserData;
7754 ItemBase destination_entity =
this;
7755 ctx.
Write(destination_entity);
7759 }
7760 }
7761 else if (!
g_Game.IsMultiplayer())
7762 {
7764 }
7765 }
7766
7768 {
7770 float split_quantity_new;
7772 if (player)
7773 {
7775 if (quantity > stackable)
7776 split_quantity_new = stackable;
7777 else
7778 split_quantity_new = quantity;
7779
7781 {
7782 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
7783 new_item =
ItemBase.Cast(in_hands);
7784 if (new_item)
7785 {
7786 new_item.SetResultOfSplit(true);
7787 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7789 new_item.SetQuantity(split_quantity_new, false, true);
7790 }
7791 }
7792 }
7793 }
7794
7796 {
7798 float split_quantity_new = Math.Floor(quantity * 0.5);
7799
7801 return;
7802
7804
7805 if (new_item)
7806 {
7807 if (new_item.GetQuantityMax() < split_quantity_new)
7808 {
7809 split_quantity_new = new_item.GetQuantityMax();
7810 }
7811
7812 new_item.SetResultOfSplit(true);
7813 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7814
7816 {
7819 }
7820 else
7821 {
7823 new_item.
SetQuantity(split_quantity_new,
false,
true);
7824 }
7825 }
7826 }
7827
7829 {
7831 float split_quantity_new = Math.Floor(quantity / 2);
7832
7834 return;
7835
7836 InventoryLocation invloc = new InventoryLocation;
7838
7840 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
7841
7842 if (new_item)
7843 {
7844 if (new_item.GetQuantityMax() < split_quantity_new)
7845 {
7846 split_quantity_new = new_item.GetQuantityMax();
7847 }
7849 {
7852 }
7853 else if (split_quantity_new > 1)
7854 {
7856 new_item.
SetQuantity(split_quantity_new,
false,
true);
7857 }
7858 }
7859 }
7860
7863 {
7864 SetWeightDirty();
7866
7867 if (parent)
7868 parent.OnAttachmentQuantityChangedEx(this, delta);
7869
7871 {
7873 {
7875 }
7877 {
7878 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
7880 }
7881 }
7882 }
7883
7886 {
7887
7888 }
7889
7892 {
7894 }
7895
7897 {
7898 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
7899
7901 {
7902 if (newLevel == GameConstants.STATE_RUINED)
7903 {
7905 EntityAI parent = GetHierarchyParent();
7906 if (parent && parent.IsFireplace())
7907 {
7908 CargoBase cargo = GetInventory().GetCargo();
7909 if (cargo)
7910 {
7912 {
7914 }
7915 }
7916 }
7917 }
7918
7920 {
7921
7923 return;
7924 }
7925
7926 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
7927 {
7929 }
7930 }
7931 }
7932
7933
7935 {
7936 super.OnRightClick();
7937
7939 {
7941 {
7942 if (ScriptInputUserData.CanStoreInputUserData())
7943 {
7944 EntityAI root = GetHierarchyRoot();
7945 Man playerOwner = GetHierarchyRootPlayer();
7946 InventoryLocation dst = new InventoryLocation;
7947
7948
7949 if (!playerOwner && root && root == this)
7950 {
7952 }
7953 else
7954 {
7955
7956 GetInventory().GetCurrentInventoryLocation(dst);
7958 {
7959 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7961 {
7963 }
7964 else
7965 {
7967
7968
7969 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
7970 {
7972 }
7973 else
7974 {
7975 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
7976 }
7977 }
7978 }
7979 }
7980
7981 ScriptInputUserData ctx = new ScriptInputUserData;
7989 }
7990 }
7991 else if (!
g_Game.IsMultiplayer())
7992 {
7994 }
7995 }
7996 }
7997
7999 {
8000 if (root)
8001 {
8002 vector m4[4];
8003 root.GetTransform(m4);
8004 dst.SetGround(this, m4);
8005 }
8006 else
8007 {
8008 GetInventory().GetCurrentInventoryLocation(dst);
8009 }
8010 }
8011
8012 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
8013 {
8014
8015 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
8016 return false;
8017
8018 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
8019 return false;
8020
8021
8023 return false;
8024
8025
8026 Magazine mag = Magazine.Cast(this);
8027 if (mag)
8028 {
8029 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
8030 return false;
8031
8032 if (stack_max_limit)
8033 {
8034 Magazine other_mag = Magazine.Cast(other_item);
8035 if (other_item)
8036 {
8037 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
8038 return false;
8039 }
8040
8041 }
8042 }
8043 else
8044 {
8045
8047 return false;
8048
8050 return false;
8051 }
8052
8053 PlayerBase player = null;
8054 if (CastTo(player, GetHierarchyRootPlayer()))
8055 {
8056 if (player.GetInventory().HasAttachment(this))
8057 return false;
8058
8059 if (player.IsItemsToDelete())
8060 return false;
8061 }
8062
8063 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
8064 return false;
8065
8066 int slotID;
8068 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
8069 return false;
8070
8071 return true;
8072 }
8073
8075 {
8077 }
8078
8080 {
8081 return m_IsResultOfSplit;
8082 }
8083
8085 {
8086 m_IsResultOfSplit = value;
8087 }
8088
8090 {
8092 }
8093
8095 {
8096 float other_item_quantity = other_item.GetQuantity();
8097 float this_free_space;
8098
8100
8102
8103 if (other_item_quantity > this_free_space)
8104 {
8105 return this_free_space;
8106 }
8107 else
8108 {
8109 return other_item_quantity;
8110 }
8111 }
8112
8114 {
8116 }
8117
8119 {
8121 return;
8122
8123 if (!IsMagazine() && other_item)
8124 {
8126 if (quantity_used != 0)
8127 {
8128 float hp1 = GetHealth01("","");
8129 float hp2 = other_item.GetHealth01("","");
8130 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
8131 hpResult = hpResult / (
GetQuantity() + quantity_used);
8132
8133 hpResult *= GetMaxHealth();
8134 Math.Round(hpResult);
8135 SetHealth("", "Health", hpResult);
8136
8138 other_item.AddQuantity(-quantity_used);
8139 }
8140 }
8142 }
8143
8145 {
8146 #ifdef SERVER
8147 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
8148 GetHierarchyParent().IncreaseLifetimeUp();
8149 #endif
8150 };
8151
8153 {
8154 PlayerBase p = PlayerBase.Cast(player);
8155
8156 array<int> recipesIds = p.m_Recipes;
8157 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8158 if (moduleRecipesManager)
8159 {
8160 EntityAI itemInHands = player.GetEntityInHands();
8161 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
8162 }
8163
8164 for (int i = 0;i < recipesIds.Count(); i++)
8165 {
8166 int key = recipesIds.Get(i);
8167 string recipeName = moduleRecipesManager.GetRecipeName(key);
8169 }
8170 }
8171
8172
8173 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
8174 {
8175 super.GetDebugActions(outputList);
8176
8177
8183
8184
8189
8194
8195
8199
8200
8202 {
8206 }
8207
8210
8211
8215
8217
8218 InventoryLocation loc = new InventoryLocation();
8219 GetInventory().GetCurrentInventoryLocation(loc);
8221 {
8222 if (Gizmo_IsSupported())
8225 }
8226
8228 }
8229
8230
8231
8232
8234 {
8235 super.OnAction(action_id, player, ctx);
8236
8238 {
8239 switch (action_id)
8240 {
8244 return true;
8248 return true;
8249 }
8250 }
8251
8253 {
8254 switch (action_id)
8255 {
8257 Delete();
8258 return true;
8259 }
8260 }
8261
8262 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
8263 {
8264 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8265 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
8266 PlayerBase p = PlayerBase.Cast(player);
8267 if (
EActions.RECIPES_RANGE_START < 1000)
8268 {
8269 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
8270 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
8271 }
8272 }
8273 #ifndef SERVER
8274 else if (action_id ==
EActions.WATCH_PLAYER)
8275 {
8276 PluginDeveloper.SetDeveloperItemClientEx(player);
8277 }
8278 #endif
8280 {
8281 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
8282 {
8283 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
8284 OnDebugButtonPressServer(id + 1);
8285 }
8286
8287 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
8288 {
8289 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
8291 }
8292
8293 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
8294 {
8295 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
8297 }
8298
8299 else if (action_id ==
EActions.ADD_QUANTITY)
8300 {
8301 if (IsMagazine())
8302 {
8303 Magazine mag = Magazine.Cast(this);
8304 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
8305 }
8306 else
8307 {
8309 }
8310
8311 if (m_EM)
8312 {
8313 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
8314 }
8315
8316 }
8317
8318 else if (action_id ==
EActions.REMOVE_QUANTITY)
8319 {
8320 if (IsMagazine())
8321 {
8322 Magazine mag2 = Magazine.Cast(this);
8323 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
8324 }
8325 else
8326 {
8328 }
8329 if (m_EM)
8330 {
8331 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
8332 }
8333
8334 }
8335
8336 else if (action_id ==
EActions.SET_QUANTITY_0)
8337 {
8339
8340 if (m_EM)
8341 {
8342 m_EM.SetEnergy(0);
8343 }
8344 }
8345
8346 else if (action_id ==
EActions.SET_MAX_QUANTITY)
8347 {
8349
8350 if (m_EM)
8351 {
8352 m_EM.SetEnergy(m_EM.GetEnergyMax());
8353 }
8354 }
8355
8356 else if (action_id ==
EActions.ADD_HEALTH)
8357 {
8358 AddHealth("","",GetMaxHealth("","Health")/5);
8359 }
8360 else if (action_id ==
EActions.REMOVE_HEALTH)
8361 {
8362 AddHealth("","",-GetMaxHealth("","Health")/5);
8363 }
8364 else if (action_id ==
EActions.DESTROY_HEALTH)
8365 {
8366 SetHealth01("","",0);
8367 }
8368 else if (action_id ==
EActions.WATCH_ITEM)
8369 {
8371 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
8372 #ifdef DEVELOPER
8373 SetDebugDeveloper_item(this);
8374 #endif
8375 }
8376
8377 else if (action_id ==
EActions.ADD_TEMPERATURE)
8378 {
8379 AddTemperature(20);
8380
8381 }
8382
8383 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
8384 {
8385 AddTemperature(-20);
8386
8387 }
8388
8389 else if (action_id ==
EActions.FLIP_FROZEN)
8390 {
8391 SetFrozen(!GetIsFrozen());
8392
8393 }
8394
8395 else if (action_id ==
EActions.ADD_WETNESS)
8396 {
8398
8399 }
8400
8401 else if (action_id ==
EActions.REMOVE_WETNESS)
8402 {
8404
8405 }
8406
8407 else if (action_id ==
EActions.LIQUIDTYPE_UP)
8408 {
8411
8412
8413 }
8414
8415 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
8416 {
8419 }
8420
8421 else if (action_id ==
EActions.MAKE_SPECIAL)
8422 {
8423 auto debugParams = DebugSpawnParams.WithPlayer(player);
8424 OnDebugSpawnEx(debugParams);
8425 }
8426
8427 }
8428
8429
8430 return false;
8431 }
8432
8433
8434
8435
8439
8442
8443
8444
8446 {
8447 return false;
8448 }
8449
8450
8452 {
8453 return true;
8454 }
8455
8456
8458 {
8459 return true;
8460 }
8461
8462
8463
8465 {
8466 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
8467 return g_Game.ConfigIsExisting(config_path);
8468 }
8469
8472 {
8473 return null;
8474 }
8475
8477 {
8478 return false;
8479 }
8480
8482 {
8483 return false;
8484 }
8485
8489
8490
8492 {
8493 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8494 return module_repairing.CanRepair(this, item_repair_kit);
8495 }
8496
8497
8498 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
8499 {
8500 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8501 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
8502 }
8503
8504
8506 {
8507
8508
8509
8510
8511
8512
8513
8514
8515 return 1;
8516 }
8517
8518
8519
8521 {
8523 }
8524
8525
8526
8528 {
8530 }
8531
8532
8541 {
8542 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8543
8544 if (player)
8545 {
8546 player.MessageStatus(text);
8547 }
8548 }
8549
8550
8559 {
8560 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8561
8562 if (player)
8563 {
8564 player.MessageAction(text);
8565 }
8566 }
8567
8568
8577 {
8578 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8579
8580 if (player)
8581 {
8582 player.MessageFriendly(text);
8583 }
8584 }
8585
8586
8595 {
8596 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8597
8598 if (player)
8599 {
8600 player.MessageImportant(text);
8601 }
8602 }
8603
8605 {
8606 return true;
8607 }
8608
8609
8610 override bool KindOf(
string tag)
8611 {
8612 bool found = false;
8613 string item_name = this.
GetType();
8615 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
8616
8617 int array_size = item_tag_array.Count();
8618 for (int i = 0; i < array_size; i++)
8619 {
8620 if (item_tag_array.Get(i) == tag)
8621 {
8622 found = true;
8623 break;
8624 }
8625 }
8626 return found;
8627 }
8628
8629
8631 {
8632
8633 super.OnRPC(sender, rpc_type,ctx);
8634
8635
8636 switch (rpc_type)
8637 {
8638 #ifndef SERVER
8639 case ERPCs.RPC_SOUND_LOCK_ATTACH:
8640 Param2<bool, string> p = new Param2<bool, string>(false, "");
8641
8643 return;
8644
8645 bool play = p.param1;
8646 string soundSet = p.param2;
8647
8648 if (play)
8649 {
8651 {
8653 {
8655 }
8656 }
8657 else
8658 {
8660 }
8661 }
8662 else
8663 {
8665 }
8666
8667 break;
8668 #endif
8669
8670 }
8671
8673 {
8675 }
8676 }
8677
8678
8679
8680
8682 {
8683 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8684 return plugin.GetID(
name);
8685 }
8686
8688 {
8689 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8690 return plugin.GetName(id);
8691 }
8692
8695 {
8696
8697
8698 int varFlags;
8699 if (!ctx.
Read(varFlags))
8700 return;
8701
8702 if (varFlags & ItemVariableFlags.FLOAT)
8703 {
8705 }
8706 }
8707
8709 {
8710
8711 super.SerializeNumericalVars(floats_out);
8712
8713
8714
8716 {
8718 }
8719
8721 {
8723 }
8724
8726 {
8728 }
8729
8731 {
8736 }
8737
8739 {
8741 }
8742 }
8743
8745 {
8746
8747 super.DeSerializeNumericalVars(floats);
8748
8749
8750 int index = 0;
8751 int mask = Math.Round(floats.Get(index));
8752
8753 index++;
8754
8756 {
8758 {
8760 }
8761 else
8762 {
8763 float quantity = floats.Get(index);
8765 }
8766 index++;
8767 }
8768
8770 {
8771 float wet = floats.Get(index);
8773 index++;
8774 }
8775
8777 {
8778 int liquidtype = Math.Round(floats.Get(index));
8780 index++;
8781 }
8782
8784 {
8786 index++;
8788 index++;
8790 index++;
8792 index++;
8793 }
8794
8796 {
8797 int cleanness = Math.Round(floats.Get(index));
8799 index++;
8800 }
8801 }
8802
8804 {
8805 super.WriteVarsToCTX(ctx);
8806
8807
8809 {
8811 }
8812
8814 {
8816 }
8817
8819 {
8821 }
8822
8824 {
8825 int r,g,b,a;
8831 }
8832
8834 {
8836 }
8837 }
8838
8840 {
8841 if (!super.ReadVarsFromCTX(ctx,version))
8842 return false;
8843
8844 int intValue;
8845 float value;
8846
8847 if (version < 140)
8848 {
8849 if (!ctx.
Read(intValue))
8850 return false;
8851
8852 m_VariablesMask = intValue;
8853 }
8854
8856 {
8857 if (!ctx.
Read(value))
8858 return false;
8859
8861 {
8863 }
8864 else
8865 {
8867 }
8868 }
8869
8870 if (version < 140)
8871 {
8873 {
8874 if (!ctx.
Read(value))
8875 return false;
8876 SetTemperatureDirect(value);
8877 }
8878 }
8879
8881 {
8882 if (!ctx.
Read(value))
8883 return false;
8885 }
8886
8888 {
8889 if (!ctx.
Read(intValue))
8890 return false;
8892 }
8893
8895 {
8896 int r,g,b,a;
8898 return false;
8900 return false;
8902 return false;
8904 return false;
8905
8907 }
8908
8910 {
8911 if (!ctx.
Read(intValue))
8912 return false;
8914 }
8915
8916 if (version >= 138 && version < 140)
8917 {
8919 {
8920 if (!ctx.
Read(intValue))
8921 return false;
8922 SetFrozen(intValue);
8923 }
8924 }
8925
8926 return true;
8927 }
8928
8929
8931 {
8934 {
8936 }
8937
8938 if (!super.OnStoreLoad(ctx, version))
8939 {
8941 return false;
8942 }
8943
8944 if (version >= 114)
8945 {
8946 bool hasQuickBarIndexSaved;
8947
8948 if (!ctx.
Read(hasQuickBarIndexSaved))
8949 {
8951 return false;
8952 }
8953
8954 if (hasQuickBarIndexSaved)
8955 {
8956 int itmQBIndex;
8957
8958
8959 if (!ctx.
Read(itmQBIndex))
8960 {
8962 return false;
8963 }
8964
8965 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
8966 if (itmQBIndex != -1 && parentPlayer)
8967 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
8968 }
8969 }
8970 else
8971 {
8972
8973 PlayerBase player;
8974 int itemQBIndex;
8975 if (version ==
int.
MAX)
8976 {
8977 if (!ctx.
Read(itemQBIndex))
8978 {
8980 return false;
8981 }
8982 }
8983 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
8984 {
8985
8986 if (!ctx.
Read(itemQBIndex))
8987 {
8989 return false;
8990 }
8991 if (itemQBIndex != -1 && player)
8992 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
8993 }
8994 }
8995
8996 if (version < 140)
8997 {
8998
8999 if (!LoadVariables(ctx, version))
9000 {
9002 return false;
9003 }
9004 }
9005
9006
9008 {
9010 return false;
9011 }
9012 if (version >= 132)
9013 {
9015 if (raib)
9016 {
9018 {
9020 return false;
9021 }
9022 }
9023 }
9024
9026 return true;
9027 }
9028
9029
9030
9032 {
9033 super.OnStoreSave(ctx);
9034
9035 PlayerBase player;
9036 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
9037 {
9039
9040 int itemQBIndex = -1;
9041 itemQBIndex = player.FindQuickBarEntityIndex(this);
9042 ctx.
Write(itemQBIndex);
9043 }
9044 else
9045 {
9047 }
9048
9050
9052 if (raib)
9053 {
9055 }
9056 }
9057
9058
9060 {
9061 super.AfterStoreLoad();
9062
9064 {
9066 }
9067
9069 {
9072 }
9073 }
9074
9076 {
9077 super.EEOnAfterLoad();
9078
9080 {
9082 }
9083
9086 }
9087
9089 {
9090 return false;
9091 }
9092
9093
9094
9096 {
9098 {
9099 #ifdef PLATFORM_CONSOLE
9100
9102 {
9104 if (menu)
9105 {
9107 }
9108 }
9109 #endif
9110 }
9111
9113 {
9116 }
9117
9119 {
9120 SetWeightDirty();
9122 }
9124 {
9127 }
9128
9130 {
9133
9136 }
9138 {
9142 }
9143
9144 super.OnVariablesSynchronized();
9145 }
9146
9147
9148
9150 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
9151 {
9152 if (!IsServerCheck(allow_client))
9153 return false;
9154
9156 return false;
9157
9160
9161 if (value <= (min + 0.001))
9162 value = min;
9163
9164 if (value == min)
9165 {
9166 if (destroy_config)
9167 {
9168 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
9169 if (dstr)
9170 {
9172 this.Delete();
9173 return true;
9174 }
9175 }
9176 else if (destroy_forced)
9177 {
9179 this.Delete();
9180 return true;
9181 }
9182
9184 }
9185
9188
9190 {
9191 EntityAI parent = GetHierarchyRoot();
9192 InventoryLocation iLoc = new InventoryLocation();
9193 GetInventory().GetCurrentInventoryLocation(iLoc);
9195 {
9196 int iLocSlot = iLoc.
GetSlot();
9198 {
9200 }
9202 {
9204 }
9205 }
9206 }
9207
9209 {
9211
9212 if (delta)
9214 }
9215
9217
9218 return false;
9219 }
9220
9221
9223 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9224 {
9226 }
9227
9229 {
9232 }
9233
9235 {
9238 }
9239
9241 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9242 {
9243 float value_clamped = Math.Clamp(value, 0, 1);
9245 SetQuantity(result, destroy_config, destroy_forced);
9246 }
9247
9248
9251 {
9253 }
9254
9256 {
9258 }
9259
9260
9261
9262
9263
9264
9265
9266
9267
9268
9270 {
9271 int slot = -1;
9272 GameInventory inventory = GetInventory();
9273 if (inventory)
9274 {
9275 InventoryLocation il = new InventoryLocation;
9278 }
9279
9281 }
9282
9284 {
9285 float quantity_max = 0;
9286
9288 {
9289 if (attSlotID != -1)
9290 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
9291
9292 if (quantity_max <= 0)
9294 }
9295
9296 if (quantity_max <= 0)
9298
9299 return quantity_max;
9300 }
9301
9303 {
9305 }
9306
9308 {
9310 }
9311
9312
9314 {
9316 }
9317
9319 {
9321 }
9322
9324 {
9326 }
9327
9328
9330 {
9331
9332 float weightEx = GetWeightEx();
9333 float special = GetInventoryAndCargoWeight();
9334 return weightEx - special;
9335 }
9336
9337
9339 {
9341 }
9342
9344 {
9346 {
9347 #ifdef DEVELOPER
9348 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9349 {
9350 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
9352 }
9353 #endif
9354
9356 }
9357 else if (HasEnergyManager())
9358 {
9359 #ifdef DEVELOPER
9360 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9361 {
9362 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
9363 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
9364 }
9365 #endif
9366 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
9367 }
9368 else
9369 {
9370 #ifdef DEVELOPER
9371 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9372 {
9373 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
9374 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
9375 }
9376 #endif
9377 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
9378 }
9379 }
9380
9383 {
9384 int item_count = 0;
9386
9387 GameInventory inventory = GetInventory();
9388 CargoBase cargo = inventory.
GetCargo();
9389 if (cargo != NULL)
9390 {
9392 }
9393
9395 for (int i = 0; i < nAttachments; ++i)
9396 {
9398 if (item)
9399 item_count += item.GetNumberOfItems();
9400 }
9401 return item_count;
9402 }
9403
9406 {
9407 float weight = 0;
9408 float wetness = 1;
9409 if (include_wetness)
9412 {
9413 weight = wetness * m_ConfigWeight;
9414 }
9416 {
9417 weight = 1;
9418 }
9419 return weight;
9420 }
9421
9422
9423
9425 {
9426 GameInventory inventory = GetInventory();
9427 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
9428 {
9429 array<EntityAI> items = new array<EntityAI>;
9431 for (int i = 0; i < items.Count(); ++i)
9432 {
9434 if (item)
9435 {
9436 g_Game.ObjectDelete(item);
9437 }
9438 }
9439 }
9440 }
9441
9442
9443
9444
9446 {
9447 float energy = 0;
9448 if (HasEnergyManager())
9449 {
9450 energy = GetCompEM().GetEnergy();
9451 }
9452 return energy;
9453 }
9454
9455
9457 {
9458 super.OnEnergyConsumed();
9459
9461 }
9462
9464 {
9465 super.OnEnergyAdded();
9466
9468 }
9469
9470
9472 {
9473 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
9474 {
9476 {
9477 float energy_0to1 = GetCompEM().GetEnergy0To1();
9479 }
9480 }
9481 }
9482
9483
9485 {
9486 return ConfigGetFloat("heatIsolation");
9487 }
9488
9490 {
9492 }
9493
9495 {
9496 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
9497 if (
g_Game.ConfigIsExisting(paramPath))
9498 return g_Game.ConfigGetFloat(paramPath);
9499
9500 return 0.0;
9501 }
9502
9504 {
9505 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
9506 if (
g_Game.ConfigIsExisting(paramPath))
9507 return g_Game.ConfigGetFloat(paramPath);
9508
9509 return 0.0;
9510 }
9511
9512 override void SetWet(
float value,
bool allow_client =
false)
9513 {
9514 if (!IsServerCheck(allow_client))
9515 return;
9516
9519
9521
9522 m_VarWet = Math.Clamp(value, min, max);
9523
9525 {
9528 }
9529 }
9530
9531 override void AddWet(
float value)
9532 {
9534 }
9535
9537 {
9539 }
9540
9542 {
9544 }
9545
9547 {
9549 }
9550
9552 {
9554 }
9555
9557 {
9559 }
9560
9562 {
9565 if (newLevel != oldLevel)
9566 {
9568 }
9569 }
9570
9572 {
9573 SetWeightDirty();
9574 }
9575
9577 {
9578 return GetWetLevelInternal(
m_VarWet);
9579 }
9580
9581
9582
9584 {
9586 }
9587
9589 {
9591 }
9592
9594 {
9596 }
9597
9599 {
9601 }
9602
9603
9604
9606 {
9607 if (ConfigIsExisting("itemModelLength"))
9608 {
9609 return ConfigGetFloat("itemModelLength");
9610 }
9611 return 0;
9612 }
9613
9615 {
9616 if (ConfigIsExisting("itemAttachOffset"))
9617 {
9618 return ConfigGetFloat("itemAttachOffset");
9619 }
9620 return 0;
9621 }
9622
9623 override void SetCleanness(
int value,
bool allow_client =
false)
9624 {
9625 if (!IsServerCheck(allow_client))
9626 return;
9627
9629
9631
9634 }
9635
9637 {
9639 }
9640
9642 {
9643 return true;
9644 }
9645
9646
9647
9648
9650 {
9652 }
9653
9655 {
9657 }
9658
9659
9660
9661
9662 override void SetColor(
int r,
int g,
int b,
int a)
9663 {
9669 }
9671 override void GetColor(out
int r,out
int g,out
int b,out
int a)
9672 {
9677 }
9678
9680 {
9682 }
9683
9686 {
9687 int r,g,b,a;
9689 r = r/255;
9690 g = g/255;
9691 b = b/255;
9692 a = a/255;
9693 return MiscGameplayFunctions.GetColorString(r, g, b, a);
9694 }
9695
9696
9697
9698 override void SetLiquidType(
int value,
bool allow_client =
false)
9699 {
9700 if (!IsServerCheck(allow_client))
9701 return;
9702
9707 }
9708
9710 {
9711 return ConfigGetInt("varLiquidTypeInit");
9712 }
9713
9715 {
9717 }
9718
9720 {
9722 SetFrozen(false);
9723 }
9724
9727 {
9728 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9729 }
9730
9731
9734 {
9735 PlayerBase nplayer;
9736 if (PlayerBase.CastTo(nplayer, player))
9737 {
9739 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9740 }
9741 }
9742
9743
9746 {
9747 PlayerBase nplayer;
9748 if (PlayerBase.CastTo(nplayer,player))
9749 {
9750 nplayer.SetEnableQuickBarEntityShortcut(this, false);
9751 }
9752
9753 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
9754
9755 if (HasEnergyManager())
9756 {
9757 GetCompEM().UpdatePlugState();
9758 }
9759 }
9760
9761
9763 {
9764 super.OnPlacementStarted(player);
9765
9767 }
9768
9769 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
9770 {
9772 {
9773 m_AdminLog.OnPlacementComplete(player,
this);
9774 }
9775
9776 super.OnPlacementComplete(player, position, orientation);
9777 }
9778
9779
9780
9781
9782
9784 {
9786 {
9787 return true;
9788 }
9789 else
9790 {
9791 return false;
9792 }
9793 }
9794
9795
9797 {
9799 {
9801 }
9802 }
9803
9804
9806 {
9808 }
9809
9811 {
9813 }
9814
9815 override void InsertAgent(
int agent,
float count = 1)
9816 {
9817 if (count < 1)
9818 return;
9819
9821 }
9822
9825 {
9827 }
9828
9829
9831 {
9833 }
9834
9835
9836
9837
9838
9839
9840
9841
9842
9843
9844
9845
9846
9847
9848
9849
9850
9851
9852
9853
9854
9855
9856
9857
9858
9859
9860
9861
9862
9863
9864
9865
9866
9867
9868
9869
9870
9871
9872
9873
9874
9875
9877 {
9879 return false;
9880 return true;
9881 }
9882
9884 {
9885
9887 }
9888
9889
9892 {
9893 super.CheckForRoofLimited(timeTresholdMS);
9894
9895 float time =
g_Game.GetTime();
9896 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
9897 {
9898 m_PreviousRoofTestTime = time;
9899 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
9900 }
9901 }
9902
9903
9905 {
9907 {
9908 return 0;
9909 }
9910
9911 if (GetInventory().GetAttachmentSlotsCount() != 0)
9912 {
9913 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
9914 if (filter)
9915 return filter.GetProtectionLevel(type, false, system);
9916 else
9917 return 0;
9918 }
9919
9920 string subclassPath, entryName;
9921
9922 switch (type)
9923 {
9925 entryName = "biological";
9926 break;
9928 entryName = "chemical";
9929 break;
9930 default:
9931 entryName = "biological";
9932 break;
9933 }
9934
9935 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
9936
9937 return g_Game.ConfigGetFloat(subclassPath + entryName);
9938 }
9939
9940
9941
9944 {
9945 if (!IsMagazine())
9947
9949 }
9950
9951
9952
9953
9954
9959 {
9960 return true;
9961 }
9962
9964 {
9966 }
9967
9968
9969
9970
9971
9973 {
9974 if (parent)
9975 {
9976 if (parent.IsInherited(DayZInfected))
9977 return true;
9978
9979 if (!parent.IsRuined())
9980 return true;
9981 }
9982
9983 return true;
9984 }
9985
9987 {
9988 if (!super.CanPutAsAttachment(parent))
9989 {
9990 return false;
9991 }
9992
9993 if (!IsRuined() && !parent.IsRuined())
9994 {
9995 return true;
9996 }
9997
9998 return false;
9999 }
10000
10002 {
10003
10004
10005
10006
10007 return super.CanReceiveItemIntoCargo(item);
10008 }
10009
10011 {
10012
10013
10014
10015
10016 GameInventory attachmentInv = attachment.GetInventory();
10018 {
10019 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
10020 return false;
10021 }
10022
10023 InventoryLocation loc = new InventoryLocation();
10024 attachment.GetInventory().GetCurrentInventoryLocation(loc);
10025 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
10026 return false;
10027
10028 return super.CanReceiveAttachment(attachment, slotId);
10029 }
10030
10032 {
10033 if (!super.CanReleaseAttachment(attachment))
10034 return false;
10035
10036 return GetInventory().AreChildrenAccessible();
10037 }
10038
10039
10040
10041
10042
10043
10044
10045
10046
10047
10048
10049
10050
10051
10052
10053
10054
10055
10056
10057
10058
10060 {
10061 int id = muzzle_owner.GetMuzzleID();
10062 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
10063
10064 if (WPOF_array)
10065 {
10066 for (int i = 0; i < WPOF_array.Count(); i++)
10067 {
10068 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
10069
10070 if (WPOF)
10071 {
10072 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
10073 }
10074 }
10075 }
10076 }
10077
10078
10080 {
10081 int id = muzzle_owner.GetMuzzleID();
10083
10084 if (WPOBE_array)
10085 {
10086 for (int i = 0; i < WPOBE_array.Count(); i++)
10087 {
10088 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
10089
10090 if (WPOBE)
10091 {
10092 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10093 }
10094 }
10095 }
10096 }
10097
10098
10100 {
10101 int id = muzzle_owner.GetMuzzleID();
10102 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10103
10104 if (WPOOH_array)
10105 {
10106 for (int i = 0; i < WPOOH_array.Count(); i++)
10107 {
10108 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10109
10110 if (WPOOH)
10111 {
10112 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10113 }
10114 }
10115 }
10116 }
10117
10118
10120 {
10121 int id = muzzle_owner.GetMuzzleID();
10122 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10123
10124 if (WPOOH_array)
10125 {
10126 for (int i = 0; i < WPOOH_array.Count(); i++)
10127 {
10128 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10129
10130 if (WPOOH)
10131 {
10132 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10133 }
10134 }
10135 }
10136 }
10137
10138
10140 {
10141 int id = muzzle_owner.GetMuzzleID();
10142 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10143
10144 if (WPOOH_array)
10145 {
10146 for (int i = 0; i < WPOOH_array.Count(); i++)
10147 {
10148 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10149
10150 if (WPOOH)
10151 {
10152 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10153 }
10154 }
10155 }
10156 }
10157
10158
10159
10161 {
10163 {
10164 return true;
10165 }
10166
10167 return false;
10168 }
10169
10171 {
10173 {
10174 return true;
10175 }
10176
10177 return false;
10178 }
10179
10181 {
10183 {
10184 return true;
10185 }
10186
10187 return false;
10188 }
10189
10191 {
10192 return false;
10193 }
10194
10197 {
10198 return UATimeSpent.DEFAULT_DEPLOY;
10199 }
10200
10201
10202
10203
10205 {
10207 SetSynchDirty();
10208 }
10209
10211 {
10213 }
10214
10215
10217 {
10218 return false;
10219 }
10220
10223 {
10224 string att_type = "None";
10225
10226 if (ConfigIsExisting("soundAttType"))
10227 {
10228 att_type = ConfigGetString("soundAttType");
10229 }
10230
10232 }
10233
10235 {
10237 }
10238
10239
10240
10241
10242
10248
10250 {
10253
10255 }
10256
10257
10259 {
10261 return;
10262
10264
10267
10270
10271 SoundParameters params = new SoundParameters();
10275 }
10276
10277
10279 {
10281 {
10284
10285 SetSynchDirty();
10286
10289 }
10290 }
10291
10293 {
10295 }
10296
10297
10299 {
10301 return;
10302
10304 SetSynchDirty();
10305
10308 }
10309
10311 {
10314 }
10315
10317 {
10319 }
10320
10321 void OnApply(PlayerBase player);
10322
10324 {
10325 return 1.0;
10326 };
10327
10329 {
10331 }
10332
10334 {
10336 }
10337
10339
10341 {
10342 SetDynamicPhysicsLifeTime(0.01);
10344 }
10345
10347 {
10348 array<string> zone_names = new array<string>;
10349 GetDamageZones(zone_names);
10350 for (int i = 0; i < zone_names.Count(); i++)
10351 {
10352 SetHealthMax(zone_names.Get(i),"Health");
10353 }
10354 SetHealthMax("","Health");
10355 }
10356
10359 {
10360 float global_health = GetHealth01("","Health");
10361 array<string> zones = new array<string>;
10362 GetDamageZones(zones);
10363
10364 for (int i = 0; i < zones.Count(); i++)
10365 {
10366 SetHealth01(zones.Get(i),"Health",global_health);
10367 }
10368 }
10369
10372 {
10373 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
10374 }
10375
10377 {
10378 if (!hasRootAsPlayer)
10379 {
10380 if (refParentIB)
10381 {
10382
10383 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
10384 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
10385
10386 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
10387 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
10388
10391 }
10392 else
10393 {
10394
10397 }
10398 }
10399 }
10400
10402 {
10404 {
10405 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
10406 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
10407 {
10408 float heatPermCoef = 1.0;
10410 while (ent)
10411 {
10412 heatPermCoef *= ent.GetHeatPermeabilityCoef();
10413 ent = ent.GetHierarchyParent();
10414 }
10415
10416 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
10417 }
10418 }
10419 }
10420
10422 {
10423
10424 EntityAI parent = GetHierarchyParent();
10425 if (!parent)
10426 {
10427 hasParent = false;
10428 hasRootAsPlayer = false;
10429 }
10430 else
10431 {
10432 hasParent = true;
10433 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
10434 refParentIB =
ItemBase.Cast(parent);
10435 }
10436 }
10437
10438 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
10439 {
10440
10441 }
10442
10444 {
10445
10446 return false;
10447 }
10448
10450 {
10451
10452
10453 return false;
10454 }
10455
10457 {
10458
10459 return false;
10460 }
10461
10464 {
10465 return !GetIsFrozen() &&
IsOpen();
10466 }
10467
10469 {
10470 bool hasParent = false, hasRootAsPlayer = false;
10472
10473 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
10474 bool foodDecay =
g_Game.IsFoodDecayEnabled();
10475
10476 if (wwtu || foodDecay)
10477 {
10481
10482 if (processWetness || processTemperature || processDecay)
10483 {
10485
10486 if (processWetness)
10487 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
10488
10489 if (processTemperature)
10491
10492 if (processDecay)
10493 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
10494 }
10495 }
10496 }
10497
10500 {
10502 }
10503
10505 {
10508
10509 return super.GetTemperatureFreezeThreshold();
10510 }
10511
10513 {
10516
10517 return super.GetTemperatureThawThreshold();
10518 }
10519
10521 {
10524
10525 return super.GetItemOverheatThreshold();
10526 }
10527
10529 {
10531 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
10532
10533 return super.GetTemperatureFreezeTime();
10534 }
10535
10537 {
10539 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
10540
10541 return super.GetTemperatureThawTime();
10542 }
10543
10548
10550 {
10551 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
10552 }
10553
10555 {
10556 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
10557 }
10558
10561 {
10563 }
10564
10566 {
10568 }
10569
10571 {
10573 }
10574
10577 {
10578 return null;
10579 }
10580
10583 {
10584 return false;
10585 }
10586
10588 {
10590 {
10593 if (!trg)
10594 {
10596 explosive = this;
10597 }
10598
10599 explosive.PairRemote(trg);
10601
10602 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
10603 trg.SetPersistentPairID(persistentID);
10604 explosive.SetPersistentPairID(persistentID);
10605
10606 return true;
10607 }
10608 return false;
10609 }
10610
10613 {
10614 float ret = 1.0;
10617 ret *= GetHealth01();
10618
10619 return ret;
10620 }
10621
10622 #ifdef DEVELOPER
10623 override void SetDebugItem()
10624 {
10625 super.SetDebugItem();
10626 _itemBase = this;
10627 }
10628
10630 {
10631 string text = super.GetDebugText();
10632
10634 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
10635
10636 return text;
10637 }
10638 #endif
10639
10641 {
10642 return true;
10643 }
10644
10646
10648
10650 {
10653 }
10654
10655
10663
10679
10680 [
Obsolete(
"Use ItemSoundHandler instead")]
10683 {
10684 if (!
g_Game.IsDedicatedServer())
10685 {
10686 if (ConfigIsExisting("attachSoundSet"))
10687 {
10688 string cfg_path = "";
10689 string soundset = "";
10690 string type_name =
GetType();
10691
10694 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
10695 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
10696
10697 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
10698 {
10699 for (int i = 0; i < cfg_soundset_array.Count(); i++)
10700 {
10701 if (cfg_slot_array[i] == slot_type)
10702 {
10703 soundset = cfg_soundset_array[i];
10704 break;
10705 }
10706 }
10707 }
10708
10709 if (soundset != "")
10710 {
10711 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
10713 }
10714 }
10715 }
10716 }
10717
10719}
10720
10722{
10724 if (entity)
10725 {
10726 bool is_item = entity.IsInherited(
ItemBase);
10727 if (is_item && full_quantity)
10728 {
10731 }
10732 }
10733 else
10734 {
10736 return NULL;
10737 }
10738 return entity;
10739}
10740
10742{
10743 if (item)
10744 {
10745 if (health > 0)
10746 item.SetHealth("", "", health);
10747
10748 if (item.CanHaveTemperature())
10749 {
10751 if (item.CanFreeze())
10752 item.SetFrozen(false);
10753 }
10754
10755 if (item.HasEnergyManager())
10756 {
10757 if (quantity >= 0)
10758 {
10759 item.GetCompEM().SetEnergy0To1(quantity);
10760 }
10761 else
10762 {
10764 }
10765 }
10766 else if (item.IsMagazine())
10767 {
10768 Magazine mag = Magazine.Cast(item);
10769 if (quantity >= 0)
10770 {
10771 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
10772 }
10773 else
10774 {
10776 }
10777
10778 }
10779 else
10780 {
10781 if (quantity >= 0)
10782 {
10783 item.SetQuantityNormalized(quantity, false);
10784 }
10785 else
10786 {
10788 }
10789
10790 }
10791 }
10792}
10793
10794#ifdef DEVELOPER
10796#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.