5705{
5707 {
5708 return true;
5709 }
5710};
5711
5713{
5714
5715};
5716
5717
5718
5720{
5724
5726
5729
5730
5731
5732
5733
5742
5748
5753
5758
5779 protected bool m_IsResultOfSplit
5780
5782
5787
5788
5789
5791
5795
5796
5797
5799
5802
5803
5804
5810
5811
5819
5822
5823
5825
5826
5828
5829
5834
5835
5840
5842
5843
5845
5846
5848 {
5853
5854 if (!
g_Game.IsDedicatedServer())
5855 {
5857 {
5859
5861 {
5863 }
5864 }
5865
5868 }
5869
5870 m_OldLocation = null;
5871
5873 {
5875 }
5876
5877 if (ConfigIsExisting("headSelectionsToHide"))
5878 {
5881 }
5882
5884 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
5885 {
5887 }
5888
5890
5891 m_IsResultOfSplit = false;
5892
5894 }
5895
5897 {
5898 super.InitItemVariables();
5899
5905 m_Count = ConfigGetInt(
"count");
5906
5909
5914
5917
5922
5934
5938
5939
5942 if (ConfigIsExisting("canBeSplit"))
5943 {
5946 }
5947
5949 if (ConfigIsExisting("itemBehaviour"))
5951
5952
5955 RegisterNetSyncVariableInt("m_VarLiquidType");
5956 RegisterNetSyncVariableInt("m_Cleanness",0,1);
5957
5958 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
5959 RegisterNetSyncVariableFloat("m_ImpactSpeed");
5960 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
5961
5962 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
5963 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
5964 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
5965 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
5966
5967 RegisterNetSyncVariableBool("m_IsBeingPlaced");
5968 RegisterNetSyncVariableBool("m_IsTakeable");
5969 RegisterNetSyncVariableBool("m_IsHologram");
5970
5973 {
5976 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
5977 }
5978
5980
5982 if (ConfigIsExisting("temperaturePerQuantityWeight"))
5984
5986 }
5987
5989 {
5991 }
5992
5994 {
5997 {
6002 }
6003 }
6004
6005 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
6006 {
6008 {
6011 }
6012
6014 }
6015
6017 {
6023 }
6024
6026
6028 {
6030
6031 if (!action)
6032 {
6033 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
6034 return;
6035 }
6036
6038 if (!ai)
6039 {
6041 return;
6042 }
6043
6045 if (!action_array)
6046 {
6047 action_array = new array<ActionBase_Basic>;
6049 }
6050 if (LogManager.IsActionLogEnable())
6051 {
6052 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
6053 }
6054
6055 if (action_array.Find(action) != -1)
6056 {
6057 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
6058 }
6059 else
6060 {
6061 action_array.Insert(action);
6062 }
6063 }
6064
6066 {
6067 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6068 ActionBase action = player.GetActionManager().GetAction(actionName);
6071
6072 if (action_array)
6073 {
6074 action_array.RemoveItem(action);
6075 }
6076 }
6077
6078
6079
6081 {
6082 ActionOverrideData overrideData = new ActionOverrideData();
6086
6088 if (!actionMap)
6089 {
6092 }
6093
6094 actionMap.Insert(this.
Type(), overrideData);
6095
6096 }
6097
6099
6101
6102
6104 {
6107
6110
6111 string config_to_search = "CfgVehicles";
6112 string muzzle_owner_config;
6113
6115 {
6116 if (IsInherited(Weapon))
6117 config_to_search = "CfgWeapons";
6118
6119 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6120
6121 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
6122
6123 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
6124
6125 if (config_OnFire_subclass_count > 0)
6126 {
6127 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
6128
6129 for (int i = 0; i < config_OnFire_subclass_count; i++)
6130 {
6131 string particle_class = "";
6132 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
6133 string config_OnFire_entry = config_OnFire_class + particle_class;
6134 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
6135 WPOF_array.Insert(WPOF);
6136 }
6137
6138
6140 }
6141 }
6142
6144 {
6145 config_to_search = "CfgWeapons";
6146 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6147
6148 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
6149
6150 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
6151
6152 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
6153 {
6154 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
6155
6156 for (i = 0; i < config_OnBulletCasingEject_count; i++)
6157 {
6158 string particle_class2 = "";
6159 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
6160 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
6161 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
6162 WPOBE_array.Insert(WPOBE);
6163 }
6164
6165
6167 }
6168 }
6169 }
6170
6171
6173 {
6176
6178 {
6179 string config_to_search = "CfgVehicles";
6180
6181 if (IsInherited(Weapon))
6182 config_to_search = "CfgWeapons";
6183
6184 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6185 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
6186
6187 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
6188 {
6189
6191
6193 {
6195 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
6197 return;
6198 }
6199
6202
6203
6204
6205 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
6206 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
6207
6208 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
6209 {
6210 string particle_class = "";
6211 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
6212 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
6213 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
6214
6215 if (entry_type == CT_CLASS)
6216 {
6217 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
6218 WPOOH_array.Insert(WPOF);
6219 }
6220 }
6221
6222
6224 }
6225 }
6226 }
6227
6229 {
6231 }
6232
6234 {
6236 {
6238
6241
6244
6245 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6246 }
6247 }
6248
6250 {
6252 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6253
6255 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6256
6258 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6259
6261 {
6263 }
6264 }
6265
6267 {
6269 }
6270
6272 {
6275 else
6277
6279 {
6282 }
6283 else
6284 {
6287
6290 }
6291
6293 }
6294
6296 {
6298 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6299 }
6300
6302 {
6304 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6306 }
6307
6309 {
6311 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6312 }
6313
6315 {
6318
6319 OverheatingParticle OP = new OverheatingParticle();
6324
6326 }
6327
6329 {
6332
6333 return -1;
6334 }
6335
6337 {
6339 {
6342
6343 for (int i = count; i > 0; --i)
6344 {
6345 int id = i - 1;
6348
6351
6352 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
6353 {
6354 if (p)
6355 {
6358 }
6359 }
6360 }
6361 }
6362 }
6363
6365 {
6367 {
6369 {
6370 int id = i - 1;
6372
6373 if (OP)
6374 {
6376
6377 if (p)
6378 {
6380 }
6381
6382 delete OP;
6383 }
6384 }
6385
6388 }
6389 }
6390
6393 {
6394 return 0.0;
6395 }
6396
6397
6399 {
6400 return 250;
6401 }
6402
6404 {
6405 return 0;
6406 }
6407
6410 {
6412 return true;
6413
6414 return false;
6415 }
6416
6419 {
6422
6424 {
6426 }
6427 else
6428 {
6429
6431 }
6432
6434 }
6435
6442 {
6443 return -1;
6444 }
6445
6446
6447
6448
6450 {
6452 {
6453 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6454 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6455
6456 if (r_index >= 0)
6457 {
6458 InventoryLocation r_il = new InventoryLocation;
6459 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6460
6461 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6464 {
6465 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6466 }
6468 {
6469 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6470 }
6471
6472 }
6473
6474 player.GetHumanInventory().ClearUserReservedLocation(this);
6475 }
6476
6479 }
6480
6481
6482
6483
6485 {
6486 return ItemBase.m_DebugActionsMask;
6487 }
6488
6490 {
6491 return ItemBase.m_DebugActionsMask & mask;
6492 }
6493
6495 {
6496 ItemBase.m_DebugActionsMask = mask;
6497 }
6498
6500 {
6501 ItemBase.m_DebugActionsMask |= mask;
6502 }
6503
6505 {
6506 ItemBase.m_DebugActionsMask &= ~mask;
6507 }
6508
6510 {
6512 {
6514 }
6515 else
6516 {
6518 }
6519 }
6520
6521
6523 {
6524 if (GetEconomyProfile())
6525 {
6526 float q_max = GetEconomyProfile().GetQuantityMax();
6527 if (q_max > 0)
6528 {
6529 float q_min = GetEconomyProfile().GetQuantityMin();
6530 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
6531
6533 {
6534 ComponentEnergyManager comp = GetCompEM();
6536 {
6538 }
6539 }
6541 {
6543
6544 }
6545
6546 }
6547 }
6548 }
6549
6552 {
6553 EntityAI parent = GetHierarchyParent();
6554
6555 if (parent)
6556 {
6557 InventoryLocation inventory_location_to_lock = new InventoryLocation;
6558 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
6559 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
6560 }
6561 }
6562
6565 {
6566 EntityAI parent = GetHierarchyParent();
6567
6568 if (parent)
6569 {
6570 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
6571 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
6572 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
6573 }
6574 }
6575
6577 {
6578
6579
6580
6581
6583
6585 {
6586 if (ScriptInputUserData.CanStoreInputUserData())
6587 {
6588 ScriptInputUserData ctx = new ScriptInputUserData;
6594 ctx.
Write(use_stack_max);
6597
6599 {
6600 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
6601 }
6602 }
6603 }
6604 else if (!
g_Game.IsMultiplayer())
6605 {
6607 }
6608 }
6609
6611 {
6613 }
6614
6616 {
6618 }
6619
6621 {
6623 }
6624
6626 {
6627
6628 return false;
6629 }
6630
6632 {
6633 return false;
6634 }
6635
6639 {
6640 return false;
6641 }
6642
6644 {
6645 return "";
6646 }
6647
6649
6651 {
6652 return false;
6653 }
6654
6656 {
6657 return true;
6658 }
6659
6660
6661
6663 {
6664 return true;
6665 }
6666
6668 {
6669 return true;
6670 }
6671
6673 {
6674 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6676 }
6677
6679 {
6681 }
6682
6684 {
6686 if (!is_being_placed)
6688 SetSynchDirty();
6689 }
6690
6691
6693
6695 {
6697 }
6698
6700 {
6702 }
6703
6705 {
6706 return 1;
6707 }
6708
6710 {
6711 return false;
6712 }
6713
6715 {
6717 SetSynchDirty();
6718 }
6719
6720
6721
6722
6723
6724
6725
6726
6727
6728
6729
6730
6731
6732
6733
6734
6735
6736
6737
6738
6739
6740
6741
6742
6743
6744
6745
6746
6747
6748
6749
6750
6751
6752
6753
6755 {
6756 super.OnMovedInsideCargo(container);
6757
6758 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6759 }
6760
6761 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
6762 {
6763 super.EEItemLocationChanged(oldLoc, newLoc);
6764
6765 PlayerBase newPlayer = null;
6766 PlayerBase oldPlayer = null;
6767
6768 if (newLoc.GetParent())
6769 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
6770
6771 if (oldLoc.GetParent())
6772 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
6773
6775 {
6776 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
6777
6778 if (rIndex >= 0)
6779 {
6780 InventoryLocation rIl = new InventoryLocation;
6781 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
6782
6783 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
6786 {
6787 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
6788 }
6790 {
6792 }
6793
6794 }
6795 }
6796
6798 {
6799 if (newPlayer)
6800 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
6801
6802 if (newPlayer == oldPlayer)
6803 {
6804 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
6805 {
6807 {
6808 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
6809 {
6810 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6811 }
6812 }
6813 else
6814 {
6815 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6816 }
6817 }
6818
6819 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
6820 {
6821 int type = oldLoc.GetType();
6823 {
6824 oldLoc.GetParent().GetOnSetLock().Invoke(this);
6825 }
6827 {
6828 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
6829 }
6830 }
6831 if (!m_OldLocation)
6832 {
6833 m_OldLocation = new InventoryLocation;
6834 }
6835 m_OldLocation.Copy(oldLoc);
6836 }
6837 else
6838 {
6839 if (m_OldLocation)
6840 {
6841 m_OldLocation.Reset();
6842 }
6843 }
6844
6845 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
6846 }
6847 else
6848 {
6849 if (newPlayer)
6850 {
6851 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
6852 if (resIndex >= 0)
6853 {
6854 InventoryLocation il = new InventoryLocation;
6855 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
6857 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
6860 {
6861 il.
GetParent().GetOnReleaseLock().Invoke(it);
6862 }
6864 {
6866 }
6867
6868 }
6869 }
6871 {
6872
6874 }
6875
6876 if (m_OldLocation)
6877 {
6878 m_OldLocation.Reset();
6879 }
6880 }
6881
6883 {
6884 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
6885 }
6886
6888 {
6889 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
6890 }
6891 }
6892
6893 override void EOnContact(IEntity other, Contact extra)
6894 {
6896 {
6897 int liquidType = -1;
6899 if (impactSpeed > 0.0)
6900 {
6902 #ifndef SERVER
6904 #else
6906 SetSynchDirty();
6907 #endif
6909 }
6910 }
6911
6912 #ifdef SERVER
6913 if (GetCompEM() && GetCompEM().IsPlugged())
6914 {
6915 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
6916 GetCompEM().UnplugThis();
6917 }
6918 #endif
6919 }
6920
6922
6924 {
6926 }
6927
6929 {
6930
6931 }
6932
6934 {
6935 super.OnItemLocationChanged(old_owner, new_owner);
6936
6937 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
6938 PlayerBase playerNew = PlayerBase.Cast(new_owner);
6939
6940 if (!relatedPlayer && playerNew)
6941 relatedPlayer = playerNew;
6942
6943 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
6944 {
6946 if (actionMgr)
6947 {
6948 ActionBase currentAction = actionMgr.GetRunningAction();
6949 if (currentAction)
6951 }
6952 }
6953
6954 Man ownerPlayerOld = null;
6955 Man ownerPlayerNew = null;
6956
6957 if (old_owner)
6958 {
6959 if (old_owner.
IsMan())
6960 {
6961 ownerPlayerOld = Man.Cast(old_owner);
6962 }
6963 else
6964 {
6965 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
6966 }
6967 }
6968 else
6969 {
6971 {
6973
6974 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
6975 {
6976 GetCompEM().UnplugThis();
6977 }
6978 }
6979 }
6980
6981 if (new_owner)
6982 {
6983 if (new_owner.
IsMan())
6984 {
6985 ownerPlayerNew = Man.Cast(new_owner);
6986 }
6987 else
6988 {
6989 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
6990 }
6991 }
6992
6993 if (ownerPlayerOld != ownerPlayerNew)
6994 {
6995 if (ownerPlayerOld)
6996 {
6997 array<EntityAI> subItemsExit = new array<EntityAI>;
6999 for (int i = 0; i < subItemsExit.Count(); i++)
7000 {
7003 }
7004 }
7005
7006 if (ownerPlayerNew)
7007 {
7008 array<EntityAI> subItemsEnter = new array<EntityAI>;
7010 for (int j = 0; j < subItemsEnter.Count(); j++)
7011 {
7014 }
7015 }
7016 }
7017 else if (ownerPlayerNew != null)
7018 {
7019 PlayerBase nplayer;
7020 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
7021 {
7022 array<EntityAI> subItemsUpdate = new array<EntityAI>;
7024 for (int k = 0; k < subItemsUpdate.Count(); k++)
7025 {
7027 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
7028 }
7029 }
7030 }
7031
7032 if (old_owner)
7033 old_owner.OnChildItemRemoved(this);
7034 if (new_owner)
7035 new_owner.OnChildItemReceived(this);
7036 }
7037
7038
7040 {
7041 super.EEDelete(parent);
7042 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
7043 if (player)
7044 {
7046
7047 if (player.IsAlive())
7048 {
7049 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7050 if (r_index >= 0)
7051 {
7052 InventoryLocation r_il = new InventoryLocation;
7053 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7054
7055 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7058 {
7059 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7060 }
7062 {
7063 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7064 }
7065
7066 }
7067
7068 player.RemoveQuickBarEntityShortcut(this);
7069 }
7070 }
7071 }
7072
7074 {
7075 super.EEKilled(killer);
7076
7079 {
7080 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
7081 {
7082 if (IsMagazine())
7083 {
7084 if (Magazine.Cast(this).GetAmmoCount() > 0)
7085 {
7087 }
7088 }
7089 else
7090 {
7092 }
7093 }
7094 }
7095 }
7096
7098 {
7099 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7100
7101 super.OnWasAttached(parent, slot_id);
7102
7105
7108 }
7109
7111 {
7112 super.OnWasDetached(parent, slot_id);
7113
7116
7119 }
7120
7122 {
7123 int idx;
7126
7127 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7128 if (inventory_slots.Count() < 1)
7129 {
7130 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
7131 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
7132 }
7133 else
7134 {
7135 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
7136 }
7137
7138 idx = inventory_slots.Find(slot);
7139 if (idx < 0)
7140 return "";
7141
7142 return attach_types.Get(idx);
7143 }
7144
7146 {
7147 int idx = -1;
7148 string slot;
7149
7152
7153 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7154 if (inventory_slots.Count() < 1)
7155 {
7156 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
7157 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7158 }
7159 else
7160 {
7161 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
7162 if (detach_types.Count() < 1)
7163 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7164 }
7165
7166 for (int i = 0; i < inventory_slots.Count(); i++)
7167 {
7168 slot = inventory_slots.Get(i);
7169 }
7170
7171 if (slot != "")
7172 {
7173 if (detach_types.Count() == 1)
7174 idx = 0;
7175 else
7176 idx = inventory_slots.Find(slot);
7177 }
7178 if (idx < 0)
7179 return "";
7180
7181 return detach_types.Get(idx);
7182 }
7183
7185 {
7186
7188
7189
7190 float min_time = 1;
7191 float max_time = 3;
7192 float delay = Math.RandomFloat(min_time, max_time);
7193
7194 explode_timer.Run(delay, this, "DoAmmoExplosion");
7195 }
7196
7198 {
7199 Magazine magazine = Magazine.Cast(this);
7200 int pop_sounds_count = 6;
7201 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
7202
7203
7204 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
7205 string sound_name = pop_sounds[ sound_idx ];
7206 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
7207
7208
7209 magazine.ServerAddAmmoCount(-1);
7210
7211
7212 float min_temp_to_explode = 100;
7213
7214 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
7215 {
7217 }
7218 }
7219
7220
7221 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
7222 {
7223 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
7224
7225 const int CHANCE_DAMAGE_CARGO = 4;
7226 const int CHANCE_DAMAGE_ATTACHMENT = 1;
7227 const int CHANCE_DAMAGE_NOTHING = 2;
7228
7230 {
7231 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
7232 int chances;
7233 int rnd;
7234
7235 if (GetInventory().GetCargo())
7236 {
7237 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7238 rnd = Math.RandomInt(0,chances);
7239
7240 if (rnd < CHANCE_DAMAGE_CARGO)
7241 {
7243 }
7244 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
7245 {
7247 }
7248 }
7249 else
7250 {
7251 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7252 rnd = Math.RandomInt(0,chances);
7253
7254 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
7255 {
7257 }
7258 }
7259 }
7260 }
7261
7263 {
7264 CargoBase cargo = GetInventory().GetCargo();
7265 if (cargo)
7266 {
7268 if (item_count > 0)
7269 {
7270 int random_pick = Math.RandomInt(0, item_count);
7272 if (!item.IsExplosive())
7273 {
7274 item.AddHealth("","",damage);
7275 return true;
7276 }
7277 }
7278 }
7279 return false;
7280 }
7281
7283 {
7284 GameInventory inventory = GetInventory();
7286 if (attachment_count > 0)
7287 {
7288 int random_pick = Math.RandomInt(0, attachment_count);
7290 if (!attachment.IsExplosive())
7291 {
7292 attachment.AddHealth("","",damage);
7293 return true;
7294 }
7295 }
7296 return false;
7297 }
7298
7300 {
7302 }
7303
7305 {
7307 return GetInventory().CanRemoveEntity();
7308
7309 return false;
7310 }
7311
7313 {
7314
7316 return false;
7317
7318
7320 return false;
7321
7322
7323
7325 if (delta == 0)
7326 return false;
7327
7328
7329 return true;
7330 }
7331
7333 {
7335 {
7336 if (ScriptInputUserData.CanStoreInputUserData())
7337 {
7338 ScriptInputUserData ctx = new ScriptInputUserData;
7343 ctx.
Write(destination_entity);
7347 }
7348 }
7349 else if (!
g_Game.IsMultiplayer())
7350 {
7352 }
7353 }
7354
7356 {
7357 float split_quantity_new;
7361 InventoryLocation loc = new InventoryLocation;
7362
7363 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7364 {
7366 split_quantity_new = stack_max;
7367 else
7369
7371 {
7372 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7373 if (new_item)
7374 {
7375 new_item.SetResultOfSplit(true);
7376 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7378 new_item.
SetQuantity(split_quantity_new,
false,
true);
7379 }
7380 }
7381 }
7382 else if (destination_entity && slot_id == -1)
7383 {
7384 if (quantity > stack_max)
7385 split_quantity_new = stack_max;
7386 else
7387 split_quantity_new = quantity;
7388
7390 {
7391 GameInventory destinationInventory = destination_entity.GetInventory();
7393 {
7396 }
7397
7398 if (new_item)
7399 {
7400 new_item.SetResultOfSplit(true);
7401 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7403 new_item.
SetQuantity(split_quantity_new,
false,
true);
7404 }
7405 }
7406 }
7407 else
7408 {
7409 if (stack_max != 0)
7410 {
7412 {
7414 }
7415
7416 if (split_quantity_new == 0)
7417 {
7418 if (!
g_Game.IsMultiplayer())
7419 player.PhysicalPredictiveDropItem(this);
7420 else
7421 player.ServerDropEntity(this);
7422 return;
7423 }
7424
7426 {
7428
7429 if (new_item)
7430 {
7431 new_item.SetResultOfSplit(true);
7432 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7435 new_item.PlaceOnSurface();
7436 }
7437 }
7438 }
7439 }
7440 }
7441
7443 {
7444 float split_quantity_new;
7448 InventoryLocation loc = new InventoryLocation;
7449
7450 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7451 {
7453 split_quantity_new = stack_max;
7454 else
7456
7458 {
7459 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7460 if (new_item)
7461 {
7462 new_item.SetResultOfSplit(true);
7463 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7465 new_item.
SetQuantity(split_quantity_new,
false,
true);
7466 }
7467 }
7468 }
7469 else if (destination_entity && slot_id == -1)
7470 {
7471 if (quantity > stack_max)
7472 split_quantity_new = stack_max;
7473 else
7474 split_quantity_new = quantity;
7475
7477 {
7478 GameInventory destinationInventory = destination_entity.GetInventory();
7480 {
7483 }
7484
7485 if (new_item)
7486 {
7487 new_item.SetResultOfSplit(true);
7488 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7490 new_item.
SetQuantity(split_quantity_new,
false,
true);
7491 }
7492 }
7493 }
7494 else
7495 {
7496 if (stack_max != 0)
7497 {
7499 {
7501 }
7502
7504 {
7506
7507 if (new_item)
7508 {
7509 new_item.SetResultOfSplit(true);
7510 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7513 new_item.PlaceOnSurface();
7514 }
7515 }
7516 }
7517 }
7518 }
7519
7521 {
7523 {
7524 if (ScriptInputUserData.CanStoreInputUserData())
7525 {
7526 ScriptInputUserData ctx = new ScriptInputUserData;
7531 dst.WriteToContext(ctx);
7533 }
7534 }
7535 else if (!
g_Game.IsMultiplayer())
7536 {
7538 }
7539 }
7540
7542 {
7544 {
7545 if (ScriptInputUserData.CanStoreInputUserData())
7546 {
7547 ScriptInputUserData ctx = new ScriptInputUserData;
7552 ctx.
Write(destination_entity);
7558 }
7559 }
7560 else if (!
g_Game.IsMultiplayer())
7561 {
7563 }
7564 }
7565
7567 {
7569 }
7570
7572 {
7574 float split_quantity_new;
7576 if (dst.IsValid())
7577 {
7578 int slot_id = dst.GetSlot();
7580
7581 if (quantity > stack_max)
7582 split_quantity_new = stack_max;
7583 else
7584 split_quantity_new = quantity;
7585
7587 {
7589
7590 if (new_item)
7591 {
7592 new_item.SetResultOfSplit(true);
7593 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7595 new_item.
SetQuantity(split_quantity_new,
false,
true);
7596 }
7597
7598 return new_item;
7599 }
7600 }
7601
7602 return null;
7603 }
7604
7606 {
7608 float split_quantity_new;
7610 if (destination_entity)
7611 {
7613 if (quantity > stackable)
7614 split_quantity_new = stackable;
7615 else
7616 split_quantity_new = quantity;
7617
7619 {
7620 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
7621 if (new_item)
7622 {
7623 new_item.SetResultOfSplit(true);
7624 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7626 new_item.
SetQuantity(split_quantity_new,
false,
true);
7627 }
7628 }
7629 }
7630 }
7631
7633 {
7635 {
7636 if (ScriptInputUserData.CanStoreInputUserData())
7637 {
7638 ScriptInputUserData ctx = new ScriptInputUserData;
7643 ItemBase destination_entity =
this;
7644 ctx.
Write(destination_entity);
7648 }
7649 }
7650 else if (!
g_Game.IsMultiplayer())
7651 {
7653 }
7654 }
7655
7657 {
7659 float split_quantity_new;
7661 if (player)
7662 {
7664 if (quantity > stackable)
7665 split_quantity_new = stackable;
7666 else
7667 split_quantity_new = quantity;
7668
7670 {
7671 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
7672 new_item =
ItemBase.Cast(in_hands);
7673 if (new_item)
7674 {
7675 new_item.SetResultOfSplit(true);
7676 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7678 new_item.SetQuantity(split_quantity_new, false, true);
7679 }
7680 }
7681 }
7682 }
7683
7685 {
7687 float split_quantity_new = Math.Floor(quantity * 0.5);
7688
7690 return;
7691
7693
7694 if (new_item)
7695 {
7696 if (new_item.GetQuantityMax() < split_quantity_new)
7697 {
7698 split_quantity_new = new_item.GetQuantityMax();
7699 }
7700
7701 new_item.SetResultOfSplit(true);
7702 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7703
7705 {
7708 }
7709 else
7710 {
7712 new_item.
SetQuantity(split_quantity_new,
false,
true);
7713 }
7714 }
7715 }
7716
7718 {
7720 float split_quantity_new = Math.Floor(quantity / 2);
7721
7723 return;
7724
7725 InventoryLocation invloc = new InventoryLocation;
7727
7729 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
7730
7731 if (new_item)
7732 {
7733 if (new_item.GetQuantityMax() < split_quantity_new)
7734 {
7735 split_quantity_new = new_item.GetQuantityMax();
7736 }
7738 {
7741 }
7742 else if (split_quantity_new > 1)
7743 {
7745 new_item.
SetQuantity(split_quantity_new,
false,
true);
7746 }
7747 }
7748 }
7749
7752 {
7753 SetWeightDirty();
7755
7756 if (parent)
7757 parent.OnAttachmentQuantityChangedEx(this, delta);
7758
7760 {
7762 {
7764 }
7766 {
7767 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
7769 }
7770 }
7771 }
7772
7775 {
7776
7777 }
7778
7781 {
7783 }
7784
7786 {
7787 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
7788
7790 {
7791 if (newLevel == GameConstants.STATE_RUINED)
7792 {
7794 EntityAI parent = GetHierarchyParent();
7795 if (parent && parent.IsFireplace())
7796 {
7797 CargoBase cargo = GetInventory().GetCargo();
7798 if (cargo)
7799 {
7801 {
7803 }
7804 }
7805 }
7806 }
7807
7809 {
7810
7812 return;
7813 }
7814
7815 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
7816 {
7818 }
7819 }
7820 }
7821
7822
7824 {
7825 super.OnRightClick();
7826
7828 {
7830 {
7831 if (ScriptInputUserData.CanStoreInputUserData())
7832 {
7833 EntityAI root = GetHierarchyRoot();
7834 Man playerOwner = GetHierarchyRootPlayer();
7835 InventoryLocation dst = new InventoryLocation;
7836
7837
7838 if (!playerOwner && root && root == this)
7839 {
7841 }
7842 else
7843 {
7844
7845 GetInventory().GetCurrentInventoryLocation(dst);
7847 {
7848 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7850 {
7852 }
7853 else
7854 {
7856
7857
7858 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
7859 {
7861 }
7862 else
7863 {
7864 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
7865 }
7866 }
7867 }
7868 }
7869
7870 ScriptInputUserData ctx = new ScriptInputUserData;
7878 }
7879 }
7880 else if (!
g_Game.IsMultiplayer())
7881 {
7883 }
7884 }
7885 }
7886
7888 {
7889 if (root)
7890 {
7891 vector m4[4];
7892 root.GetTransform(m4);
7893 dst.SetGround(this, m4);
7894 }
7895 else
7896 {
7897 GetInventory().GetCurrentInventoryLocation(dst);
7898 }
7899 }
7900
7901 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
7902 {
7903
7904 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
7905 return false;
7906
7907 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
7908 return false;
7909
7910
7912 return false;
7913
7914
7915 Magazine mag = Magazine.Cast(this);
7916 if (mag)
7917 {
7918 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
7919 return false;
7920
7921 if (stack_max_limit)
7922 {
7923 Magazine other_mag = Magazine.Cast(other_item);
7924 if (other_item)
7925 {
7926 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
7927 return false;
7928 }
7929
7930 }
7931 }
7932 else
7933 {
7934
7936 return false;
7937
7939 return false;
7940 }
7941
7942 PlayerBase player = null;
7943 if (CastTo(player, GetHierarchyRootPlayer()))
7944 {
7945 if (player.GetInventory().HasAttachment(this))
7946 return false;
7947
7948 if (player.IsItemsToDelete())
7949 return false;
7950 }
7951
7952 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
7953 return false;
7954
7955 int slotID;
7957 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
7958 return false;
7959
7960 return true;
7961 }
7962
7964 {
7966 }
7967
7969 {
7970 return m_IsResultOfSplit;
7971 }
7972
7974 {
7975 m_IsResultOfSplit = value;
7976 }
7977
7979 {
7981 }
7982
7984 {
7985 float other_item_quantity = other_item.GetQuantity();
7986 float this_free_space;
7987
7989
7991
7992 if (other_item_quantity > this_free_space)
7993 {
7994 return this_free_space;
7995 }
7996 else
7997 {
7998 return other_item_quantity;
7999 }
8000 }
8001
8003 {
8005 }
8006
8008 {
8010 return;
8011
8012 if (!IsMagazine() && other_item)
8013 {
8015 if (quantity_used != 0)
8016 {
8017 float hp1 = GetHealth01("","");
8018 float hp2 = other_item.GetHealth01("","");
8019 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
8020 hpResult = hpResult / (
GetQuantity() + quantity_used);
8021
8022 hpResult *= GetMaxHealth();
8023 Math.Round(hpResult);
8024 SetHealth("", "Health", hpResult);
8025
8027 other_item.AddQuantity(-quantity_used);
8028 }
8029 }
8031 }
8032
8034 {
8035 #ifdef SERVER
8036 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
8037 GetHierarchyParent().IncreaseLifetimeUp();
8038 #endif
8039 };
8040
8042 {
8043 PlayerBase p = PlayerBase.Cast(player);
8044
8045 array<int> recipesIds = p.m_Recipes;
8046 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8047 if (moduleRecipesManager)
8048 {
8049 EntityAI itemInHands = player.GetEntityInHands();
8050 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
8051 }
8052
8053 for (int i = 0;i < recipesIds.Count(); i++)
8054 {
8055 int key = recipesIds.Get(i);
8056 string recipeName = moduleRecipesManager.GetRecipeName(key);
8058 }
8059 }
8060
8061
8062 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
8063 {
8064 super.GetDebugActions(outputList);
8065
8066
8072
8073
8078
8083
8084
8088
8089
8091 {
8095 }
8096
8099
8100
8104
8106
8107 InventoryLocation loc = new InventoryLocation();
8108 GetInventory().GetCurrentInventoryLocation(loc);
8110 {
8111 if (Gizmo_IsSupported())
8114 }
8115
8117 }
8118
8119
8120
8121
8123 {
8124 super.OnAction(action_id, player, ctx);
8125
8127 {
8128 switch (action_id)
8129 {
8133 return true;
8137 return true;
8138 }
8139 }
8140
8142 {
8143 switch (action_id)
8144 {
8146 Delete();
8147 return true;
8148 }
8149 }
8150
8151 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
8152 {
8153 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8154 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
8155 PlayerBase p = PlayerBase.Cast(player);
8156 if (
EActions.RECIPES_RANGE_START < 1000)
8157 {
8158 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
8159 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
8160 }
8161 }
8162 #ifndef SERVER
8163 else if (action_id ==
EActions.WATCH_PLAYER)
8164 {
8165 PluginDeveloper.SetDeveloperItemClientEx(player);
8166 }
8167 #endif
8169 {
8170 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
8171 {
8172 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
8173 OnDebugButtonPressServer(id + 1);
8174 }
8175
8176 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
8177 {
8178 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
8180 }
8181
8182 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
8183 {
8184 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
8186 }
8187
8188 else if (action_id ==
EActions.ADD_QUANTITY)
8189 {
8190 if (IsMagazine())
8191 {
8192 Magazine mag = Magazine.Cast(this);
8193 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
8194 }
8195 else
8196 {
8198 }
8199
8200 if (m_EM)
8201 {
8202 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
8203 }
8204
8205 }
8206
8207 else if (action_id ==
EActions.REMOVE_QUANTITY)
8208 {
8209 if (IsMagazine())
8210 {
8211 Magazine mag2 = Magazine.Cast(this);
8212 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
8213 }
8214 else
8215 {
8217 }
8218 if (m_EM)
8219 {
8220 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
8221 }
8222
8223 }
8224
8225 else if (action_id ==
EActions.SET_QUANTITY_0)
8226 {
8228
8229 if (m_EM)
8230 {
8231 m_EM.SetEnergy(0);
8232 }
8233 }
8234
8235 else if (action_id ==
EActions.SET_MAX_QUANTITY)
8236 {
8238
8239 if (m_EM)
8240 {
8241 m_EM.SetEnergy(m_EM.GetEnergyMax());
8242 }
8243 }
8244
8245 else if (action_id ==
EActions.ADD_HEALTH)
8246 {
8247 AddHealth("","",GetMaxHealth("","Health")/5);
8248 }
8249 else if (action_id ==
EActions.REMOVE_HEALTH)
8250 {
8251 AddHealth("","",-GetMaxHealth("","Health")/5);
8252 }
8253 else if (action_id ==
EActions.DESTROY_HEALTH)
8254 {
8255 SetHealth01("","",0);
8256 }
8257 else if (action_id ==
EActions.WATCH_ITEM)
8258 {
8260 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
8261 #ifdef DEVELOPER
8262 SetDebugDeveloper_item(this);
8263 #endif
8264 }
8265
8266 else if (action_id ==
EActions.ADD_TEMPERATURE)
8267 {
8268 AddTemperature(20);
8269
8270 }
8271
8272 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
8273 {
8274 AddTemperature(-20);
8275
8276 }
8277
8278 else if (action_id ==
EActions.FLIP_FROZEN)
8279 {
8280 SetFrozen(!GetIsFrozen());
8281
8282 }
8283
8284 else if (action_id ==
EActions.ADD_WETNESS)
8285 {
8287
8288 }
8289
8290 else if (action_id ==
EActions.REMOVE_WETNESS)
8291 {
8293
8294 }
8295
8296 else if (action_id ==
EActions.LIQUIDTYPE_UP)
8297 {
8300
8301
8302 }
8303
8304 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
8305 {
8308 }
8309
8310 else if (action_id ==
EActions.MAKE_SPECIAL)
8311 {
8312 auto debugParams = DebugSpawnParams.WithPlayer(player);
8313 OnDebugSpawnEx(debugParams);
8314 }
8315
8316 }
8317
8318
8319 return false;
8320 }
8321
8322
8323
8324
8328
8331
8332
8333
8335 {
8336 return false;
8337 }
8338
8339
8341 {
8342 return true;
8343 }
8344
8345
8347 {
8348 return true;
8349 }
8350
8351
8352
8354 {
8355 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
8356 return g_Game.ConfigIsExisting(config_path);
8357 }
8358
8361 {
8362 return null;
8363 }
8364
8366 {
8367 return false;
8368 }
8369
8371 {
8372 return false;
8373 }
8374
8378
8379
8381 {
8382 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8383 return module_repairing.CanRepair(this, item_repair_kit);
8384 }
8385
8386
8387 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
8388 {
8389 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8390 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
8391 }
8392
8393
8395 {
8396
8397
8398
8399
8400
8401
8402
8403
8404 return 1;
8405 }
8406
8407
8408
8410 {
8412 }
8413
8414
8415
8417 {
8419 }
8420
8421
8430 {
8431 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8432
8433 if (player)
8434 {
8435 player.MessageStatus(text);
8436 }
8437 }
8438
8439
8448 {
8449 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8450
8451 if (player)
8452 {
8453 player.MessageAction(text);
8454 }
8455 }
8456
8457
8466 {
8467 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8468
8469 if (player)
8470 {
8471 player.MessageFriendly(text);
8472 }
8473 }
8474
8475
8484 {
8485 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8486
8487 if (player)
8488 {
8489 player.MessageImportant(text);
8490 }
8491 }
8492
8494 {
8495 return true;
8496 }
8497
8498
8499 override bool KindOf(
string tag)
8500 {
8501 bool found = false;
8502 string item_name = this.
GetType();
8504 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
8505
8506 int array_size = item_tag_array.Count();
8507 for (int i = 0; i < array_size; i++)
8508 {
8509 if (item_tag_array.Get(i) == tag)
8510 {
8511 found = true;
8512 break;
8513 }
8514 }
8515 return found;
8516 }
8517
8518
8520 {
8521
8522 super.OnRPC(sender, rpc_type,ctx);
8523
8524
8525 switch (rpc_type)
8526 {
8527 #ifndef SERVER
8528 case ERPCs.RPC_SOUND_LOCK_ATTACH:
8529 Param2<bool, string> p = new Param2<bool, string>(false, "");
8530
8532 return;
8533
8534 bool play = p.param1;
8535 string soundSet = p.param2;
8536
8537 if (play)
8538 {
8540 {
8542 {
8544 }
8545 }
8546 else
8547 {
8549 }
8550 }
8551 else
8552 {
8554 }
8555
8556 break;
8557 #endif
8558
8559 }
8560
8562 {
8564 }
8565 }
8566
8567
8568
8569
8571 {
8572 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8573 return plugin.GetID(
name);
8574 }
8575
8577 {
8578 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8579 return plugin.GetName(id);
8580 }
8581
8584 {
8585
8586
8587 int varFlags;
8588 if (!ctx.
Read(varFlags))
8589 return;
8590
8591 if (varFlags & ItemVariableFlags.FLOAT)
8592 {
8594 }
8595 }
8596
8598 {
8599
8600 super.SerializeNumericalVars(floats_out);
8601
8602
8603
8605 {
8607 }
8608
8610 {
8612 }
8613
8615 {
8617 }
8618
8620 {
8625 }
8626
8628 {
8630 }
8631 }
8632
8634 {
8635
8636 super.DeSerializeNumericalVars(floats);
8637
8638
8639 int index = 0;
8640 int mask = Math.Round(floats.Get(index));
8641
8642 index++;
8643
8645 {
8647 {
8649 }
8650 else
8651 {
8652 float quantity = floats.Get(index);
8654 }
8655 index++;
8656 }
8657
8659 {
8660 float wet = floats.Get(index);
8662 index++;
8663 }
8664
8666 {
8667 int liquidtype = Math.Round(floats.Get(index));
8669 index++;
8670 }
8671
8673 {
8675 index++;
8677 index++;
8679 index++;
8681 index++;
8682 }
8683
8685 {
8686 int cleanness = Math.Round(floats.Get(index));
8688 index++;
8689 }
8690 }
8691
8693 {
8694 super.WriteVarsToCTX(ctx);
8695
8696
8698 {
8700 }
8701
8703 {
8705 }
8706
8708 {
8710 }
8711
8713 {
8714 int r,g,b,a;
8720 }
8721
8723 {
8725 }
8726 }
8727
8729 {
8730 if (!super.ReadVarsFromCTX(ctx,version))
8731 return false;
8732
8733 int intValue;
8734 float value;
8735
8736 if (version < 140)
8737 {
8738 if (!ctx.
Read(intValue))
8739 return false;
8740
8741 m_VariablesMask = intValue;
8742 }
8743
8745 {
8746 if (!ctx.
Read(value))
8747 return false;
8748
8750 {
8752 }
8753 else
8754 {
8756 }
8757 }
8758
8759 if (version < 140)
8760 {
8762 {
8763 if (!ctx.
Read(value))
8764 return false;
8765 SetTemperatureDirect(value);
8766 }
8767 }
8768
8770 {
8771 if (!ctx.
Read(value))
8772 return false;
8774 }
8775
8777 {
8778 if (!ctx.
Read(intValue))
8779 return false;
8781 }
8782
8784 {
8785 int r,g,b,a;
8787 return false;
8789 return false;
8791 return false;
8793 return false;
8794
8796 }
8797
8799 {
8800 if (!ctx.
Read(intValue))
8801 return false;
8803 }
8804
8805 if (version >= 138 && version < 140)
8806 {
8808 {
8809 if (!ctx.
Read(intValue))
8810 return false;
8811 SetFrozen(intValue);
8812 }
8813 }
8814
8815 return true;
8816 }
8817
8818
8820 {
8823 {
8825 }
8826
8827 if (!super.OnStoreLoad(ctx, version))
8828 {
8830 return false;
8831 }
8832
8833 if (version >= 114)
8834 {
8835 bool hasQuickBarIndexSaved;
8836
8837 if (!ctx.
Read(hasQuickBarIndexSaved))
8838 {
8840 return false;
8841 }
8842
8843 if (hasQuickBarIndexSaved)
8844 {
8845 int itmQBIndex;
8846
8847
8848 if (!ctx.
Read(itmQBIndex))
8849 {
8851 return false;
8852 }
8853
8854 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
8855 if (itmQBIndex != -1 && parentPlayer)
8856 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
8857 }
8858 }
8859 else
8860 {
8861
8862 PlayerBase player;
8863 int itemQBIndex;
8864 if (version ==
int.
MAX)
8865 {
8866 if (!ctx.
Read(itemQBIndex))
8867 {
8869 return false;
8870 }
8871 }
8872 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
8873 {
8874
8875 if (!ctx.
Read(itemQBIndex))
8876 {
8878 return false;
8879 }
8880 if (itemQBIndex != -1 && player)
8881 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
8882 }
8883 }
8884
8885 if (version < 140)
8886 {
8887
8888 if (!LoadVariables(ctx, version))
8889 {
8891 return false;
8892 }
8893 }
8894
8895
8897 {
8899 return false;
8900 }
8901 if (version >= 132)
8902 {
8904 if (raib)
8905 {
8907 {
8909 return false;
8910 }
8911 }
8912 }
8913
8915 return true;
8916 }
8917
8918
8919
8921 {
8922 super.OnStoreSave(ctx);
8923
8924 PlayerBase player;
8925 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
8926 {
8928
8929 int itemQBIndex = -1;
8930 itemQBIndex = player.FindQuickBarEntityIndex(this);
8931 ctx.
Write(itemQBIndex);
8932 }
8933 else
8934 {
8936 }
8937
8939
8941 if (raib)
8942 {
8944 }
8945 }
8946
8947
8949 {
8950 super.AfterStoreLoad();
8951
8953 {
8955 }
8956
8958 {
8961 }
8962 }
8963
8965 {
8966 super.EEOnAfterLoad();
8967
8969 {
8971 }
8972
8975 }
8976
8978 {
8979 return false;
8980 }
8981
8982
8983
8985 {
8987 {
8988 #ifdef PLATFORM_CONSOLE
8989
8991 {
8993 if (menu)
8994 {
8996 }
8997 }
8998 #endif
8999 }
9000
9002 {
9005 }
9006
9008 {
9009 SetWeightDirty();
9011 }
9013 {
9016 }
9017
9019 {
9022
9025 }
9027 {
9031 }
9032
9033 super.OnVariablesSynchronized();
9034 }
9035
9036
9037
9039 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
9040 {
9041 if (!IsServerCheck(allow_client))
9042 return false;
9043
9045 return false;
9046
9049
9050 if (value <= (min + 0.001))
9051 value = min;
9052
9053 if (value == min)
9054 {
9055 if (destroy_config)
9056 {
9057 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
9058 if (dstr)
9059 {
9061 this.Delete();
9062 return true;
9063 }
9064 }
9065 else if (destroy_forced)
9066 {
9068 this.Delete();
9069 return true;
9070 }
9071
9073 }
9074
9077
9079 {
9080 EntityAI parent = GetHierarchyRoot();
9081 InventoryLocation iLoc = new InventoryLocation();
9082 GetInventory().GetCurrentInventoryLocation(iLoc);
9084 {
9085 int iLocSlot = iLoc.
GetSlot();
9087 {
9089 }
9091 {
9093 }
9094 }
9095 }
9096
9098 {
9100
9101 if (delta)
9103 }
9104
9106
9107 return false;
9108 }
9109
9110
9112 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9113 {
9115 }
9116
9118 {
9121 }
9122
9124 {
9127 }
9128
9130 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9131 {
9132 float value_clamped = Math.Clamp(value, 0, 1);
9134 SetQuantity(result, destroy_config, destroy_forced);
9135 }
9136
9137
9140 {
9142 }
9143
9145 {
9147 }
9148
9149
9150
9151
9152
9153
9154
9155
9156
9157
9159 {
9160 int slot = -1;
9161 GameInventory inventory = GetInventory();
9162 if (inventory)
9163 {
9164 InventoryLocation il = new InventoryLocation;
9167 }
9168
9170 }
9171
9173 {
9174 float quantity_max = 0;
9175
9177 {
9178 if (attSlotID != -1)
9179 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
9180
9181 if (quantity_max <= 0)
9183 }
9184
9185 if (quantity_max <= 0)
9187
9188 return quantity_max;
9189 }
9190
9192 {
9194 }
9195
9197 {
9199 }
9200
9201
9203 {
9205 }
9206
9208 {
9210 }
9211
9213 {
9215 }
9216
9217
9219 {
9220
9221 float weightEx = GetWeightEx();
9222 float special = GetInventoryAndCargoWeight();
9223 return weightEx - special;
9224 }
9225
9226
9228 {
9230 }
9231
9233 {
9235 {
9236 #ifdef DEVELOPER
9237 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9238 {
9239 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
9241 }
9242 #endif
9243
9245 }
9246 else if (HasEnergyManager())
9247 {
9248 #ifdef DEVELOPER
9249 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9250 {
9251 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
9252 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
9253 }
9254 #endif
9255 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
9256 }
9257 else
9258 {
9259 #ifdef DEVELOPER
9260 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9261 {
9262 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
9263 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
9264 }
9265 #endif
9266 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
9267 }
9268 }
9269
9272 {
9273 int item_count = 0;
9275
9276 GameInventory inventory = GetInventory();
9277 CargoBase cargo = inventory.
GetCargo();
9278 if (cargo != NULL)
9279 {
9281 }
9282
9284 for (int i = 0; i < nAttachments; ++i)
9285 {
9287 if (item)
9288 item_count += item.GetNumberOfItems();
9289 }
9290 return item_count;
9291 }
9292
9295 {
9296 float weight = 0;
9297 float wetness = 1;
9298 if (include_wetness)
9301 {
9302 weight = wetness * m_ConfigWeight;
9303 }
9305 {
9306 weight = 1;
9307 }
9308 return weight;
9309 }
9310
9311
9312
9314 {
9315 GameInventory inventory = GetInventory();
9316 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
9317 {
9318 array<EntityAI> items = new array<EntityAI>;
9320 for (int i = 0; i < items.Count(); ++i)
9321 {
9323 if (item)
9324 {
9325 g_Game.ObjectDelete(item);
9326 }
9327 }
9328 }
9329 }
9330
9331
9332
9333
9335 {
9336 float energy = 0;
9337 if (HasEnergyManager())
9338 {
9339 energy = GetCompEM().GetEnergy();
9340 }
9341 return energy;
9342 }
9343
9344
9346 {
9347 super.OnEnergyConsumed();
9348
9350 }
9351
9353 {
9354 super.OnEnergyAdded();
9355
9357 }
9358
9359
9361 {
9362 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
9363 {
9365 {
9366 float energy_0to1 = GetCompEM().GetEnergy0To1();
9368 }
9369 }
9370 }
9371
9372
9374 {
9375 return ConfigGetFloat("heatIsolation");
9376 }
9377
9379 {
9381 }
9382
9384 {
9385 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
9386 if (
g_Game.ConfigIsExisting(paramPath))
9387 return g_Game.ConfigGetFloat(paramPath);
9388
9389 return 0.0;
9390 }
9391
9393 {
9394 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
9395 if (
g_Game.ConfigIsExisting(paramPath))
9396 return g_Game.ConfigGetFloat(paramPath);
9397
9398 return 0.0;
9399 }
9400
9401 override void SetWet(
float value,
bool allow_client =
false)
9402 {
9403 if (!IsServerCheck(allow_client))
9404 return;
9405
9408
9410
9411 m_VarWet = Math.Clamp(value, min, max);
9412
9414 {
9417 }
9418 }
9419
9420 override void AddWet(
float value)
9421 {
9423 }
9424
9426 {
9428 }
9429
9431 {
9433 }
9434
9436 {
9438 }
9439
9441 {
9443 }
9444
9446 {
9448 }
9449
9451 {
9454 if (newLevel != oldLevel)
9455 {
9457 }
9458 }
9459
9461 {
9462 SetWeightDirty();
9463 }
9464
9466 {
9467 return GetWetLevelInternal(
m_VarWet);
9468 }
9469
9470
9471
9473 {
9475 }
9476
9478 {
9480 }
9481
9483 {
9485 }
9486
9488 {
9490 }
9491
9492
9493
9495 {
9496 if (ConfigIsExisting("itemModelLength"))
9497 {
9498 return ConfigGetFloat("itemModelLength");
9499 }
9500 return 0;
9501 }
9502
9504 {
9505 if (ConfigIsExisting("itemAttachOffset"))
9506 {
9507 return ConfigGetFloat("itemAttachOffset");
9508 }
9509 return 0;
9510 }
9511
9512 override void SetCleanness(
int value,
bool allow_client =
false)
9513 {
9514 if (!IsServerCheck(allow_client))
9515 return;
9516
9518
9520
9523 }
9524
9526 {
9528 }
9529
9531 {
9532 return true;
9533 }
9534
9535
9536
9537
9539 {
9541 }
9542
9544 {
9546 }
9547
9548
9549
9550
9551 override void SetColor(
int r,
int g,
int b,
int a)
9552 {
9558 }
9560 override void GetColor(out
int r,out
int g,out
int b,out
int a)
9561 {
9566 }
9567
9569 {
9571 }
9572
9575 {
9576 int r,g,b,a;
9578 r = r/255;
9579 g = g/255;
9580 b = b/255;
9581 a = a/255;
9582 return MiscGameplayFunctions.GetColorString(r, g, b, a);
9583 }
9584
9585
9586
9587 override void SetLiquidType(
int value,
bool allow_client =
false)
9588 {
9589 if (!IsServerCheck(allow_client))
9590 return;
9591
9596 }
9597
9599 {
9600 return ConfigGetInt("varLiquidTypeInit");
9601 }
9602
9604 {
9606 }
9607
9609 {
9611 SetFrozen(false);
9612 }
9613
9616 {
9617 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9618 }
9619
9620
9623 {
9624 PlayerBase nplayer;
9625 if (PlayerBase.CastTo(nplayer, player))
9626 {
9628 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9629 }
9630 }
9631
9632
9635 {
9636 PlayerBase nplayer;
9637 if (PlayerBase.CastTo(nplayer,player))
9638 {
9639 nplayer.SetEnableQuickBarEntityShortcut(this, false);
9640 }
9641
9642 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
9643
9644 if (HasEnergyManager())
9645 {
9646 GetCompEM().UpdatePlugState();
9647 }
9648 }
9649
9650
9652 {
9653 super.OnPlacementStarted(player);
9654
9656 }
9657
9658 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
9659 {
9661 {
9662 m_AdminLog.OnPlacementComplete(player,
this);
9663 }
9664
9665 super.OnPlacementComplete(player, position, orientation);
9666 }
9667
9668
9669
9670
9671
9673 {
9675 {
9676 return true;
9677 }
9678 else
9679 {
9680 return false;
9681 }
9682 }
9683
9684
9686 {
9688 {
9690 }
9691 }
9692
9693
9695 {
9697 }
9698
9700 {
9702 }
9703
9704 override void InsertAgent(
int agent,
float count = 1)
9705 {
9706 if (count < 1)
9707 return;
9708
9710 }
9711
9714 {
9716 }
9717
9718
9720 {
9722 }
9723
9724
9725
9726
9727
9728
9729
9730
9731
9732
9733
9734
9735
9736
9737
9738
9739
9740
9741
9742
9743
9744
9745
9746
9747
9748
9749
9750
9751
9752
9753
9754
9755
9756
9757
9758
9759
9760
9761
9762
9763
9764
9766 {
9768 return false;
9769 return true;
9770 }
9771
9773 {
9774
9776 }
9777
9778
9781 {
9782 super.CheckForRoofLimited(timeTresholdMS);
9783
9784 float time =
g_Game.GetTime();
9785 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
9786 {
9787 m_PreviousRoofTestTime = time;
9788 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
9789 }
9790 }
9791
9792
9794 {
9796 {
9797 return 0;
9798 }
9799
9800 if (GetInventory().GetAttachmentSlotsCount() != 0)
9801 {
9802 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
9803 if (filter)
9804 return filter.GetProtectionLevel(type, false, system);
9805 else
9806 return 0;
9807 }
9808
9809 string subclassPath, entryName;
9810
9811 switch (type)
9812 {
9814 entryName = "biological";
9815 break;
9817 entryName = "chemical";
9818 break;
9819 default:
9820 entryName = "biological";
9821 break;
9822 }
9823
9824 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
9825
9826 return g_Game.ConfigGetFloat(subclassPath + entryName);
9827 }
9828
9829
9830
9833 {
9834 if (!IsMagazine())
9836
9838 }
9839
9840
9841
9842
9843
9848 {
9849 return true;
9850 }
9851
9853 {
9855 }
9856
9857
9858
9859
9860
9862 {
9863 if (parent)
9864 {
9865 if (parent.IsInherited(DayZInfected))
9866 return true;
9867
9868 if (!parent.IsRuined())
9869 return true;
9870 }
9871
9872 return true;
9873 }
9874
9876 {
9877 if (!super.CanPutAsAttachment(parent))
9878 {
9879 return false;
9880 }
9881
9882 if (!IsRuined() && !parent.IsRuined())
9883 {
9884 return true;
9885 }
9886
9887 return false;
9888 }
9889
9891 {
9892
9893
9894
9895
9896 return super.CanReceiveItemIntoCargo(item);
9897 }
9898
9900 {
9901
9902
9903
9904
9905 GameInventory attachmentInv = attachment.GetInventory();
9907 {
9908 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
9909 return false;
9910 }
9911
9912 InventoryLocation loc = new InventoryLocation();
9913 attachment.GetInventory().GetCurrentInventoryLocation(loc);
9914 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
9915 return false;
9916
9917 return super.CanReceiveAttachment(attachment, slotId);
9918 }
9919
9921 {
9922 if (!super.CanReleaseAttachment(attachment))
9923 return false;
9924
9925 return GetInventory().AreChildrenAccessible();
9926 }
9927
9928
9929
9930
9931
9932
9933
9934
9935
9936
9937
9938
9939
9940
9941
9942
9943
9944
9945
9946
9947
9949 {
9950 int id = muzzle_owner.GetMuzzleID();
9951 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
9952
9953 if (WPOF_array)
9954 {
9955 for (int i = 0; i < WPOF_array.Count(); i++)
9956 {
9957 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
9958
9959 if (WPOF)
9960 {
9961 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
9962 }
9963 }
9964 }
9965 }
9966
9967
9969 {
9970 int id = muzzle_owner.GetMuzzleID();
9972
9973 if (WPOBE_array)
9974 {
9975 for (int i = 0; i < WPOBE_array.Count(); i++)
9976 {
9977 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
9978
9979 if (WPOBE)
9980 {
9981 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
9982 }
9983 }
9984 }
9985 }
9986
9987
9989 {
9990 int id = muzzle_owner.GetMuzzleID();
9991 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9992
9993 if (WPOOH_array)
9994 {
9995 for (int i = 0; i < WPOOH_array.Count(); i++)
9996 {
9997 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9998
9999 if (WPOOH)
10000 {
10001 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10002 }
10003 }
10004 }
10005 }
10006
10007
10009 {
10010 int id = muzzle_owner.GetMuzzleID();
10011 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10012
10013 if (WPOOH_array)
10014 {
10015 for (int i = 0; i < WPOOH_array.Count(); i++)
10016 {
10017 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10018
10019 if (WPOOH)
10020 {
10021 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10022 }
10023 }
10024 }
10025 }
10026
10027
10029 {
10030 int id = muzzle_owner.GetMuzzleID();
10031 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10032
10033 if (WPOOH_array)
10034 {
10035 for (int i = 0; i < WPOOH_array.Count(); i++)
10036 {
10037 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10038
10039 if (WPOOH)
10040 {
10041 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10042 }
10043 }
10044 }
10045 }
10046
10047
10048
10050 {
10052 {
10053 return true;
10054 }
10055
10056 return false;
10057 }
10058
10060 {
10062 {
10063 return true;
10064 }
10065
10066 return false;
10067 }
10068
10070 {
10072 {
10073 return true;
10074 }
10075
10076 return false;
10077 }
10078
10080 {
10081 return false;
10082 }
10083
10086 {
10087 return UATimeSpent.DEFAULT_DEPLOY;
10088 }
10089
10090
10091
10092
10094 {
10096 SetSynchDirty();
10097 }
10098
10100 {
10102 }
10103
10104
10106 {
10107 return false;
10108 }
10109
10112 {
10113 string att_type = "None";
10114
10115 if (ConfigIsExisting("soundAttType"))
10116 {
10117 att_type = ConfigGetString("soundAttType");
10118 }
10119
10121 }
10122
10124 {
10126 }
10127
10128
10129
10130
10131
10137
10139 {
10142
10144 }
10145
10146
10148 {
10150 return;
10151
10153
10156
10159
10160 SoundParameters params = new SoundParameters();
10164 }
10165
10166
10168 {
10170 {
10173
10174 SetSynchDirty();
10175
10178 }
10179 }
10180
10182 {
10184 }
10185
10186
10188 {
10190 return;
10191
10193 SetSynchDirty();
10194
10197 }
10198
10200 {
10203 }
10204
10206 {
10208 }
10209
10210 void OnApply(PlayerBase player);
10211
10213 {
10214 return 1.0;
10215 };
10216
10218 {
10220 }
10221
10223 {
10225 }
10226
10228
10230 {
10231 SetDynamicPhysicsLifeTime(0.01);
10233 }
10234
10236 {
10237 array<string> zone_names = new array<string>;
10238 GetDamageZones(zone_names);
10239 for (int i = 0; i < zone_names.Count(); i++)
10240 {
10241 SetHealthMax(zone_names.Get(i),"Health");
10242 }
10243 SetHealthMax("","Health");
10244 }
10245
10248 {
10249 float global_health = GetHealth01("","Health");
10250 array<string> zones = new array<string>;
10251 GetDamageZones(zones);
10252
10253 for (int i = 0; i < zones.Count(); i++)
10254 {
10255 SetHealth01(zones.Get(i),"Health",global_health);
10256 }
10257 }
10258
10261 {
10262 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
10263 }
10264
10266 {
10267 if (!hasRootAsPlayer)
10268 {
10269 if (refParentIB)
10270 {
10271
10272 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
10273 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
10274
10275 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
10276 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
10277
10280 }
10281 else
10282 {
10283
10286 }
10287 }
10288 }
10289
10291 {
10293 {
10294 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
10295 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
10296 {
10297 float heatPermCoef = 1.0;
10299 while (ent)
10300 {
10301 heatPermCoef *= ent.GetHeatPermeabilityCoef();
10302 ent = ent.GetHierarchyParent();
10303 }
10304
10305 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
10306 }
10307 }
10308 }
10309
10311 {
10312
10313 EntityAI parent = GetHierarchyParent();
10314 if (!parent)
10315 {
10316 hasParent = false;
10317 hasRootAsPlayer = false;
10318 }
10319 else
10320 {
10321 hasParent = true;
10322 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
10323 refParentIB =
ItemBase.Cast(parent);
10324 }
10325 }
10326
10327 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
10328 {
10329
10330 }
10331
10333 {
10334
10335 return false;
10336 }
10337
10339 {
10340
10341
10342 return false;
10343 }
10344
10346 {
10347
10348 return false;
10349 }
10350
10353 {
10354 return !GetIsFrozen() &&
IsOpen();
10355 }
10356
10358 {
10359 bool hasParent = false, hasRootAsPlayer = false;
10361
10362 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
10363 bool foodDecay =
g_Game.IsFoodDecayEnabled();
10364
10365 if (wwtu || foodDecay)
10366 {
10370
10371 if (processWetness || processTemperature || processDecay)
10372 {
10374
10375 if (processWetness)
10376 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
10377
10378 if (processTemperature)
10380
10381 if (processDecay)
10382 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
10383 }
10384 }
10385 }
10386
10389 {
10391 }
10392
10394 {
10397
10398 return super.GetTemperatureFreezeThreshold();
10399 }
10400
10402 {
10405
10406 return super.GetTemperatureThawThreshold();
10407 }
10408
10410 {
10413
10414 return super.GetItemOverheatThreshold();
10415 }
10416
10418 {
10420 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
10421
10422 return super.GetTemperatureFreezeTime();
10423 }
10424
10426 {
10428 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
10429
10430 return super.GetTemperatureThawTime();
10431 }
10432
10437
10439 {
10440 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
10441 }
10442
10444 {
10445 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
10446 }
10447
10450 {
10452 }
10453
10455 {
10457 }
10458
10460 {
10462 }
10463
10466 {
10467 return null;
10468 }
10469
10472 {
10473 return false;
10474 }
10475
10477 {
10479 {
10482 if (!trg)
10483 {
10485 explosive = this;
10486 }
10487
10488 explosive.PairRemote(trg);
10490
10491 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
10492 trg.SetPersistentPairID(persistentID);
10493 explosive.SetPersistentPairID(persistentID);
10494
10495 return true;
10496 }
10497 return false;
10498 }
10499
10502 {
10503 float ret = 1.0;
10506 ret *= GetHealth01();
10507
10508 return ret;
10509 }
10510
10511 #ifdef DEVELOPER
10512 override void SetDebugItem()
10513 {
10514 super.SetDebugItem();
10515 _itemBase = this;
10516 }
10517
10519 {
10520 string text = super.GetDebugText();
10521
10523 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
10524
10525 return text;
10526 }
10527 #endif
10528
10530 {
10531 return true;
10532 }
10533
10535
10537
10539 {
10542 }
10543
10544
10552
10568
10569 [
Obsolete(
"Use ItemSoundHandler instead")]
10572 {
10573 if (!
g_Game.IsDedicatedServer())
10574 {
10575 if (ConfigIsExisting("attachSoundSet"))
10576 {
10577 string cfg_path = "";
10578 string soundset = "";
10579 string type_name =
GetType();
10580
10583 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
10584 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
10585
10586 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
10587 {
10588 for (int i = 0; i < cfg_soundset_array.Count(); i++)
10589 {
10590 if (cfg_slot_array[i] == slot_type)
10591 {
10592 soundset = cfg_soundset_array[i];
10593 break;
10594 }
10595 }
10596 }
10597
10598 if (soundset != "")
10599 {
10600 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
10602 }
10603 }
10604 }
10605 }
10606
10608}
10609
10611{
10613 if (entity)
10614 {
10615 bool is_item = entity.IsInherited(
ItemBase);
10616 if (is_item && full_quantity)
10617 {
10620 }
10621 }
10622 else
10623 {
10625 return NULL;
10626 }
10627 return entity;
10628}
10629
10631{
10632 if (item)
10633 {
10634 if (health > 0)
10635 item.SetHealth("", "", health);
10636
10637 if (item.CanHaveTemperature())
10638 {
10640 if (item.CanFreeze())
10641 item.SetFrozen(false);
10642 }
10643
10644 if (item.HasEnergyManager())
10645 {
10646 if (quantity >= 0)
10647 {
10648 item.GetCompEM().SetEnergy0To1(quantity);
10649 }
10650 else
10651 {
10653 }
10654 }
10655 else if (item.IsMagazine())
10656 {
10657 Magazine mag = Magazine.Cast(item);
10658 if (quantity >= 0)
10659 {
10660 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
10661 }
10662 else
10663 {
10665 }
10666
10667 }
10668 else
10669 {
10670 if (quantity >= 0)
10671 {
10672 item.SetQuantityNormalized(quantity, false);
10673 }
10674 else
10675 {
10677 }
10678
10679 }
10680 }
10681}
10682
10683#ifdef DEVELOPER
10685#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.