5711{
5713 {
5714 return true;
5715 }
5716};
5717
5718
5719
5721{
5725
5727
5730
5731
5732
5733
5734
5743
5749
5754
5759
5780 protected bool m_IsResultOfSplit
5781
5783
5788
5789
5790
5792
5796
5797
5798
5800
5803
5804
5805
5811
5812
5820
5823
5824
5826
5827
5829
5830
5835
5836
5841
5842
5844
5845
5847 {
5852
5853 if (!
GetGame().IsDedicatedServer())
5854 {
5856 {
5858
5860 {
5862 }
5863 }
5864
5867 }
5868
5869 m_OldLocation = null;
5870
5872 {
5874 }
5875
5876 if (ConfigIsExisting("headSelectionsToHide"))
5877 {
5880 }
5881
5883 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
5884 {
5886 }
5887
5889
5890 m_IsResultOfSplit = false;
5891
5893 }
5894
5896 {
5897 super.InitItemVariables();
5898
5904 m_Count = ConfigGetInt(
"count");
5905
5908
5913
5916
5921
5933
5937
5938
5941 if (ConfigIsExisting("canBeSplit"))
5942 {
5945 }
5946
5948 if (ConfigIsExisting("itemBehaviour"))
5950
5951
5954 RegisterNetSyncVariableInt("m_VarLiquidType");
5955 RegisterNetSyncVariableInt("m_Cleanness",0,1);
5956
5957 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
5958 RegisterNetSyncVariableFloat("m_ImpactSpeed");
5959 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
5960
5961 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
5962 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
5963 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
5964 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
5965
5966 RegisterNetSyncVariableBool("m_IsBeingPlaced");
5967 RegisterNetSyncVariableBool("m_IsTakeable");
5968 RegisterNetSyncVariableBool("m_IsHologram");
5969
5972 {
5975 }
5976
5978
5980 if (ConfigIsExisting("temperaturePerQuantityWeight"))
5982
5983 }
5984
5986 {
5988 }
5989
5991 {
5994 {
5999 }
6000 }
6001
6002 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
6003 {
6005 {
6008 }
6009
6011 }
6012
6014 {
6020 }
6021
6023
6025 {
6027
6028 if (!action)
6029 {
6030 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
6031 return;
6032 }
6033
6035 if (!ai)
6036 {
6038 return;
6039 }
6040
6042 if (!action_array)
6043 {
6044 action_array = new array<ActionBase_Basic>;
6046 }
6047 if (LogManager.IsActionLogEnable())
6048 {
6049 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
6050 }
6051
6052 if (action_array.Find(action) != -1)
6053 {
6054 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
6055 }
6056 else
6057 {
6058 action_array.Insert(action);
6059 }
6060 }
6061
6063 {
6065 ActionBase action = player.GetActionManager().GetAction(actionName);
6068
6069 if (action_array)
6070 {
6071 action_array.RemoveItem(action);
6072 }
6073 }
6074
6075
6076
6078 {
6079 ActionOverrideData overrideData = new ActionOverrideData();
6083
6085 if (!actionMap)
6086 {
6089 }
6090
6091 actionMap.Insert(this.
Type(), overrideData);
6092
6093 }
6094
6096
6098
6099
6101 {
6104
6107
6108 string config_to_search = "CfgVehicles";
6109 string muzzle_owner_config;
6110
6112 {
6113 if (IsInherited(Weapon))
6114 config_to_search = "CfgWeapons";
6115
6116 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6117
6118 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
6119
6121
6122 if (config_OnFire_subclass_count > 0)
6123 {
6124 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
6125
6126 for (int i = 0; i < config_OnFire_subclass_count; i++)
6127 {
6128 string particle_class = "";
6130 string config_OnFire_entry = config_OnFire_class + particle_class;
6131 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
6132 WPOF_array.Insert(WPOF);
6133 }
6134
6135
6137 }
6138 }
6139
6141 {
6142 config_to_search = "CfgWeapons";
6143 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6144
6145 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
6146
6148
6149 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
6150 {
6151 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
6152
6153 for (i = 0; i < config_OnBulletCasingEject_count; i++)
6154 {
6155 string particle_class2 = "";
6157 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
6158 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
6159 WPOBE_array.Insert(WPOBE);
6160 }
6161
6162
6164 }
6165 }
6166 }
6167
6168
6170 {
6173
6175 {
6176 string config_to_search = "CfgVehicles";
6177
6178 if (IsInherited(Weapon))
6179 config_to_search = "CfgWeapons";
6180
6181 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6182 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
6183
6184 if (
GetGame().ConfigIsExisting(config_OnOverheating_class))
6185 {
6186
6188
6190 {
6192 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
6194 return;
6195 }
6196
6199
6200
6201
6203 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
6204
6205 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
6206 {
6207 string particle_class = "";
6209 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
6211
6212 if (entry_type == CT_CLASS)
6213 {
6214 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
6215 WPOOH_array.Insert(WPOF);
6216 }
6217 }
6218
6219
6221 }
6222 }
6223 }
6224
6226 {
6228 }
6229
6231 {
6233 {
6235
6238
6241
6242 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6243 }
6244 }
6245
6247 {
6249 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6250
6252 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6253
6255 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6256
6258 {
6260 }
6261 }
6262
6264 {
6266 }
6267
6269 {
6272 else
6274
6276 {
6279 }
6280 else
6281 {
6284
6287 }
6288
6290 }
6291
6293 {
6295 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6296 }
6297
6299 {
6301 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6303 }
6304
6306 {
6308 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6309 }
6310
6312 {
6315
6316 OverheatingParticle OP = new OverheatingParticle();
6321
6323 }
6324
6326 {
6329
6330 return -1;
6331 }
6332
6334 {
6336 {
6339
6340 for (int i = count; i > 0; --i)
6341 {
6342 int id = i - 1;
6345
6348
6349 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
6350 {
6351 if (p)
6352 {
6355 }
6356 }
6357 }
6358 }
6359 }
6360
6362 {
6364 {
6366 {
6367 int id = i - 1;
6369
6370 if (OP)
6371 {
6373
6374 if (p)
6375 {
6377 }
6378
6379 delete OP;
6380 }
6381 }
6382
6385 }
6386 }
6387
6390 {
6391 return 0.0;
6392 }
6393
6394
6396 {
6397 return 250;
6398 }
6399
6401 {
6402 return 0;
6403 }
6404
6407 {
6409 return true;
6410
6411 return false;
6412 }
6413
6416 {
6419
6421 {
6423 }
6424 else
6425 {
6426
6428 }
6429
6431 }
6432
6439 {
6440 return -1;
6441 }
6442
6443
6444
6445
6447 {
6449 {
6451 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6452
6453 if (r_index >= 0)
6454 {
6455 InventoryLocation r_il = new InventoryLocation;
6456 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6457
6458 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6461 {
6462 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6463 }
6465 {
6466 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6467 }
6468
6469 }
6470
6471 player.GetHumanInventory().ClearUserReservedLocation(this);
6472 }
6473
6476 }
6477
6478
6479
6480
6482 {
6483 return ItemBase.m_DebugActionsMask;
6484 }
6485
6487 {
6488 return ItemBase.m_DebugActionsMask & mask;
6489 }
6490
6492 {
6493 ItemBase.m_DebugActionsMask = mask;
6494 }
6495
6497 {
6498 ItemBase.m_DebugActionsMask |= mask;
6499 }
6500
6502 {
6503 ItemBase.m_DebugActionsMask &= ~mask;
6504 }
6505
6507 {
6509 {
6511 }
6512 else
6513 {
6515 }
6516 }
6517
6518
6520 {
6521 if (GetEconomyProfile())
6522 {
6523 float q_max = GetEconomyProfile().GetQuantityMax();
6524 if (q_max > 0)
6525 {
6526 float q_min = GetEconomyProfile().GetQuantityMin();
6527 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
6528
6530 {
6531 ComponentEnergyManager comp = GetCompEM();
6533 {
6535 }
6536 }
6538 {
6540
6541 }
6542
6543 }
6544 }
6545 }
6546
6549 {
6550 EntityAI parent = GetHierarchyParent();
6551
6552 if (parent)
6553 {
6554 InventoryLocation inventory_location_to_lock = new InventoryLocation;
6555 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
6556 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
6557 }
6558 }
6559
6562 {
6563 EntityAI parent = GetHierarchyParent();
6564
6565 if (parent)
6566 {
6567 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
6568 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
6569 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
6570 }
6571 }
6572
6574 {
6575
6576
6577
6578
6580
6582 {
6583 if (ScriptInputUserData.CanStoreInputUserData())
6584 {
6585 ScriptInputUserData ctx = new ScriptInputUserData;
6591 ctx.
Write(use_stack_max);
6594
6596 {
6597 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
6598 }
6599 }
6600 }
6601 else if (!
GetGame().IsMultiplayer())
6602 {
6604 }
6605 }
6606
6608 {
6610 }
6611
6613 {
6615 }
6616
6618 {
6620 }
6621
6623 {
6624
6625 return false;
6626 }
6627
6629 {
6630 return false;
6631 }
6632
6636 {
6637 return false;
6638 }
6639
6641 {
6642 return "";
6643 }
6644
6646
6648 {
6649 return false;
6650 }
6651
6653 {
6654 return true;
6655 }
6656
6657
6658
6660 {
6661 return true;
6662 }
6663
6665 {
6666 return true;
6667 }
6668
6670 {
6671 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6673 }
6674
6676 {
6678 }
6679
6681 {
6683 if (!is_being_placed)
6685 SetSynchDirty();
6686 }
6687
6688
6690
6692 {
6694 }
6695
6697 {
6699 }
6700
6702 {
6703 return 1;
6704 }
6705
6707 {
6708 return false;
6709 }
6710
6712 {
6714 SetSynchDirty();
6715 }
6716
6717
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
6752 {
6753 super.OnMovedInsideCargo(container);
6754
6755 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6756 }
6757
6758 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
6759 {
6760 super.EEItemLocationChanged(oldLoc,newLoc);
6761
6762 PlayerBase new_player = null;
6763 PlayerBase old_player = null;
6764
6765 if (newLoc.GetParent())
6766 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
6767
6768 if (oldLoc.GetParent())
6769 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
6770
6772 {
6773 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
6774
6775 if (r_index >= 0)
6776 {
6777 InventoryLocation r_il = new InventoryLocation;
6778 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6779
6780 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6783 {
6784 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6785 }
6787 {
6788 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6789 }
6790
6791 }
6792 }
6793
6795 {
6796 if (new_player)
6797 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
6798
6799 if (new_player == old_player)
6800 {
6801
6802 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
6803 {
6805 {
6806 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
6807 {
6808 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6809 }
6810 }
6811 else
6812 {
6813 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6814 }
6815 }
6816
6817 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
6818 {
6819 int type = oldLoc.GetType();
6821 {
6822 oldLoc.GetParent().GetOnSetLock().Invoke(this);
6823 }
6825 {
6826 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
6827 }
6828 }
6829 if (!m_OldLocation)
6830 {
6831 m_OldLocation = new InventoryLocation;
6832 }
6833 m_OldLocation.Copy(oldLoc);
6834 }
6835 else
6836 {
6837 if (m_OldLocation)
6838 {
6839 m_OldLocation.Reset();
6840 }
6841 }
6842
6844 }
6845 else
6846 {
6847 if (new_player)
6848 {
6849 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
6850 if (res_index >= 0)
6851 {
6852 InventoryLocation il = new InventoryLocation;
6853 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
6855 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
6858 {
6859 il.
GetParent().GetOnReleaseLock().Invoke(it);
6860 }
6862 {
6864 }
6865
6866 }
6867 }
6869 {
6870
6872 }
6873
6874 if (m_OldLocation)
6875 {
6876 m_OldLocation.Reset();
6877 }
6878 }
6879 }
6880
6881 override void EOnContact(IEntity other, Contact extra)
6882 {
6884 {
6885 int liquidType = -1;
6887 if (impactSpeed > 0.0)
6888 {
6890 #ifndef SERVER
6892 #else
6894 SetSynchDirty();
6895 #endif
6897 }
6898 }
6899
6900 #ifdef SERVER
6901 if (GetCompEM() && GetCompEM().IsPlugged())
6902 {
6903 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
6904 GetCompEM().UnplugThis();
6905 }
6906 #endif
6907 }
6908
6910
6912 {
6914 }
6915
6917 {
6918
6919 }
6920
6922 {
6923 super.OnItemLocationChanged(old_owner, new_owner);
6924
6925 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
6926 PlayerBase playerNew = PlayerBase.Cast(new_owner);
6927
6928 if (!relatedPlayer && playerNew)
6929 relatedPlayer = playerNew;
6930
6931 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
6932 {
6934 if (actionMgr)
6935 {
6936 ActionBase currentAction = actionMgr.GetRunningAction();
6937 if (currentAction)
6939 }
6940 }
6941
6942 Man ownerPlayerOld = null;
6943 Man ownerPlayerNew = null;
6944
6945 if (old_owner)
6946 {
6947 if (old_owner.
IsMan())
6948 {
6949 ownerPlayerOld = Man.Cast(old_owner);
6950 }
6951 else
6952 {
6953 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
6954 }
6955 }
6956 else
6957 {
6959 {
6961
6962 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
6963 {
6964 GetCompEM().UnplugThis();
6965 }
6966 }
6967 }
6968
6969 if (new_owner)
6970 {
6971 if (new_owner.
IsMan())
6972 {
6973 ownerPlayerNew = Man.Cast(new_owner);
6974 }
6975 else
6976 {
6977 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
6978 }
6979 }
6980
6981 if (ownerPlayerOld != ownerPlayerNew)
6982 {
6983 if (ownerPlayerOld)
6984 {
6985 array<EntityAI> subItemsExit = new array<EntityAI>;
6987 for (int i = 0; i < subItemsExit.Count(); i++)
6988 {
6991 }
6992 }
6993
6994 if (ownerPlayerNew)
6995 {
6996 array<EntityAI> subItemsEnter = new array<EntityAI>;
6998 for (int j = 0; j < subItemsEnter.Count(); j++)
6999 {
7002 }
7003 }
7004 }
7005 else if (ownerPlayerNew != null)
7006 {
7007 PlayerBase nplayer;
7008 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
7009 {
7010 array<EntityAI> subItemsUpdate = new array<EntityAI>;
7012 for (int k = 0; k < subItemsUpdate.Count(); k++)
7013 {
7015 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
7016 }
7017 }
7018 }
7019
7020 if (old_owner)
7021 old_owner.OnChildItemRemoved(this);
7022 if (new_owner)
7023 new_owner.OnChildItemReceived(this);
7024 }
7025
7026
7028 {
7029 super.EEDelete(parent);
7030 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
7031 if (player)
7032 {
7034
7035 if (player.IsAlive())
7036 {
7037 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7038 if (r_index >= 0)
7039 {
7040 InventoryLocation r_il = new InventoryLocation;
7041 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7042
7043 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7046 {
7047 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7048 }
7050 {
7051 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7052 }
7053
7054 }
7055
7056 player.RemoveQuickBarEntityShortcut(this);
7057 }
7058 }
7059 }
7060
7062 {
7063 super.EEKilled(killer);
7064
7067 {
7068 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
7069 {
7070 if (IsMagazine())
7071 {
7072 if (Magazine.Cast(this).GetAmmoCount() > 0)
7073 {
7075 }
7076 }
7077 else
7078 {
7080 }
7081 }
7082 }
7083 }
7084
7086 {
7087 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7088
7089 super.OnWasAttached(parent, slot_id);
7090
7093
7095 }
7096
7098 {
7099 super.OnWasDetached(parent, slot_id);
7100
7103 }
7104
7106 {
7107 int idx;
7110
7111 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7112 if (inventory_slots.Count() < 1)
7113 {
7114 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
7115 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
7116 }
7117 else
7118 {
7119 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
7120 }
7121
7122 idx = inventory_slots.Find(slot);
7123 if (idx < 0)
7124 return "";
7125
7126 return attach_types.Get(idx);
7127 }
7128
7130 {
7131 int idx = -1;
7132 string slot;
7133
7136
7137 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7138 if (inventory_slots.Count() < 1)
7139 {
7140 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
7141 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7142 }
7143 else
7144 {
7145 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
7146 if (detach_types.Count() < 1)
7147 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7148 }
7149
7150 for (int i = 0; i < inventory_slots.Count(); i++)
7151 {
7152 slot = inventory_slots.Get(i);
7153 }
7154
7155 if (slot != "")
7156 {
7157 if (detach_types.Count() == 1)
7158 idx = 0;
7159 else
7160 idx = inventory_slots.Find(slot);
7161 }
7162 if (idx < 0)
7163 return "";
7164
7165 return detach_types.Get(idx);
7166 }
7167
7169 {
7170
7172
7173
7174 float min_time = 1;
7175 float max_time = 3;
7176 float delay = Math.RandomFloat(min_time, max_time);
7177
7178 explode_timer.Run(delay, this, "DoAmmoExplosion");
7179 }
7180
7182 {
7183 Magazine magazine = Magazine.Cast(this);
7184 int pop_sounds_count = 6;
7185 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
7186
7187
7188 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
7189 string sound_name = pop_sounds[ sound_idx ];
7191
7192
7193 magazine.ServerAddAmmoCount(-1);
7194
7195
7196 float min_temp_to_explode = 100;
7197
7198 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
7199 {
7201 }
7202 }
7203
7204
7205 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
7206 {
7207 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
7208
7209 const int CHANCE_DAMAGE_CARGO = 4;
7210 const int CHANCE_DAMAGE_ATTACHMENT = 1;
7211 const int CHANCE_DAMAGE_NOTHING = 2;
7212
7214 {
7215 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
7216 int chances;
7217 int rnd;
7218
7219 if (GetInventory().GetCargo())
7220 {
7221 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7222 rnd = Math.RandomInt(0,chances);
7223
7224 if (rnd < CHANCE_DAMAGE_CARGO)
7225 {
7227 }
7228 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
7229 {
7231 }
7232 }
7233 else
7234 {
7235 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7236 rnd = Math.RandomInt(0,chances);
7237
7238 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
7239 {
7241 }
7242 }
7243 }
7244 }
7245
7247 {
7248 if (GetInventory().GetCargo())
7249 {
7250 int item_count = GetInventory().GetCargo().GetItemCount();
7251 if (item_count > 0)
7252 {
7253 int random_pick = Math.RandomInt(0, item_count);
7255 if (!item.IsExplosive())
7256 {
7257 item.AddHealth("","",damage);
7258 return true;
7259 }
7260 }
7261 }
7262 return false;
7263 }
7264
7266 {
7267 int attachment_count = GetInventory().AttachmentCount();
7268 if (attachment_count > 0)
7269 {
7270 int random_pick = Math.RandomInt(0, attachment_count);
7271 ItemBase attachment =
ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
7272 if (!attachment.IsExplosive())
7273 {
7274 attachment.AddHealth("","",damage);
7275 return true;
7276 }
7277 }
7278 return false;
7279 }
7280
7282 {
7284 }
7285
7287 {
7289 return GetInventory().CanRemoveEntity();
7290
7291 return false;
7292 }
7293
7295 {
7296
7298 return false;
7299
7300
7302 return false;
7303
7304
7305
7307 if (delta == 0)
7308 return false;
7309
7310
7311 return true;
7312 }
7313
7315 {
7317 {
7318 if (ScriptInputUserData.CanStoreInputUserData())
7319 {
7320 ScriptInputUserData ctx = new ScriptInputUserData;
7325 ctx.
Write(destination_entity);
7329 }
7330 }
7331 else if (!
GetGame().IsMultiplayer())
7332 {
7334 }
7335 }
7336
7338 {
7339 float split_quantity_new;
7343 InventoryLocation loc = new InventoryLocation;
7344
7345 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7346 {
7348 split_quantity_new = stack_max;
7349 else
7351
7353 {
7354 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7355 if (new_item)
7356 {
7357 new_item.SetResultOfSplit(true);
7358 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7360 new_item.
SetQuantity(split_quantity_new,
false,
true);
7361 }
7362 }
7363 }
7364 else if (destination_entity && slot_id == -1)
7365 {
7366 if (quantity > stack_max)
7367 split_quantity_new = stack_max;
7368 else
7369 split_quantity_new = quantity;
7370
7372 {
7374 {
7377 }
7378
7379 if (new_item)
7380 {
7381 new_item.SetResultOfSplit(true);
7382 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7384 new_item.
SetQuantity(split_quantity_new,
false,
true);
7385 }
7386 }
7387 }
7388 else
7389 {
7390 if (stack_max != 0)
7391 {
7393 {
7395 }
7396
7397 if (split_quantity_new == 0)
7398 {
7399 if (!
GetGame().IsMultiplayer())
7400 player.PhysicalPredictiveDropItem(this);
7401 else
7402 player.ServerDropEntity(this);
7403 return;
7404 }
7405
7407 {
7409
7410 if (new_item)
7411 {
7412 new_item.SetResultOfSplit(true);
7413 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7416 new_item.PlaceOnSurface();
7417 }
7418 }
7419 }
7420 }
7421 }
7422
7424 {
7425 float split_quantity_new;
7429 InventoryLocation loc = new InventoryLocation;
7430
7431 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7432 {
7434 split_quantity_new = stack_max;
7435 else
7437
7439 {
7440 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7441 if (new_item)
7442 {
7443 new_item.SetResultOfSplit(true);
7444 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7446 new_item.
SetQuantity(split_quantity_new,
false,
true);
7447 }
7448 }
7449 }
7450 else if (destination_entity && slot_id == -1)
7451 {
7452 if (quantity > stack_max)
7453 split_quantity_new = stack_max;
7454 else
7455 split_quantity_new = quantity;
7456
7458 {
7460 {
7463 }
7464
7465 if (new_item)
7466 {
7467 new_item.SetResultOfSplit(true);
7468 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7470 new_item.
SetQuantity(split_quantity_new,
false,
true);
7471 }
7472 }
7473 }
7474 else
7475 {
7476 if (stack_max != 0)
7477 {
7479 {
7481 }
7482
7484 {
7486
7487 if (new_item)
7488 {
7489 new_item.SetResultOfSplit(true);
7490 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7493 new_item.PlaceOnSurface();
7494 }
7495 }
7496 }
7497 }
7498 }
7499
7501 {
7503 {
7504 if (ScriptInputUserData.CanStoreInputUserData())
7505 {
7506 ScriptInputUserData ctx = new ScriptInputUserData;
7511 dst.WriteToContext(ctx);
7513 }
7514 }
7515 else if (!
GetGame().IsMultiplayer())
7516 {
7518 }
7519 }
7520
7522 {
7524 {
7525 if (ScriptInputUserData.CanStoreInputUserData())
7526 {
7527 ScriptInputUserData ctx = new ScriptInputUserData;
7532 ctx.
Write(destination_entity);
7538 }
7539 }
7540 else if (!
GetGame().IsMultiplayer())
7541 {
7543 }
7544 }
7545
7547 {
7549 }
7550
7552 {
7554 float split_quantity_new;
7556 if (dst.IsValid())
7557 {
7558 int slot_id = dst.GetSlot();
7560
7561 if (quantity > stack_max)
7562 split_quantity_new = stack_max;
7563 else
7564 split_quantity_new = quantity;
7565
7567 {
7569
7570 if (new_item)
7571 {
7572 new_item.SetResultOfSplit(true);
7573 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7575 new_item.
SetQuantity(split_quantity_new,
false,
true);
7576 }
7577
7578 return new_item;
7579 }
7580 }
7581
7582 return null;
7583 }
7584
7586 {
7588 float split_quantity_new;
7590 if (destination_entity)
7591 {
7593 if (quantity > stackable)
7594 split_quantity_new = stackable;
7595 else
7596 split_quantity_new = quantity;
7597
7599 {
7600 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
7601 if (new_item)
7602 {
7603 new_item.SetResultOfSplit(true);
7604 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7606 new_item.
SetQuantity(split_quantity_new,
false,
true);
7607 }
7608 }
7609 }
7610 }
7611
7613 {
7615 {
7616 if (ScriptInputUserData.CanStoreInputUserData())
7617 {
7618 ScriptInputUserData ctx = new ScriptInputUserData;
7623 ItemBase destination_entity =
this;
7624 ctx.
Write(destination_entity);
7628 }
7629 }
7630 else if (!
GetGame().IsMultiplayer())
7631 {
7633 }
7634 }
7635
7637 {
7639 float split_quantity_new;
7641 if (player)
7642 {
7644 if (quantity > stackable)
7645 split_quantity_new = stackable;
7646 else
7647 split_quantity_new = quantity;
7648
7650 {
7651 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
7652 new_item =
ItemBase.Cast(in_hands);
7653 if (new_item)
7654 {
7655 new_item.SetResultOfSplit(true);
7656 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7658 new_item.SetQuantity(split_quantity_new, false, true);
7659 }
7660 }
7661 }
7662 }
7663
7665 {
7667 float split_quantity_new = Math.Floor(quantity * 0.5);
7668
7670 return;
7671
7673
7674 if (new_item)
7675 {
7676 if (new_item.GetQuantityMax() < split_quantity_new)
7677 {
7678 split_quantity_new = new_item.GetQuantityMax();
7679 }
7680
7681 new_item.SetResultOfSplit(true);
7682 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7683
7685 {
7688 }
7689 else
7690 {
7692 new_item.
SetQuantity(split_quantity_new,
false,
true);
7693 }
7694 }
7695 }
7696
7698 {
7700 float split_quantity_new = Math.Floor(quantity / 2);
7701
7703 return;
7704
7705 InventoryLocation invloc = new InventoryLocation;
7707
7709 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
7710
7711 if (new_item)
7712 {
7713 if (new_item.GetQuantityMax() < split_quantity_new)
7714 {
7715 split_quantity_new = new_item.GetQuantityMax();
7716 }
7718 {
7721 }
7722 else if (split_quantity_new > 1)
7723 {
7725 new_item.
SetQuantity(split_quantity_new,
false,
true);
7726 }
7727 }
7728 }
7729
7732 {
7733 SetWeightDirty();
7735
7736 if (parent)
7737 parent.OnAttachmentQuantityChangedEx(this, delta);
7738
7740 {
7742 {
7744 }
7746 {
7747 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
7749 }
7750 }
7751
7752 }
7753
7756 {
7757
7758 }
7759
7762 {
7764 }
7765
7767 {
7768 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
7769
7771 {
7772 if (newLevel == GameConstants.STATE_RUINED)
7773 {
7775 EntityAI parent = GetHierarchyParent();
7776 if (parent && parent.IsFireplace())
7777 {
7778 CargoBase cargo = GetInventory().GetCargo();
7779 if (cargo)
7780 {
7782 {
7784 }
7785 }
7786 }
7787 }
7788
7790 {
7791
7793 return;
7794 }
7795
7796 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
7797 {
7799 }
7800 }
7801 }
7802
7803
7805 {
7806 super.OnRightClick();
7807
7809 {
7811 {
7812 if (ScriptInputUserData.CanStoreInputUserData())
7813 {
7814 EntityAI root = GetHierarchyRoot();
7815 Man playerOwner = GetHierarchyRootPlayer();
7816 InventoryLocation dst = new InventoryLocation;
7817
7818
7819 if (!playerOwner && root && root == this)
7820 {
7822 }
7823 else
7824 {
7825
7826 GetInventory().GetCurrentInventoryLocation(dst);
7828 {
7831 {
7833 }
7834 else
7835 {
7837
7838
7839 if (
GetGame().
GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
7840 {
7842 }
7843 else
7844 {
7845 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
7846 }
7847 }
7848 }
7849 }
7850
7851 ScriptInputUserData ctx = new ScriptInputUserData;
7859 }
7860 }
7861 else if (!
GetGame().IsMultiplayer())
7862 {
7864 }
7865 }
7866 }
7867
7869 {
7870 if (root)
7871 {
7872 vector m4[4];
7873 root.GetTransform(m4);
7874 dst.SetGround(this, m4);
7875 }
7876 else
7877 {
7878 GetInventory().GetCurrentInventoryLocation(dst);
7879 }
7880 }
7881
7882 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
7883 {
7884
7885 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
7886 return false;
7887
7888 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
7889 return false;
7890
7891
7893 return false;
7894
7895
7896 Magazine mag = Magazine.Cast(this);
7897 if (mag)
7898 {
7899 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
7900 return false;
7901
7902 if (stack_max_limit)
7903 {
7904 Magazine other_mag = Magazine.Cast(other_item);
7905 if (other_item)
7906 {
7907 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
7908 return false;
7909 }
7910
7911 }
7912 }
7913 else
7914 {
7915
7917 return false;
7918
7920 return false;
7921 }
7922
7923 PlayerBase player = null;
7924 if (CastTo(player, GetHierarchyRootPlayer()))
7925 {
7926 if (player.GetInventory().HasAttachment(this))
7927 return false;
7928
7929 if (player.IsItemsToDelete())
7930 return false;
7931 }
7932
7933 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
7934 return false;
7935
7936 int slotID;
7938 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
7939 return false;
7940
7941 return true;
7942 }
7943
7945 {
7947 }
7948
7950 {
7951 return m_IsResultOfSplit;
7952 }
7953
7955 {
7956 m_IsResultOfSplit = value;
7957 }
7958
7960 {
7962 }
7963
7965 {
7966 float other_item_quantity = other_item.GetQuantity();
7967 float this_free_space;
7968
7970
7972
7973 if (other_item_quantity > this_free_space)
7974 {
7975 return this_free_space;
7976 }
7977 else
7978 {
7979 return other_item_quantity;
7980 }
7981 }
7982
7984 {
7986 }
7987
7989 {
7991 return;
7992
7993 if (!IsMagazine() && other_item)
7994 {
7996 if (quantity_used != 0)
7997 {
7998 float hp1 = GetHealth01("","");
7999 float hp2 = other_item.GetHealth01("","");
8000 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
8001 hpResult = hpResult / (
GetQuantity() + quantity_used);
8002
8003 hpResult *= GetMaxHealth();
8004 Math.Round(hpResult);
8005 SetHealth("", "Health", hpResult);
8006
8008 other_item.AddQuantity(-quantity_used);
8009 }
8010 }
8012 }
8013
8015 {
8016 #ifdef SERVER
8017 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
8018 GetHierarchyParent().IncreaseLifetimeUp();
8019 #endif
8020 };
8021
8023 {
8024 PlayerBase p = PlayerBase.Cast(player);
8025
8026 array<int> recipesIds = p.m_Recipes;
8027 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8028 if (moduleRecipesManager)
8029 {
8030 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
8031 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
8032 }
8033
8034 for (int i = 0;i < recipesIds.Count(); i++)
8035 {
8036 int key = recipesIds.Get(i);
8037 string recipeName = moduleRecipesManager.GetRecipeName(key);
8039 }
8040 }
8041
8042
8043 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
8044 {
8045 super.GetDebugActions(outputList);
8046
8047
8053
8054
8059
8064
8065
8069
8070
8072 {
8076 }
8077
8080
8081
8085
8087
8088 InventoryLocation loc = new InventoryLocation();
8089 GetInventory().GetCurrentInventoryLocation(loc);
8091 {
8092 if (Gizmo_IsSupported())
8095 }
8096
8098 }
8099
8100
8101
8102
8104 {
8105 super.OnAction(action_id, player, ctx);
8106
8108 {
8109 switch (action_id)
8110 {
8113 return true;
8116 return true;
8117 }
8118 }
8119
8121 {
8122 switch (action_id)
8123 {
8125 Delete();
8126 return true;
8127 }
8128 }
8129
8130 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
8131 {
8132 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8133 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
8134 PlayerBase p = PlayerBase.Cast(player);
8135 if (
EActions.RECIPES_RANGE_START < 1000)
8136 {
8137 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
8138 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
8139 }
8140 }
8141 #ifndef SERVER
8142 else if (action_id ==
EActions.WATCH_PLAYER)
8143 {
8144 PluginDeveloper.SetDeveloperItemClientEx(player);
8145 }
8146 #endif
8148 {
8149 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
8150 {
8151 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
8152 OnDebugButtonPressServer(id + 1);
8153 }
8154
8155 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
8156 {
8157 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
8159 }
8160
8161 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
8162 {
8163 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
8165 }
8166
8167 else if (action_id ==
EActions.ADD_QUANTITY)
8168 {
8169 if (IsMagazine())
8170 {
8171 Magazine mag = Magazine.Cast(this);
8172 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
8173 }
8174 else
8175 {
8177 }
8178
8179 if (m_EM)
8180 {
8181 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
8182 }
8183
8184 }
8185
8186 else if (action_id ==
EActions.REMOVE_QUANTITY)
8187 {
8188 if (IsMagazine())
8189 {
8190 Magazine mag2 = Magazine.Cast(this);
8191 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
8192 }
8193 else
8194 {
8196 }
8197 if (m_EM)
8198 {
8199 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
8200 }
8201
8202 }
8203
8204 else if (action_id ==
EActions.SET_QUANTITY_0)
8205 {
8207
8208 if (m_EM)
8209 {
8210 m_EM.SetEnergy(0);
8211 }
8212 }
8213
8214 else if (action_id ==
EActions.SET_MAX_QUANTITY)
8215 {
8217
8218 if (m_EM)
8219 {
8220 m_EM.SetEnergy(m_EM.GetEnergyMax());
8221 }
8222 }
8223
8224 else if (action_id ==
EActions.ADD_HEALTH)
8225 {
8226 AddHealth("","",GetMaxHealth("","Health")/5);
8227 }
8228 else if (action_id ==
EActions.REMOVE_HEALTH)
8229 {
8230 AddHealth("","",-GetMaxHealth("","Health")/5);
8231 }
8232 else if (action_id ==
EActions.DESTROY_HEALTH)
8233 {
8234 SetHealth01("","",0);
8235 }
8236 else if (action_id ==
EActions.WATCH_ITEM)
8237 {
8239 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
8240 #ifdef DEVELOPER
8241 SetDebugDeveloper_item(this);
8242 #endif
8243 }
8244
8245 else if (action_id ==
EActions.ADD_TEMPERATURE)
8246 {
8247 AddTemperature(20);
8248
8249 }
8250
8251 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
8252 {
8253 AddTemperature(-20);
8254
8255 }
8256
8257 else if (action_id ==
EActions.FLIP_FROZEN)
8258 {
8259 SetFrozen(!GetIsFrozen());
8260
8261 }
8262
8263 else if (action_id ==
EActions.ADD_WETNESS)
8264 {
8266
8267 }
8268
8269 else if (action_id ==
EActions.REMOVE_WETNESS)
8270 {
8272
8273 }
8274
8275 else if (action_id ==
EActions.LIQUIDTYPE_UP)
8276 {
8279
8280
8281 }
8282
8283 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
8284 {
8287 }
8288
8289 else if (action_id ==
EActions.MAKE_SPECIAL)
8290 {
8291 auto debugParams = DebugSpawnParams.WithPlayer(player);
8292 OnDebugSpawnEx(debugParams);
8293 }
8294
8295 }
8296
8297
8298 return false;
8299 }
8300
8301
8302
8303
8307
8310
8311
8312
8314 {
8315 return false;
8316 }
8317
8318
8320 {
8321 return true;
8322 }
8323
8324
8326 {
8327 return true;
8328 }
8329
8330
8331
8333 {
8334 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
8336 }
8337
8340 {
8341 return null;
8342 }
8343
8345 {
8346 return false;
8347 }
8348
8350 {
8351 return false;
8352 }
8353
8357
8358
8360 {
8361 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8362 return module_repairing.CanRepair(this, item_repair_kit);
8363 }
8364
8365
8366 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
8367 {
8368 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8369 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
8370 }
8371
8372
8374 {
8375
8376
8377
8378
8379
8380
8381
8382
8383 return 1;
8384 }
8385
8386
8387
8389 {
8391 }
8392
8393
8394
8396 {
8398 }
8399
8400
8409 {
8410 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8411
8412 if (player)
8413 {
8414 player.MessageStatus(text);
8415 }
8416 }
8417
8418
8427 {
8428 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8429
8430 if (player)
8431 {
8432 player.MessageAction(text);
8433 }
8434 }
8435
8436
8445 {
8446 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8447
8448 if (player)
8449 {
8450 player.MessageFriendly(text);
8451 }
8452 }
8453
8454
8463 {
8464 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8465
8466 if (player)
8467 {
8468 player.MessageImportant(text);
8469 }
8470 }
8471
8473 {
8474 return true;
8475 }
8476
8477
8478 override bool KindOf(
string tag)
8479 {
8480 bool found = false;
8481 string item_name = this.
GetType();
8484
8485 int array_size = item_tag_array.Count();
8486 for (int i = 0; i < array_size; i++)
8487 {
8488 if (item_tag_array.Get(i) == tag)
8489 {
8490 found = true;
8491 break;
8492 }
8493 }
8494 return found;
8495 }
8496
8497
8499 {
8500
8501 super.OnRPC(sender, rpc_type,ctx);
8502
8503
8504 switch (rpc_type)
8505 {
8506 #ifndef SERVER
8507 case ERPCs.RPC_SOUND_LOCK_ATTACH:
8508 Param2<bool, string> p = new Param2<bool, string>(false, "");
8509
8511 return;
8512
8513 bool play = p.param1;
8514 string soundSet = p.param2;
8515
8516 if (play)
8517 {
8519 {
8521 {
8523 }
8524 }
8525 else
8526 {
8528 }
8529 }
8530 else
8531 {
8533 }
8534
8535 break;
8536 #endif
8537
8538 }
8539
8541 {
8543 }
8544 }
8545
8546
8547
8548
8550 {
8551 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8552 return plugin.GetID(
name);
8553 }
8554
8556 {
8557 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8558 return plugin.GetName(id);
8559 }
8560
8563 {
8564
8565
8566 int varFlags;
8567 if (!ctx.
Read(varFlags))
8568 return;
8569
8570 if (varFlags & ItemVariableFlags.FLOAT)
8571 {
8573 }
8574 }
8575
8577 {
8578
8579 super.SerializeNumericalVars(floats_out);
8580
8581
8582
8584 {
8586 }
8587
8589 {
8591 }
8592
8594 {
8596 }
8597
8599 {
8604 }
8605
8607 {
8609 }
8610 }
8611
8613 {
8614
8615 super.DeSerializeNumericalVars(floats);
8616
8617
8618 int index = 0;
8619 int mask = Math.Round(floats.Get(index));
8620
8621 index++;
8622
8624 {
8626 {
8628 }
8629 else
8630 {
8631 float quantity = floats.Get(index);
8633 }
8634 index++;
8635 }
8636
8638 {
8639 float wet = floats.Get(index);
8641 index++;
8642 }
8643
8645 {
8646 int liquidtype = Math.Round(floats.Get(index));
8648 index++;
8649 }
8650
8652 {
8654 index++;
8656 index++;
8658 index++;
8660 index++;
8661 }
8662
8664 {
8665 int cleanness = Math.Round(floats.Get(index));
8667 index++;
8668 }
8669 }
8670
8672 {
8673 super.WriteVarsToCTX(ctx);
8674
8675
8677 {
8679 }
8680
8682 {
8684 }
8685
8687 {
8689 }
8690
8692 {
8693 int r,g,b,a;
8699 }
8700
8702 {
8704 }
8705 }
8706
8708 {
8709 if (!super.ReadVarsFromCTX(ctx,version))
8710 return false;
8711
8712 int intValue;
8713 float value;
8714
8715 if (version < 140)
8716 {
8717 if (!ctx.
Read(intValue))
8718 return false;
8719
8720 m_VariablesMask = intValue;
8721 }
8722
8724 {
8725 if (!ctx.
Read(value))
8726 return false;
8727
8729 {
8731 }
8732 else
8733 {
8735 }
8736 }
8737
8738 if (version < 140)
8739 {
8741 {
8742 if (!ctx.
Read(value))
8743 return false;
8744 SetTemperatureDirect(value);
8745 }
8746 }
8747
8749 {
8750 if (!ctx.
Read(value))
8751 return false;
8753 }
8754
8756 {
8757 if (!ctx.
Read(intValue))
8758 return false;
8760 }
8761
8763 {
8764 int r,g,b,a;
8766 return false;
8768 return false;
8770 return false;
8772 return false;
8773
8775 }
8776
8778 {
8779 if (!ctx.
Read(intValue))
8780 return false;
8782 }
8783
8784 if (version >= 138 && version < 140)
8785 {
8787 {
8788 if (!ctx.
Read(intValue))
8789 return false;
8790 SetFrozen(intValue);
8791 }
8792 }
8793
8794 return true;
8795 }
8796
8797
8799 {
8802 {
8804 }
8805
8806 if (!super.OnStoreLoad(ctx, version))
8807 {
8809 return false;
8810 }
8811
8812 if (version >= 114)
8813 {
8814 bool hasQuickBarIndexSaved;
8815
8816 if (!ctx.
Read(hasQuickBarIndexSaved))
8817 {
8819 return false;
8820 }
8821
8822 if (hasQuickBarIndexSaved)
8823 {
8824 int itmQBIndex;
8825
8826
8827 if (!ctx.
Read(itmQBIndex))
8828 {
8830 return false;
8831 }
8832
8833 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
8834 if (itmQBIndex != -1 && parentPlayer)
8835 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
8836 }
8837 }
8838 else
8839 {
8840
8841 PlayerBase player;
8842 int itemQBIndex;
8843 if (version ==
int.
MAX)
8844 {
8845 if (!ctx.
Read(itemQBIndex))
8846 {
8848 return false;
8849 }
8850 }
8851 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
8852 {
8853
8854 if (!ctx.
Read(itemQBIndex))
8855 {
8857 return false;
8858 }
8859 if (itemQBIndex != -1 && player)
8860 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
8861 }
8862 }
8863
8864 if (version < 140)
8865 {
8866
8867 if (!LoadVariables(ctx, version))
8868 {
8870 return false;
8871 }
8872 }
8873
8874
8876 {
8878 return false;
8879 }
8880 if (version >= 132)
8881 {
8883 if (raib)
8884 {
8886 {
8888 return false;
8889 }
8890 }
8891 }
8892
8894 return true;
8895 }
8896
8897
8898
8900 {
8901 super.OnStoreSave(ctx);
8902
8903 PlayerBase player;
8904 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
8905 {
8907
8908 int itemQBIndex = -1;
8909 itemQBIndex = player.FindQuickBarEntityIndex(this);
8910 ctx.
Write(itemQBIndex);
8911 }
8912 else
8913 {
8915 }
8916
8918
8920 if (raib)
8921 {
8923 }
8924 }
8925
8926
8928 {
8929 super.AfterStoreLoad();
8930
8932 {
8934 }
8935
8937 {
8940 }
8941 }
8942
8944 {
8945 super.EEOnAfterLoad();
8946
8948 {
8950 }
8951
8954 }
8955
8957 {
8958 return false;
8959 }
8960
8961
8962
8964 {
8966 {
8967 #ifdef PLATFORM_CONSOLE
8968
8970 {
8972 if (menu)
8973 {
8975 }
8976 }
8977 #endif
8978 }
8979
8981 {
8984 }
8985
8987 {
8988 SetWeightDirty();
8990 }
8992 {
8995 }
8996
8998 {
9001 }
9003 {
9006 }
9007
9008 super.OnVariablesSynchronized();
9009 }
9010
9011
9012
9014 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
9015 {
9016 if (!IsServerCheck(allow_client))
9017 return false;
9018
9020 return false;
9021
9024
9025 if (value <= (min + 0.001))
9026 value = min;
9027
9028 if (value == min)
9029 {
9030 if (destroy_config)
9031 {
9032 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
9033 if (dstr)
9034 {
9036 this.Delete();
9037 return true;
9038 }
9039 }
9040 else if (destroy_forced)
9041 {
9043 this.Delete();
9044 return true;
9045 }
9046
9048 }
9049
9052
9054 {
9056
9057 if (delta)
9059 }
9060
9062
9063 return false;
9064 }
9065
9066
9068 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9069 {
9071 }
9072
9074 {
9077 }
9078
9080 {
9083 }
9084
9086 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9087 {
9088 float value_clamped = Math.Clamp(value, 0, 1);
9090 SetQuantity(result, destroy_config, destroy_forced);
9091 }
9092
9093
9096 {
9098 }
9099
9101 {
9103 }
9104
9105
9106
9107
9108
9109
9110
9111
9112
9113
9115 {
9116 int slot = -1;
9117 if (GetInventory())
9118 {
9119 InventoryLocation il = new InventoryLocation;
9120 GetInventory().GetCurrentInventoryLocation(il);
9122 }
9123
9125 }
9126
9128 {
9129 float quantity_max = 0;
9130
9132 {
9133 if (attSlotID != -1)
9134 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
9135
9136 if (quantity_max <= 0)
9138 }
9139
9140 if (quantity_max <= 0)
9142
9143 return quantity_max;
9144 }
9145
9147 {
9149 }
9150
9152 {
9154 }
9155
9156
9158 {
9160 }
9161
9163 {
9165 }
9166
9168 {
9170 }
9171
9172
9174 {
9175
9176 float weightEx = GetWeightEx();
9177 float special = GetInventoryAndCargoWeight();
9178 return weightEx - special;
9179 }
9180
9181
9183 {
9185 }
9186
9188 {
9190 {
9191 #ifdef DEVELOPER
9192 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9193 {
9194 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
9196 }
9197 #endif
9198
9200 }
9201 else if (HasEnergyManager())
9202 {
9203 #ifdef DEVELOPER
9204 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9205 {
9206 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
9207 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
9208 }
9209 #endif
9210 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
9211 }
9212 else
9213 {
9214 #ifdef DEVELOPER
9215 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9216 {
9217 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
9218 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
9219 }
9220 #endif
9221 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
9222 }
9223 }
9224
9227 {
9228 int item_count = 0;
9230
9231 if (GetInventory().GetCargo() != NULL)
9232 {
9233 item_count = GetInventory().GetCargo().GetItemCount();
9234 }
9235
9236 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
9237 {
9238 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
9239 if (item)
9240 item_count += item.GetNumberOfItems();
9241 }
9242 return item_count;
9243 }
9244
9247 {
9248 float weight = 0;
9249 float wetness = 1;
9250 if (include_wetness)
9253 {
9254 weight = wetness * m_ConfigWeight;
9255 }
9257 {
9258 weight = 1;
9259 }
9260 return weight;
9261 }
9262
9263
9264
9266 {
9267 if ((
GetGame().IsServer() || !
GetGame().IsMultiplayer()) && GetInventory())
9268 {
9269 GameInventory inv = GetInventory();
9270 array<EntityAI> items = new array<EntityAI>;
9272 for (int i = 0; i < items.Count(); i++)
9273 {
9275 if (item)
9276 {
9278 }
9279 }
9280 }
9281 }
9282
9283
9284
9285
9287 {
9288 float energy = 0;
9289 if (HasEnergyManager())
9290 {
9291 energy = GetCompEM().GetEnergy();
9292 }
9293 return energy;
9294 }
9295
9296
9298 {
9299 super.OnEnergyConsumed();
9300
9302 }
9303
9305 {
9306 super.OnEnergyAdded();
9307
9309 }
9310
9311
9313 {
9314 if (
GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
9315 {
9317 {
9318 float energy_0to1 = GetCompEM().GetEnergy0To1();
9320 }
9321 }
9322 }
9323
9324
9326 {
9327 return ConfigGetFloat("heatIsolation");
9328 }
9329
9331 {
9333 }
9334
9336 {
9337 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
9338 if (
GetGame().ConfigIsExisting(paramPath))
9340
9341 return 0.0;
9342 }
9343
9345 {
9346 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
9347 if (
GetGame().ConfigIsExisting(paramPath))
9349
9350 return 0.0;
9351 }
9352
9353 override void SetWet(
float value,
bool allow_client =
false)
9354 {
9355 if (!IsServerCheck(allow_client))
9356 return;
9357
9360
9362
9363 m_VarWet = Math.Clamp(value, min, max);
9364
9366 {
9369 }
9370 }
9371
9372 override void AddWet(
float value)
9373 {
9375 }
9376
9378 {
9380 }
9381
9383 {
9385 }
9386
9388 {
9390 }
9391
9393 {
9395 }
9396
9398 {
9400 }
9401
9403 {
9406 if (newLevel != oldLevel)
9407 {
9409 }
9410 }
9411
9413 {
9414 SetWeightDirty();
9415 }
9416
9418 {
9419 return GetWetLevelInternal(
m_VarWet);
9420 }
9421
9422
9423
9425 {
9427 }
9428
9430 {
9432 }
9433
9435 {
9437 }
9438
9440 {
9442 }
9443
9444
9445
9447 {
9448 if (ConfigIsExisting("itemModelLength"))
9449 {
9450 return ConfigGetFloat("itemModelLength");
9451 }
9452 return 0;
9453 }
9454
9456 {
9457 if (ConfigIsExisting("itemAttachOffset"))
9458 {
9459 return ConfigGetFloat("itemAttachOffset");
9460 }
9461 return 0;
9462 }
9463
9464 override void SetCleanness(
int value,
bool allow_client =
false)
9465 {
9466 if (!IsServerCheck(allow_client))
9467 return;
9468
9470
9472
9475 }
9476
9478 {
9480 }
9481
9483 {
9484 return true;
9485 }
9486
9487
9488
9489
9491 {
9493 }
9494
9496 {
9498 }
9499
9500
9501
9502
9503 override void SetColor(
int r,
int g,
int b,
int a)
9504 {
9510 }
9512 override void GetColor(out
int r,out
int g,out
int b,out
int a)
9513 {
9518 }
9519
9521 {
9523 }
9524
9527 {
9528 int r,g,b,a;
9530 r = r/255;
9531 g = g/255;
9532 b = b/255;
9533 a = a/255;
9534 return MiscGameplayFunctions.GetColorString(r, g, b, a);
9535 }
9536
9537
9538
9539 override void SetLiquidType(
int value,
bool allow_client =
false)
9540 {
9541 if (!IsServerCheck(allow_client))
9542 return;
9543
9548 }
9549
9551 {
9552 return ConfigGetInt("varLiquidTypeInit");
9553 }
9554
9556 {
9558 }
9559
9561 {
9563 SetFrozen(false);
9564 }
9565
9568 {
9569 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9570 }
9571
9572
9575 {
9576 PlayerBase nplayer;
9577 if (PlayerBase.CastTo(nplayer, player))
9578 {
9580
9581 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9582 }
9583 }
9584
9585
9588 {
9589 PlayerBase nplayer;
9590 if (PlayerBase.CastTo(nplayer,player))
9591 {
9592
9593 nplayer.SetEnableQuickBarEntityShortcut(this,false);
9594
9595 }
9596
9597
9598 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
9599
9600
9601 if (HasEnergyManager())
9602 {
9603 GetCompEM().UpdatePlugState();
9604 }
9605 }
9606
9607
9609 {
9610 super.OnPlacementStarted(player);
9611
9613 }
9614
9615 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
9616 {
9618 {
9619 m_AdminLog.OnPlacementComplete(player,
this);
9620 }
9621
9622 super.OnPlacementComplete(player, position, orientation);
9623 }
9624
9625
9626
9627
9628
9630 {
9632 {
9633 return true;
9634 }
9635 else
9636 {
9637 return false;
9638 }
9639 }
9640
9641
9643 {
9645 {
9647 }
9648 }
9649
9650
9652 {
9654 }
9655
9657 {
9659 }
9660
9661 override void InsertAgent(
int agent,
float count = 1)
9662 {
9663 if (count < 1)
9664 return;
9665
9667 }
9668
9671 {
9673 }
9674
9675
9677 {
9679 }
9680
9681
9682
9683
9684
9685
9686
9687
9688
9689
9690
9691
9692
9693
9694
9695
9696
9697
9698
9699
9700
9701
9702
9703
9704
9705
9706
9707
9708
9709
9710
9711
9712
9713
9714
9715
9716
9717
9718
9719
9720
9721
9723 {
9725 return false;
9726 return true;
9727 }
9728
9730 {
9731
9733 }
9734
9735
9738 {
9739 super.CheckForRoofLimited(timeTresholdMS);
9740
9742 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
9743 {
9744 m_PreviousRoofTestTime = time;
9745 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
9746 }
9747 }
9748
9749
9751 {
9753 {
9754 return 0;
9755 }
9756
9757 if (GetInventory().GetAttachmentSlotsCount() != 0)
9758 {
9759 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
9760 if (filter)
9761 return filter.GetProtectionLevel(type, false, system);
9762 else
9763 return 0;
9764 }
9765
9766 string subclassPath, entryName;
9767
9768 switch (type)
9769 {
9771 entryName = "biological";
9772 break;
9774 entryName = "chemical";
9775 break;
9776 default:
9777 entryName = "biological";
9778 break;
9779 }
9780
9781 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
9782
9784 }
9785
9786
9787
9790 {
9791 if (!IsMagazine())
9793
9795 }
9796
9797
9798
9799
9800
9805 {
9806 return true;
9807 }
9808
9810 {
9812 }
9813
9814
9815
9816
9817
9819 {
9820 if (parent)
9821 {
9822 if (parent.IsInherited(DayZInfected))
9823 return true;
9824
9825 if (!parent.IsRuined())
9826 return true;
9827 }
9828
9829 return true;
9830 }
9831
9833 {
9834 if (!super.CanPutAsAttachment(parent))
9835 {
9836 return false;
9837 }
9838
9839 if (!IsRuined() && !parent.IsRuined())
9840 {
9841 return true;
9842 }
9843
9844 return false;
9845 }
9846
9848 {
9849
9850
9851
9852
9853 return super.CanReceiveItemIntoCargo(item);
9854 }
9855
9857 {
9858
9859
9860
9861
9862 GameInventory attachmentInv = attachment.GetInventory();
9864 {
9865 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
9866 return false;
9867 }
9868
9869 InventoryLocation loc = new InventoryLocation();
9870 attachment.GetInventory().GetCurrentInventoryLocation(loc);
9871 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
9872 return false;
9873
9874 return super.CanReceiveAttachment(attachment, slotId);
9875 }
9876
9878 {
9879 if (!super.CanReleaseAttachment(attachment))
9880 return false;
9881
9882 return GetInventory().AreChildrenAccessible();
9883 }
9884
9885
9886
9887
9888
9889
9890
9891
9892
9893
9894
9895
9896
9897
9898
9899
9900
9901
9902
9903
9904
9906 {
9907 int id = muzzle_owner.GetMuzzleID();
9908 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
9909
9910 if (WPOF_array)
9911 {
9912 for (int i = 0; i < WPOF_array.Count(); i++)
9913 {
9914 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
9915
9916 if (WPOF)
9917 {
9918 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
9919 }
9920 }
9921 }
9922 }
9923
9924
9926 {
9927 int id = muzzle_owner.GetMuzzleID();
9929
9930 if (WPOBE_array)
9931 {
9932 for (int i = 0; i < WPOBE_array.Count(); i++)
9933 {
9934 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
9935
9936 if (WPOBE)
9937 {
9938 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
9939 }
9940 }
9941 }
9942 }
9943
9944
9946 {
9947 int id = muzzle_owner.GetMuzzleID();
9948 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9949
9950 if (WPOOH_array)
9951 {
9952 for (int i = 0; i < WPOOH_array.Count(); i++)
9953 {
9954 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9955
9956 if (WPOOH)
9957 {
9958 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
9959 }
9960 }
9961 }
9962 }
9963
9964
9966 {
9967 int id = muzzle_owner.GetMuzzleID();
9968 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9969
9970 if (WPOOH_array)
9971 {
9972 for (int i = 0; i < WPOOH_array.Count(); i++)
9973 {
9974 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9975
9976 if (WPOOH)
9977 {
9978 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9979 }
9980 }
9981 }
9982 }
9983
9984
9986 {
9987 int id = muzzle_owner.GetMuzzleID();
9988 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9989
9990 if (WPOOH_array)
9991 {
9992 for (int i = 0; i < WPOOH_array.Count(); i++)
9993 {
9994 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9995
9996 if (WPOOH)
9997 {
9998 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9999 }
10000 }
10001 }
10002 }
10003
10004
10005
10007 {
10009 {
10010 return true;
10011 }
10012
10013 return false;
10014 }
10015
10017 {
10019 {
10020 return true;
10021 }
10022
10023 return false;
10024 }
10025
10027 {
10029 {
10030 return true;
10031 }
10032
10033 return false;
10034 }
10035
10037 {
10038 return false;
10039 }
10040
10043 {
10044 return UATimeSpent.DEFAULT_DEPLOY;
10045 }
10046
10047
10048
10049
10051 {
10053 SetSynchDirty();
10054 }
10055
10057 {
10059 }
10060
10061
10063 {
10064 return false;
10065 }
10066
10069 {
10070 string att_type = "None";
10071
10072 if (ConfigIsExisting("soundAttType"))
10073 {
10074 att_type = ConfigGetString("soundAttType");
10075 }
10076
10078 }
10079
10081 {
10083 }
10084
10085
10086
10087
10088
10094
10096 {
10099
10101 }
10102
10103
10105 {
10107 return;
10108
10110
10113
10116
10117 SoundParameters params = new SoundParameters();
10121 }
10122
10123
10125 {
10127 return;
10128
10130 SetSynchDirty();
10131
10134 }
10135
10136
10138 {
10140 return;
10141
10143 SetSynchDirty();
10144
10147 }
10148
10150 {
10152 }
10153
10155 {
10157 }
10158
10161 {
10162 if (!
GetGame().IsDedicatedServer())
10163 {
10164 if (ConfigIsExisting("attachSoundSet"))
10165 {
10166 string cfg_path = "";
10167 string soundset = "";
10168 string type_name =
GetType();
10169
10172 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
10173 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
10174
10175 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
10176 {
10177 for (int i = 0; i < cfg_soundset_array.Count(); i++)
10178 {
10179 if (cfg_slot_array[i] == slot_type)
10180 {
10181 soundset = cfg_soundset_array[i];
10182 break;
10183 }
10184 }
10185 }
10186
10187 if (soundset != "")
10188 {
10189 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
10191 }
10192 }
10193 }
10194 }
10195
10197 {
10198
10199 }
10200
10201 void OnApply(PlayerBase player);
10202
10204 {
10205 return 1.0;
10206 };
10207
10209 {
10211 }
10212
10214 {
10216 }
10217
10219
10221 {
10222 SetDynamicPhysicsLifeTime(0.01);
10224 }
10225
10227 {
10228 array<string> zone_names = new array<string>;
10229 GetDamageZones(zone_names);
10230 for (int i = 0; i < zone_names.Count(); i++)
10231 {
10232 SetHealthMax(zone_names.Get(i),"Health");
10233 }
10234 SetHealthMax("","Health");
10235 }
10236
10239 {
10240 float global_health = GetHealth01("","Health");
10241 array<string> zones = new array<string>;
10242 GetDamageZones(zones);
10243
10244 for (int i = 0; i < zones.Count(); i++)
10245 {
10246 SetHealth01(zones.Get(i),"Health",global_health);
10247 }
10248 }
10249
10252 {
10253 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
10254 }
10255
10257 {
10258 if (!hasRootAsPlayer)
10259 {
10260 if (refParentIB)
10261 {
10262
10263 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
10264 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
10265
10266 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
10267 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
10268
10271 }
10272 else
10273 {
10274
10277 }
10278 }
10279 }
10280
10282 {
10284 {
10285 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
10286 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
10287 {
10288 float heatPermCoef = 1.0;
10290 while (ent)
10291 {
10292 heatPermCoef *= ent.GetHeatPermeabilityCoef();
10293 ent = ent.GetHierarchyParent();
10294 }
10295
10296 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
10297 }
10298 }
10299 }
10300
10302 {
10303
10304 EntityAI parent = GetHierarchyParent();
10305 if (!parent)
10306 {
10307 hasParent = false;
10308 hasRootAsPlayer = false;
10309 }
10310 else
10311 {
10312 hasParent = true;
10313 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
10314 refParentIB =
ItemBase.Cast(parent);
10315 }
10316 }
10317
10318 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
10319 {
10320
10321 }
10322
10324 {
10325
10326 return false;
10327 }
10328
10330 {
10331
10332
10333 return false;
10334 }
10335
10337 {
10338
10339 return false;
10340 }
10341
10344 {
10345 return !GetIsFrozen() &&
IsOpen();
10346 }
10347
10349 {
10350 bool hasParent = false, hasRootAsPlayer = false;
10352
10353 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
10354 bool foodDecay =
g_Game.IsFoodDecayEnabled();
10355
10356 if (wwtu || foodDecay)
10357 {
10361
10362 if (processWetness || processTemperature || processDecay)
10363 {
10365
10366 if (processWetness)
10367 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
10368
10369 if (processTemperature)
10371
10372 if (processDecay)
10373 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
10374 }
10375 }
10376 }
10377
10380 {
10382 }
10383
10385 {
10388
10389 return super.GetTemperatureFreezeThreshold();
10390 }
10391
10393 {
10396
10397 return super.GetTemperatureThawThreshold();
10398 }
10399
10401 {
10404
10405 return super.GetItemOverheatThreshold();
10406 }
10407
10409 {
10411 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
10412
10413 return super.GetTemperatureFreezeTime();
10414 }
10415
10417 {
10419 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
10420
10421 return super.GetTemperatureThawTime();
10422 }
10423
10428
10430 {
10431 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
10432 }
10433
10435 {
10436 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
10437 }
10438
10441 {
10443 }
10444
10446 {
10448 }
10449
10451 {
10453 }
10454
10457 {
10458 return null;
10459 }
10460
10463 {
10464 return false;
10465 }
10466
10468 {
10470 {
10473 if (!trg)
10474 {
10476 explosive = this;
10477 }
10478
10479 explosive.PairRemote(trg);
10481
10482 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
10483 trg.SetPersistentPairID(persistentID);
10484 explosive.SetPersistentPairID(persistentID);
10485
10486 return true;
10487 }
10488 return false;
10489 }
10490
10493 {
10494 float ret = 1.0;
10497 ret *= GetHealth01();
10498
10499 return ret;
10500 }
10501
10502 #ifdef DEVELOPER
10503 override void SetDebugItem()
10504 {
10505 super.SetDebugItem();
10506 _itemBase = this;
10507 }
10508
10510 {
10511 string text = super.GetDebugText();
10512
10514 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
10515
10516 return text;
10517 }
10518 #endif
10519
10521 {
10522 return true;
10523 }
10524
10526
10528
10530 {
10533 }
10534
10535
10543
10559}
10560
10562{
10564 if (entity)
10565 {
10566 bool is_item = entity.IsInherited(
ItemBase);
10567 if (is_item && full_quantity)
10568 {
10571 }
10572 }
10573 else
10574 {
10576 return NULL;
10577 }
10578 return entity;
10579}
10580
10582{
10583 if (item)
10584 {
10585 if (health > 0)
10586 item.SetHealth("", "", health);
10587
10588 if (item.CanHaveTemperature())
10589 {
10591 if (item.CanFreeze())
10592 item.SetFrozen(false);
10593 }
10594
10595 if (item.HasEnergyManager())
10596 {
10597 if (quantity >= 0)
10598 {
10599 item.GetCompEM().SetEnergy0To1(quantity);
10600 }
10601 else
10602 {
10604 }
10605 }
10606 else if (item.IsMagazine())
10607 {
10608 Magazine mag = Magazine.Cast(item);
10609 if (quantity >= 0)
10610 {
10611 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
10612 }
10613 else
10614 {
10616 }
10617
10618 }
10619 else
10620 {
10621 if (quantity >= 0)
10622 {
10623 item.SetQuantityNormalized(quantity, false);
10624 }
10625 else
10626 {
10628 }
10629
10630 }
10631 }
10632}
10633
10634#ifdef DEVELOPER
10636#endif
Param4< int, int, string, int > TSelectableActionInfoWithColor
Param3 TSelectableActionInfo
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 CanHaveTemperature()
class GP5GasMask extends MaskBase ItemBase
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
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)
void StartItemSoundServer(int id)
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()
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)
void OnItemAttachedAtPlayer(EntityAI item, string slot_name)
proto native UIManager GetUIManager()
proto bool ConfigGetChildName(string path, int index, out string name)
Get name of subclass in config class on path.
proto native float ConfigGetFloat(string path)
Get float value from config on path.
override ScriptCallQueue GetCallQueue(int call_category)
proto native void GizmoSelectObject(Object object)
proto native bool ConfigIsExisting(string path)
proto native void ConfigGetTextArray(string path, out TStringArray values)
Get array of strings from config on path.
proto native DayZPlayer GetPlayer()
proto native void GizmoSelectPhysics(Physics physics)
proto int GetTime()
returns mission time in milliseconds
proto native int ConfigGetType(string path)
Returns type of config value.
AnalyticsManagerClient GetAnalyticsClient()
proto native int ConfigGetChildrenCount(string path)
Get count of subclasses in config class on path.
proto native SoundOnVehicle CreateSoundOnObject(Object source, string sound_name, float distance, bool looped, bool create_local=false)
proto native void ObjectDelete(Object obj)
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 bool EnumerateInventory(InventoryTraversalType tt, out array< EntityAI > items)
enumerate inventory using traversal type and filling items array
proto native CargoBase GetCargo()
cargo
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 void Remove(func fn)
remove specific call from queue
proto void CallLater(func fn, int delay=0, bool repeat=false, 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)
adds call into the queue with given parameters and arguments (arguments are held in memory until the ...
proto bool Write(void value_out)
proto bool Read(void value_in)
proto native float GetDamage(string zoneName, string healthType)
UIScriptedMenu FindMenu(int id)
Returns menu with specific ID if it is open (see MenuID)
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
proto native CGame GetGame()
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
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
class JsonUndergroundAreaTriggerData GetPosition
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.