5718{
5720 {
5721 return true;
5722 }
5723};
5724
5726{
5727
5728};
5729
5730
5731
5733{
5737
5739
5742
5743
5744
5745
5746
5755
5761
5766
5771
5792 protected bool m_IsResultOfSplit
5793
5795
5800
5801
5802
5804
5808
5809
5810
5812
5815
5816
5817
5823
5824
5832
5835
5836
5838
5839
5841
5842
5847
5848
5853
5855
5856
5858
5859
5861 {
5866
5867 if (!
g_Game.IsDedicatedServer())
5868 {
5870 {
5872
5874 {
5876 }
5877 }
5878
5881 }
5882
5883 m_OldLocation = null;
5884
5886 {
5888 }
5889
5890 if (ConfigIsExisting("headSelectionsToHide"))
5891 {
5894 }
5895
5897 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
5898 {
5900 }
5901
5903
5904 m_IsResultOfSplit = false;
5905
5907 }
5908
5910 {
5911 super.InitItemVariables();
5912
5918 m_Count = ConfigGetInt(
"count");
5919
5922
5927
5930
5935
5947
5951
5952
5955 if (ConfigIsExisting("canBeSplit"))
5956 {
5959 }
5960
5962 if (ConfigIsExisting("itemBehaviour"))
5964
5965
5968 RegisterNetSyncVariableInt("m_VarLiquidType");
5969 RegisterNetSyncVariableInt("m_Cleanness",0,1);
5970
5971 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
5972 RegisterNetSyncVariableFloat("m_ImpactSpeed");
5973 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
5974
5975 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
5976 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
5977 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
5978 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
5979
5980 RegisterNetSyncVariableBool("m_IsBeingPlaced");
5981 RegisterNetSyncVariableBool("m_IsTakeable");
5982 RegisterNetSyncVariableBool("m_IsHologram");
5983
5986 {
5989 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
5990 }
5991
5993
5995 if (ConfigIsExisting("temperaturePerQuantityWeight"))
5997
5999 }
6000
6002 {
6004 }
6005
6007 {
6010 {
6015 }
6016 }
6017
6018 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
6019 {
6021 {
6024 }
6025
6027 }
6028
6030 {
6036 }
6037
6039
6041 {
6043
6044 if (!action)
6045 {
6046 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
6047 return;
6048 }
6049
6051 if (!ai)
6052 {
6054 return;
6055 }
6056
6058 if (!action_array)
6059 {
6060 action_array = new array<ActionBase_Basic>;
6062 }
6063 if (LogManager.IsActionLogEnable())
6064 {
6065 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
6066 }
6067
6068 if (action_array.Find(action) != -1)
6069 {
6070 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
6071 }
6072 else
6073 {
6074 action_array.Insert(action);
6075 }
6076 }
6077
6079 {
6080 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6081 ActionBase action = player.GetActionManager().GetAction(actionName);
6084
6085 if (action_array)
6086 {
6087 action_array.RemoveItem(action);
6088 }
6089 }
6090
6091
6092
6094 {
6095 ActionOverrideData overrideData = new ActionOverrideData();
6099
6101 if (!actionMap)
6102 {
6105 }
6106
6107 actionMap.Insert(this.
Type(), overrideData);
6108
6109 }
6110
6112
6114
6115
6117 {
6120
6123
6124 string config_to_search = "CfgVehicles";
6125 string muzzle_owner_config;
6126
6128 {
6129 if (IsInherited(Weapon))
6130 config_to_search = "CfgWeapons";
6131
6132 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6133
6134 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
6135
6136 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
6137
6138 if (config_OnFire_subclass_count > 0)
6139 {
6140 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
6141
6142 for (int i = 0; i < config_OnFire_subclass_count; i++)
6143 {
6144 string particle_class = "";
6145 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
6146 string config_OnFire_entry = config_OnFire_class + particle_class;
6147 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
6148 WPOF_array.Insert(WPOF);
6149 }
6150
6151
6153 }
6154 }
6155
6157 {
6158 config_to_search = "CfgWeapons";
6159 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6160
6161 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
6162
6163 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
6164
6165 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
6166 {
6167 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
6168
6169 for (i = 0; i < config_OnBulletCasingEject_count; i++)
6170 {
6171 string particle_class2 = "";
6172 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
6173 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
6174 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
6175 WPOBE_array.Insert(WPOBE);
6176 }
6177
6178
6180 }
6181 }
6182 }
6183
6184
6186 {
6189
6191 {
6192 string config_to_search = "CfgVehicles";
6193
6194 if (IsInherited(Weapon))
6195 config_to_search = "CfgWeapons";
6196
6197 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6198 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
6199
6200 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
6201 {
6202
6204
6206 {
6208 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
6210 return;
6211 }
6212
6215
6216
6217
6218 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
6219 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
6220
6221 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
6222 {
6223 string particle_class = "";
6224 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
6225 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
6226 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
6227
6228 if (entry_type == CT_CLASS)
6229 {
6230 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
6231 WPOOH_array.Insert(WPOF);
6232 }
6233 }
6234
6235
6237 }
6238 }
6239 }
6240
6242 {
6244 }
6245
6247 {
6249 {
6251
6254
6257
6258 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6259 }
6260 }
6261
6263 {
6265 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6266
6268 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6269
6271 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6272
6274 {
6276 }
6277 }
6278
6280 {
6282 }
6283
6285 {
6288 else
6290
6292 {
6295 }
6296 else
6297 {
6300
6303 }
6304
6306 }
6307
6309 {
6311 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6312 }
6313
6315 {
6317 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6319 }
6320
6322 {
6324 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6325 }
6326
6328 {
6331
6332 OverheatingParticle OP = new OverheatingParticle();
6337
6339 }
6340
6342 {
6345
6346 return -1;
6347 }
6348
6350 {
6352 {
6355
6356 for (int i = count; i > 0; --i)
6357 {
6358 int id = i - 1;
6361
6364
6365 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
6366 {
6367 if (p)
6368 {
6371 }
6372 }
6373 }
6374 }
6375 }
6376
6378 {
6380 {
6382 {
6383 int id = i - 1;
6385
6386 if (OP)
6387 {
6389
6390 if (p)
6391 {
6393 }
6394
6395 delete OP;
6396 }
6397 }
6398
6401 }
6402 }
6403
6406 {
6407 return 0.0;
6408 }
6409
6410
6412 {
6413 return 250;
6414 }
6415
6417 {
6418 return 0;
6419 }
6420
6423 {
6425 return true;
6426
6427 return false;
6428 }
6429
6432 {
6435
6437 {
6439 }
6440 else
6441 {
6442
6444 }
6445
6447 }
6448
6455 {
6456 return -1;
6457 }
6458
6459
6460
6461
6463 {
6465 {
6466 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6467 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6468
6469 if (r_index >= 0)
6470 {
6471 InventoryLocation r_il = new InventoryLocation;
6472 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6473
6474 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6477 {
6478 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6479 }
6481 {
6482 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6483 }
6484
6485 }
6486
6487 player.GetHumanInventory().ClearUserReservedLocation(this);
6488 }
6489
6492 }
6493
6494
6495
6496
6498 {
6499 return ItemBase.m_DebugActionsMask;
6500 }
6501
6503 {
6504 return ItemBase.m_DebugActionsMask & mask;
6505 }
6506
6508 {
6509 ItemBase.m_DebugActionsMask = mask;
6510 }
6511
6513 {
6514 ItemBase.m_DebugActionsMask |= mask;
6515 }
6516
6518 {
6519 ItemBase.m_DebugActionsMask &= ~mask;
6520 }
6521
6523 {
6525 {
6527 }
6528 else
6529 {
6531 }
6532 }
6533
6534
6536 {
6537 if (GetEconomyProfile())
6538 {
6539 float q_max = GetEconomyProfile().GetQuantityMax();
6540 if (q_max > 0)
6541 {
6542 float q_min = GetEconomyProfile().GetQuantityMin();
6543 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
6544
6546 {
6547 ComponentEnergyManager comp = GetCompEM();
6549 {
6551 }
6552 }
6554 {
6556
6557 }
6558
6559 }
6560 }
6561 }
6562
6565 {
6566 EntityAI parent = GetHierarchyParent();
6567
6568 if (parent)
6569 {
6570 InventoryLocation inventory_location_to_lock = new InventoryLocation;
6571 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
6572 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
6573 }
6574 }
6575
6578 {
6579 EntityAI parent = GetHierarchyParent();
6580
6581 if (parent)
6582 {
6583 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
6584 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
6585 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
6586 }
6587 }
6588
6590 {
6591
6592
6593
6594
6596
6598 {
6599 if (ScriptInputUserData.CanStoreInputUserData())
6600 {
6601 ScriptInputUserData ctx = new ScriptInputUserData;
6607 ctx.
Write(use_stack_max);
6610
6612 {
6613 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
6614 }
6615 }
6616 }
6617 else if (!
g_Game.IsMultiplayer())
6618 {
6620 }
6621 }
6622
6624 {
6626 }
6627
6629 {
6631 }
6632
6634 {
6636 }
6637
6639 {
6640
6641 return false;
6642 }
6643
6645 {
6646 return false;
6647 }
6648
6652 {
6653 return false;
6654 }
6655
6657 {
6658 return "";
6659 }
6660
6662
6664 {
6665 return false;
6666 }
6667
6669 {
6670 return true;
6671 }
6672
6673
6674
6676 {
6677 return true;
6678 }
6679
6681 {
6682 return true;
6683 }
6684
6686 {
6687 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6689 }
6690
6692 {
6694 }
6695
6697 {
6699 if (!is_being_placed)
6701 SetSynchDirty();
6702 }
6703
6704
6706
6708 {
6710 }
6711
6713 {
6715 }
6716
6718 {
6719 return 1;
6720 }
6721
6723 {
6724 return false;
6725 }
6726
6728 {
6730 SetSynchDirty();
6731 }
6732
6733
6734
6735
6736
6737
6738
6739
6740
6741
6742
6743
6744
6745
6746
6747
6748
6749
6750
6751
6752
6753
6754
6755
6756
6757
6758
6759
6760
6761
6762
6763
6764
6765
6766
6768 {
6769 super.OnMovedInsideCargo(container);
6770
6771 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6772 }
6773
6774 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
6775 {
6776 super.EEItemLocationChanged(oldLoc, newLoc);
6777
6778 PlayerBase newPlayer = null;
6779 PlayerBase oldPlayer = null;
6780
6781 if (newLoc.GetParent())
6782 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
6783
6784 if (oldLoc.GetParent())
6785 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
6786
6788 {
6789 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
6790
6791 if (rIndex >= 0)
6792 {
6793 InventoryLocation rIl = new InventoryLocation;
6794 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
6795
6796 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
6799 {
6800 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
6801 }
6803 {
6805 }
6806
6807 }
6808 }
6809
6811 {
6812 if (newPlayer)
6813 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
6814
6815 if (newPlayer == oldPlayer)
6816 {
6817 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
6818 {
6820 {
6821 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
6822 {
6823 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6824 }
6825 }
6826 else
6827 {
6828 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6829 }
6830 }
6831
6832 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
6833 {
6834 int type = oldLoc.GetType();
6836 {
6837 oldLoc.GetParent().GetOnSetLock().Invoke(this);
6838 }
6840 {
6841 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
6842 }
6843 }
6844 if (!m_OldLocation)
6845 {
6846 m_OldLocation = new InventoryLocation;
6847 }
6848 m_OldLocation.Copy(oldLoc);
6849 }
6850 else
6851 {
6852 if (m_OldLocation)
6853 {
6854 m_OldLocation.Reset();
6855 }
6856 }
6857
6858 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
6859 }
6860 else
6861 {
6862 if (newPlayer)
6863 {
6864 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
6865 if (resIndex >= 0)
6866 {
6867 InventoryLocation il = new InventoryLocation;
6868 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
6870 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
6873 {
6874 il.
GetParent().GetOnReleaseLock().Invoke(it);
6875 }
6877 {
6879 }
6880
6881 }
6882 }
6884 {
6885
6887 }
6888
6889 if (m_OldLocation)
6890 {
6891 m_OldLocation.Reset();
6892 }
6893 }
6894
6896 {
6897 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
6898 }
6899
6901 {
6902 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
6903 }
6904 }
6905
6906 override void EOnContact(IEntity other, Contact extra)
6907 {
6909 {
6910 int liquidType = -1;
6912 if (impactSpeed > 0.0)
6913 {
6915 #ifndef SERVER
6917 #else
6919 SetSynchDirty();
6920 #endif
6922 }
6923 }
6924
6925 #ifdef SERVER
6926 if (GetCompEM() && GetCompEM().IsPlugged())
6927 {
6928 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
6929 GetCompEM().UnplugThis();
6930 }
6931 #endif
6932 }
6933
6935
6937 {
6939 }
6940
6942 {
6943
6944 }
6945
6947 {
6948 super.OnItemLocationChanged(old_owner, new_owner);
6949
6950 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
6951 PlayerBase playerNew = PlayerBase.Cast(new_owner);
6952
6953 if (!relatedPlayer && playerNew)
6954 relatedPlayer = playerNew;
6955
6956 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
6957 {
6959 if (actionMgr)
6960 {
6961 ActionBase currentAction = actionMgr.GetRunningAction();
6962 if (currentAction)
6964 }
6965 }
6966
6967 Man ownerPlayerOld = null;
6968 Man ownerPlayerNew = null;
6969
6970 if (old_owner)
6971 {
6972 if (old_owner.
IsMan())
6973 {
6974 ownerPlayerOld = Man.Cast(old_owner);
6975 }
6976 else
6977 {
6978 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
6979 }
6980 }
6981 else
6982 {
6984 {
6986
6987 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
6988 {
6989 GetCompEM().UnplugThis();
6990 }
6991 }
6992 }
6993
6994 if (new_owner)
6995 {
6996 if (new_owner.
IsMan())
6997 {
6998 ownerPlayerNew = Man.Cast(new_owner);
6999 }
7000 else
7001 {
7002 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
7003 }
7004 }
7005
7006 if (ownerPlayerOld != ownerPlayerNew)
7007 {
7008 if (ownerPlayerOld)
7009 {
7010 array<EntityAI> subItemsExit = new array<EntityAI>;
7012 for (int i = 0; i < subItemsExit.Count(); i++)
7013 {
7016 }
7017 }
7018
7019 if (ownerPlayerNew)
7020 {
7021 array<EntityAI> subItemsEnter = new array<EntityAI>;
7023 for (int j = 0; j < subItemsEnter.Count(); j++)
7024 {
7027 }
7028 }
7029 }
7030 else if (ownerPlayerNew != null)
7031 {
7032 PlayerBase nplayer;
7033 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
7034 {
7035 array<EntityAI> subItemsUpdate = new array<EntityAI>;
7037 for (int k = 0; k < subItemsUpdate.Count(); k++)
7038 {
7040 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
7041 }
7042 }
7043 }
7044
7045 if (old_owner)
7046 old_owner.OnChildItemRemoved(this);
7047 if (new_owner)
7048 new_owner.OnChildItemReceived(this);
7049 }
7050
7051
7053 {
7054 super.EEDelete(parent);
7055 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
7056 if (player)
7057 {
7059
7060 if (player.IsAlive())
7061 {
7062 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7063 if (r_index >= 0)
7064 {
7065 InventoryLocation r_il = new InventoryLocation;
7066 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7067
7068 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7071 {
7072 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7073 }
7075 {
7076 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7077 }
7078
7079 }
7080
7081 player.RemoveQuickBarEntityShortcut(this);
7082 }
7083 }
7084 }
7085
7087 {
7088 super.EEKilled(killer);
7089
7092 {
7093 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
7094 {
7095 if (IsMagazine())
7096 {
7097 if (Magazine.Cast(this).GetAmmoCount() > 0)
7098 {
7100 }
7101 }
7102 else
7103 {
7105 }
7106 }
7107 }
7108 }
7109
7111 {
7112 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7113
7114 super.OnWasAttached(parent, slot_id);
7115
7118
7121 }
7122
7124 {
7125 super.OnWasDetached(parent, slot_id);
7126
7129
7132 }
7133
7135 {
7136 int idx;
7139
7140 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7141 if (inventory_slots.Count() < 1)
7142 {
7143 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
7144 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
7145 }
7146 else
7147 {
7148 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
7149 }
7150
7151 idx = inventory_slots.Find(slot);
7152 if (idx < 0)
7153 return "";
7154
7155 return attach_types.Get(idx);
7156 }
7157
7159 {
7160 int idx = -1;
7161 string slot;
7162
7165
7166 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7167 if (inventory_slots.Count() < 1)
7168 {
7169 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
7170 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7171 }
7172 else
7173 {
7174 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
7175 if (detach_types.Count() < 1)
7176 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7177 }
7178
7179 for (int i = 0; i < inventory_slots.Count(); i++)
7180 {
7181 slot = inventory_slots.Get(i);
7182 }
7183
7184 if (slot != "")
7185 {
7186 if (detach_types.Count() == 1)
7187 idx = 0;
7188 else
7189 idx = inventory_slots.Find(slot);
7190 }
7191 if (idx < 0)
7192 return "";
7193
7194 return detach_types.Get(idx);
7195 }
7196
7198 {
7199
7201
7202
7203 float min_time = 1;
7204 float max_time = 3;
7205 float delay = Math.RandomFloat(min_time, max_time);
7206
7207 explode_timer.Run(delay, this, "DoAmmoExplosion");
7208 }
7209
7211 {
7212 Magazine magazine = Magazine.Cast(this);
7213 int pop_sounds_count = 6;
7214 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
7215
7216
7217 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
7218 string sound_name = pop_sounds[ sound_idx ];
7219 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
7220
7221
7222 magazine.ServerAddAmmoCount(-1);
7223
7224
7225 float min_temp_to_explode = 100;
7226
7227 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
7228 {
7230 }
7231 }
7232
7233
7234 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
7235 {
7236 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
7237
7238 const int CHANCE_DAMAGE_CARGO = 4;
7239 const int CHANCE_DAMAGE_ATTACHMENT = 1;
7240 const int CHANCE_DAMAGE_NOTHING = 2;
7241
7243 {
7244 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
7245 int chances;
7246 int rnd;
7247
7248 if (GetInventory().GetCargo())
7249 {
7250 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7251 rnd = Math.RandomInt(0,chances);
7252
7253 if (rnd < CHANCE_DAMAGE_CARGO)
7254 {
7256 }
7257 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
7258 {
7260 }
7261 }
7262 else
7263 {
7264 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7265 rnd = Math.RandomInt(0,chances);
7266
7267 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
7268 {
7270 }
7271 }
7272 }
7273 }
7274
7276 {
7277 CargoBase cargo = GetInventory().GetCargo();
7278 if (cargo)
7279 {
7281 if (item_count > 0)
7282 {
7283 int random_pick = Math.RandomInt(0, item_count);
7285 if (!item.IsExplosive())
7286 {
7287 item.AddHealth("","",damage);
7288 return true;
7289 }
7290 }
7291 }
7292 return false;
7293 }
7294
7296 {
7297 GameInventory inventory = GetInventory();
7299 if (attachment_count > 0)
7300 {
7301 int random_pick = Math.RandomInt(0, attachment_count);
7303 if (!attachment.IsExplosive())
7304 {
7305 attachment.AddHealth("","",damage);
7306 return true;
7307 }
7308 }
7309 return false;
7310 }
7311
7313 {
7315 }
7316
7318 {
7320 return GetInventory().CanRemoveEntity();
7321
7322 return false;
7323 }
7324
7326 {
7327
7329 return false;
7330
7331
7333 return false;
7334
7335
7336
7338 if (delta == 0)
7339 return false;
7340
7341
7342 return true;
7343 }
7344
7346 {
7348 {
7349 if (ScriptInputUserData.CanStoreInputUserData())
7350 {
7351 ScriptInputUserData ctx = new ScriptInputUserData;
7356 ctx.
Write(destination_entity);
7360 }
7361 }
7362 else if (!
g_Game.IsMultiplayer())
7363 {
7365 }
7366 }
7367
7369 {
7370 float split_quantity_new;
7374 InventoryLocation loc = new InventoryLocation;
7375
7376 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7377 {
7379 split_quantity_new = stack_max;
7380 else
7382
7384 {
7385 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7386 if (new_item)
7387 {
7388 new_item.SetResultOfSplit(true);
7389 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7391 new_item.
SetQuantity(split_quantity_new,
false,
true);
7392 }
7393 }
7394 }
7395 else if (destination_entity && slot_id == -1)
7396 {
7397 if (quantity > stack_max)
7398 split_quantity_new = stack_max;
7399 else
7400 split_quantity_new = quantity;
7401
7403 {
7404 GameInventory destinationInventory = destination_entity.GetInventory();
7406 {
7409 }
7410
7411 if (new_item)
7412 {
7413 new_item.SetResultOfSplit(true);
7414 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7416 new_item.
SetQuantity(split_quantity_new,
false,
true);
7417 }
7418 }
7419 }
7420 else
7421 {
7422 if (stack_max != 0)
7423 {
7425 {
7427 }
7428
7429 if (split_quantity_new == 0)
7430 {
7431 if (!
g_Game.IsMultiplayer())
7432 player.PhysicalPredictiveDropItem(this);
7433 else
7434 player.ServerDropEntity(this);
7435 return;
7436 }
7437
7439 {
7441
7442 if (new_item)
7443 {
7444 new_item.SetResultOfSplit(true);
7445 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7448 new_item.PlaceOnSurface();
7449 }
7450 }
7451 }
7452 }
7453 }
7454
7456 {
7457 float split_quantity_new;
7461 InventoryLocation loc = new InventoryLocation;
7462
7463 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7464 {
7466 split_quantity_new = stack_max;
7467 else
7469
7471 {
7472 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7473 if (new_item)
7474 {
7475 new_item.SetResultOfSplit(true);
7476 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7478 new_item.
SetQuantity(split_quantity_new,
false,
true);
7479 }
7480 }
7481 }
7482 else if (destination_entity && slot_id == -1)
7483 {
7484 if (quantity > stack_max)
7485 split_quantity_new = stack_max;
7486 else
7487 split_quantity_new = quantity;
7488
7490 {
7491 GameInventory destinationInventory = destination_entity.GetInventory();
7493 {
7496 }
7497
7498 if (new_item)
7499 {
7500 new_item.SetResultOfSplit(true);
7501 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7503 new_item.
SetQuantity(split_quantity_new,
false,
true);
7504 }
7505 }
7506 }
7507 else
7508 {
7509 if (stack_max != 0)
7510 {
7512 {
7514 }
7515
7517 {
7519
7520 if (new_item)
7521 {
7522 new_item.SetResultOfSplit(true);
7523 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7526 new_item.PlaceOnSurface();
7527 }
7528 }
7529 }
7530 }
7531 }
7532
7534 {
7536 {
7537 if (ScriptInputUserData.CanStoreInputUserData())
7538 {
7539 ScriptInputUserData ctx = new ScriptInputUserData;
7544 dst.WriteToContext(ctx);
7546 }
7547 }
7548 else if (!
g_Game.IsMultiplayer())
7549 {
7551 }
7552 }
7553
7555 {
7557 {
7558 if (ScriptInputUserData.CanStoreInputUserData())
7559 {
7560 ScriptInputUserData ctx = new ScriptInputUserData;
7565 ctx.
Write(destination_entity);
7571 }
7572 }
7573 else if (!
g_Game.IsMultiplayer())
7574 {
7576 }
7577 }
7578
7580 {
7582 }
7583
7585 {
7587 float split_quantity_new;
7589 if (dst.IsValid())
7590 {
7591 int slot_id = dst.GetSlot();
7593
7594 if (quantity > stack_max)
7595 split_quantity_new = stack_max;
7596 else
7597 split_quantity_new = quantity;
7598
7600 {
7602
7603 if (new_item)
7604 {
7605 new_item.SetResultOfSplit(true);
7606 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7608 new_item.
SetQuantity(split_quantity_new,
false,
true);
7609 }
7610
7611 return new_item;
7612 }
7613 }
7614
7615 return null;
7616 }
7617
7619 {
7621 float split_quantity_new;
7623 if (destination_entity)
7624 {
7626 if (quantity > stackable)
7627 split_quantity_new = stackable;
7628 else
7629 split_quantity_new = quantity;
7630
7632 {
7633 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
7634 if (new_item)
7635 {
7636 new_item.SetResultOfSplit(true);
7637 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7639 new_item.
SetQuantity(split_quantity_new,
false,
true);
7640 }
7641 }
7642 }
7643 }
7644
7646 {
7648 {
7649 if (ScriptInputUserData.CanStoreInputUserData())
7650 {
7651 ScriptInputUserData ctx = new ScriptInputUserData;
7656 ItemBase destination_entity =
this;
7657 ctx.
Write(destination_entity);
7661 }
7662 }
7663 else if (!
g_Game.IsMultiplayer())
7664 {
7666 }
7667 }
7668
7670 {
7672 float split_quantity_new;
7674 if (player)
7675 {
7677 if (quantity > stackable)
7678 split_quantity_new = stackable;
7679 else
7680 split_quantity_new = quantity;
7681
7683 {
7684 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
7685 new_item =
ItemBase.Cast(in_hands);
7686 if (new_item)
7687 {
7688 new_item.SetResultOfSplit(true);
7689 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7691 new_item.SetQuantity(split_quantity_new, false, true);
7692 }
7693 }
7694 }
7695 }
7696
7698 {
7700 float split_quantity_new = Math.Floor(quantity * 0.5);
7701
7703 return;
7704
7706
7707 if (new_item)
7708 {
7709 if (new_item.GetQuantityMax() < split_quantity_new)
7710 {
7711 split_quantity_new = new_item.GetQuantityMax();
7712 }
7713
7714 new_item.SetResultOfSplit(true);
7715 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7716
7718 {
7721 }
7722 else
7723 {
7725 new_item.
SetQuantity(split_quantity_new,
false,
true);
7726 }
7727 }
7728 }
7729
7731 {
7733 float split_quantity_new = Math.Floor(quantity / 2);
7734
7736 return;
7737
7738 InventoryLocation invloc = new InventoryLocation;
7740
7742 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
7743
7744 if (new_item)
7745 {
7746 if (new_item.GetQuantityMax() < split_quantity_new)
7747 {
7748 split_quantity_new = new_item.GetQuantityMax();
7749 }
7751 {
7754 }
7755 else if (split_quantity_new > 1)
7756 {
7758 new_item.
SetQuantity(split_quantity_new,
false,
true);
7759 }
7760 }
7761 }
7762
7765 {
7766 SetWeightDirty();
7768
7769 if (parent)
7770 parent.OnAttachmentQuantityChangedEx(this, delta);
7771
7773 {
7775 {
7777 }
7779 {
7780 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
7782 }
7783 }
7784 }
7785
7788 {
7789
7790 }
7791
7794 {
7796 }
7797
7799 {
7800 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
7801
7803 {
7804 if (newLevel == GameConstants.STATE_RUINED)
7805 {
7807 EntityAI parent = GetHierarchyParent();
7808 if (parent && parent.IsFireplace())
7809 {
7810 CargoBase cargo = GetInventory().GetCargo();
7811 if (cargo)
7812 {
7814 {
7816 }
7817 }
7818 }
7819 }
7820
7822 {
7823
7825 return;
7826 }
7827
7828 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
7829 {
7831 }
7832 }
7833 }
7834
7835
7837 {
7838 super.OnRightClick();
7839
7841 {
7843 {
7844 if (ScriptInputUserData.CanStoreInputUserData())
7845 {
7846 EntityAI root = GetHierarchyRoot();
7847 Man playerOwner = GetHierarchyRootPlayer();
7848 InventoryLocation dst = new InventoryLocation;
7849
7850
7851 if (!playerOwner && root && root == this)
7852 {
7854 }
7855 else
7856 {
7857
7858 GetInventory().GetCurrentInventoryLocation(dst);
7860 {
7861 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7863 {
7865 }
7866 else
7867 {
7869
7870
7871 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
7872 {
7874 }
7875 else
7876 {
7877 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
7878 }
7879 }
7880 }
7881 }
7882
7883 ScriptInputUserData ctx = new ScriptInputUserData;
7891 }
7892 }
7893 else if (!
g_Game.IsMultiplayer())
7894 {
7896 }
7897 }
7898 }
7899
7901 {
7902 if (root)
7903 {
7904 vector m4[4];
7905 root.GetTransform(m4);
7906 dst.SetGround(this, m4);
7907 }
7908 else
7909 {
7910 GetInventory().GetCurrentInventoryLocation(dst);
7911 }
7912 }
7913
7914 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
7915 {
7916
7917 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
7918 return false;
7919
7920 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
7921 return false;
7922
7923
7925 return false;
7926
7927
7928 Magazine mag = Magazine.Cast(this);
7929 if (mag)
7930 {
7931 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
7932 return false;
7933
7934 if (stack_max_limit)
7935 {
7936 Magazine other_mag = Magazine.Cast(other_item);
7937 if (other_item)
7938 {
7939 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
7940 return false;
7941 }
7942
7943 }
7944 }
7945 else
7946 {
7947
7949 return false;
7950
7952 return false;
7953 }
7954
7955 PlayerBase player = null;
7956 if (CastTo(player, GetHierarchyRootPlayer()))
7957 {
7958 if (player.GetInventory().HasAttachment(this))
7959 return false;
7960
7961 if (player.IsItemsToDelete())
7962 return false;
7963 }
7964
7965 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
7966 return false;
7967
7968 int slotID;
7970 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
7971 return false;
7972
7973 return true;
7974 }
7975
7977 {
7979 }
7980
7982 {
7983 return m_IsResultOfSplit;
7984 }
7985
7987 {
7988 m_IsResultOfSplit = value;
7989 }
7990
7992 {
7994 }
7995
7997 {
7998 float other_item_quantity = other_item.GetQuantity();
7999 float this_free_space;
8000
8002
8004
8005 if (other_item_quantity > this_free_space)
8006 {
8007 return this_free_space;
8008 }
8009 else
8010 {
8011 return other_item_quantity;
8012 }
8013 }
8014
8016 {
8018 }
8019
8021 {
8023 return;
8024
8025 if (!IsMagazine() && other_item)
8026 {
8028 if (quantity_used != 0)
8029 {
8030 float hp1 = GetHealth01("","");
8031 float hp2 = other_item.GetHealth01("","");
8032 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
8033 hpResult = hpResult / (
GetQuantity() + quantity_used);
8034
8035 hpResult *= GetMaxHealth();
8036 Math.Round(hpResult);
8037 SetHealth("", "Health", hpResult);
8038
8040 other_item.AddQuantity(-quantity_used);
8041 }
8042 }
8044 }
8045
8047 {
8048 #ifdef SERVER
8049 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
8050 GetHierarchyParent().IncreaseLifetimeUp();
8051 #endif
8052 };
8053
8055 {
8056 PlayerBase p = PlayerBase.Cast(player);
8057
8058 array<int> recipesIds = p.m_Recipes;
8059 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8060 if (moduleRecipesManager)
8061 {
8062 EntityAI itemInHands = player.GetEntityInHands();
8063 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
8064 }
8065
8066 for (int i = 0;i < recipesIds.Count(); i++)
8067 {
8068 int key = recipesIds.Get(i);
8069 string recipeName = moduleRecipesManager.GetRecipeName(key);
8071 }
8072 }
8073
8074
8075 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
8076 {
8077 super.GetDebugActions(outputList);
8078
8079
8085
8086
8091
8096
8097
8101
8102
8104 {
8108 }
8109
8112
8113
8117
8119
8120 InventoryLocation loc = new InventoryLocation();
8121 GetInventory().GetCurrentInventoryLocation(loc);
8123 {
8124 if (Gizmo_IsSupported())
8127 }
8128
8130 }
8131
8132
8133
8134
8136 {
8137 super.OnAction(action_id, player, ctx);
8138
8140 {
8141 switch (action_id)
8142 {
8146 return true;
8150 return true;
8151 }
8152 }
8153
8155 {
8156 switch (action_id)
8157 {
8159 Delete();
8160 return true;
8161 }
8162 }
8163
8164 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
8165 {
8166 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8167 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
8168 PlayerBase p = PlayerBase.Cast(player);
8169 if (
EActions.RECIPES_RANGE_START < 1000)
8170 {
8171 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
8172 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
8173 }
8174 }
8175 #ifndef SERVER
8176 else if (action_id ==
EActions.WATCH_PLAYER)
8177 {
8178 PluginDeveloper.SetDeveloperItemClientEx(player);
8179 }
8180 #endif
8182 {
8183 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
8184 {
8185 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
8186 OnDebugButtonPressServer(id + 1);
8187 }
8188
8189 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
8190 {
8191 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
8193 }
8194
8195 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
8196 {
8197 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
8199 }
8200
8201 else if (action_id ==
EActions.ADD_QUANTITY)
8202 {
8203 if (IsMagazine())
8204 {
8205 Magazine mag = Magazine.Cast(this);
8206 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
8207 }
8208 else
8209 {
8211 }
8212
8213 if (m_EM)
8214 {
8215 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
8216 }
8217
8218 }
8219
8220 else if (action_id ==
EActions.REMOVE_QUANTITY)
8221 {
8222 if (IsMagazine())
8223 {
8224 Magazine mag2 = Magazine.Cast(this);
8225 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
8226 }
8227 else
8228 {
8230 }
8231 if (m_EM)
8232 {
8233 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
8234 }
8235
8236 }
8237
8238 else if (action_id ==
EActions.SET_QUANTITY_0)
8239 {
8241
8242 if (m_EM)
8243 {
8244 m_EM.SetEnergy(0);
8245 }
8246 }
8247
8248 else if (action_id ==
EActions.SET_MAX_QUANTITY)
8249 {
8251
8252 if (m_EM)
8253 {
8254 m_EM.SetEnergy(m_EM.GetEnergyMax());
8255 }
8256 }
8257
8258 else if (action_id ==
EActions.ADD_HEALTH)
8259 {
8260 AddHealth("","",GetMaxHealth("","Health")/5);
8261 }
8262 else if (action_id ==
EActions.REMOVE_HEALTH)
8263 {
8264 AddHealth("","",-GetMaxHealth("","Health")/5);
8265 }
8266 else if (action_id ==
EActions.DESTROY_HEALTH)
8267 {
8268 SetHealth01("","",0);
8269 }
8270 else if (action_id ==
EActions.WATCH_ITEM)
8271 {
8273 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
8274 #ifdef DEVELOPER
8275 SetDebugDeveloper_item(this);
8276 #endif
8277 }
8278
8279 else if (action_id ==
EActions.ADD_TEMPERATURE)
8280 {
8281 AddTemperature(20);
8282
8283 }
8284
8285 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
8286 {
8287 AddTemperature(-20);
8288
8289 }
8290
8291 else if (action_id ==
EActions.FLIP_FROZEN)
8292 {
8293 SetFrozen(!GetIsFrozen());
8294
8295 }
8296
8297 else if (action_id ==
EActions.ADD_WETNESS)
8298 {
8300
8301 }
8302
8303 else if (action_id ==
EActions.REMOVE_WETNESS)
8304 {
8306
8307 }
8308
8309 else if (action_id ==
EActions.LIQUIDTYPE_UP)
8310 {
8313
8314
8315 }
8316
8317 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
8318 {
8321 }
8322
8323 else if (action_id ==
EActions.MAKE_SPECIAL)
8324 {
8325 auto debugParams = DebugSpawnParams.WithPlayer(player);
8326 OnDebugSpawnEx(debugParams);
8327 }
8328
8329 }
8330
8331
8332 return false;
8333 }
8334
8335
8336
8337
8341
8344
8345
8346
8348 {
8349 return false;
8350 }
8351
8352
8354 {
8355 return true;
8356 }
8357
8358
8360 {
8361 return true;
8362 }
8363
8364
8365
8367 {
8368 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
8369 return g_Game.ConfigIsExisting(config_path);
8370 }
8371
8374 {
8375 return null;
8376 }
8377
8379 {
8380 return false;
8381 }
8382
8384 {
8385 return false;
8386 }
8387
8391
8392
8394 {
8395 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8396 return module_repairing.CanRepair(this, item_repair_kit);
8397 }
8398
8399
8400 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
8401 {
8402 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8403 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
8404 }
8405
8406
8408 {
8409
8410
8411
8412
8413
8414
8415
8416
8417 return 1;
8418 }
8419
8420
8421
8423 {
8425 }
8426
8427
8428
8430 {
8432 }
8433
8434
8443 {
8444 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8445
8446 if (player)
8447 {
8448 player.MessageStatus(text);
8449 }
8450 }
8451
8452
8461 {
8462 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8463
8464 if (player)
8465 {
8466 player.MessageAction(text);
8467 }
8468 }
8469
8470
8479 {
8480 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8481
8482 if (player)
8483 {
8484 player.MessageFriendly(text);
8485 }
8486 }
8487
8488
8497 {
8498 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8499
8500 if (player)
8501 {
8502 player.MessageImportant(text);
8503 }
8504 }
8505
8507 {
8508 return true;
8509 }
8510
8511
8512 override bool KindOf(
string tag)
8513 {
8514 bool found = false;
8515 string item_name = this.
GetType();
8517 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
8518
8519 int array_size = item_tag_array.Count();
8520 for (int i = 0; i < array_size; i++)
8521 {
8522 if (item_tag_array.Get(i) == tag)
8523 {
8524 found = true;
8525 break;
8526 }
8527 }
8528 return found;
8529 }
8530
8531
8533 {
8534
8535 super.OnRPC(sender, rpc_type,ctx);
8536
8537
8538 switch (rpc_type)
8539 {
8540 #ifndef SERVER
8541 case ERPCs.RPC_SOUND_LOCK_ATTACH:
8542 Param2<bool, string> p = new Param2<bool, string>(false, "");
8543
8545 return;
8546
8547 bool play = p.param1;
8548 string soundSet = p.param2;
8549
8550 if (play)
8551 {
8553 {
8555 {
8557 }
8558 }
8559 else
8560 {
8562 }
8563 }
8564 else
8565 {
8567 }
8568
8569 break;
8570 #endif
8571
8572 }
8573
8575 {
8577 }
8578 }
8579
8580
8581
8582
8584 {
8585 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8586 return plugin.GetID(
name);
8587 }
8588
8590 {
8591 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8592 return plugin.GetName(id);
8593 }
8594
8597 {
8598
8599
8600 int varFlags;
8601 if (!ctx.
Read(varFlags))
8602 return;
8603
8604 if (varFlags & ItemVariableFlags.FLOAT)
8605 {
8607 }
8608 }
8609
8611 {
8612
8613 super.SerializeNumericalVars(floats_out);
8614
8615
8616
8618 {
8620 }
8621
8623 {
8625 }
8626
8628 {
8630 }
8631
8633 {
8638 }
8639
8641 {
8643 }
8644 }
8645
8647 {
8648
8649 super.DeSerializeNumericalVars(floats);
8650
8651
8652 int index = 0;
8653 int mask = Math.Round(floats.Get(index));
8654
8655 index++;
8656
8658 {
8660 {
8662 }
8663 else
8664 {
8665 float quantity = floats.Get(index);
8667 }
8668 index++;
8669 }
8670
8672 {
8673 float wet = floats.Get(index);
8675 index++;
8676 }
8677
8679 {
8680 int liquidtype = Math.Round(floats.Get(index));
8682 index++;
8683 }
8684
8686 {
8688 index++;
8690 index++;
8692 index++;
8694 index++;
8695 }
8696
8698 {
8699 int cleanness = Math.Round(floats.Get(index));
8701 index++;
8702 }
8703 }
8704
8706 {
8707 super.WriteVarsToCTX(ctx);
8708
8709
8711 {
8713 }
8714
8716 {
8718 }
8719
8721 {
8723 }
8724
8726 {
8727 int r,g,b,a;
8733 }
8734
8736 {
8738 }
8739 }
8740
8742 {
8743 if (!super.ReadVarsFromCTX(ctx,version))
8744 return false;
8745
8746 int intValue;
8747 float value;
8748
8749 if (version < 140)
8750 {
8751 if (!ctx.
Read(intValue))
8752 return false;
8753
8754 m_VariablesMask = intValue;
8755 }
8756
8758 {
8759 if (!ctx.
Read(value))
8760 return false;
8761
8763 {
8765 }
8766 else
8767 {
8769 }
8770 }
8771
8772 if (version < 140)
8773 {
8775 {
8776 if (!ctx.
Read(value))
8777 return false;
8778 SetTemperatureDirect(value);
8779 }
8780 }
8781
8783 {
8784 if (!ctx.
Read(value))
8785 return false;
8787 }
8788
8790 {
8791 if (!ctx.
Read(intValue))
8792 return false;
8794 }
8795
8797 {
8798 int r,g,b,a;
8800 return false;
8802 return false;
8804 return false;
8806 return false;
8807
8809 }
8810
8812 {
8813 if (!ctx.
Read(intValue))
8814 return false;
8816 }
8817
8818 if (version >= 138 && version < 140)
8819 {
8821 {
8822 if (!ctx.
Read(intValue))
8823 return false;
8824 SetFrozen(intValue);
8825 }
8826 }
8827
8828 return true;
8829 }
8830
8831
8833 {
8836 {
8838 }
8839
8840 if (!super.OnStoreLoad(ctx, version))
8841 {
8843 return false;
8844 }
8845
8846 if (version >= 114)
8847 {
8848 bool hasQuickBarIndexSaved;
8849
8850 if (!ctx.
Read(hasQuickBarIndexSaved))
8851 {
8853 return false;
8854 }
8855
8856 if (hasQuickBarIndexSaved)
8857 {
8858 int itmQBIndex;
8859
8860
8861 if (!ctx.
Read(itmQBIndex))
8862 {
8864 return false;
8865 }
8866
8867 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
8868 if (itmQBIndex != -1 && parentPlayer)
8869 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
8870 }
8871 }
8872 else
8873 {
8874
8875 PlayerBase player;
8876 int itemQBIndex;
8877 if (version ==
int.
MAX)
8878 {
8879 if (!ctx.
Read(itemQBIndex))
8880 {
8882 return false;
8883 }
8884 }
8885 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
8886 {
8887
8888 if (!ctx.
Read(itemQBIndex))
8889 {
8891 return false;
8892 }
8893 if (itemQBIndex != -1 && player)
8894 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
8895 }
8896 }
8897
8898 if (version < 140)
8899 {
8900
8901 if (!LoadVariables(ctx, version))
8902 {
8904 return false;
8905 }
8906 }
8907
8908
8910 {
8912 return false;
8913 }
8914 if (version >= 132)
8915 {
8917 if (raib)
8918 {
8920 {
8922 return false;
8923 }
8924 }
8925 }
8926
8928 return true;
8929 }
8930
8931
8932
8934 {
8935 super.OnStoreSave(ctx);
8936
8937 PlayerBase player;
8938 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
8939 {
8941
8942 int itemQBIndex = -1;
8943 itemQBIndex = player.FindQuickBarEntityIndex(this);
8944 ctx.
Write(itemQBIndex);
8945 }
8946 else
8947 {
8949 }
8950
8952
8954 if (raib)
8955 {
8957 }
8958 }
8959
8960
8962 {
8963 super.AfterStoreLoad();
8964
8966 {
8968 }
8969
8971 {
8974 }
8975 }
8976
8978 {
8979 super.EEOnAfterLoad();
8980
8982 {
8984 }
8985
8988 }
8989
8991 {
8992 return false;
8993 }
8994
8995
8996
8998 {
9000 {
9001 #ifdef PLATFORM_CONSOLE
9002
9004 {
9006 if (menu)
9007 {
9009 }
9010 }
9011 #endif
9012 }
9013
9015 {
9018 }
9019
9021 {
9022 SetWeightDirty();
9024 }
9026 {
9029 }
9030
9032 {
9035
9038 }
9040 {
9044 }
9045
9046 super.OnVariablesSynchronized();
9047 }
9048
9049
9050
9052 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
9053 {
9054 if (!IsServerCheck(allow_client))
9055 return false;
9056
9058 return false;
9059
9062
9063 if (value <= (min + 0.001))
9064 value = min;
9065
9066 if (value == min)
9067 {
9068 if (destroy_config)
9069 {
9070 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
9071 if (dstr)
9072 {
9074 this.Delete();
9075 return true;
9076 }
9077 }
9078 else if (destroy_forced)
9079 {
9081 this.Delete();
9082 return true;
9083 }
9084
9086 }
9087
9090
9092 {
9093 EntityAI parent = GetHierarchyRoot();
9094 InventoryLocation iLoc = new InventoryLocation();
9095 GetInventory().GetCurrentInventoryLocation(iLoc);
9097 {
9098 int iLocSlot = iLoc.
GetSlot();
9100 {
9102 }
9104 {
9106 }
9107 }
9108 }
9109
9111 {
9113
9114 if (delta)
9116 }
9117
9119
9120 return false;
9121 }
9122
9123
9125 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9126 {
9128 }
9129
9131 {
9134 }
9135
9137 {
9140 }
9141
9143 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9144 {
9145 float value_clamped = Math.Clamp(value, 0, 1);
9147 SetQuantity(result, destroy_config, destroy_forced);
9148 }
9149
9150
9153 {
9155 }
9156
9158 {
9160 }
9161
9162
9163
9164
9165
9166
9167
9168
9169
9170
9172 {
9173 int slot = -1;
9174 GameInventory inventory = GetInventory();
9175 if (inventory)
9176 {
9177 InventoryLocation il = new InventoryLocation;
9180 }
9181
9183 }
9184
9186 {
9187 float quantity_max = 0;
9188
9190 {
9191 if (attSlotID != -1)
9192 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
9193
9194 if (quantity_max <= 0)
9196 }
9197
9198 if (quantity_max <= 0)
9200
9201 return quantity_max;
9202 }
9203
9205 {
9207 }
9208
9210 {
9212 }
9213
9214
9216 {
9218 }
9219
9221 {
9223 }
9224
9226 {
9228 }
9229
9230
9232 {
9233
9234 float weightEx = GetWeightEx();
9235 float special = GetInventoryAndCargoWeight();
9236 return weightEx - special;
9237 }
9238
9239
9241 {
9243 }
9244
9246 {
9248 {
9249 #ifdef DEVELOPER
9250 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9251 {
9252 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
9254 }
9255 #endif
9256
9258 }
9259 else if (HasEnergyManager())
9260 {
9261 #ifdef DEVELOPER
9262 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9263 {
9264 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
9265 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
9266 }
9267 #endif
9268 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
9269 }
9270 else
9271 {
9272 #ifdef DEVELOPER
9273 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9274 {
9275 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
9276 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
9277 }
9278 #endif
9279 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
9280 }
9281 }
9282
9285 {
9286 int item_count = 0;
9288
9289 GameInventory inventory = GetInventory();
9290 CargoBase cargo = inventory.
GetCargo();
9291 if (cargo != NULL)
9292 {
9294 }
9295
9297 for (int i = 0; i < nAttachments; ++i)
9298 {
9300 if (item)
9301 item_count += item.GetNumberOfItems();
9302 }
9303 return item_count;
9304 }
9305
9308 {
9309 float weight = 0;
9310 float wetness = 1;
9311 if (include_wetness)
9314 {
9315 weight = wetness * m_ConfigWeight;
9316 }
9318 {
9319 weight = 1;
9320 }
9321 return weight;
9322 }
9323
9324
9325
9327 {
9328 GameInventory inventory = GetInventory();
9329 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
9330 {
9331 array<EntityAI> items = new array<EntityAI>;
9333 for (int i = 0; i < items.Count(); ++i)
9334 {
9336 if (item)
9337 {
9338 g_Game.ObjectDelete(item);
9339 }
9340 }
9341 }
9342 }
9343
9344
9345
9346
9348 {
9349 float energy = 0;
9350 if (HasEnergyManager())
9351 {
9352 energy = GetCompEM().GetEnergy();
9353 }
9354 return energy;
9355 }
9356
9357
9359 {
9360 super.OnEnergyConsumed();
9361
9363 }
9364
9366 {
9367 super.OnEnergyAdded();
9368
9370 }
9371
9372
9374 {
9375 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
9376 {
9378 {
9379 float energy_0to1 = GetCompEM().GetEnergy0To1();
9381 }
9382 }
9383 }
9384
9385
9387 {
9388 return ConfigGetFloat("heatIsolation");
9389 }
9390
9392 {
9394 }
9395
9397 {
9398 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
9399 if (
g_Game.ConfigIsExisting(paramPath))
9400 return g_Game.ConfigGetFloat(paramPath);
9401
9402 return 0.0;
9403 }
9404
9406 {
9407 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
9408 if (
g_Game.ConfigIsExisting(paramPath))
9409 return g_Game.ConfigGetFloat(paramPath);
9410
9411 return 0.0;
9412 }
9413
9414 override void SetWet(
float value,
bool allow_client =
false)
9415 {
9416 if (!IsServerCheck(allow_client))
9417 return;
9418
9421
9423
9424 m_VarWet = Math.Clamp(value, min, max);
9425
9427 {
9430 }
9431 }
9432
9433 override void AddWet(
float value)
9434 {
9436 }
9437
9439 {
9441 }
9442
9444 {
9446 }
9447
9449 {
9451 }
9452
9454 {
9456 }
9457
9459 {
9461 }
9462
9464 {
9467 if (newLevel != oldLevel)
9468 {
9470 }
9471 }
9472
9474 {
9475 SetWeightDirty();
9476 }
9477
9479 {
9480 return GetWetLevelInternal(
m_VarWet);
9481 }
9482
9483
9484
9486 {
9488 }
9489
9491 {
9493 }
9494
9496 {
9498 }
9499
9501 {
9503 }
9504
9505
9506
9508 {
9509 if (ConfigIsExisting("itemModelLength"))
9510 {
9511 return ConfigGetFloat("itemModelLength");
9512 }
9513 return 0;
9514 }
9515
9517 {
9518 if (ConfigIsExisting("itemAttachOffset"))
9519 {
9520 return ConfigGetFloat("itemAttachOffset");
9521 }
9522 return 0;
9523 }
9524
9525 override void SetCleanness(
int value,
bool allow_client =
false)
9526 {
9527 if (!IsServerCheck(allow_client))
9528 return;
9529
9531
9533
9536 }
9537
9539 {
9541 }
9542
9544 {
9545 return true;
9546 }
9547
9548
9549
9550
9552 {
9554 }
9555
9557 {
9559 }
9560
9561
9562
9563
9564 override void SetColor(
int r,
int g,
int b,
int a)
9565 {
9571 }
9573 override void GetColor(out
int r,out
int g,out
int b,out
int a)
9574 {
9579 }
9580
9582 {
9584 }
9585
9588 {
9589 int r,g,b,a;
9591 r = r/255;
9592 g = g/255;
9593 b = b/255;
9594 a = a/255;
9595 return MiscGameplayFunctions.GetColorString(r, g, b, a);
9596 }
9597
9598
9599
9600 override void SetLiquidType(
int value,
bool allow_client =
false)
9601 {
9602 if (!IsServerCheck(allow_client))
9603 return;
9604
9609 }
9610
9612 {
9613 return ConfigGetInt("varLiquidTypeInit");
9614 }
9615
9617 {
9619 }
9620
9622 {
9624 SetFrozen(false);
9625 }
9626
9629 {
9630 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9631 }
9632
9633
9636 {
9637 PlayerBase nplayer;
9638 if (PlayerBase.CastTo(nplayer, player))
9639 {
9641 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9642 }
9643 }
9644
9645
9648 {
9649 PlayerBase nplayer;
9650 if (PlayerBase.CastTo(nplayer,player))
9651 {
9652 nplayer.SetEnableQuickBarEntityShortcut(this, false);
9653 }
9654
9655 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
9656
9657 if (HasEnergyManager())
9658 {
9659 GetCompEM().UpdatePlugState();
9660 }
9661 }
9662
9663
9665 {
9666 super.OnPlacementStarted(player);
9667
9669 }
9670
9671 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
9672 {
9674 {
9675 m_AdminLog.OnPlacementComplete(player,
this);
9676 }
9677
9678 super.OnPlacementComplete(player, position, orientation);
9679 }
9680
9681
9682
9683
9684
9686 {
9688 {
9689 return true;
9690 }
9691 else
9692 {
9693 return false;
9694 }
9695 }
9696
9697
9699 {
9701 {
9703 }
9704 }
9705
9706
9708 {
9710 }
9711
9713 {
9715 }
9716
9717 override void InsertAgent(
int agent,
float count = 1)
9718 {
9719 if (count < 1)
9720 return;
9721
9723 }
9724
9727 {
9729 }
9730
9731
9733 {
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
9765
9766
9767
9768
9769
9770
9771
9772
9773
9774
9775
9776
9777
9779 {
9781 return false;
9782 return true;
9783 }
9784
9786 {
9787
9789 }
9790
9791
9794 {
9795 super.CheckForRoofLimited(timeTresholdMS);
9796
9797 float time =
g_Game.GetTime();
9798 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
9799 {
9800 m_PreviousRoofTestTime = time;
9801 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
9802 }
9803 }
9804
9805
9807 {
9809 {
9810 return 0;
9811 }
9812
9813 if (GetInventory().GetAttachmentSlotsCount() != 0)
9814 {
9815 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
9816 if (filter)
9817 return filter.GetProtectionLevel(type, false, system);
9818 else
9819 return 0;
9820 }
9821
9822 string subclassPath, entryName;
9823
9824 switch (type)
9825 {
9827 entryName = "biological";
9828 break;
9830 entryName = "chemical";
9831 break;
9832 default:
9833 entryName = "biological";
9834 break;
9835 }
9836
9837 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
9838
9839 return g_Game.ConfigGetFloat(subclassPath + entryName);
9840 }
9841
9842
9843
9846 {
9847 if (!IsMagazine())
9849
9851 }
9852
9853
9854
9855
9856
9861 {
9862 return true;
9863 }
9864
9866 {
9868 }
9869
9870
9871
9872
9873
9875 {
9876 if (parent)
9877 {
9878 if (parent.IsInherited(DayZInfected))
9879 return true;
9880
9881 if (!parent.IsRuined())
9882 return true;
9883 }
9884
9885 return true;
9886 }
9887
9889 {
9890 if (!super.CanPutAsAttachment(parent))
9891 {
9892 return false;
9893 }
9894
9895 if (!IsRuined() && !parent.IsRuined())
9896 {
9897 return true;
9898 }
9899
9900 return false;
9901 }
9902
9904 {
9905
9906
9907
9908
9909 return super.CanReceiveItemIntoCargo(item);
9910 }
9911
9913 {
9914
9915
9916
9917
9918 GameInventory attachmentInv = attachment.GetInventory();
9920 {
9921 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
9922 return false;
9923 }
9924
9925 InventoryLocation loc = new InventoryLocation();
9926 attachment.GetInventory().GetCurrentInventoryLocation(loc);
9927 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
9928 return false;
9929
9930 return super.CanReceiveAttachment(attachment, slotId);
9931 }
9932
9934 {
9935 if (!super.CanReleaseAttachment(attachment))
9936 return false;
9937
9938 return GetInventory().AreChildrenAccessible();
9939 }
9940
9941
9942
9943
9944
9945
9946
9947
9948
9949
9950
9951
9952
9953
9954
9955
9956
9957
9958
9959
9960
9962 {
9963 int id = muzzle_owner.GetMuzzleID();
9964 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
9965
9966 if (WPOF_array)
9967 {
9968 for (int i = 0; i < WPOF_array.Count(); i++)
9969 {
9970 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
9971
9972 if (WPOF)
9973 {
9974 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
9975 }
9976 }
9977 }
9978 }
9979
9980
9982 {
9983 int id = muzzle_owner.GetMuzzleID();
9985
9986 if (WPOBE_array)
9987 {
9988 for (int i = 0; i < WPOBE_array.Count(); i++)
9989 {
9990 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
9991
9992 if (WPOBE)
9993 {
9994 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
9995 }
9996 }
9997 }
9998 }
9999
10000
10002 {
10003 int id = muzzle_owner.GetMuzzleID();
10004 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10005
10006 if (WPOOH_array)
10007 {
10008 for (int i = 0; i < WPOOH_array.Count(); i++)
10009 {
10010 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10011
10012 if (WPOOH)
10013 {
10014 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10015 }
10016 }
10017 }
10018 }
10019
10020
10022 {
10023 int id = muzzle_owner.GetMuzzleID();
10024 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10025
10026 if (WPOOH_array)
10027 {
10028 for (int i = 0; i < WPOOH_array.Count(); i++)
10029 {
10030 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10031
10032 if (WPOOH)
10033 {
10034 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10035 }
10036 }
10037 }
10038 }
10039
10040
10042 {
10043 int id = muzzle_owner.GetMuzzleID();
10044 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10045
10046 if (WPOOH_array)
10047 {
10048 for (int i = 0; i < WPOOH_array.Count(); i++)
10049 {
10050 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10051
10052 if (WPOOH)
10053 {
10054 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10055 }
10056 }
10057 }
10058 }
10059
10060
10061
10063 {
10065 {
10066 return true;
10067 }
10068
10069 return false;
10070 }
10071
10073 {
10075 {
10076 return true;
10077 }
10078
10079 return false;
10080 }
10081
10083 {
10085 {
10086 return true;
10087 }
10088
10089 return false;
10090 }
10091
10093 {
10094 return false;
10095 }
10096
10099 {
10100 return UATimeSpent.DEFAULT_DEPLOY;
10101 }
10102
10103
10104
10105
10107 {
10109 SetSynchDirty();
10110 }
10111
10113 {
10115 }
10116
10117
10119 {
10120 return false;
10121 }
10122
10125 {
10126 string att_type = "None";
10127
10128 if (ConfigIsExisting("soundAttType"))
10129 {
10130 att_type = ConfigGetString("soundAttType");
10131 }
10132
10134 }
10135
10137 {
10139 }
10140
10141
10142
10143
10144
10150
10152 {
10155
10157 }
10158
10159
10161 {
10163 return;
10164
10166
10169
10172
10173 SoundParameters params = new SoundParameters();
10177 }
10178
10179
10181 {
10183 {
10186
10187 SetSynchDirty();
10188
10191 }
10192 }
10193
10195 {
10197 }
10198
10199
10201 {
10203 return;
10204
10206 SetSynchDirty();
10207
10210 }
10211
10213 {
10216 }
10217
10219 {
10221 }
10222
10223 void OnApply(PlayerBase player);
10224
10226 {
10227 return 1.0;
10228 };
10229
10231 {
10233 }
10234
10236 {
10238 }
10239
10241
10243 {
10244 SetDynamicPhysicsLifeTime(0.01);
10246 }
10247
10249 {
10250 array<string> zone_names = new array<string>;
10251 GetDamageZones(zone_names);
10252 for (int i = 0; i < zone_names.Count(); i++)
10253 {
10254 SetHealthMax(zone_names.Get(i),"Health");
10255 }
10256 SetHealthMax("","Health");
10257 }
10258
10261 {
10262 float global_health = GetHealth01("","Health");
10263 array<string> zones = new array<string>;
10264 GetDamageZones(zones);
10265
10266 for (int i = 0; i < zones.Count(); i++)
10267 {
10268 SetHealth01(zones.Get(i),"Health",global_health);
10269 }
10270 }
10271
10274 {
10275 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
10276 }
10277
10279 {
10280 if (!hasRootAsPlayer)
10281 {
10282 if (refParentIB)
10283 {
10284
10285 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
10286 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
10287
10288 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
10289 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
10290
10293 }
10294 else
10295 {
10296
10299 }
10300 }
10301 }
10302
10304 {
10306 {
10307 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
10308 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
10309 {
10310 float heatPermCoef = 1.0;
10312 while (ent)
10313 {
10314 heatPermCoef *= ent.GetHeatPermeabilityCoef();
10315 ent = ent.GetHierarchyParent();
10316 }
10317
10318 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
10319 }
10320 }
10321 }
10322
10324 {
10325
10326 EntityAI parent = GetHierarchyParent();
10327 if (!parent)
10328 {
10329 hasParent = false;
10330 hasRootAsPlayer = false;
10331 }
10332 else
10333 {
10334 hasParent = true;
10335 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
10336 refParentIB =
ItemBase.Cast(parent);
10337 }
10338 }
10339
10340 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
10341 {
10342
10343 }
10344
10346 {
10347
10348 return false;
10349 }
10350
10352 {
10353
10354
10355 return false;
10356 }
10357
10359 {
10360
10361 return false;
10362 }
10363
10366 {
10367 return !GetIsFrozen() &&
IsOpen();
10368 }
10369
10371 {
10372 bool hasParent = false, hasRootAsPlayer = false;
10374
10375 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
10376 bool foodDecay =
g_Game.IsFoodDecayEnabled();
10377
10378 if (wwtu || foodDecay)
10379 {
10383
10384 if (processWetness || processTemperature || processDecay)
10385 {
10387
10388 if (processWetness)
10389 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
10390
10391 if (processTemperature)
10393
10394 if (processDecay)
10395 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
10396 }
10397 }
10398 }
10399
10402 {
10404 }
10405
10407 {
10410
10411 return super.GetTemperatureFreezeThreshold();
10412 }
10413
10415 {
10418
10419 return super.GetTemperatureThawThreshold();
10420 }
10421
10423 {
10426
10427 return super.GetItemOverheatThreshold();
10428 }
10429
10431 {
10433 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
10434
10435 return super.GetTemperatureFreezeTime();
10436 }
10437
10439 {
10441 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
10442
10443 return super.GetTemperatureThawTime();
10444 }
10445
10450
10452 {
10453 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
10454 }
10455
10457 {
10458 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
10459 }
10460
10463 {
10465 }
10466
10468 {
10470 }
10471
10473 {
10475 }
10476
10479 {
10480 return null;
10481 }
10482
10485 {
10486 return false;
10487 }
10488
10490 {
10492 {
10495 if (!trg)
10496 {
10498 explosive = this;
10499 }
10500
10501 explosive.PairRemote(trg);
10503
10504 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
10505 trg.SetPersistentPairID(persistentID);
10506 explosive.SetPersistentPairID(persistentID);
10507
10508 return true;
10509 }
10510 return false;
10511 }
10512
10515 {
10516 float ret = 1.0;
10519 ret *= GetHealth01();
10520
10521 return ret;
10522 }
10523
10524 #ifdef DEVELOPER
10525 override void SetDebugItem()
10526 {
10527 super.SetDebugItem();
10528 _itemBase = this;
10529 }
10530
10532 {
10533 string text = super.GetDebugText();
10534
10536 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
10537
10538 return text;
10539 }
10540 #endif
10541
10543 {
10544 return true;
10545 }
10546
10548
10550
10552 {
10555 }
10556
10557
10565
10581
10582 [
Obsolete(
"Use ItemSoundHandler instead")]
10585 {
10586 if (!
g_Game.IsDedicatedServer())
10587 {
10588 if (ConfigIsExisting("attachSoundSet"))
10589 {
10590 string cfg_path = "";
10591 string soundset = "";
10592 string type_name =
GetType();
10593
10596 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
10597 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
10598
10599 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
10600 {
10601 for (int i = 0; i < cfg_soundset_array.Count(); i++)
10602 {
10603 if (cfg_slot_array[i] == slot_type)
10604 {
10605 soundset = cfg_soundset_array[i];
10606 break;
10607 }
10608 }
10609 }
10610
10611 if (soundset != "")
10612 {
10613 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
10615 }
10616 }
10617 }
10618 }
10619
10621}
10622
10624{
10626 if (entity)
10627 {
10628 bool is_item = entity.IsInherited(
ItemBase);
10629 if (is_item && full_quantity)
10630 {
10633 }
10634 }
10635 else
10636 {
10638 return NULL;
10639 }
10640 return entity;
10641}
10642
10644{
10645 if (item)
10646 {
10647 if (health > 0)
10648 item.SetHealth("", "", health);
10649
10650 if (item.CanHaveTemperature())
10651 {
10653 if (item.CanFreeze())
10654 item.SetFrozen(false);
10655 }
10656
10657 if (item.HasEnergyManager())
10658 {
10659 if (quantity >= 0)
10660 {
10661 item.GetCompEM().SetEnergy0To1(quantity);
10662 }
10663 else
10664 {
10666 }
10667 }
10668 else if (item.IsMagazine())
10669 {
10670 Magazine mag = Magazine.Cast(item);
10671 if (quantity >= 0)
10672 {
10673 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
10674 }
10675 else
10676 {
10678 }
10679
10680 }
10681 else
10682 {
10683 if (quantity >= 0)
10684 {
10685 item.SetQuantityNormalized(quantity, false);
10686 }
10687 else
10688 {
10690 }
10691
10692 }
10693 }
10694}
10695
10696#ifdef DEVELOPER
10698#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.