Unlocks this item from its attachment slot of its parent.
5627{
5629 {
5630 return true;
5631 }
5632};
5633
5634
5635
5637{
5641
5643
5646
5647
5648
5649
5650
5659
5665
5670
5675
5696 protected bool m_IsResultOfSplit
5697
5699
5704
5705
5706
5708
5712
5713
5714
5716
5719
5720
5721
5727
5728
5736
5739
5740
5742
5743
5745
5746
5751
5752
5757
5758
5760
5761
5763 {
5768
5769 if (!
GetGame().IsDedicatedServer())
5770 {
5772 {
5774
5776 {
5778 }
5779 }
5780
5783 }
5784
5785 m_OldLocation = null;
5786
5788 {
5790 }
5791
5792 if (ConfigIsExisting("headSelectionsToHide"))
5793 {
5796 }
5797
5799 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
5800 {
5802 }
5803
5805
5806 m_IsResultOfSplit = false;
5807
5809 }
5810
5812 {
5813 super.InitItemVariables();
5814
5820 m_Count = ConfigGetInt(
"count");
5821
5824
5829
5832
5837
5849
5853
5854
5857 if (ConfigIsExisting("canBeSplit"))
5858 {
5861 }
5862
5864 if (ConfigIsExisting("itemBehaviour"))
5866
5867
5870 RegisterNetSyncVariableInt("m_VarLiquidType");
5871 RegisterNetSyncVariableInt("m_Cleanness",0,1);
5872
5873 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
5874 RegisterNetSyncVariableFloat("m_ImpactSpeed");
5875 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
5876
5877 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
5878 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
5879 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
5880 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
5881
5882 RegisterNetSyncVariableBool("m_IsBeingPlaced");
5883 RegisterNetSyncVariableBool("m_IsTakeable");
5884 RegisterNetSyncVariableBool("m_IsHologram");
5885
5888 {
5891 }
5892
5894
5896 if (ConfigIsExisting("temperaturePerQuantityWeight"))
5898
5899 }
5900
5902 {
5904 }
5905
5907 {
5910 {
5915 }
5916 }
5917
5918 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
5919 {
5921 {
5924 }
5925
5927 }
5928
5930 {
5936 }
5937
5939
5941 {
5943
5944 if (!action)
5945 {
5946 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
5947 return;
5948 }
5949
5951 if (!ai)
5952 {
5954 return;
5955 }
5956
5958 if (!action_array)
5959 {
5960 action_array = new array<ActionBase_Basic>;
5962 }
5963 if (LogManager.IsActionLogEnable())
5964 {
5965 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
5966 }
5967
5968 if (action_array.Find(action) != -1)
5969 {
5970 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
5971 }
5972 else
5973 {
5974 action_array.Insert(action);
5975 }
5976 }
5977
5979 {
5981 ActionBase action = player.GetActionManager().GetAction(actionName);
5984
5985 if (action_array)
5986 {
5987 action_array.RemoveItem(action);
5988 }
5989 }
5990
5991
5992
5994 {
5995 ActionOverrideData overrideData = new ActionOverrideData();
5999
6001 if (!actionMap)
6002 {
6005 }
6006
6007 actionMap.Insert(this.
Type(), overrideData);
6008
6009 }
6010
6012
6014
6015
6017 {
6020
6023
6024 string config_to_search = "CfgVehicles";
6025 string muzzle_owner_config;
6026
6028 {
6029 if (IsInherited(Weapon))
6030 config_to_search = "CfgWeapons";
6031
6032 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6033
6034 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
6035
6037
6038 if (config_OnFire_subclass_count > 0)
6039 {
6040 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
6041
6042 for (int i = 0; i < config_OnFire_subclass_count; i++)
6043 {
6044 string particle_class = "";
6046 string config_OnFire_entry = config_OnFire_class + particle_class;
6047 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
6048 WPOF_array.Insert(WPOF);
6049 }
6050
6051
6053 }
6054 }
6055
6057 {
6058 config_to_search = "CfgWeapons";
6059 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6060
6061 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
6062
6064
6065 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
6066 {
6067 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
6068
6069 for (i = 0; i < config_OnBulletCasingEject_count; i++)
6070 {
6071 string particle_class2 = "";
6073 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
6074 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
6075 WPOBE_array.Insert(WPOBE);
6076 }
6077
6078
6080 }
6081 }
6082 }
6083
6084
6086 {
6089
6091 {
6092 string config_to_search = "CfgVehicles";
6093
6094 if (IsInherited(Weapon))
6095 config_to_search = "CfgWeapons";
6096
6097 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6098 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
6099
6100 if (
GetGame().ConfigIsExisting(config_OnOverheating_class))
6101 {
6102
6104
6106 {
6108 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
6110 return;
6111 }
6112
6115
6116
6117
6119 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
6120
6121 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
6122 {
6123 string particle_class = "";
6125 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
6127
6128 if (entry_type == CT_CLASS)
6129 {
6130 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
6131 WPOOH_array.Insert(WPOF);
6132 }
6133 }
6134
6135
6137 }
6138 }
6139 }
6140
6142 {
6144 }
6145
6147 {
6149 {
6151
6154
6157
6158 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6159 }
6160 }
6161
6163 {
6165 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6166
6168 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6169
6171 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6172
6174 {
6176 }
6177 }
6178
6180 {
6182 }
6183
6185 {
6188 else
6190
6192 {
6195 }
6196 else
6197 {
6200
6203 }
6204
6206 }
6207
6209 {
6211 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6212 }
6213
6215 {
6217 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6219 }
6220
6222 {
6224 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6225 }
6226
6228 {
6231
6232 OverheatingParticle OP = new OverheatingParticle();
6237
6239 }
6240
6242 {
6245
6246 return -1;
6247 }
6248
6250 {
6252 {
6255
6256 for (int i = count; i > 0; --i)
6257 {
6258 int id = i - 1;
6261
6264
6265 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
6266 {
6267 if (p)
6268 {
6271 }
6272 }
6273 }
6274 }
6275 }
6276
6278 {
6280 {
6282 {
6283 int id = i - 1;
6285
6286 if (OP)
6287 {
6289
6290 if (p)
6291 {
6293 }
6294
6295 delete OP;
6296 }
6297 }
6298
6301 }
6302 }
6303
6306 {
6307 return 0.0;
6308 }
6309
6310
6312 {
6313 return 250;
6314 }
6315
6317 {
6318 return 0;
6319 }
6320
6323 {
6325 return true;
6326
6327 return false;
6328 }
6329
6332 {
6335
6337 {
6339 }
6340 else
6341 {
6342
6344 }
6345
6347 }
6348
6355 {
6356 return -1;
6357 }
6358
6359
6360
6361
6363 {
6365 {
6367 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6368
6369 if (r_index >= 0)
6370 {
6371 InventoryLocation r_il = new InventoryLocation;
6372 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6373
6374 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6377 {
6378 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6379 }
6381 {
6382 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6383 }
6384
6385 }
6386
6387 player.GetHumanInventory().ClearUserReservedLocation(this);
6388 }
6389
6392 }
6393
6394
6395
6396
6398 {
6399 return ItemBase.m_DebugActionsMask;
6400 }
6401
6403 {
6404 return ItemBase.m_DebugActionsMask & mask;
6405 }
6406
6408 {
6409 ItemBase.m_DebugActionsMask = mask;
6410 }
6411
6413 {
6414 ItemBase.m_DebugActionsMask |= mask;
6415 }
6416
6418 {
6419 ItemBase.m_DebugActionsMask &= ~mask;
6420 }
6421
6423 {
6425 {
6427 }
6428 else
6429 {
6431 }
6432 }
6433
6434
6436 {
6437 if (GetEconomyProfile())
6438 {
6439 float q_max = GetEconomyProfile().GetQuantityMax();
6440 if (q_max > 0)
6441 {
6442 float q_min = GetEconomyProfile().GetQuantityMin();
6443 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
6444
6446 {
6447 ComponentEnergyManager comp = GetCompEM();
6449 {
6451 }
6452 }
6454 {
6456
6457 }
6458
6459 }
6460 }
6461 }
6462
6465 {
6466 EntityAI parent = GetHierarchyParent();
6467
6468 if (parent)
6469 {
6470 InventoryLocation inventory_location_to_lock = new InventoryLocation;
6471 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
6472 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
6473 }
6474 }
6475
6478 {
6479 EntityAI parent = GetHierarchyParent();
6480
6481 if (parent)
6482 {
6483 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
6484 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
6485 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
6486 }
6487 }
6488
6490 {
6491
6492
6493
6494
6496
6498 {
6499 if (ScriptInputUserData.CanStoreInputUserData())
6500 {
6501 ScriptInputUserData ctx = new ScriptInputUserData;
6507 ctx.
Write(use_stack_max);
6510
6512 {
6513 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
6514 }
6515 }
6516 }
6517 else if (!
GetGame().IsMultiplayer())
6518 {
6520 }
6521 }
6522
6524 {
6526 }
6527
6529 {
6531 }
6532
6534 {
6536 }
6537
6539 {
6540
6541 return false;
6542 }
6543
6545 {
6546 return false;
6547 }
6548
6552 {
6553 return false;
6554 }
6555
6557 {
6558 return "";
6559 }
6560
6562
6564 {
6565 return false;
6566 }
6567
6569 {
6570 return true;
6571 }
6572
6573
6574
6576 {
6577 return true;
6578 }
6579
6581 {
6582 return true;
6583 }
6584
6586 {
6587 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6589 }
6590
6592 {
6594 }
6595
6597 {
6599 if (!is_being_placed)
6601 SetSynchDirty();
6602 }
6603
6604
6606
6608 {
6610 }
6611
6613 {
6615 }
6616
6618 {
6619 return 1;
6620 }
6621
6623 {
6624 return false;
6625 }
6626
6628 {
6630 SetSynchDirty();
6631 }
6632
6633
6634
6635
6636
6637
6638
6639
6640
6641
6642
6643
6644
6645
6646
6647
6648
6649
6650
6651
6652
6653
6654
6655
6656
6657
6658
6659
6660
6661
6662
6663
6664
6665
6666
6668 {
6669 super.OnMovedInsideCargo(container);
6670
6671 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6672 }
6673
6674 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
6675 {
6676 super.EEItemLocationChanged(oldLoc,newLoc);
6677
6678 PlayerBase new_player = null;
6679 PlayerBase old_player = null;
6680
6681 if (newLoc.GetParent())
6682 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
6683
6684 if (oldLoc.GetParent())
6685 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
6686
6688 {
6689 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
6690
6691 if (r_index >= 0)
6692 {
6693 InventoryLocation r_il = new InventoryLocation;
6694 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6695
6696 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6699 {
6700 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6701 }
6703 {
6704 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6705 }
6706
6707 }
6708 }
6709
6711 {
6712 if (new_player)
6713 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
6714
6715 if (new_player == old_player)
6716 {
6717
6718 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
6719 {
6721 {
6722 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
6723 {
6724 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6725 }
6726 }
6727 else
6728 {
6729 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6730 }
6731 }
6732
6733 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
6734 {
6735 int type = oldLoc.GetType();
6737 {
6738 oldLoc.GetParent().GetOnSetLock().Invoke(this);
6739 }
6741 {
6742 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
6743 }
6744 }
6745 if (!m_OldLocation)
6746 {
6747 m_OldLocation = new InventoryLocation;
6748 }
6749 m_OldLocation.Copy(oldLoc);
6750 }
6751 else
6752 {
6753 if (m_OldLocation)
6754 {
6755 m_OldLocation.Reset();
6756 }
6757 }
6758
6760 }
6761 else
6762 {
6763 if (new_player)
6764 {
6765 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
6766 if (res_index >= 0)
6767 {
6768 InventoryLocation il = new InventoryLocation;
6769 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
6771 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
6774 {
6775 il.
GetParent().GetOnReleaseLock().Invoke(it);
6776 }
6778 {
6780 }
6781
6782 }
6783 }
6785 {
6786
6788 }
6789
6790 if (m_OldLocation)
6791 {
6792 m_OldLocation.Reset();
6793 }
6794 }
6795 }
6796
6797 override void EOnContact(IEntity other, Contact extra)
6798 {
6800 {
6801 int liquidType = -1;
6803 if (impactSpeed > 0.0)
6804 {
6806 #ifndef SERVER
6808 #else
6810 SetSynchDirty();
6811 #endif
6813 }
6814 }
6815
6816 #ifdef SERVER
6817 if (GetCompEM() && GetCompEM().IsPlugged())
6818 {
6819 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
6820 GetCompEM().UnplugThis();
6821 }
6822 #endif
6823 }
6824
6826
6828 {
6830 }
6831
6833 {
6834
6835 }
6836
6838 {
6839 super.OnItemLocationChanged(old_owner, new_owner);
6840
6841 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
6842 PlayerBase playerNew = PlayerBase.Cast(new_owner);
6843
6844 if (!relatedPlayer && playerNew)
6845 relatedPlayer = playerNew;
6846
6847 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
6848 {
6850 if (actionMgr)
6851 {
6852 ActionBase currentAction = actionMgr.GetRunningAction();
6853 if (currentAction)
6855 }
6856 }
6857
6858 Man ownerPlayerOld = null;
6859 Man ownerPlayerNew = null;
6860
6861 if (old_owner)
6862 {
6863 if (old_owner.
IsMan())
6864 {
6865 ownerPlayerOld = Man.Cast(old_owner);
6866 }
6867 else
6868 {
6869 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
6870 }
6871 }
6872 else
6873 {
6875 {
6877
6878 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
6879 {
6880 GetCompEM().UnplugThis();
6881 }
6882 }
6883 }
6884
6885 if (new_owner)
6886 {
6887 if (new_owner.
IsMan())
6888 {
6889 ownerPlayerNew = Man.Cast(new_owner);
6890 }
6891 else
6892 {
6893 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
6894 }
6895 }
6896
6897 if (ownerPlayerOld != ownerPlayerNew)
6898 {
6899 if (ownerPlayerOld)
6900 {
6901 array<EntityAI> subItemsExit = new array<EntityAI>;
6903 for (int i = 0; i < subItemsExit.Count(); i++)
6904 {
6907 }
6908 }
6909
6910 if (ownerPlayerNew)
6911 {
6912 array<EntityAI> subItemsEnter = new array<EntityAI>;
6914 for (int j = 0; j < subItemsEnter.Count(); j++)
6915 {
6918 }
6919 }
6920 }
6921 else if (ownerPlayerNew != null)
6922 {
6923 PlayerBase nplayer;
6924 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
6925 {
6926 array<EntityAI> subItemsUpdate = new array<EntityAI>;
6928 for (int k = 0; k < subItemsUpdate.Count(); k++)
6929 {
6931 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
6932 }
6933 }
6934 }
6935
6936 if (old_owner)
6937 old_owner.OnChildItemRemoved(this);
6938 if (new_owner)
6939 new_owner.OnChildItemReceived(this);
6940 }
6941
6942
6944 {
6945 super.EEDelete(parent);
6946 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
6947 if (player)
6948 {
6950
6951 if (player.IsAlive())
6952 {
6953 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6954 if (r_index >= 0)
6955 {
6956 InventoryLocation r_il = new InventoryLocation;
6957 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6958
6959 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6962 {
6963 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6964 }
6966 {
6967 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6968 }
6969
6970 }
6971
6972 player.RemoveQuickBarEntityShortcut(this);
6973 }
6974 }
6975 }
6976
6978 {
6979 super.EEKilled(killer);
6980
6983 {
6984 if (GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
6985 {
6986 if (IsMagazine())
6987 {
6988 if (Magazine.Cast(this).GetAmmoCount() > 0)
6989 {
6991 }
6992 }
6993 else
6994 {
6996 }
6997 }
6998 }
6999 }
7000
7002 {
7003 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7004
7005 super.OnWasAttached(parent, slot_id);
7006
7009
7011 }
7012
7014 {
7015 super.OnWasDetached(parent, slot_id);
7016
7019 }
7020
7022 {
7023 int idx;
7026
7027 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7028 if (inventory_slots.Count() < 1)
7029 {
7030 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
7031 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
7032 }
7033 else
7034 {
7035 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
7036 }
7037
7038 idx = inventory_slots.Find(slot);
7039 if (idx < 0)
7040 return "";
7041
7042 return attach_types.Get(idx);
7043 }
7044
7046 {
7047 int idx = -1;
7048 string slot;
7049
7052
7053 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7054 if (inventory_slots.Count() < 1)
7055 {
7056 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
7057 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7058 }
7059 else
7060 {
7061 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
7062 if (detach_types.Count() < 1)
7063 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7064 }
7065
7066 for (int i = 0; i < inventory_slots.Count(); i++)
7067 {
7068 slot = inventory_slots.Get(i);
7069 }
7070
7071 if (slot != "")
7072 {
7073 if (detach_types.Count() == 1)
7074 idx = 0;
7075 else
7076 idx = inventory_slots.Find(slot);
7077 }
7078 if (idx < 0)
7079 return "";
7080
7081 return detach_types.Get(idx);
7082 }
7083
7085 {
7086
7088
7089
7090 float min_time = 1;
7091 float max_time = 3;
7092 float delay = Math.RandomFloat(min_time, max_time);
7093
7094 explode_timer.Run(delay, this, "DoAmmoExplosion");
7095 }
7096
7098 {
7099 Magazine magazine = Magazine.Cast(this);
7100 int pop_sounds_count = 6;
7101 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
7102
7103
7104 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
7105 string sound_name = pop_sounds[ sound_idx ];
7107
7108
7109 magazine.ServerAddAmmoCount(-1);
7110
7111
7112 float min_temp_to_explode = 100;
7113
7114 if (magazine.GetAmmoCount() > 0 && GetTemperature() >= min_temp_to_explode)
7115 {
7117 }
7118 }
7119
7120
7121 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
7122 {
7123 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
7124
7125 const int CHANCE_DAMAGE_CARGO = 4;
7126 const int CHANCE_DAMAGE_ATTACHMENT = 1;
7127 const int CHANCE_DAMAGE_NOTHING = 2;
7128
7130 {
7131 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
7132 int chances;
7133 int rnd;
7134
7135 if (GetInventory().GetCargo())
7136 {
7137 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7138 rnd = Math.RandomInt(0,chances);
7139
7140 if (rnd < CHANCE_DAMAGE_CARGO)
7141 {
7143 }
7144 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
7145 {
7147 }
7148 }
7149 else
7150 {
7151 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7152 rnd = Math.RandomInt(0,chances);
7153
7154 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
7155 {
7157 }
7158 }
7159 }
7160 }
7161
7163 {
7164 if (GetInventory().GetCargo())
7165 {
7166 int item_count = GetInventory().GetCargo().GetItemCount();
7167 if (item_count > 0)
7168 {
7169 int random_pick = Math.RandomInt(0, item_count);
7171 if (!item.IsExplosive())
7172 {
7173 item.AddHealth("","",damage);
7174 return true;
7175 }
7176 }
7177 }
7178 return false;
7179 }
7180
7182 {
7183 int attachment_count = GetInventory().AttachmentCount();
7184 if (attachment_count > 0)
7185 {
7186 int random_pick = Math.RandomInt(0, attachment_count);
7187 ItemBase attachment =
ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
7188 if (!attachment.IsExplosive())
7189 {
7190 attachment.AddHealth("","",damage);
7191 return true;
7192 }
7193 }
7194 return false;
7195 }
7196
7198 {
7200 }
7201
7203 {
7205 return GetInventory().CanRemoveEntity();
7206
7207 return false;
7208 }
7209
7211 {
7213 return;
7214
7216 {
7217 if (ScriptInputUserData.CanStoreInputUserData())
7218 {
7219 ScriptInputUserData ctx = new ScriptInputUserData;
7224 ctx.
Write(destination_entity);
7228 }
7229 }
7230 else if (!
GetGame().IsMultiplayer())
7231 {
7233 }
7234 }
7235
7237 {
7239 return;
7240
7241 float split_quantity_new;
7245 InventoryLocation loc = new InventoryLocation;
7246
7247 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7248 {
7250 split_quantity_new = stack_max;
7251 else
7253
7254 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7255 if (new_item)
7256 {
7257 new_item.SetResultOfSplit(true);
7258 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7260 new_item.SetQuantity(split_quantity_new);
7261 }
7262 }
7263 else if (destination_entity && slot_id == -1)
7264 {
7265 if (quantity > stack_max)
7266 split_quantity_new = stack_max;
7267 else
7268 split_quantity_new = quantity;
7269
7271 {
7274 }
7275
7276 if (new_item)
7277 {
7278 new_item.SetResultOfSplit(true);
7279 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7281 new_item.SetQuantity(split_quantity_new);
7282 }
7283 }
7284 else
7285 {
7286 if (stack_max != 0)
7287 {
7289 {
7291 }
7292
7293 if (split_quantity_new == 0)
7294 {
7295 if (!
GetGame().IsMultiplayer())
7296 player.PhysicalPredictiveDropItem(this);
7297 else
7298 player.ServerDropEntity(this);
7299 return;
7300 }
7301
7303
7304 if (new_item)
7305 {
7306 new_item.SetResultOfSplit(true);
7307 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7309 new_item.SetQuantity(stack_max);
7310 new_item.PlaceOnSurface();
7311 }
7312 }
7313 }
7314 }
7315
7317 {
7319 return;
7320
7321 float split_quantity_new;
7325 InventoryLocation loc = new InventoryLocation;
7326
7327 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7328 {
7330 split_quantity_new = stack_max;
7331 else
7333
7334 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7335 if (new_item)
7336 {
7337 new_item.SetResultOfSplit(true);
7338 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7340 new_item.SetQuantity(split_quantity_new);
7341 }
7342 }
7343 else if (destination_entity && slot_id == -1)
7344 {
7345 if (quantity > stack_max)
7346 split_quantity_new = stack_max;
7347 else
7348 split_quantity_new = quantity;
7349
7351 {
7354 }
7355
7356 if (new_item)
7357 {
7358 new_item.SetResultOfSplit(true);
7359 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7361 new_item.SetQuantity(split_quantity_new);
7362 }
7363 }
7364 else
7365 {
7366 if (stack_max != 0)
7367 {
7369 {
7371 }
7372
7374
7375 if (new_item)
7376 {
7377 new_item.SetResultOfSplit(true);
7378 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7380 new_item.SetQuantity(stack_max);
7381 new_item.PlaceOnSurface();
7382 }
7383 }
7384 }
7385 }
7386
7388 {
7390 return;
7391
7393 {
7394 if (ScriptInputUserData.CanStoreInputUserData())
7395 {
7396 ScriptInputUserData ctx = new ScriptInputUserData;
7401 dst.WriteToContext(ctx);
7403 }
7404 }
7405 else if (!
GetGame().IsMultiplayer())
7406 {
7408 }
7409 }
7410
7412 {
7414 return;
7415
7417 {
7418 if (ScriptInputUserData.CanStoreInputUserData())
7419 {
7420 ScriptInputUserData ctx = new ScriptInputUserData;
7425 ctx.
Write(destination_entity);
7431 }
7432 }
7433 else if (!
GetGame().IsMultiplayer())
7434 {
7436 }
7437 }
7438
7440 {
7442 }
7443
7445 {
7447 return this;
7448
7450 float split_quantity_new;
7452 if (dst.IsValid())
7453 {
7454 int slot_id = dst.GetSlot();
7456
7457 if (quantity > stack_max)
7458 split_quantity_new = stack_max;
7459 else
7460 split_quantity_new = quantity;
7461
7463
7464 if (new_item)
7465 {
7466 new_item.SetResultOfSplit(true);
7467 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7470 }
7471
7472 return new_item;
7473 }
7474
7475 return null;
7476 }
7477
7479 {
7481 return;
7482
7484 float split_quantity_new;
7486 if (destination_entity)
7487 {
7489 if (quantity > stackable)
7490 split_quantity_new = stackable;
7491 else
7492 split_quantity_new = quantity;
7493
7494 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
7495 if (new_item)
7496 {
7497 new_item.SetResultOfSplit(true);
7498 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7500 new_item.SetQuantity(split_quantity_new);
7501 }
7502 }
7503 }
7504
7506 {
7508 return;
7509
7511 {
7512 if (ScriptInputUserData.CanStoreInputUserData())
7513 {
7514 ScriptInputUserData ctx = new ScriptInputUserData;
7519 ItemBase destination_entity =
this;
7520 ctx.
Write(destination_entity);
7524 }
7525 }
7526 else if (!
GetGame().IsMultiplayer())
7527 {
7529 }
7530 }
7531
7533 {
7535 return;
7536
7538 float split_quantity_new;
7540 if (player)
7541 {
7543 if (quantity > stackable)
7544 split_quantity_new = stackable;
7545 else
7546 split_quantity_new = quantity;
7547
7548 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
7549 new_item =
ItemBase.Cast(in_hands);
7550 if (new_item)
7551 {
7552 new_item.SetResultOfSplit(true);
7553 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7555 new_item.SetQuantity(split_quantity_new);
7556 }
7557 }
7558 }
7559
7561 {
7563 return;
7564
7566 float split_quantity_new = Math.Floor(quantity * 0.5);
7567
7569
7570 if (new_item)
7571 {
7572 if (new_item.GetQuantityMax() < split_quantity_new)
7573 {
7574 split_quantity_new = new_item.GetQuantityMax();
7575 }
7576
7577 new_item.SetResultOfSplit(true);
7578 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7579
7581 {
7584 }
7585 else
7586 {
7589 }
7590 }
7591 }
7592
7594 {
7596 return;
7597
7599 float split_quantity_new = Math.Floor(quantity / 2);
7600
7601 InventoryLocation invloc = new InventoryLocation;
7603
7605 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
7606
7607 if (new_item)
7608 {
7609 if (new_item.GetQuantityMax() < split_quantity_new)
7610 {
7611 split_quantity_new = new_item.GetQuantityMax();
7612 }
7614 {
7617 }
7618 else
7619 {
7622 }
7623 }
7624 }
7625
7628 {
7629 SetWeightDirty();
7631
7632 if (parent)
7633 parent.OnAttachmentQuantityChangedEx(this, delta);
7634
7636 {
7638 {
7640 }
7642 {
7643 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
7645 }
7646 }
7647
7648 }
7649
7652 {
7653
7654 }
7655
7658 {
7660 }
7661
7663 {
7664 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
7665
7667 {
7668 if (newLevel == GameConstants.STATE_RUINED)
7669 {
7671 EntityAI parent = GetHierarchyParent();
7672 if (parent && parent.IsFireplace())
7673 {
7674 CargoBase cargo = GetInventory().GetCargo();
7675 if (cargo)
7676 {
7678 {
7680 }
7681 }
7682 }
7683 }
7684
7686 {
7687
7689 return;
7690 }
7691
7692 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
7693 {
7695 }
7696 }
7697 }
7698
7699
7701 {
7702 super.OnRightClick();
7703
7705 {
7707 {
7708 if (ScriptInputUserData.CanStoreInputUserData())
7709 {
7710 vector m4[4];
7712
7713 EntityAI root = GetHierarchyRoot();
7714
7715 InventoryLocation dst = new InventoryLocation;
7717 {
7718 if (root)
7719 {
7720 root.GetTransform(m4);
7722 }
7723 else
7724 GetInventory().GetCurrentInventoryLocation(dst);
7725 }
7726 else
7727 {
7729
7730
7731 if (
GetGame().
GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
7732 {
7733 if (root)
7734 {
7735 root.GetTransform(m4);
7737 }
7738 else
7739 GetInventory().GetCurrentInventoryLocation(dst);
7740 }
7741 else
7742 {
7743 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
7744 }
7745 }
7746
7747 ScriptInputUserData ctx = new ScriptInputUserData;
7755 }
7756 }
7757 else if (!
GetGame().IsMultiplayer())
7758 {
7760 }
7761 }
7762 }
7763
7764 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
7765 {
7766
7767 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
7768 return false;
7769
7770 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
7771 return false;
7772
7773
7775 return false;
7776
7777
7778 Magazine mag = Magazine.Cast(this);
7779 if (mag)
7780 {
7781 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
7782 return false;
7783
7784 if (stack_max_limit)
7785 {
7786 Magazine other_mag = Magazine.Cast(other_item);
7787 if (other_item)
7788 {
7789 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
7790 return false;
7791 }
7792
7793 }
7794 }
7795 else
7796 {
7797
7799 return false;
7800
7802 return false;
7803 }
7804
7805 PlayerBase player = null;
7806 if (CastTo(player, GetHierarchyRootPlayer()))
7807 {
7808 if (player.GetInventory().HasAttachment(this))
7809 return false;
7810
7811 if (player.IsItemsToDelete())
7812 return false;
7813 }
7814
7815 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
7816 return false;
7817
7818 int slotID;
7820 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
7821 return false;
7822
7823 return true;
7824 }
7825
7827 {
7829 }
7830
7832 {
7833 return m_IsResultOfSplit;
7834 }
7835
7837 {
7838 m_IsResultOfSplit = value;
7839 }
7840
7842 {
7844 }
7845
7847 {
7848 float other_item_quantity = other_item.GetQuantity();
7849 float this_free_space;
7850
7852
7854
7855 if (other_item_quantity > this_free_space)
7856 {
7857 return this_free_space;
7858 }
7859 else
7860 {
7861 return other_item_quantity;
7862 }
7863 }
7864
7866 {
7868 }
7869
7871 {
7873 return;
7874
7875 if (!IsMagazine() && other_item)
7876 {
7878 if (quantity_used != 0)
7879 {
7880 float hp1 = GetHealth01("","");
7881 float hp2 = other_item.GetHealth01("","");
7882 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
7883 hpResult = hpResult / (
GetQuantity() + quantity_used);
7884
7885 hpResult *= GetMaxHealth();
7886 Math.Round(hpResult);
7887 SetHealth("", "Health", hpResult);
7888
7890 other_item.AddQuantity(-quantity_used);
7891 }
7892 }
7894 }
7895
7897 {
7898 #ifdef SERVER
7899 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
7900 GetHierarchyParent().IncreaseLifetimeUp();
7901 #endif
7902 };
7903
7905 {
7906 PlayerBase p = PlayerBase.Cast(player);
7907
7908 array<int> recipesIds = p.m_Recipes;
7909 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
7910 if (moduleRecipesManager)
7911 {
7912 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
7913 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
7914 }
7915
7916 for (int i = 0;i < recipesIds.Count(); i++)
7917 {
7918 int key = recipesIds.Get(i);
7919 string recipeName = moduleRecipesManager.GetRecipeName(key);
7921 }
7922 }
7923
7924
7925 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
7926 {
7927 super.GetDebugActions(outputList);
7928
7929
7934
7935
7939
7943
7944
7947
7948
7950 {
7953 }
7954
7956
7959
7963 }
7964
7965
7966
7967
7969 {
7970 super.OnAction(action_id, player, ctx);
7971 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
7972 {
7973 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
7974 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
7975 PlayerBase p = PlayerBase.Cast(player);
7976 if (
EActions.RECIPES_RANGE_START < 1000)
7977 {
7978 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
7979 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
7980 }
7981 }
7982 #ifndef SERVER
7983 else if (action_id ==
EActions.WATCH_PLAYER)
7984 {
7985 PluginDeveloper.SetDeveloperItemClientEx(player);
7986 }
7987 #endif
7989 {
7990 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
7991 {
7992 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
7993 OnDebugButtonPressServer(id + 1);
7994 }
7995
7996 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
7997 {
7998 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
8000 }
8001
8002 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
8003 {
8004 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
8006 }
8007
8008 else if (action_id ==
EActions.ADD_QUANTITY)
8009 {
8010 if (IsMagazine())
8011 {
8012 Magazine mag = Magazine.Cast(this);
8013 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
8014 }
8015 else
8016 {
8018 }
8019
8020 if (m_EM)
8021 {
8022 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
8023 }
8024
8025 }
8026
8027 else if (action_id ==
EActions.REMOVE_QUANTITY)
8028 {
8029 if (IsMagazine())
8030 {
8031 Magazine mag2 = Magazine.Cast(this);
8032 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
8033 }
8034 else
8035 {
8037 }
8038 if (m_EM)
8039 {
8040 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
8041 }
8042
8043 }
8044
8045 else if (action_id ==
EActions.SET_QUANTITY_0)
8046 {
8048
8049 if (m_EM)
8050 {
8051 m_EM.SetEnergy(0);
8052 }
8053 }
8054
8055 else if (action_id ==
EActions.SET_MAX_QUANTITY)
8056 {
8058
8059 if (m_EM)
8060 {
8061 m_EM.SetEnergy(m_EM.GetEnergyMax());
8062 }
8063 }
8064
8065 else if (action_id ==
EActions.ADD_HEALTH)
8066 {
8067 AddHealth("","",GetMaxHealth("","Health")/5);
8068 }
8069 else if (action_id ==
EActions.REMOVE_HEALTH)
8070 {
8071 AddHealth("","",-GetMaxHealth("","Health")/5);
8072 }
8073 else if (action_id ==
EActions.DESTROY_HEALTH)
8074 {
8075 SetHealth01("","",0);
8076 }
8077 else if (action_id ==
EActions.WATCH_ITEM)
8078 {
8080 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
8081 #ifdef DEVELOPER
8082 SetDebugDeveloper_item(this);
8083 #endif
8084 }
8085
8086 else if (action_id ==
EActions.ADD_TEMPERATURE)
8087 {
8088 AddTemperature(20);
8089
8090 }
8091
8092 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
8093 {
8094 AddTemperature(-20);
8095
8096 }
8097
8098 else if (action_id ==
EActions.FLIP_FROZEN)
8099 {
8100 SetFrozen(!GetIsFrozen());
8101
8102 }
8103
8104 else if (action_id ==
EActions.ADD_WETNESS)
8105 {
8107
8108 }
8109
8110 else if (action_id ==
EActions.REMOVE_WETNESS)
8111 {
8113
8114 }
8115
8116 else if (action_id ==
EActions.LIQUIDTYPE_UP)
8117 {
8120
8121
8122 }
8123
8124 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
8125 {
8128 }
8129
8130 else if (action_id ==
EActions.MAKE_SPECIAL)
8131 {
8132 auto debugParams = DebugSpawnParams.WithPlayer(player);
8133 OnDebugSpawnEx(debugParams);
8134 }
8135
8136 else if (action_id ==
EActions.DELETE)
8137 {
8138 Delete();
8139 }
8140
8141 }
8142
8143
8144 return false;
8145 }
8146
8147
8148
8149
8153
8156
8157
8158
8160 {
8161 return false;
8162 }
8163
8164
8166 {
8167 return true;
8168 }
8169
8170
8172 {
8173 return true;
8174 }
8175
8176
8177
8179 {
8180 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
8182 }
8183
8186 {
8187 return null;
8188 }
8189
8191 {
8192 return false;
8193 }
8194
8196 {
8197 return false;
8198 }
8199
8203
8204
8206 {
8207 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8208 return module_repairing.CanRepair(this, item_repair_kit);
8209 }
8210
8211
8212 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
8213 {
8214 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8215 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
8216 }
8217
8218
8220 {
8221
8222
8223
8224
8225
8226
8227
8228
8229 return 1;
8230 }
8231
8232
8233
8235 {
8237 }
8238
8239
8240
8242 {
8244 }
8245
8246
8255 {
8256 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8257
8258 if (player)
8259 {
8260 player.MessageStatus(text);
8261 }
8262 }
8263
8264
8273 {
8274 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8275
8276 if (player)
8277 {
8278 player.MessageAction(text);
8279 }
8280 }
8281
8282
8291 {
8292 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8293
8294 if (player)
8295 {
8296 player.MessageFriendly(text);
8297 }
8298 }
8299
8300
8309 {
8310 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8311
8312 if (player)
8313 {
8314 player.MessageImportant(text);
8315 }
8316 }
8317
8319 {
8320 return true;
8321 }
8322
8323
8324 override bool KindOf(
string tag)
8325 {
8326 bool found = false;
8327 string item_name = this.
GetType();
8330
8331 int array_size = item_tag_array.Count();
8332 for (int i = 0; i < array_size; i++)
8333 {
8334 if (item_tag_array.Get(i) == tag)
8335 {
8336 found = true;
8337 break;
8338 }
8339 }
8340 return found;
8341 }
8342
8343
8345 {
8346
8347 super.OnRPC(sender, rpc_type,ctx);
8348
8349
8350 switch (rpc_type)
8351 {
8352 #ifndef SERVER
8353 case ERPCs.RPC_SOUND_LOCK_ATTACH:
8354 Param2<bool, string> p = new Param2<bool, string>(false, "");
8355
8357 return;
8358
8359 bool play = p.param1;
8360 string soundSet = p.param2;
8361
8362 if (play)
8363 {
8365 {
8367 {
8369 }
8370 }
8371 else
8372 {
8374 }
8375 }
8376 else
8377 {
8379 }
8380
8381 break;
8382 #endif
8383
8384 }
8385
8387 {
8389 }
8390 }
8391
8392
8393
8394
8396 {
8397 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8398 return plugin.GetID(
name);
8399 }
8400
8402 {
8403 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8404 return plugin.GetName(id);
8405 }
8406
8409 {
8410
8411
8412 int varFlags;
8413 if (!ctx.
Read(varFlags))
8414 return;
8415
8416 if (varFlags & ItemVariableFlags.FLOAT)
8417 {
8419 }
8420 }
8421
8423 {
8424
8425 super.SerializeNumericalVars(floats_out);
8426
8427
8428
8430 {
8432 }
8433
8435 {
8437 }
8438
8440 {
8442 }
8443
8445 {
8450 }
8451
8453 {
8455 }
8456 }
8457
8459 {
8460
8461 super.DeSerializeNumericalVars(floats);
8462
8463
8464 int index = 0;
8465 int mask = Math.Round(floats.Get(index));
8466
8467 index++;
8468
8470 {
8472 {
8474 }
8475 else
8476 {
8477 float quantity = floats.Get(index);
8479 }
8480 index++;
8481 }
8482
8484 {
8485 float wet = floats.Get(index);
8487 index++;
8488 }
8489
8491 {
8492 int liquidtype = Math.Round(floats.Get(index));
8494 index++;
8495 }
8496
8498 {
8500 index++;
8502 index++;
8504 index++;
8506 index++;
8507 }
8508
8510 {
8511 int cleanness = Math.Round(floats.Get(index));
8513 index++;
8514 }
8515 }
8516
8518 {
8519 super.WriteVarsToCTX(ctx);
8520
8521
8523 {
8525 }
8526
8528 {
8530 }
8531
8533 {
8535 }
8536
8538 {
8539 int r,g,b,a;
8545 }
8546
8548 {
8550 }
8551 }
8552
8554 {
8555 if (!super.ReadVarsFromCTX(ctx,version))
8556 return false;
8557
8558 int intValue;
8559 float value;
8560
8561 if (version < 140)
8562 {
8563 if (!ctx.
Read(intValue))
8564 return false;
8565
8566 m_VariablesMask = intValue;
8567 }
8568
8570 {
8571 if (!ctx.
Read(value))
8572 return false;
8573
8575 {
8577 }
8578 else
8579 {
8581 }
8582 }
8583
8584 if (version < 140)
8585 {
8587 {
8588 if (!ctx.
Read(value))
8589 return false;
8590 SetTemperatureDirect(value);
8591 }
8592 }
8593
8595 {
8596 if (!ctx.
Read(value))
8597 return false;
8599 }
8600
8602 {
8603 if (!ctx.
Read(intValue))
8604 return false;
8606 }
8607
8609 {
8610 int r,g,b,a;
8612 return false;
8614 return false;
8616 return false;
8618 return false;
8619
8621 }
8622
8624 {
8625 if (!ctx.
Read(intValue))
8626 return false;
8628 }
8629
8630 if (version >= 138 && version < 140)
8631 {
8633 {
8634 if (!ctx.
Read(intValue))
8635 return false;
8636 SetFrozen(intValue);
8637 }
8638 }
8639
8640 return true;
8641 }
8642
8643
8645 {
8648 {
8650 }
8651
8652 if (!super.OnStoreLoad(ctx, version))
8653 {
8655 return false;
8656 }
8657
8658 if (version >= 114)
8659 {
8660 bool hasQuickBarIndexSaved;
8661
8662 if (!ctx.
Read(hasQuickBarIndexSaved))
8663 {
8665 return false;
8666 }
8667
8668 if (hasQuickBarIndexSaved)
8669 {
8670 int itmQBIndex;
8671
8672
8673 if (!ctx.
Read(itmQBIndex))
8674 {
8676 return false;
8677 }
8678
8679 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
8680 if (itmQBIndex != -1 && parentPlayer)
8681 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
8682 }
8683 }
8684 else
8685 {
8686
8687 PlayerBase player;
8688 int itemQBIndex;
8689 if (version ==
int.
MAX)
8690 {
8691 if (!ctx.
Read(itemQBIndex))
8692 {
8694 return false;
8695 }
8696 }
8697 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
8698 {
8699
8700 if (!ctx.
Read(itemQBIndex))
8701 {
8703 return false;
8704 }
8705 if (itemQBIndex != -1 && player)
8706 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
8707 }
8708 }
8709
8710 if (version < 140)
8711 {
8712
8713 if (!LoadVariables(ctx, version))
8714 {
8716 return false;
8717 }
8718 }
8719
8720
8722 {
8724 return false;
8725 }
8726 if (version >= 132)
8727 {
8729 if (raib)
8730 {
8732 {
8734 return false;
8735 }
8736 }
8737 }
8738
8740 return true;
8741 }
8742
8743
8744
8746 {
8747 super.OnStoreSave(ctx);
8748
8749 PlayerBase player;
8750 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
8751 {
8753
8754 int itemQBIndex = -1;
8755 itemQBIndex = player.FindQuickBarEntityIndex(this);
8756 ctx.
Write(itemQBIndex);
8757 }
8758 else
8759 {
8761 }
8762
8764
8766 if (raib)
8767 {
8769 }
8770 }
8771
8772
8774 {
8775 super.AfterStoreLoad();
8776
8778 {
8780 }
8781
8783 {
8786 }
8787 }
8788
8790 {
8791 super.EEOnAfterLoad();
8792
8794 {
8796 }
8797
8800 }
8801
8803 {
8804 return false;
8805 }
8806
8807
8808
8810 {
8812 {
8813 #ifdef PLATFORM_CONSOLE
8814
8816 {
8818 if (menu)
8819 {
8821 }
8822 }
8823 #endif
8824 }
8825
8827 {
8830 }
8831
8833 {
8834 SetWeightDirty();
8836 }
8838 {
8841 }
8842
8844 {
8847 }
8849 {
8852 }
8853
8854 super.OnVariablesSynchronized();
8855 }
8856
8857
8858
8860 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
8861 {
8862 if (!IsServerCheck(allow_client))
8863 return false;
8864
8866 return false;
8867
8870
8871 if (value <= (min + 0.001))
8872 value = min;
8873
8874 if (value == min)
8875 {
8876 if (destroy_config)
8877 {
8878 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
8879 if (dstr)
8880 {
8882 this.Delete();
8883 return true;
8884 }
8885 }
8886 else if (destroy_forced)
8887 {
8889 this.Delete();
8890 return true;
8891 }
8892
8894 }
8895
8898
8900 {
8902
8903 if (delta)
8905 }
8906
8908
8909 return false;
8910 }
8911
8912
8914 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
8915 {
8917 }
8918
8920 {
8923 }
8924
8926 {
8929 }
8930
8933 {
8934 float value_clamped = Math.Clamp(value, 0, 1);
8936 SetQuantity(result, destroy_config, destroy_forced);
8937 }
8938
8939
8942 {
8944 }
8945
8947 {
8949 }
8950
8951
8952
8953
8954
8955
8956
8957
8958
8959
8961 {
8962 int slot = -1;
8963 if (GetInventory())
8964 {
8965 InventoryLocation il = new InventoryLocation;
8966 GetInventory().GetCurrentInventoryLocation(il);
8968 }
8969
8971 }
8972
8974 {
8975 float quantity_max = 0;
8976
8978 {
8979 if (attSlotID != -1)
8980 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
8981
8982 if (quantity_max <= 0)
8984 }
8985
8986 if (quantity_max <= 0)
8988
8989 return quantity_max;
8990 }
8991
8993 {
8995 }
8996
8998 {
9000 }
9001
9002
9004 {
9006 }
9007
9009 {
9011 }
9012
9014 {
9016 }
9017
9018
9020 {
9021
9022 float weightEx = GetWeightEx();
9023 float special = GetInventoryAndCargoWeight();
9024 return weightEx - special;
9025 }
9026
9027
9029 {
9031 }
9032
9034 {
9036 {
9037 #ifdef DEVELOPER
9038 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9039 {
9040 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
9042 }
9043 #endif
9044
9046 }
9047 else if (HasEnergyManager())
9048 {
9049 #ifdef DEVELOPER
9050 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9051 {
9052 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
9053 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
9054 }
9055 #endif
9056 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified());
9057 }
9058 else
9059 {
9060 #ifdef DEVELOPER
9061 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9062 {
9063 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
9064 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
9065 }
9066 #endif
9067 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified());
9068 }
9069 }
9070
9073 {
9074 int item_count = 0;
9076
9077 if (GetInventory().GetCargo() != NULL)
9078 {
9079 item_count = GetInventory().GetCargo().GetItemCount();
9080 }
9081
9082 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
9083 {
9084 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
9085 if (item)
9086 item_count += item.GetNumberOfItems();
9087 }
9088 return item_count;
9089 }
9090
9093 {
9094 float weight = 0;
9095 float wetness = 1;
9096 if (include_wetness)
9099 {
9100 weight = wetness * m_ConfigWeight;
9101 }
9103 {
9104 weight = 1;
9105 }
9106 return weight;
9107 }
9108
9109
9110
9112 {
9113 if ((
GetGame().IsServer() || !
GetGame().IsMultiplayer()) && GetInventory())
9114 {
9115 GameInventory inv = GetInventory();
9116 array<EntityAI> items = new array<EntityAI>;
9118 for (int i = 0; i < items.Count(); i++)
9119 {
9121 if (item)
9122 {
9124 }
9125 }
9126 }
9127 }
9128
9129
9130
9131
9133 {
9134 float energy = 0;
9135 if (HasEnergyManager())
9136 {
9137 energy = GetCompEM().GetEnergy();
9138 }
9139 return energy;
9140 }
9141
9142
9144 {
9145 super.OnEnergyConsumed();
9146
9148 }
9149
9151 {
9152 super.OnEnergyAdded();
9153
9155 }
9156
9157
9159 {
9160 if (
GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
9161 {
9163 {
9164 float energy_0to1 = GetCompEM().GetEnergy0To1();
9166 }
9167 }
9168 }
9169
9170
9172 {
9173 return ConfigGetFloat("heatIsolation");
9174 }
9175
9177 {
9179 }
9180
9182 {
9183 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
9184 if (
GetGame().ConfigIsExisting(paramPath))
9186
9187 return 0.0;
9188 }
9189
9191 {
9192 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
9193 if (
GetGame().ConfigIsExisting(paramPath))
9195
9196 return 0.0;
9197 }
9198
9199 override void SetWet(
float value,
bool allow_client =
false)
9200 {
9201 if (!IsServerCheck(allow_client))
9202 return;
9203
9206
9208
9209 m_VarWet = Math.Clamp(value, min, max);
9210
9212 {
9215 }
9216 }
9217
9218 override void AddWet(
float value)
9219 {
9221 }
9222
9224 {
9226 }
9227
9229 {
9231 }
9232
9234 {
9236 }
9237
9239 {
9241 }
9242
9244 {
9246 }
9247
9249 {
9252 if (newLevel != oldLevel)
9253 {
9255 }
9256 }
9257
9259 {
9260 SetWeightDirty();
9261 }
9262
9264 {
9265 return GetWetLevelInternal(
m_VarWet);
9266 }
9267
9268
9269
9271 {
9273 }
9274
9276 {
9278 }
9279
9281 {
9283 }
9284
9286 {
9288 }
9289
9290
9291
9293 {
9294 if (ConfigIsExisting("itemModelLength"))
9295 {
9296 return ConfigGetFloat("itemModelLength");
9297 }
9298 return 0;
9299 }
9300
9302 {
9303 if (ConfigIsExisting("itemAttachOffset"))
9304 {
9305 return ConfigGetFloat("itemAttachOffset");
9306 }
9307 return 0;
9308 }
9309
9310 override void SetCleanness(
int value,
bool allow_client =
false)
9311 {
9312 if (!IsServerCheck(allow_client))
9313 return;
9314
9316
9318
9321 }
9322
9324 {
9326 }
9327
9329 {
9330 return true;
9331 }
9332
9333
9334
9335
9337 {
9339 }
9340
9342 {
9344 }
9345
9346
9347
9348
9349 override void SetColor(
int r,
int g,
int b,
int a)
9350 {
9356 }
9358 override void GetColor(out
int r,out
int g,out
int b,out
int a)
9359 {
9364 }
9365
9367 {
9369 }
9370
9373 {
9374 int r,g,b,a;
9376 r = r/255;
9377 g = g/255;
9378 b = b/255;
9379 a = a/255;
9380 return MiscGameplayFunctions.GetColorString(r, g, b, a);
9381 }
9382
9383
9384
9385 override void SetLiquidType(
int value,
bool allow_client =
false)
9386 {
9387 if (!IsServerCheck(allow_client))
9388 return;
9389
9394 }
9395
9397 {
9398 return ConfigGetInt("varLiquidTypeInit");
9399 }
9400
9402 {
9404 }
9405
9407 {
9409 SetFrozen(false);
9410 }
9411
9414 {
9415 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9416 }
9417
9418
9421 {
9422 PlayerBase nplayer;
9423 if (PlayerBase.CastTo(nplayer, player))
9424 {
9426
9427 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9428 }
9429 }
9430
9431
9434 {
9435 PlayerBase nplayer;
9436 if (PlayerBase.CastTo(nplayer,player))
9437 {
9438
9439 nplayer.SetEnableQuickBarEntityShortcut(this,false);
9440
9441 }
9442
9443
9444 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
9445
9446
9447 if (HasEnergyManager())
9448 {
9449 GetCompEM().UpdatePlugState();
9450 }
9451 }
9452
9453
9455 {
9456 super.OnPlacementStarted(player);
9457
9459 }
9460
9461 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
9462 {
9464 {
9465 m_AdminLog.OnPlacementComplete(player,
this);
9466 }
9467
9468 super.OnPlacementComplete(player, position, orientation);
9469 }
9470
9471
9472
9473
9474
9476 {
9478 {
9479 return true;
9480 }
9481 else
9482 {
9483 return false;
9484 }
9485 }
9486
9487
9489 {
9491 {
9493 }
9494 }
9495
9496
9498 {
9500 }
9501
9503 {
9505 }
9506
9507 override void InsertAgent(
int agent,
float count = 1)
9508 {
9509 if (count < 1)
9510 return;
9511
9513 }
9514
9517 {
9519 }
9520
9521
9523 {
9525 }
9526
9527
9528
9529
9530
9531
9532
9533
9534
9535
9536
9537
9538
9539
9540
9541
9542
9543
9544
9545
9546
9547
9548
9549
9550
9551
9552
9553
9554
9555
9556
9557
9558
9559
9560
9561
9562
9563
9564
9565
9566
9567
9569 {
9571 return false;
9572 return true;
9573 }
9574
9576 {
9577
9579 }
9580
9581
9584 {
9585 super.CheckForRoofLimited(timeTresholdMS);
9586
9588 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
9589 {
9590 m_PreviousRoofTestTime = time;
9591 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
9592 }
9593 }
9594
9595
9597 {
9599 {
9600 return 0;
9601 }
9602
9603 if (GetInventory().GetAttachmentSlotsCount() != 0)
9604 {
9605 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
9606 if (filter)
9607 return filter.GetProtectionLevel(type, false, system);
9608 else
9609 return 0;
9610 }
9611
9612 string subclassPath, entryName;
9613
9614 switch (type)
9615 {
9617 entryName = "biological";
9618 break;
9620 entryName = "chemical";
9621 break;
9622 default:
9623 entryName = "biological";
9624 break;
9625 }
9626
9627 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
9628
9630 }
9631
9632
9633
9636 {
9637 if (!IsMagazine())
9639
9641 }
9642
9643
9644
9645
9646
9651 {
9652 return true;
9653 }
9654
9656 {
9658 }
9659
9660
9661
9662
9663
9665 {
9666 if (parent)
9667 {
9668 if (parent.IsInherited(DayZInfected))
9669 return true;
9670
9671 if (!parent.IsRuined())
9672 return true;
9673 }
9674
9675 return true;
9676 }
9677
9679 {
9680 if (!super.CanPutAsAttachment(parent))
9681 {
9682 return false;
9683 }
9684
9685 if (!IsRuined() && !parent.IsRuined())
9686 {
9687 return true;
9688 }
9689
9690 return false;
9691 }
9692
9694 {
9695
9696
9697
9698
9699 return super.CanReceiveItemIntoCargo(item);
9700 }
9701
9703 {
9704
9705
9706
9707
9708 GameInventory attachmentInv = attachment.GetInventory();
9710 {
9711 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
9712 return false;
9713 }
9714
9715 InventoryLocation loc = new InventoryLocation();
9716 attachment.GetInventory().GetCurrentInventoryLocation(loc);
9717 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
9718 return false;
9719
9720 return super.CanReceiveAttachment(attachment, slotId);
9721 }
9722
9724 {
9725 if (!super.CanReleaseAttachment(attachment))
9726 return false;
9727
9728 return GetInventory().AreChildrenAccessible();
9729 }
9730
9731
9732
9733
9734
9735
9736
9737
9738
9739
9740
9741
9742
9743
9744
9745
9746
9747
9748
9749
9750
9752 {
9753 int id = muzzle_owner.GetMuzzleID();
9754 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
9755
9756 if (WPOF_array)
9757 {
9758 for (int i = 0; i < WPOF_array.Count(); i++)
9759 {
9760 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
9761
9762 if (WPOF)
9763 {
9764 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
9765 }
9766 }
9767 }
9768 }
9769
9770
9772 {
9773 int id = muzzle_owner.GetMuzzleID();
9775
9776 if (WPOBE_array)
9777 {
9778 for (int i = 0; i < WPOBE_array.Count(); i++)
9779 {
9780 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
9781
9782 if (WPOBE)
9783 {
9784 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
9785 }
9786 }
9787 }
9788 }
9789
9790
9792 {
9793 int id = muzzle_owner.GetMuzzleID();
9794 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9795
9796 if (WPOOH_array)
9797 {
9798 for (int i = 0; i < WPOOH_array.Count(); i++)
9799 {
9800 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9801
9802 if (WPOOH)
9803 {
9804 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
9805 }
9806 }
9807 }
9808 }
9809
9810
9812 {
9813 int id = muzzle_owner.GetMuzzleID();
9814 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9815
9816 if (WPOOH_array)
9817 {
9818 for (int i = 0; i < WPOOH_array.Count(); i++)
9819 {
9820 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9821
9822 if (WPOOH)
9823 {
9824 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9825 }
9826 }
9827 }
9828 }
9829
9830
9832 {
9833 int id = muzzle_owner.GetMuzzleID();
9834 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9835
9836 if (WPOOH_array)
9837 {
9838 for (int i = 0; i < WPOOH_array.Count(); i++)
9839 {
9840 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9841
9842 if (WPOOH)
9843 {
9844 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9845 }
9846 }
9847 }
9848 }
9849
9850
9851
9853 {
9855 {
9856 return true;
9857 }
9858
9859 return false;
9860 }
9861
9863 {
9865 {
9866 return true;
9867 }
9868
9869 return false;
9870 }
9871
9873 {
9875 {
9876 return true;
9877 }
9878
9879 return false;
9880 }
9881
9883 {
9884 return false;
9885 }
9886
9889 {
9890 return UATimeSpent.DEFAULT_DEPLOY;
9891 }
9892
9893
9894
9895
9897 {
9899 SetSynchDirty();
9900 }
9901
9903 {
9905 }
9906
9907
9909 {
9910 return false;
9911 }
9912
9915 {
9916 string att_type = "None";
9917
9918 if (ConfigIsExisting("soundAttType"))
9919 {
9920 att_type = ConfigGetString("soundAttType");
9921 }
9922
9924 }
9925
9927 {
9929 }
9930
9931
9932
9933
9934
9938
9940 {
9943
9945 }
9946
9947
9949 {
9951 return;
9952
9954
9957
9960
9961 SoundParameters params = new SoundParameters();
9965 }
9966
9967
9969 {
9971 return;
9972
9974 SetSynchDirty();
9975
9978 }
9979
9980
9982 {
9984 return;
9985
9987 SetSynchDirty();
9988
9991 }
9992
9994 {
9996 }
9997
9999 {
10001 }
10002
10005 {
10006 if (!
GetGame().IsDedicatedServer())
10007 {
10008 if (ConfigIsExisting("attachSoundSet"))
10009 {
10010 string cfg_path = "";
10011 string soundset = "";
10012 string type_name =
GetType();
10013
10016 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
10017 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
10018
10019 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
10020 {
10021 for (int i = 0; i < cfg_soundset_array.Count(); i++)
10022 {
10023 if (cfg_slot_array[i] == slot_type)
10024 {
10025 soundset = cfg_soundset_array[i];
10026 break;
10027 }
10028 }
10029 }
10030
10031 if (soundset != "")
10032 {
10033 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
10035 }
10036 }
10037 }
10038 }
10039
10041 {
10042
10043 }
10044
10045 void OnApply(PlayerBase player);
10046
10048 {
10049 return 1.0;
10050 };
10051
10053 {
10055 }
10056
10058 {
10060 }
10061
10063
10065 {
10066 SetDynamicPhysicsLifeTime(0.01);
10068 }
10069
10071 {
10072 array<string> zone_names = new array<string>;
10073 GetDamageZones(zone_names);
10074 for (int i = 0; i < zone_names.Count(); i++)
10075 {
10076 SetHealthMax(zone_names.Get(i),"Health");
10077 }
10078 SetHealthMax("","Health");
10079 }
10080
10083 {
10084 float global_health = GetHealth01("","Health");
10085 array<string> zones = new array<string>;
10086 GetDamageZones(zones);
10087
10088 for (int i = 0; i < zones.Count(); i++)
10089 {
10090 SetHealth01(zones.Get(i),"Health",global_health);
10091 }
10092 }
10093
10096 {
10097 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
10098 }
10099
10101 {
10102 if (!hasRootAsPlayer)
10103 {
10104 if (refParentIB)
10105 {
10106
10107 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
10108 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
10109
10110 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
10111 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
10112
10115 }
10116 else
10117 {
10118
10121 }
10122 }
10123 }
10124
10126 {
10128 {
10129 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
10130 if (GetTemperature() != target || !IsFreezeThawProgressFinished())
10131 {
10132 float heatPermCoef = 1.0;
10134 while (ent)
10135 {
10136 heatPermCoef *= ent.GetHeatPermeabilityCoef();
10137 ent = ent.GetHierarchyParent();
10138 }
10139
10140 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
10141 }
10142 }
10143 }
10144
10146 {
10147
10148 EntityAI parent = GetHierarchyParent();
10149 if (!parent)
10150 {
10151 hasParent = false;
10152 hasRootAsPlayer = false;
10153 }
10154 else
10155 {
10156 hasParent = true;
10157 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
10158 refParentIB =
ItemBase.Cast(parent);
10159 }
10160 }
10161
10162 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
10163 {
10164
10165 }
10166
10168 {
10169
10170 return false;
10171 }
10172
10174 {
10175
10176
10177 return false;
10178 }
10179
10181 {
10182
10183 return false;
10184 }
10185
10188 {
10189 return !GetIsFrozen() &&
IsOpen();
10190 }
10191
10193 {
10194 bool hasParent = false, hasRootAsPlayer = false;
10196
10197 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
10198 bool foodDecay =
g_Game.IsFoodDecayEnabled();
10199
10200 if (wwtu || foodDecay)
10201 {
10205
10206 if (processWetness || processTemperature || processDecay)
10207 {
10209
10210 if (processWetness)
10211 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
10212
10213 if (processTemperature)
10215
10216 if (processDecay)
10217 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
10218 }
10219 }
10220 }
10221
10224 {
10226 }
10227
10229 {
10232
10233 return super.GetTemperatureFreezeThreshold();
10234 }
10235
10237 {
10240
10241 return super.GetTemperatureThawThreshold();
10242 }
10243
10245 {
10248
10249 return super.GetItemOverheatThreshold();
10250 }
10251
10253 {
10255 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
10256
10257 return super.GetTemperatureFreezeTime();
10258 }
10259
10261 {
10263 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
10264
10265 return super.GetTemperatureThawTime();
10266 }
10267
10272
10274 {
10275 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
10276 }
10277
10279 {
10280 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
10281 }
10282
10285 {
10287 }
10288
10290 {
10292 }
10293
10295 {
10297 }
10298
10301 {
10302 return null;
10303 }
10304
10307 {
10308 return false;
10309 }
10310
10312 {
10314 {
10317 if (!trg)
10318 {
10320 explosive = this;
10321 }
10322
10323 explosive.PairRemote(trg);
10325
10326 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
10327 trg.SetPersistentPairID(persistentID);
10328 explosive.SetPersistentPairID(persistentID);
10329
10330 return true;
10331 }
10332 return false;
10333 }
10334
10337 {
10338 float ret = 1.0;
10341 ret *= GetHealth01();
10342
10343 return ret;
10344 }
10345
10346 #ifdef DEVELOPER
10347 override void SetDebugItem()
10348 {
10349 super.SetDebugItem();
10350 _itemBase = this;
10351 }
10352
10354 {
10355 string text = super.GetDebugText();
10356
10358 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
10359
10360 return text;
10361 }
10362 #endif
10363
10365 {
10366 return true;
10367 }
10368
10370
10372
10374 {
10377 }
10378
10379
10387
10403}
10404
10406{
10408 if (entity)
10409 {
10410 bool is_item = entity.IsInherited(
ItemBase);
10411 if (is_item && full_quantity)
10412 {
10415 }
10416 }
10417 else
10418 {
10420 return NULL;
10421 }
10422 return entity;
10423}
10424
10426{
10427 if (item)
10428 {
10429 if (health > 0)
10430 item.SetHealth("", "", health);
10431
10432 if (item.CanHaveTemperature())
10433 {
10435 if (item.CanFreeze())
10436 item.SetFrozen(false);
10437 }
10438
10439 if (item.HasEnergyManager())
10440 {
10441 if (quantity >= 0)
10442 {
10443 item.GetCompEM().SetEnergy0To1(quantity);
10444 }
10445 else
10446 {
10448 }
10449 }
10450 else if (item.IsMagazine())
10451 {
10452 Magazine mag = Magazine.Cast(item);
10453 if (quantity >= 0)
10454 {
10455 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
10456 }
10457 else
10458 {
10460 }
10461
10462 }
10463 else
10464 {
10465 if (quantity >= 0)
10466 {
10467 item.SetQuantityNormalized(quantity, false);
10468 }
10469 else
10470 {
10472 }
10473
10474 }
10475 }
10476}
10477
10478#ifdef DEVELOPER
10480#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
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 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...
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)
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)
bool m_HideSelectionsBySlot
bool IsOverheatingEffectActive()
void SetIsBeingPlaced(bool is_being_placed)
int GetLiquidContainerMask()
ref Timer m_CheckOverheating
void RegisterOverheatingParticle(Particle p, float min_heat_coef, float max_heat_coef, int particle_id, Object parent, vector local_pos, vector local_ori)
bool GetActionWidgetOverride(out typename name)
If we need a different (handheld)item action widget displayed, the logic goes in here.
float GetUnitWeight(bool include_wetness=true)
Obsolete, use GetWeightEx instead.
void SetZoneDamageCEInit()
Sets zone damages to match randomized global health set by CE (CE spawn only)
static void PlayOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
override bool IsOneHandedBehaviour()
void AddLightSourceItem(ItemBase lightsource)
Adds a light source child.
FoodStage GetFoodStage()
overridden on Edible_Base; so we don't have to parse configs all the time
override float GetSingleInventoryItemWeightEx()
void SaveAgents(ParamsWriteContext ctx)
override int GetTargetQuantityMax(int attSlotID=-1)
float GetDisinfectQuantity(int system=0, Param param1=null)
override bool IsHologram()
float GetItemAttachOffset()
static int GetDebugActionsMask()
override int GetLiquidType()
void ProcessDecay(float delta, bool hasRootAsPlayer)
override bool IsItemBase()
override bool IsTwoHandedBehaviour()
bool IsCombineAll(ItemBase other_item, bool use_stack_max=false)
float GetProtectionLevel(int type, bool consider_filter=false, int system=0)
static void PlayBulletCasingEjectParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
override void OnEnergyAdded()
void AffectLiquidContainerOnFill(int liquid_type, float amount)
from enviro source
void AffectLiquidContainerOnTransfer(int liquidType, float amount, float sourceLiquidTemperature)
from other liquid container source
string GetExplosiveTriggerSlotName()
EffectSound m_DeployLoopSoundEx
override void DeSerializeNumericalVars(array< float > floats)
void StopItemDynamicPhysics()
override void SetStoreLoad(bool value)
float GetOverheatingValue()
bool ContainsAgent(int agent_id)
override void AddWet(float value)
override void EOnContact(IEntity other, Contact extra)
void SplitIntoStackMaxHands(PlayerBase player)
void SplitIntoStackMaxHandsClient(PlayerBase player)
ref Timer m_PhysDropTimer
void MessageToOwnerFriendly(string text)
Send message to owner player in green color.
override void SetStoreLoadedQuantity(float value)
bool m_IsResultOfSplit string m_SoundAttType
distinguish if item has been created as new or it came from splitting (server only flag)
void CheckOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
void UnlockFromParent()
Unlocks this item from its attachment slot of its parent.
bool Repair(PlayerBase player, ItemBase item_repair_kit, float specialty_weight)
void OnLiquidTypeChanged(int oldType, int newType)
void StartOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
void PlayDeployFinishSound()
bool AllowFoodConsumption()
bool m_IsOverheatingEffectActive
int m_LiquidContainerMask
void ProcessItemWetness(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
override int GetCleanness()
bool PairWithDevice(notnull ItemBase otherDevice)
static void RemoveDebugActionsMask(int mask)
static void UpdateOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
void PerformDamageSystemReinit()
override void ClearInventory()
static int m_LastRegisteredWeaponID
ItemBase GetLightSourceItem()
void MessageToOwnerImportant(string text)
Send message to owner player in red color.
override float GetItemOverheatThreshold()
void StopDeployLoopSoundEx()
override void SerializeNumericalVars(array< float > floats_out)
void Open()
Implementations only.
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 EEOnCECreate()
Called when entity is being created as new by CE/ Debug.
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 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 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
proto native void SetGround(EntityAI e, vector mat[4])
sets current inventory location type to Ground with transformation mat
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 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 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.