Locks this item in it's current attachment slot of its parent. This makes the "locked" icon visible in inventory over this item.
5686{
5688 {
5689 return true;
5690 }
5691};
5692
5693
5694
5696{
5700
5702
5705
5706
5707
5708
5709
5718
5724
5729
5734
5755 protected bool m_IsResultOfSplit
5756
5758
5763
5764
5765
5767
5771
5772
5773
5775
5778
5779
5780
5786
5787
5795
5798
5799
5801
5802
5804
5805
5810
5811
5816
5817
5819
5820
5822 {
5827
5828 if (!
GetGame().IsDedicatedServer())
5829 {
5831 {
5833
5835 {
5837 }
5838 }
5839
5842 }
5843
5844 m_OldLocation = null;
5845
5847 {
5849 }
5850
5851 if (ConfigIsExisting("headSelectionsToHide"))
5852 {
5855 }
5856
5858 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
5859 {
5861 }
5862
5864
5865 m_IsResultOfSplit = false;
5866
5868 }
5869
5871 {
5872 super.InitItemVariables();
5873
5879 m_Count = ConfigGetInt(
"count");
5880
5883
5888
5891
5896
5908
5912
5913
5916 if (ConfigIsExisting("canBeSplit"))
5917 {
5920 }
5921
5923 if (ConfigIsExisting("itemBehaviour"))
5925
5926
5929 RegisterNetSyncVariableInt("m_VarLiquidType");
5930 RegisterNetSyncVariableInt("m_Cleanness",0,1);
5931
5932 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
5933 RegisterNetSyncVariableFloat("m_ImpactSpeed");
5934 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
5935
5936 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
5937 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
5938 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
5939 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
5940
5941 RegisterNetSyncVariableBool("m_IsBeingPlaced");
5942 RegisterNetSyncVariableBool("m_IsTakeable");
5943 RegisterNetSyncVariableBool("m_IsHologram");
5944
5947 {
5950 }
5951
5953
5955 if (ConfigIsExisting("temperaturePerQuantityWeight"))
5957
5958 }
5959
5961 {
5963 }
5964
5966 {
5969 {
5974 }
5975 }
5976
5977 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
5978 {
5980 {
5983 }
5984
5986 }
5987
5989 {
5995 }
5996
5998
6000 {
6002
6003 if (!action)
6004 {
6005 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
6006 return;
6007 }
6008
6010 if (!ai)
6011 {
6013 return;
6014 }
6015
6017 if (!action_array)
6018 {
6019 action_array = new array<ActionBase_Basic>;
6021 }
6022 if (LogManager.IsActionLogEnable())
6023 {
6024 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
6025 }
6026
6027 if (action_array.Find(action) != -1)
6028 {
6029 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
6030 }
6031 else
6032 {
6033 action_array.Insert(action);
6034 }
6035 }
6036
6038 {
6040 ActionBase action = player.GetActionManager().GetAction(actionName);
6043
6044 if (action_array)
6045 {
6046 action_array.RemoveItem(action);
6047 }
6048 }
6049
6050
6051
6053 {
6054 ActionOverrideData overrideData = new ActionOverrideData();
6058
6060 if (!actionMap)
6061 {
6064 }
6065
6066 actionMap.Insert(this.
Type(), overrideData);
6067
6068 }
6069
6071
6073
6074
6076 {
6079
6082
6083 string config_to_search = "CfgVehicles";
6084 string muzzle_owner_config;
6085
6087 {
6088 if (IsInherited(Weapon))
6089 config_to_search = "CfgWeapons";
6090
6091 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6092
6093 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
6094
6096
6097 if (config_OnFire_subclass_count > 0)
6098 {
6099 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
6100
6101 for (int i = 0; i < config_OnFire_subclass_count; i++)
6102 {
6103 string particle_class = "";
6105 string config_OnFire_entry = config_OnFire_class + particle_class;
6106 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
6107 WPOF_array.Insert(WPOF);
6108 }
6109
6110
6112 }
6113 }
6114
6116 {
6117 config_to_search = "CfgWeapons";
6118 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6119
6120 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
6121
6123
6124 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
6125 {
6126 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
6127
6128 for (i = 0; i < config_OnBulletCasingEject_count; i++)
6129 {
6130 string particle_class2 = "";
6132 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
6133 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
6134 WPOBE_array.Insert(WPOBE);
6135 }
6136
6137
6139 }
6140 }
6141 }
6142
6143
6145 {
6148
6150 {
6151 string config_to_search = "CfgVehicles";
6152
6153 if (IsInherited(Weapon))
6154 config_to_search = "CfgWeapons";
6155
6156 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6157 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
6158
6159 if (
GetGame().ConfigIsExisting(config_OnOverheating_class))
6160 {
6161
6163
6165 {
6167 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
6169 return;
6170 }
6171
6174
6175
6176
6178 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
6179
6180 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
6181 {
6182 string particle_class = "";
6184 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
6186
6187 if (entry_type == CT_CLASS)
6188 {
6189 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
6190 WPOOH_array.Insert(WPOF);
6191 }
6192 }
6193
6194
6196 }
6197 }
6198 }
6199
6201 {
6203 }
6204
6206 {
6208 {
6210
6213
6216
6217 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6218 }
6219 }
6220
6222 {
6224 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6225
6227 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6228
6230 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6231
6233 {
6235 }
6236 }
6237
6239 {
6241 }
6242
6244 {
6247 else
6249
6251 {
6254 }
6255 else
6256 {
6259
6262 }
6263
6265 }
6266
6268 {
6270 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6271 }
6272
6274 {
6276 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6278 }
6279
6281 {
6283 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6284 }
6285
6287 {
6290
6291 OverheatingParticle OP = new OverheatingParticle();
6296
6298 }
6299
6301 {
6304
6305 return -1;
6306 }
6307
6309 {
6311 {
6314
6315 for (int i = count; i > 0; --i)
6316 {
6317 int id = i - 1;
6320
6323
6324 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
6325 {
6326 if (p)
6327 {
6330 }
6331 }
6332 }
6333 }
6334 }
6335
6337 {
6339 {
6341 {
6342 int id = i - 1;
6344
6345 if (OP)
6346 {
6348
6349 if (p)
6350 {
6352 }
6353
6354 delete OP;
6355 }
6356 }
6357
6360 }
6361 }
6362
6365 {
6366 return 0.0;
6367 }
6368
6369
6371 {
6372 return 250;
6373 }
6374
6376 {
6377 return 0;
6378 }
6379
6382 {
6384 return true;
6385
6386 return false;
6387 }
6388
6391 {
6394
6396 {
6398 }
6399 else
6400 {
6401
6403 }
6404
6406 }
6407
6414 {
6415 return -1;
6416 }
6417
6418
6419
6420
6422 {
6424 {
6426 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6427
6428 if (r_index >= 0)
6429 {
6430 InventoryLocation r_il = new InventoryLocation;
6431 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6432
6433 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6436 {
6437 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6438 }
6440 {
6441 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6442 }
6443
6444 }
6445
6446 player.GetHumanInventory().ClearUserReservedLocation(this);
6447 }
6448
6451 }
6452
6453
6454
6455
6457 {
6458 return ItemBase.m_DebugActionsMask;
6459 }
6460
6462 {
6463 return ItemBase.m_DebugActionsMask & mask;
6464 }
6465
6467 {
6468 ItemBase.m_DebugActionsMask = mask;
6469 }
6470
6472 {
6473 ItemBase.m_DebugActionsMask |= mask;
6474 }
6475
6477 {
6478 ItemBase.m_DebugActionsMask &= ~mask;
6479 }
6480
6482 {
6484 {
6486 }
6487 else
6488 {
6490 }
6491 }
6492
6493
6495 {
6496 if (GetEconomyProfile())
6497 {
6498 float q_max = GetEconomyProfile().GetQuantityMax();
6499 if (q_max > 0)
6500 {
6501 float q_min = GetEconomyProfile().GetQuantityMin();
6502 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
6503
6505 {
6506 ComponentEnergyManager comp = GetCompEM();
6508 {
6510 }
6511 }
6513 {
6515
6516 }
6517
6518 }
6519 }
6520 }
6521
6524 {
6525 EntityAI parent = GetHierarchyParent();
6526
6527 if (parent)
6528 {
6529 InventoryLocation inventory_location_to_lock = new InventoryLocation;
6530 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
6531 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
6532 }
6533 }
6534
6537 {
6538 EntityAI parent = GetHierarchyParent();
6539
6540 if (parent)
6541 {
6542 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
6543 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
6544 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
6545 }
6546 }
6547
6549 {
6550
6551
6552
6553
6555
6557 {
6558 if (ScriptInputUserData.CanStoreInputUserData())
6559 {
6560 ScriptInputUserData ctx = new ScriptInputUserData;
6566 ctx.
Write(use_stack_max);
6569
6571 {
6572 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
6573 }
6574 }
6575 }
6576 else if (!
GetGame().IsMultiplayer())
6577 {
6579 }
6580 }
6581
6583 {
6585 }
6586
6588 {
6590 }
6591
6593 {
6595 }
6596
6598 {
6599
6600 return false;
6601 }
6602
6604 {
6605 return false;
6606 }
6607
6611 {
6612 return false;
6613 }
6614
6616 {
6617 return "";
6618 }
6619
6621
6623 {
6624 return false;
6625 }
6626
6628 {
6629 return true;
6630 }
6631
6632
6633
6635 {
6636 return true;
6637 }
6638
6640 {
6641 return true;
6642 }
6643
6645 {
6646 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6648 }
6649
6651 {
6653 }
6654
6656 {
6658 if (!is_being_placed)
6660 SetSynchDirty();
6661 }
6662
6663
6665
6667 {
6669 }
6670
6672 {
6674 }
6675
6677 {
6678 return 1;
6679 }
6680
6682 {
6683 return false;
6684 }
6685
6687 {
6689 SetSynchDirty();
6690 }
6691
6692
6693
6694
6695
6696
6697
6698
6699
6700
6701
6702
6703
6704
6705
6706
6707
6708
6709
6710
6711
6712
6713
6714
6715
6716
6717
6718
6719
6720
6721
6722
6723
6724
6725
6727 {
6728 super.OnMovedInsideCargo(container);
6729
6730 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6731 }
6732
6733 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
6734 {
6735 super.EEItemLocationChanged(oldLoc,newLoc);
6736
6737 PlayerBase new_player = null;
6738 PlayerBase old_player = null;
6739
6740 if (newLoc.GetParent())
6741 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
6742
6743 if (oldLoc.GetParent())
6744 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
6745
6747 {
6748 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
6749
6750 if (r_index >= 0)
6751 {
6752 InventoryLocation r_il = new InventoryLocation;
6753 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6754
6755 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6758 {
6759 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6760 }
6762 {
6763 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6764 }
6765
6766 }
6767 }
6768
6770 {
6771 if (new_player)
6772 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
6773
6774 if (new_player == old_player)
6775 {
6776
6777 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
6778 {
6780 {
6781 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
6782 {
6783 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6784 }
6785 }
6786 else
6787 {
6788 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6789 }
6790 }
6791
6792 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
6793 {
6794 int type = oldLoc.GetType();
6796 {
6797 oldLoc.GetParent().GetOnSetLock().Invoke(this);
6798 }
6800 {
6801 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
6802 }
6803 }
6804 if (!m_OldLocation)
6805 {
6806 m_OldLocation = new InventoryLocation;
6807 }
6808 m_OldLocation.Copy(oldLoc);
6809 }
6810 else
6811 {
6812 if (m_OldLocation)
6813 {
6814 m_OldLocation.Reset();
6815 }
6816 }
6817
6819 }
6820 else
6821 {
6822 if (new_player)
6823 {
6824 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
6825 if (res_index >= 0)
6826 {
6827 InventoryLocation il = new InventoryLocation;
6828 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
6830 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
6833 {
6834 il.
GetParent().GetOnReleaseLock().Invoke(it);
6835 }
6837 {
6839 }
6840
6841 }
6842 }
6844 {
6845
6847 }
6848
6849 if (m_OldLocation)
6850 {
6851 m_OldLocation.Reset();
6852 }
6853 }
6854 }
6855
6856 override void EOnContact(IEntity other, Contact extra)
6857 {
6859 {
6860 int liquidType = -1;
6862 if (impactSpeed > 0.0)
6863 {
6865 #ifndef SERVER
6867 #else
6869 SetSynchDirty();
6870 #endif
6872 }
6873 }
6874
6875 #ifdef SERVER
6876 if (GetCompEM() && GetCompEM().IsPlugged())
6877 {
6878 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
6879 GetCompEM().UnplugThis();
6880 }
6881 #endif
6882 }
6883
6885
6887 {
6889 }
6890
6892 {
6893
6894 }
6895
6897 {
6898 super.OnItemLocationChanged(old_owner, new_owner);
6899
6900 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
6901 PlayerBase playerNew = PlayerBase.Cast(new_owner);
6902
6903 if (!relatedPlayer && playerNew)
6904 relatedPlayer = playerNew;
6905
6906 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
6907 {
6909 if (actionMgr)
6910 {
6911 ActionBase currentAction = actionMgr.GetRunningAction();
6912 if (currentAction)
6914 }
6915 }
6916
6917 Man ownerPlayerOld = null;
6918 Man ownerPlayerNew = null;
6919
6920 if (old_owner)
6921 {
6922 if (old_owner.
IsMan())
6923 {
6924 ownerPlayerOld = Man.Cast(old_owner);
6925 }
6926 else
6927 {
6928 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
6929 }
6930 }
6931 else
6932 {
6934 {
6936
6937 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
6938 {
6939 GetCompEM().UnplugThis();
6940 }
6941 }
6942 }
6943
6944 if (new_owner)
6945 {
6946 if (new_owner.
IsMan())
6947 {
6948 ownerPlayerNew = Man.Cast(new_owner);
6949 }
6950 else
6951 {
6952 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
6953 }
6954 }
6955
6956 if (ownerPlayerOld != ownerPlayerNew)
6957 {
6958 if (ownerPlayerOld)
6959 {
6960 array<EntityAI> subItemsExit = new array<EntityAI>;
6962 for (int i = 0; i < subItemsExit.Count(); i++)
6963 {
6966 }
6967 }
6968
6969 if (ownerPlayerNew)
6970 {
6971 array<EntityAI> subItemsEnter = new array<EntityAI>;
6973 for (int j = 0; j < subItemsEnter.Count(); j++)
6974 {
6977 }
6978 }
6979 }
6980 else if (ownerPlayerNew != null)
6981 {
6982 PlayerBase nplayer;
6983 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
6984 {
6985 array<EntityAI> subItemsUpdate = new array<EntityAI>;
6987 for (int k = 0; k < subItemsUpdate.Count(); k++)
6988 {
6990 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
6991 }
6992 }
6993 }
6994
6995 if (old_owner)
6996 old_owner.OnChildItemRemoved(this);
6997 if (new_owner)
6998 new_owner.OnChildItemReceived(this);
6999 }
7000
7001
7003 {
7004 super.EEDelete(parent);
7005 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
7006 if (player)
7007 {
7009
7010 if (player.IsAlive())
7011 {
7012 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7013 if (r_index >= 0)
7014 {
7015 InventoryLocation r_il = new InventoryLocation;
7016 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7017
7018 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7021 {
7022 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7023 }
7025 {
7026 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7027 }
7028
7029 }
7030
7031 player.RemoveQuickBarEntityShortcut(this);
7032 }
7033 }
7034 }
7035
7037 {
7038 super.EEKilled(killer);
7039
7042 {
7043 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
7044 {
7045 if (IsMagazine())
7046 {
7047 if (Magazine.Cast(this).GetAmmoCount() > 0)
7048 {
7050 }
7051 }
7052 else
7053 {
7055 }
7056 }
7057 }
7058 }
7059
7061 {
7062 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7063
7064 super.OnWasAttached(parent, slot_id);
7065
7068
7070 }
7071
7073 {
7074 super.OnWasDetached(parent, slot_id);
7075
7078 }
7079
7081 {
7082 int idx;
7085
7086 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7087 if (inventory_slots.Count() < 1)
7088 {
7089 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
7090 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
7091 }
7092 else
7093 {
7094 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
7095 }
7096
7097 idx = inventory_slots.Find(slot);
7098 if (idx < 0)
7099 return "";
7100
7101 return attach_types.Get(idx);
7102 }
7103
7105 {
7106 int idx = -1;
7107 string slot;
7108
7111
7112 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7113 if (inventory_slots.Count() < 1)
7114 {
7115 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
7116 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7117 }
7118 else
7119 {
7120 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
7121 if (detach_types.Count() < 1)
7122 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7123 }
7124
7125 for (int i = 0; i < inventory_slots.Count(); i++)
7126 {
7127 slot = inventory_slots.Get(i);
7128 }
7129
7130 if (slot != "")
7131 {
7132 if (detach_types.Count() == 1)
7133 idx = 0;
7134 else
7135 idx = inventory_slots.Find(slot);
7136 }
7137 if (idx < 0)
7138 return "";
7139
7140 return detach_types.Get(idx);
7141 }
7142
7144 {
7145
7147
7148
7149 float min_time = 1;
7150 float max_time = 3;
7151 float delay = Math.RandomFloat(min_time, max_time);
7152
7153 explode_timer.Run(delay, this, "DoAmmoExplosion");
7154 }
7155
7157 {
7158 Magazine magazine = Magazine.Cast(this);
7159 int pop_sounds_count = 6;
7160 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
7161
7162
7163 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
7164 string sound_name = pop_sounds[ sound_idx ];
7166
7167
7168 magazine.ServerAddAmmoCount(-1);
7169
7170
7171 float min_temp_to_explode = 100;
7172
7173 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
7174 {
7176 }
7177 }
7178
7179
7180 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
7181 {
7182 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
7183
7184 const int CHANCE_DAMAGE_CARGO = 4;
7185 const int CHANCE_DAMAGE_ATTACHMENT = 1;
7186 const int CHANCE_DAMAGE_NOTHING = 2;
7187
7189 {
7190 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
7191 int chances;
7192 int rnd;
7193
7194 if (GetInventory().GetCargo())
7195 {
7196 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7197 rnd = Math.RandomInt(0,chances);
7198
7199 if (rnd < CHANCE_DAMAGE_CARGO)
7200 {
7202 }
7203 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
7204 {
7206 }
7207 }
7208 else
7209 {
7210 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7211 rnd = Math.RandomInt(0,chances);
7212
7213 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
7214 {
7216 }
7217 }
7218 }
7219 }
7220
7222 {
7223 if (GetInventory().GetCargo())
7224 {
7225 int item_count = GetInventory().GetCargo().GetItemCount();
7226 if (item_count > 0)
7227 {
7228 int random_pick = Math.RandomInt(0, item_count);
7230 if (!item.IsExplosive())
7231 {
7232 item.AddHealth("","",damage);
7233 return true;
7234 }
7235 }
7236 }
7237 return false;
7238 }
7239
7241 {
7242 int attachment_count = GetInventory().AttachmentCount();
7243 if (attachment_count > 0)
7244 {
7245 int random_pick = Math.RandomInt(0, attachment_count);
7246 ItemBase attachment =
ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
7247 if (!attachment.IsExplosive())
7248 {
7249 attachment.AddHealth("","",damage);
7250 return true;
7251 }
7252 }
7253 return false;
7254 }
7255
7257 {
7259 }
7260
7262 {
7264 return GetInventory().CanRemoveEntity();
7265
7266 return false;
7267 }
7268
7270 {
7271
7273 return false;
7274
7275
7277 return false;
7278
7279
7280
7282 if (delta == 0)
7283 return false;
7284
7285
7286 return true;
7287 }
7288
7290 {
7292 {
7293 if (ScriptInputUserData.CanStoreInputUserData())
7294 {
7295 ScriptInputUserData ctx = new ScriptInputUserData;
7300 ctx.
Write(destination_entity);
7304 }
7305 }
7306 else if (!
GetGame().IsMultiplayer())
7307 {
7309 }
7310 }
7311
7313 {
7314 float split_quantity_new;
7318 InventoryLocation loc = new InventoryLocation;
7319
7320 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7321 {
7323 split_quantity_new = stack_max;
7324 else
7326
7328 {
7329 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7330 if (new_item)
7331 {
7332 new_item.SetResultOfSplit(true);
7333 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7335 new_item.
SetQuantity(split_quantity_new,
false,
true);
7336 }
7337 }
7338 }
7339 else if (destination_entity && slot_id == -1)
7340 {
7341 if (quantity > stack_max)
7342 split_quantity_new = stack_max;
7343 else
7344 split_quantity_new = quantity;
7345
7347 {
7349 {
7352 }
7353
7354 if (new_item)
7355 {
7356 new_item.SetResultOfSplit(true);
7357 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7359 new_item.
SetQuantity(split_quantity_new,
false,
true);
7360 }
7361 }
7362 }
7363 else
7364 {
7365 if (stack_max != 0)
7366 {
7368 {
7370 }
7371
7372 if (split_quantity_new == 0)
7373 {
7374 if (!
GetGame().IsMultiplayer())
7375 player.PhysicalPredictiveDropItem(this);
7376 else
7377 player.ServerDropEntity(this);
7378 return;
7379 }
7380
7382 {
7384
7385 if (new_item)
7386 {
7387 new_item.SetResultOfSplit(true);
7388 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7391 new_item.PlaceOnSurface();
7392 }
7393 }
7394 }
7395 }
7396 }
7397
7399 {
7400 float split_quantity_new;
7404 InventoryLocation loc = new InventoryLocation;
7405
7406 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7407 {
7409 split_quantity_new = stack_max;
7410 else
7412
7414 {
7415 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7416 if (new_item)
7417 {
7418 new_item.SetResultOfSplit(true);
7419 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7421 new_item.
SetQuantity(split_quantity_new,
false,
true);
7422 }
7423 }
7424 }
7425 else if (destination_entity && slot_id == -1)
7426 {
7427 if (quantity > stack_max)
7428 split_quantity_new = stack_max;
7429 else
7430 split_quantity_new = quantity;
7431
7433 {
7435 {
7438 }
7439
7440 if (new_item)
7441 {
7442 new_item.SetResultOfSplit(true);
7443 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7445 new_item.
SetQuantity(split_quantity_new,
false,
true);
7446 }
7447 }
7448 }
7449 else
7450 {
7451 if (stack_max != 0)
7452 {
7454 {
7456 }
7457
7459 {
7461
7462 if (new_item)
7463 {
7464 new_item.SetResultOfSplit(true);
7465 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7468 new_item.PlaceOnSurface();
7469 }
7470 }
7471 }
7472 }
7473 }
7474
7476 {
7478 {
7479 if (ScriptInputUserData.CanStoreInputUserData())
7480 {
7481 ScriptInputUserData ctx = new ScriptInputUserData;
7486 dst.WriteToContext(ctx);
7488 }
7489 }
7490 else if (!
GetGame().IsMultiplayer())
7491 {
7493 }
7494 }
7495
7497 {
7499 {
7500 if (ScriptInputUserData.CanStoreInputUserData())
7501 {
7502 ScriptInputUserData ctx = new ScriptInputUserData;
7507 ctx.
Write(destination_entity);
7513 }
7514 }
7515 else if (!
GetGame().IsMultiplayer())
7516 {
7518 }
7519 }
7520
7522 {
7524 }
7525
7527 {
7529 float split_quantity_new;
7531 if (dst.IsValid())
7532 {
7533 int slot_id = dst.GetSlot();
7535
7536 if (quantity > stack_max)
7537 split_quantity_new = stack_max;
7538 else
7539 split_quantity_new = quantity;
7540
7542 {
7544
7545 if (new_item)
7546 {
7547 new_item.SetResultOfSplit(true);
7548 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7550 new_item.
SetQuantity(split_quantity_new,
false,
true);
7551 }
7552
7553 return new_item;
7554 }
7555 }
7556
7557 return null;
7558 }
7559
7561 {
7563 float split_quantity_new;
7565 if (destination_entity)
7566 {
7568 if (quantity > stackable)
7569 split_quantity_new = stackable;
7570 else
7571 split_quantity_new = quantity;
7572
7574 {
7575 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
7576 if (new_item)
7577 {
7578 new_item.SetResultOfSplit(true);
7579 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7581 new_item.
SetQuantity(split_quantity_new,
false,
true);
7582 }
7583 }
7584 }
7585 }
7586
7588 {
7590 {
7591 if (ScriptInputUserData.CanStoreInputUserData())
7592 {
7593 ScriptInputUserData ctx = new ScriptInputUserData;
7598 ItemBase destination_entity =
this;
7599 ctx.
Write(destination_entity);
7603 }
7604 }
7605 else if (!
GetGame().IsMultiplayer())
7606 {
7608 }
7609 }
7610
7612 {
7614 float split_quantity_new;
7616 if (player)
7617 {
7619 if (quantity > stackable)
7620 split_quantity_new = stackable;
7621 else
7622 split_quantity_new = quantity;
7623
7625 {
7626 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
7627 new_item =
ItemBase.Cast(in_hands);
7628 if (new_item)
7629 {
7630 new_item.SetResultOfSplit(true);
7631 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7633 new_item.SetQuantity(split_quantity_new, false, true);
7634 }
7635 }
7636 }
7637 }
7638
7640 {
7642 float split_quantity_new = Math.Floor(quantity * 0.5);
7643
7645 return;
7646
7648
7649 if (new_item)
7650 {
7651 if (new_item.GetQuantityMax() < split_quantity_new)
7652 {
7653 split_quantity_new = new_item.GetQuantityMax();
7654 }
7655
7656 new_item.SetResultOfSplit(true);
7657 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7658
7660 {
7663 }
7664 else
7665 {
7667 new_item.
SetQuantity(split_quantity_new,
false,
true);
7668 }
7669 }
7670 }
7671
7673 {
7675 float split_quantity_new = Math.Floor(quantity / 2);
7676
7678 return;
7679
7680 InventoryLocation invloc = new InventoryLocation;
7682
7684 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
7685
7686 if (new_item)
7687 {
7688 if (new_item.GetQuantityMax() < split_quantity_new)
7689 {
7690 split_quantity_new = new_item.GetQuantityMax();
7691 }
7693 {
7696 }
7697 else if (split_quantity_new > 1)
7698 {
7700 new_item.
SetQuantity(split_quantity_new,
false,
true);
7701 }
7702 }
7703 }
7704
7707 {
7708 SetWeightDirty();
7710
7711 if (parent)
7712 parent.OnAttachmentQuantityChangedEx(this, delta);
7713
7715 {
7717 {
7719 }
7721 {
7722 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
7724 }
7725 }
7726
7727 }
7728
7731 {
7732
7733 }
7734
7737 {
7739 }
7740
7742 {
7743 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
7744
7746 {
7747 if (newLevel == GameConstants.STATE_RUINED)
7748 {
7750 EntityAI parent = GetHierarchyParent();
7751 if (parent && parent.IsFireplace())
7752 {
7753 CargoBase cargo = GetInventory().GetCargo();
7754 if (cargo)
7755 {
7757 {
7759 }
7760 }
7761 }
7762 }
7763
7765 {
7766
7768 return;
7769 }
7770
7771 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
7772 {
7774 }
7775 }
7776 }
7777
7778
7780 {
7781 super.OnRightClick();
7782
7784 {
7786 {
7787 if (ScriptInputUserData.CanStoreInputUserData())
7788 {
7789 EntityAI root = GetHierarchyRoot();
7790 Man playerOwner = GetHierarchyRootPlayer();
7791 InventoryLocation dst = new InventoryLocation;
7792
7793
7794 if (!playerOwner && root && root == this)
7795 {
7797 }
7798 else
7799 {
7800
7801 GetInventory().GetCurrentInventoryLocation(dst);
7803 {
7806 {
7808 }
7809 else
7810 {
7812
7813
7814 if (
GetGame().
GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
7815 {
7817 }
7818 else
7819 {
7820 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
7821 }
7822 }
7823 }
7824 }
7825
7826 ScriptInputUserData ctx = new ScriptInputUserData;
7834 }
7835 }
7836 else if (!
GetGame().IsMultiplayer())
7837 {
7839 }
7840 }
7841 }
7842
7844 {
7845 if (root)
7846 {
7847 vector m4[4];
7848 root.GetTransform(m4);
7849 dst.SetGround(this, m4);
7850 }
7851 else
7852 {
7853 GetInventory().GetCurrentInventoryLocation(dst);
7854 }
7855 }
7856
7857 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
7858 {
7859
7860 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
7861 return false;
7862
7863 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
7864 return false;
7865
7866
7868 return false;
7869
7870
7871 Magazine mag = Magazine.Cast(this);
7872 if (mag)
7873 {
7874 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
7875 return false;
7876
7877 if (stack_max_limit)
7878 {
7879 Magazine other_mag = Magazine.Cast(other_item);
7880 if (other_item)
7881 {
7882 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
7883 return false;
7884 }
7885
7886 }
7887 }
7888 else
7889 {
7890
7892 return false;
7893
7895 return false;
7896 }
7897
7898 PlayerBase player = null;
7899 if (CastTo(player, GetHierarchyRootPlayer()))
7900 {
7901 if (player.GetInventory().HasAttachment(this))
7902 return false;
7903
7904 if (player.IsItemsToDelete())
7905 return false;
7906 }
7907
7908 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
7909 return false;
7910
7911 int slotID;
7913 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
7914 return false;
7915
7916 return true;
7917 }
7918
7920 {
7922 }
7923
7925 {
7926 return m_IsResultOfSplit;
7927 }
7928
7930 {
7931 m_IsResultOfSplit = value;
7932 }
7933
7935 {
7937 }
7938
7940 {
7941 float other_item_quantity = other_item.GetQuantity();
7942 float this_free_space;
7943
7945
7947
7948 if (other_item_quantity > this_free_space)
7949 {
7950 return this_free_space;
7951 }
7952 else
7953 {
7954 return other_item_quantity;
7955 }
7956 }
7957
7959 {
7961 }
7962
7964 {
7966 return;
7967
7968 if (!IsMagazine() && other_item)
7969 {
7971 if (quantity_used != 0)
7972 {
7973 float hp1 = GetHealth01("","");
7974 float hp2 = other_item.GetHealth01("","");
7975 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
7976 hpResult = hpResult / (
GetQuantity() + quantity_used);
7977
7978 hpResult *= GetMaxHealth();
7979 Math.Round(hpResult);
7980 SetHealth("", "Health", hpResult);
7981
7983 other_item.AddQuantity(-quantity_used);
7984 }
7985 }
7987 }
7988
7990 {
7991 #ifdef SERVER
7992 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
7993 GetHierarchyParent().IncreaseLifetimeUp();
7994 #endif
7995 };
7996
7998 {
7999 PlayerBase p = PlayerBase.Cast(player);
8000
8001 array<int> recipesIds = p.m_Recipes;
8002 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8003 if (moduleRecipesManager)
8004 {
8005 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
8006 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
8007 }
8008
8009 for (int i = 0;i < recipesIds.Count(); i++)
8010 {
8011 int key = recipesIds.Get(i);
8012 string recipeName = moduleRecipesManager.GetRecipeName(key);
8014 }
8015 }
8016
8017
8018 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
8019 {
8020 super.GetDebugActions(outputList);
8021
8022
8028
8029
8034
8039
8040
8044
8045
8047 {
8051 }
8052
8055
8056
8060
8062
8063 InventoryLocation loc = new InventoryLocation();
8064 GetInventory().GetCurrentInventoryLocation(loc);
8066 {
8067 if (Gizmo_IsSupported())
8070 }
8071
8073 }
8074
8075
8076
8077
8079 {
8080 super.OnAction(action_id, player, ctx);
8081
8083 {
8084 switch (action_id)
8085 {
8088 return true;
8091 return true;
8092 }
8093 }
8094
8096 {
8097 switch (action_id)
8098 {
8100 Delete();
8101 return true;
8102 }
8103 }
8104
8105 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
8106 {
8107 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8108 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
8109 PlayerBase p = PlayerBase.Cast(player);
8110 if (
EActions.RECIPES_RANGE_START < 1000)
8111 {
8112 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
8113 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
8114 }
8115 }
8116 #ifndef SERVER
8117 else if (action_id ==
EActions.WATCH_PLAYER)
8118 {
8119 PluginDeveloper.SetDeveloperItemClientEx(player);
8120 }
8121 #endif
8123 {
8124 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
8125 {
8126 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
8127 OnDebugButtonPressServer(id + 1);
8128 }
8129
8130 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
8131 {
8132 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
8134 }
8135
8136 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
8137 {
8138 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
8140 }
8141
8142 else if (action_id ==
EActions.ADD_QUANTITY)
8143 {
8144 if (IsMagazine())
8145 {
8146 Magazine mag = Magazine.Cast(this);
8147 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
8148 }
8149 else
8150 {
8152 }
8153
8154 if (m_EM)
8155 {
8156 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
8157 }
8158
8159 }
8160
8161 else if (action_id ==
EActions.REMOVE_QUANTITY)
8162 {
8163 if (IsMagazine())
8164 {
8165 Magazine mag2 = Magazine.Cast(this);
8166 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
8167 }
8168 else
8169 {
8171 }
8172 if (m_EM)
8173 {
8174 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
8175 }
8176
8177 }
8178
8179 else if (action_id ==
EActions.SET_QUANTITY_0)
8180 {
8182
8183 if (m_EM)
8184 {
8185 m_EM.SetEnergy(0);
8186 }
8187 }
8188
8189 else if (action_id ==
EActions.SET_MAX_QUANTITY)
8190 {
8192
8193 if (m_EM)
8194 {
8195 m_EM.SetEnergy(m_EM.GetEnergyMax());
8196 }
8197 }
8198
8199 else if (action_id ==
EActions.ADD_HEALTH)
8200 {
8201 AddHealth("","",GetMaxHealth("","Health")/5);
8202 }
8203 else if (action_id ==
EActions.REMOVE_HEALTH)
8204 {
8205 AddHealth("","",-GetMaxHealth("","Health")/5);
8206 }
8207 else if (action_id ==
EActions.DESTROY_HEALTH)
8208 {
8209 SetHealth01("","",0);
8210 }
8211 else if (action_id ==
EActions.WATCH_ITEM)
8212 {
8214 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
8215 #ifdef DEVELOPER
8216 SetDebugDeveloper_item(this);
8217 #endif
8218 }
8219
8220 else if (action_id ==
EActions.ADD_TEMPERATURE)
8221 {
8222 AddTemperature(20);
8223
8224 }
8225
8226 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
8227 {
8228 AddTemperature(-20);
8229
8230 }
8231
8232 else if (action_id ==
EActions.FLIP_FROZEN)
8233 {
8234 SetFrozen(!GetIsFrozen());
8235
8236 }
8237
8238 else if (action_id ==
EActions.ADD_WETNESS)
8239 {
8241
8242 }
8243
8244 else if (action_id ==
EActions.REMOVE_WETNESS)
8245 {
8247
8248 }
8249
8250 else if (action_id ==
EActions.LIQUIDTYPE_UP)
8251 {
8254
8255
8256 }
8257
8258 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
8259 {
8262 }
8263
8264 else if (action_id ==
EActions.MAKE_SPECIAL)
8265 {
8266 auto debugParams = DebugSpawnParams.WithPlayer(player);
8267 OnDebugSpawnEx(debugParams);
8268 }
8269
8270 }
8271
8272
8273 return false;
8274 }
8275
8276
8277
8278
8282
8285
8286
8287
8289 {
8290 return false;
8291 }
8292
8293
8295 {
8296 return true;
8297 }
8298
8299
8301 {
8302 return true;
8303 }
8304
8305
8306
8308 {
8309 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
8311 }
8312
8315 {
8316 return null;
8317 }
8318
8320 {
8321 return false;
8322 }
8323
8325 {
8326 return false;
8327 }
8328
8332
8333
8335 {
8336 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8337 return module_repairing.CanRepair(this, item_repair_kit);
8338 }
8339
8340
8341 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
8342 {
8343 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8344 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
8345 }
8346
8347
8349 {
8350
8351
8352
8353
8354
8355
8356
8357
8358 return 1;
8359 }
8360
8361
8362
8364 {
8366 }
8367
8368
8369
8371 {
8373 }
8374
8375
8384 {
8385 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8386
8387 if (player)
8388 {
8389 player.MessageStatus(text);
8390 }
8391 }
8392
8393
8402 {
8403 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8404
8405 if (player)
8406 {
8407 player.MessageAction(text);
8408 }
8409 }
8410
8411
8420 {
8421 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8422
8423 if (player)
8424 {
8425 player.MessageFriendly(text);
8426 }
8427 }
8428
8429
8438 {
8439 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8440
8441 if (player)
8442 {
8443 player.MessageImportant(text);
8444 }
8445 }
8446
8448 {
8449 return true;
8450 }
8451
8452
8453 override bool KindOf(
string tag)
8454 {
8455 bool found = false;
8456 string item_name = this.
GetType();
8459
8460 int array_size = item_tag_array.Count();
8461 for (int i = 0; i < array_size; i++)
8462 {
8463 if (item_tag_array.Get(i) == tag)
8464 {
8465 found = true;
8466 break;
8467 }
8468 }
8469 return found;
8470 }
8471
8472
8474 {
8475
8476 super.OnRPC(sender, rpc_type,ctx);
8477
8478
8479 switch (rpc_type)
8480 {
8481 #ifndef SERVER
8482 case ERPCs.RPC_SOUND_LOCK_ATTACH:
8483 Param2<bool, string> p = new Param2<bool, string>(false, "");
8484
8486 return;
8487
8488 bool play = p.param1;
8489 string soundSet = p.param2;
8490
8491 if (play)
8492 {
8494 {
8496 {
8498 }
8499 }
8500 else
8501 {
8503 }
8504 }
8505 else
8506 {
8508 }
8509
8510 break;
8511 #endif
8512
8513 }
8514
8516 {
8518 }
8519 }
8520
8521
8522
8523
8525 {
8526 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8527 return plugin.GetID(
name);
8528 }
8529
8531 {
8532 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8533 return plugin.GetName(id);
8534 }
8535
8538 {
8539
8540
8541 int varFlags;
8542 if (!ctx.
Read(varFlags))
8543 return;
8544
8545 if (varFlags & ItemVariableFlags.FLOAT)
8546 {
8548 }
8549 }
8550
8552 {
8553
8554 super.SerializeNumericalVars(floats_out);
8555
8556
8557
8559 {
8561 }
8562
8564 {
8566 }
8567
8569 {
8571 }
8572
8574 {
8579 }
8580
8582 {
8584 }
8585 }
8586
8588 {
8589
8590 super.DeSerializeNumericalVars(floats);
8591
8592
8593 int index = 0;
8594 int mask = Math.Round(floats.Get(index));
8595
8596 index++;
8597
8599 {
8601 {
8603 }
8604 else
8605 {
8606 float quantity = floats.Get(index);
8608 }
8609 index++;
8610 }
8611
8613 {
8614 float wet = floats.Get(index);
8616 index++;
8617 }
8618
8620 {
8621 int liquidtype = Math.Round(floats.Get(index));
8623 index++;
8624 }
8625
8627 {
8629 index++;
8631 index++;
8633 index++;
8635 index++;
8636 }
8637
8639 {
8640 int cleanness = Math.Round(floats.Get(index));
8642 index++;
8643 }
8644 }
8645
8647 {
8648 super.WriteVarsToCTX(ctx);
8649
8650
8652 {
8654 }
8655
8657 {
8659 }
8660
8662 {
8664 }
8665
8667 {
8668 int r,g,b,a;
8674 }
8675
8677 {
8679 }
8680 }
8681
8683 {
8684 if (!super.ReadVarsFromCTX(ctx,version))
8685 return false;
8686
8687 int intValue;
8688 float value;
8689
8690 if (version < 140)
8691 {
8692 if (!ctx.
Read(intValue))
8693 return false;
8694
8695 m_VariablesMask = intValue;
8696 }
8697
8699 {
8700 if (!ctx.
Read(value))
8701 return false;
8702
8704 {
8706 }
8707 else
8708 {
8710 }
8711 }
8712
8713 if (version < 140)
8714 {
8716 {
8717 if (!ctx.
Read(value))
8718 return false;
8719 SetTemperatureDirect(value);
8720 }
8721 }
8722
8724 {
8725 if (!ctx.
Read(value))
8726 return false;
8728 }
8729
8731 {
8732 if (!ctx.
Read(intValue))
8733 return false;
8735 }
8736
8738 {
8739 int r,g,b,a;
8741 return false;
8743 return false;
8745 return false;
8747 return false;
8748
8750 }
8751
8753 {
8754 if (!ctx.
Read(intValue))
8755 return false;
8757 }
8758
8759 if (version >= 138 && version < 140)
8760 {
8762 {
8763 if (!ctx.
Read(intValue))
8764 return false;
8765 SetFrozen(intValue);
8766 }
8767 }
8768
8769 return true;
8770 }
8771
8772
8774 {
8777 {
8779 }
8780
8781 if (!super.OnStoreLoad(ctx, version))
8782 {
8784 return false;
8785 }
8786
8787 if (version >= 114)
8788 {
8789 bool hasQuickBarIndexSaved;
8790
8791 if (!ctx.
Read(hasQuickBarIndexSaved))
8792 {
8794 return false;
8795 }
8796
8797 if (hasQuickBarIndexSaved)
8798 {
8799 int itmQBIndex;
8800
8801
8802 if (!ctx.
Read(itmQBIndex))
8803 {
8805 return false;
8806 }
8807
8808 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
8809 if (itmQBIndex != -1 && parentPlayer)
8810 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
8811 }
8812 }
8813 else
8814 {
8815
8816 PlayerBase player;
8817 int itemQBIndex;
8818 if (version ==
int.
MAX)
8819 {
8820 if (!ctx.
Read(itemQBIndex))
8821 {
8823 return false;
8824 }
8825 }
8826 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
8827 {
8828
8829 if (!ctx.
Read(itemQBIndex))
8830 {
8832 return false;
8833 }
8834 if (itemQBIndex != -1 && player)
8835 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
8836 }
8837 }
8838
8839 if (version < 140)
8840 {
8841
8842 if (!LoadVariables(ctx, version))
8843 {
8845 return false;
8846 }
8847 }
8848
8849
8851 {
8853 return false;
8854 }
8855 if (version >= 132)
8856 {
8858 if (raib)
8859 {
8861 {
8863 return false;
8864 }
8865 }
8866 }
8867
8869 return true;
8870 }
8871
8872
8873
8875 {
8876 super.OnStoreSave(ctx);
8877
8878 PlayerBase player;
8879 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
8880 {
8882
8883 int itemQBIndex = -1;
8884 itemQBIndex = player.FindQuickBarEntityIndex(this);
8885 ctx.
Write(itemQBIndex);
8886 }
8887 else
8888 {
8890 }
8891
8893
8895 if (raib)
8896 {
8898 }
8899 }
8900
8901
8903 {
8904 super.AfterStoreLoad();
8905
8907 {
8909 }
8910
8912 {
8915 }
8916 }
8917
8919 {
8920 super.EEOnAfterLoad();
8921
8923 {
8925 }
8926
8929 }
8930
8932 {
8933 return false;
8934 }
8935
8936
8937
8939 {
8941 {
8942 #ifdef PLATFORM_CONSOLE
8943
8945 {
8947 if (menu)
8948 {
8950 }
8951 }
8952 #endif
8953 }
8954
8956 {
8959 }
8960
8962 {
8963 SetWeightDirty();
8965 }
8967 {
8970 }
8971
8973 {
8976 }
8978 {
8981 }
8982
8983 super.OnVariablesSynchronized();
8984 }
8985
8986
8987
8989 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
8990 {
8991 if (!IsServerCheck(allow_client))
8992 return false;
8993
8995 return false;
8996
8999
9000 if (value <= (min + 0.001))
9001 value = min;
9002
9003 if (value == min)
9004 {
9005 if (destroy_config)
9006 {
9007 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
9008 if (dstr)
9009 {
9011 this.Delete();
9012 return true;
9013 }
9014 }
9015 else if (destroy_forced)
9016 {
9018 this.Delete();
9019 return true;
9020 }
9021
9023 }
9024
9027
9029 {
9031
9032 if (delta)
9034 }
9035
9037
9038 return false;
9039 }
9040
9041
9043 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9044 {
9046 }
9047
9049 {
9052 }
9053
9055 {
9058 }
9059
9061 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9062 {
9063 float value_clamped = Math.Clamp(value, 0, 1);
9065 SetQuantity(result, destroy_config, destroy_forced);
9066 }
9067
9068
9071 {
9073 }
9074
9076 {
9078 }
9079
9080
9081
9082
9083
9084
9085
9086
9087
9088
9090 {
9091 int slot = -1;
9092 if (GetInventory())
9093 {
9094 InventoryLocation il = new InventoryLocation;
9095 GetInventory().GetCurrentInventoryLocation(il);
9097 }
9098
9100 }
9101
9103 {
9104 float quantity_max = 0;
9105
9107 {
9108 if (attSlotID != -1)
9109 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
9110
9111 if (quantity_max <= 0)
9113 }
9114
9115 if (quantity_max <= 0)
9117
9118 return quantity_max;
9119 }
9120
9122 {
9124 }
9125
9127 {
9129 }
9130
9131
9133 {
9135 }
9136
9138 {
9140 }
9141
9143 {
9145 }
9146
9147
9149 {
9150
9151 float weightEx = GetWeightEx();
9152 float special = GetInventoryAndCargoWeight();
9153 return weightEx - special;
9154 }
9155
9156
9158 {
9160 }
9161
9163 {
9165 {
9166 #ifdef DEVELOPER
9167 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9168 {
9169 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
9171 }
9172 #endif
9173
9175 }
9176 else if (HasEnergyManager())
9177 {
9178 #ifdef DEVELOPER
9179 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9180 {
9181 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
9182 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
9183 }
9184 #endif
9185 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
9186 }
9187 else
9188 {
9189 #ifdef DEVELOPER
9190 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9191 {
9192 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
9193 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
9194 }
9195 #endif
9196 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
9197 }
9198 }
9199
9202 {
9203 int item_count = 0;
9205
9206 if (GetInventory().GetCargo() != NULL)
9207 {
9208 item_count = GetInventory().GetCargo().GetItemCount();
9209 }
9210
9211 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
9212 {
9213 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
9214 if (item)
9215 item_count += item.GetNumberOfItems();
9216 }
9217 return item_count;
9218 }
9219
9222 {
9223 float weight = 0;
9224 float wetness = 1;
9225 if (include_wetness)
9228 {
9229 weight = wetness * m_ConfigWeight;
9230 }
9232 {
9233 weight = 1;
9234 }
9235 return weight;
9236 }
9237
9238
9239
9241 {
9242 if ((
GetGame().IsServer() || !
GetGame().IsMultiplayer()) && GetInventory())
9243 {
9244 GameInventory inv = GetInventory();
9245 array<EntityAI> items = new array<EntityAI>;
9247 for (int i = 0; i < items.Count(); i++)
9248 {
9250 if (item)
9251 {
9253 }
9254 }
9255 }
9256 }
9257
9258
9259
9260
9262 {
9263 float energy = 0;
9264 if (HasEnergyManager())
9265 {
9266 energy = GetCompEM().GetEnergy();
9267 }
9268 return energy;
9269 }
9270
9271
9273 {
9274 super.OnEnergyConsumed();
9275
9277 }
9278
9280 {
9281 super.OnEnergyAdded();
9282
9284 }
9285
9286
9288 {
9289 if (
GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
9290 {
9292 {
9293 float energy_0to1 = GetCompEM().GetEnergy0To1();
9295 }
9296 }
9297 }
9298
9299
9301 {
9302 return ConfigGetFloat("heatIsolation");
9303 }
9304
9306 {
9308 }
9309
9311 {
9312 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
9313 if (
GetGame().ConfigIsExisting(paramPath))
9315
9316 return 0.0;
9317 }
9318
9320 {
9321 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
9322 if (
GetGame().ConfigIsExisting(paramPath))
9324
9325 return 0.0;
9326 }
9327
9328 override void SetWet(
float value,
bool allow_client =
false)
9329 {
9330 if (!IsServerCheck(allow_client))
9331 return;
9332
9335
9337
9338 m_VarWet = Math.Clamp(value, min, max);
9339
9341 {
9344 }
9345 }
9346
9347 override void AddWet(
float value)
9348 {
9350 }
9351
9353 {
9355 }
9356
9358 {
9360 }
9361
9363 {
9365 }
9366
9368 {
9370 }
9371
9373 {
9375 }
9376
9378 {
9381 if (newLevel != oldLevel)
9382 {
9384 }
9385 }
9386
9388 {
9389 SetWeightDirty();
9390 }
9391
9393 {
9394 return GetWetLevelInternal(
m_VarWet);
9395 }
9396
9397
9398
9400 {
9402 }
9403
9405 {
9407 }
9408
9410 {
9412 }
9413
9415 {
9417 }
9418
9419
9420
9422 {
9423 if (ConfigIsExisting("itemModelLength"))
9424 {
9425 return ConfigGetFloat("itemModelLength");
9426 }
9427 return 0;
9428 }
9429
9431 {
9432 if (ConfigIsExisting("itemAttachOffset"))
9433 {
9434 return ConfigGetFloat("itemAttachOffset");
9435 }
9436 return 0;
9437 }
9438
9439 override void SetCleanness(
int value,
bool allow_client =
false)
9440 {
9441 if (!IsServerCheck(allow_client))
9442 return;
9443
9445
9447
9450 }
9451
9453 {
9455 }
9456
9458 {
9459 return true;
9460 }
9461
9462
9463
9464
9466 {
9468 }
9469
9471 {
9473 }
9474
9475
9476
9477
9478 override void SetColor(
int r,
int g,
int b,
int a)
9479 {
9485 }
9487 override void GetColor(out
int r,out
int g,out
int b,out
int a)
9488 {
9493 }
9494
9496 {
9498 }
9499
9502 {
9503 int r,g,b,a;
9505 r = r/255;
9506 g = g/255;
9507 b = b/255;
9508 a = a/255;
9509 return MiscGameplayFunctions.GetColorString(r, g, b, a);
9510 }
9511
9512
9513
9514 override void SetLiquidType(
int value,
bool allow_client =
false)
9515 {
9516 if (!IsServerCheck(allow_client))
9517 return;
9518
9523 }
9524
9526 {
9527 return ConfigGetInt("varLiquidTypeInit");
9528 }
9529
9531 {
9533 }
9534
9536 {
9538 SetFrozen(false);
9539 }
9540
9543 {
9544 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9545 }
9546
9547
9550 {
9551 PlayerBase nplayer;
9552 if (PlayerBase.CastTo(nplayer, player))
9553 {
9555
9556 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9557 }
9558 }
9559
9560
9563 {
9564 PlayerBase nplayer;
9565 if (PlayerBase.CastTo(nplayer,player))
9566 {
9567
9568 nplayer.SetEnableQuickBarEntityShortcut(this,false);
9569
9570 }
9571
9572
9573 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
9574
9575
9576 if (HasEnergyManager())
9577 {
9578 GetCompEM().UpdatePlugState();
9579 }
9580 }
9581
9582
9584 {
9585 super.OnPlacementStarted(player);
9586
9588 }
9589
9590 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
9591 {
9593 {
9594 m_AdminLog.OnPlacementComplete(player,
this);
9595 }
9596
9597 super.OnPlacementComplete(player, position, orientation);
9598 }
9599
9600
9601
9602
9603
9605 {
9607 {
9608 return true;
9609 }
9610 else
9611 {
9612 return false;
9613 }
9614 }
9615
9616
9618 {
9620 {
9622 }
9623 }
9624
9625
9627 {
9629 }
9630
9632 {
9634 }
9635
9636 override void InsertAgent(
int agent,
float count = 1)
9637 {
9638 if (count < 1)
9639 return;
9640
9642 }
9643
9646 {
9648 }
9649
9650
9652 {
9654 }
9655
9656
9657
9658
9659
9660
9661
9662
9663
9664
9665
9666
9667
9668
9669
9670
9671
9672
9673
9674
9675
9676
9677
9678
9679
9680
9681
9682
9683
9684
9685
9686
9687
9688
9689
9690
9691
9692
9693
9694
9695
9696
9698 {
9700 return false;
9701 return true;
9702 }
9703
9705 {
9706
9708 }
9709
9710
9713 {
9714 super.CheckForRoofLimited(timeTresholdMS);
9715
9717 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
9718 {
9719 m_PreviousRoofTestTime = time;
9720 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
9721 }
9722 }
9723
9724
9726 {
9728 {
9729 return 0;
9730 }
9731
9732 if (GetInventory().GetAttachmentSlotsCount() != 0)
9733 {
9734 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
9735 if (filter)
9736 return filter.GetProtectionLevel(type, false, system);
9737 else
9738 return 0;
9739 }
9740
9741 string subclassPath, entryName;
9742
9743 switch (type)
9744 {
9746 entryName = "biological";
9747 break;
9749 entryName = "chemical";
9750 break;
9751 default:
9752 entryName = "biological";
9753 break;
9754 }
9755
9756 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
9757
9759 }
9760
9761
9762
9765 {
9766 if (!IsMagazine())
9768
9770 }
9771
9772
9773
9774
9775
9780 {
9781 return true;
9782 }
9783
9785 {
9787 }
9788
9789
9790
9791
9792
9794 {
9795 if (parent)
9796 {
9797 if (parent.IsInherited(DayZInfected))
9798 return true;
9799
9800 if (!parent.IsRuined())
9801 return true;
9802 }
9803
9804 return true;
9805 }
9806
9808 {
9809 if (!super.CanPutAsAttachment(parent))
9810 {
9811 return false;
9812 }
9813
9814 if (!IsRuined() && !parent.IsRuined())
9815 {
9816 return true;
9817 }
9818
9819 return false;
9820 }
9821
9823 {
9824
9825
9826
9827
9828 return super.CanReceiveItemIntoCargo(item);
9829 }
9830
9832 {
9833
9834
9835
9836
9837 GameInventory attachmentInv = attachment.GetInventory();
9839 {
9840 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
9841 return false;
9842 }
9843
9844 InventoryLocation loc = new InventoryLocation();
9845 attachment.GetInventory().GetCurrentInventoryLocation(loc);
9846 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
9847 return false;
9848
9849 return super.CanReceiveAttachment(attachment, slotId);
9850 }
9851
9853 {
9854 if (!super.CanReleaseAttachment(attachment))
9855 return false;
9856
9857 return GetInventory().AreChildrenAccessible();
9858 }
9859
9860
9861
9862
9863
9864
9865
9866
9867
9868
9869
9870
9871
9872
9873
9874
9875
9876
9877
9878
9879
9881 {
9882 int id = muzzle_owner.GetMuzzleID();
9883 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
9884
9885 if (WPOF_array)
9886 {
9887 for (int i = 0; i < WPOF_array.Count(); i++)
9888 {
9889 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
9890
9891 if (WPOF)
9892 {
9893 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
9894 }
9895 }
9896 }
9897 }
9898
9899
9901 {
9902 int id = muzzle_owner.GetMuzzleID();
9904
9905 if (WPOBE_array)
9906 {
9907 for (int i = 0; i < WPOBE_array.Count(); i++)
9908 {
9909 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
9910
9911 if (WPOBE)
9912 {
9913 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
9914 }
9915 }
9916 }
9917 }
9918
9919
9921 {
9922 int id = muzzle_owner.GetMuzzleID();
9923 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9924
9925 if (WPOOH_array)
9926 {
9927 for (int i = 0; i < WPOOH_array.Count(); i++)
9928 {
9929 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9930
9931 if (WPOOH)
9932 {
9933 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
9934 }
9935 }
9936 }
9937 }
9938
9939
9941 {
9942 int id = muzzle_owner.GetMuzzleID();
9943 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9944
9945 if (WPOOH_array)
9946 {
9947 for (int i = 0; i < WPOOH_array.Count(); i++)
9948 {
9949 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9950
9951 if (WPOOH)
9952 {
9953 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9954 }
9955 }
9956 }
9957 }
9958
9959
9961 {
9962 int id = muzzle_owner.GetMuzzleID();
9963 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9964
9965 if (WPOOH_array)
9966 {
9967 for (int i = 0; i < WPOOH_array.Count(); i++)
9968 {
9969 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9970
9971 if (WPOOH)
9972 {
9973 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9974 }
9975 }
9976 }
9977 }
9978
9979
9980
9982 {
9984 {
9985 return true;
9986 }
9987
9988 return false;
9989 }
9990
9992 {
9994 {
9995 return true;
9996 }
9997
9998 return false;
9999 }
10000
10002 {
10004 {
10005 return true;
10006 }
10007
10008 return false;
10009 }
10010
10012 {
10013 return false;
10014 }
10015
10018 {
10019 return UATimeSpent.DEFAULT_DEPLOY;
10020 }
10021
10022
10023
10024
10026 {
10028 SetSynchDirty();
10029 }
10030
10032 {
10034 }
10035
10036
10038 {
10039 return false;
10040 }
10041
10044 {
10045 string att_type = "None";
10046
10047 if (ConfigIsExisting("soundAttType"))
10048 {
10049 att_type = ConfigGetString("soundAttType");
10050 }
10051
10053 }
10054
10056 {
10058 }
10059
10060
10061
10062
10063
10069
10071 {
10074
10076 }
10077
10078
10080 {
10082 return;
10083
10085
10088
10091
10092 SoundParameters params = new SoundParameters();
10096 }
10097
10098
10100 {
10102 return;
10103
10105 SetSynchDirty();
10106
10109 }
10110
10111
10113 {
10115 return;
10116
10118 SetSynchDirty();
10119
10122 }
10123
10125 {
10127 }
10128
10130 {
10132 }
10133
10136 {
10137 if (!
GetGame().IsDedicatedServer())
10138 {
10139 if (ConfigIsExisting("attachSoundSet"))
10140 {
10141 string cfg_path = "";
10142 string soundset = "";
10143 string type_name =
GetType();
10144
10147 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
10148 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
10149
10150 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
10151 {
10152 for (int i = 0; i < cfg_soundset_array.Count(); i++)
10153 {
10154 if (cfg_slot_array[i] == slot_type)
10155 {
10156 soundset = cfg_soundset_array[i];
10157 break;
10158 }
10159 }
10160 }
10161
10162 if (soundset != "")
10163 {
10164 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
10166 }
10167 }
10168 }
10169 }
10170
10172 {
10173
10174 }
10175
10176 void OnApply(PlayerBase player);
10177
10179 {
10180 return 1.0;
10181 };
10182
10184 {
10186 }
10187
10189 {
10191 }
10192
10194
10196 {
10197 SetDynamicPhysicsLifeTime(0.01);
10199 }
10200
10202 {
10203 array<string> zone_names = new array<string>;
10204 GetDamageZones(zone_names);
10205 for (int i = 0; i < zone_names.Count(); i++)
10206 {
10207 SetHealthMax(zone_names.Get(i),"Health");
10208 }
10209 SetHealthMax("","Health");
10210 }
10211
10214 {
10215 float global_health = GetHealth01("","Health");
10216 array<string> zones = new array<string>;
10217 GetDamageZones(zones);
10218
10219 for (int i = 0; i < zones.Count(); i++)
10220 {
10221 SetHealth01(zones.Get(i),"Health",global_health);
10222 }
10223 }
10224
10227 {
10228 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
10229 }
10230
10232 {
10233 if (!hasRootAsPlayer)
10234 {
10235 if (refParentIB)
10236 {
10237
10238 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
10239 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
10240
10241 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
10242 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
10243
10246 }
10247 else
10248 {
10249
10252 }
10253 }
10254 }
10255
10257 {
10259 {
10260 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
10261 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
10262 {
10263 float heatPermCoef = 1.0;
10265 while (ent)
10266 {
10267 heatPermCoef *= ent.GetHeatPermeabilityCoef();
10268 ent = ent.GetHierarchyParent();
10269 }
10270
10271 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
10272 }
10273 }
10274 }
10275
10277 {
10278
10279 EntityAI parent = GetHierarchyParent();
10280 if (!parent)
10281 {
10282 hasParent = false;
10283 hasRootAsPlayer = false;
10284 }
10285 else
10286 {
10287 hasParent = true;
10288 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
10289 refParentIB =
ItemBase.Cast(parent);
10290 }
10291 }
10292
10293 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
10294 {
10295
10296 }
10297
10299 {
10300
10301 return false;
10302 }
10303
10305 {
10306
10307
10308 return false;
10309 }
10310
10312 {
10313
10314 return false;
10315 }
10316
10319 {
10320 return !GetIsFrozen() &&
IsOpen();
10321 }
10322
10324 {
10325 bool hasParent = false, hasRootAsPlayer = false;
10327
10328 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
10329 bool foodDecay =
g_Game.IsFoodDecayEnabled();
10330
10331 if (wwtu || foodDecay)
10332 {
10336
10337 if (processWetness || processTemperature || processDecay)
10338 {
10340
10341 if (processWetness)
10342 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
10343
10344 if (processTemperature)
10346
10347 if (processDecay)
10348 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
10349 }
10350 }
10351 }
10352
10355 {
10357 }
10358
10360 {
10363
10364 return super.GetTemperatureFreezeThreshold();
10365 }
10366
10368 {
10371
10372 return super.GetTemperatureThawThreshold();
10373 }
10374
10376 {
10379
10380 return super.GetItemOverheatThreshold();
10381 }
10382
10384 {
10386 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
10387
10388 return super.GetTemperatureFreezeTime();
10389 }
10390
10392 {
10394 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
10395
10396 return super.GetTemperatureThawTime();
10397 }
10398
10403
10405 {
10406 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
10407 }
10408
10410 {
10411 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
10412 }
10413
10416 {
10418 }
10419
10421 {
10423 }
10424
10426 {
10428 }
10429
10432 {
10433 return null;
10434 }
10435
10438 {
10439 return false;
10440 }
10441
10443 {
10445 {
10448 if (!trg)
10449 {
10451 explosive = this;
10452 }
10453
10454 explosive.PairRemote(trg);
10456
10457 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
10458 trg.SetPersistentPairID(persistentID);
10459 explosive.SetPersistentPairID(persistentID);
10460
10461 return true;
10462 }
10463 return false;
10464 }
10465
10468 {
10469 float ret = 1.0;
10472 ret *= GetHealth01();
10473
10474 return ret;
10475 }
10476
10477 #ifdef DEVELOPER
10478 override void SetDebugItem()
10479 {
10480 super.SetDebugItem();
10481 _itemBase = this;
10482 }
10483
10485 {
10486 string text = super.GetDebugText();
10487
10489 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
10490
10491 return text;
10492 }
10493 #endif
10494
10496 {
10497 return true;
10498 }
10499
10501
10503
10505 {
10508 }
10509
10510
10518
10534}
10535
10537{
10539 if (entity)
10540 {
10541 bool is_item = entity.IsInherited(
ItemBase);
10542 if (is_item && full_quantity)
10543 {
10546 }
10547 }
10548 else
10549 {
10551 return NULL;
10552 }
10553 return entity;
10554}
10555
10557{
10558 if (item)
10559 {
10560 if (health > 0)
10561 item.SetHealth("", "", health);
10562
10563 if (item.CanHaveTemperature())
10564 {
10566 if (item.CanFreeze())
10567 item.SetFrozen(false);
10568 }
10569
10570 if (item.HasEnergyManager())
10571 {
10572 if (quantity >= 0)
10573 {
10574 item.GetCompEM().SetEnergy0To1(quantity);
10575 }
10576 else
10577 {
10579 }
10580 }
10581 else if (item.IsMagazine())
10582 {
10583 Magazine mag = Magazine.Cast(item);
10584 if (quantity >= 0)
10585 {
10586 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
10587 }
10588 else
10589 {
10591 }
10592
10593 }
10594 else
10595 {
10596 if (quantity >= 0)
10597 {
10598 item.SetQuantityNormalized(quantity, false);
10599 }
10600 else
10601 {
10603 }
10604
10605 }
10606 }
10607}
10608
10609#ifdef DEVELOPER
10611#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.