Unlocks this item from its attachment slot of its parent.
5699{
5701 {
5702 return true;
5703 }
5704};
5705
5706
5707
5709{
5713
5715
5718
5719
5720
5721
5722
5731
5737
5742
5747
5768 protected bool m_IsResultOfSplit
5769
5771
5776
5777
5778
5780
5784
5785
5786
5788
5791
5792
5793
5799
5800
5808
5811
5812
5814
5815
5817
5818
5823
5824
5829
5830
5832
5833
5835 {
5840
5841 if (!
GetGame().IsDedicatedServer())
5842 {
5844 {
5846
5848 {
5850 }
5851 }
5852
5855 }
5856
5857 m_OldLocation = null;
5858
5860 {
5862 }
5863
5864 if (ConfigIsExisting("headSelectionsToHide"))
5865 {
5868 }
5869
5871 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
5872 {
5874 }
5875
5877
5878 m_IsResultOfSplit = false;
5879
5881 }
5882
5884 {
5885 super.InitItemVariables();
5886
5892 m_Count = ConfigGetInt(
"count");
5893
5896
5901
5904
5909
5921
5925
5926
5929 if (ConfigIsExisting("canBeSplit"))
5930 {
5933 }
5934
5936 if (ConfigIsExisting("itemBehaviour"))
5938
5939
5942 RegisterNetSyncVariableInt("m_VarLiquidType");
5943 RegisterNetSyncVariableInt("m_Cleanness",0,1);
5944
5945 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
5946 RegisterNetSyncVariableFloat("m_ImpactSpeed");
5947 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
5948
5949 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
5950 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
5951 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
5952 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
5953
5954 RegisterNetSyncVariableBool("m_IsBeingPlaced");
5955 RegisterNetSyncVariableBool("m_IsTakeable");
5956 RegisterNetSyncVariableBool("m_IsHologram");
5957
5960 {
5963 }
5964
5966
5968 if (ConfigIsExisting("temperaturePerQuantityWeight"))
5970
5971 }
5972
5974 {
5976 }
5977
5979 {
5982 {
5987 }
5988 }
5989
5990 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
5991 {
5993 {
5996 }
5997
5999 }
6000
6002 {
6008 }
6009
6011
6013 {
6015
6016 if (!action)
6017 {
6018 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
6019 return;
6020 }
6021
6023 if (!ai)
6024 {
6026 return;
6027 }
6028
6030 if (!action_array)
6031 {
6032 action_array = new array<ActionBase_Basic>;
6034 }
6035 if (LogManager.IsActionLogEnable())
6036 {
6037 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
6038 }
6039
6040 if (action_array.Find(action) != -1)
6041 {
6042 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
6043 }
6044 else
6045 {
6046 action_array.Insert(action);
6047 }
6048 }
6049
6051 {
6053 ActionBase action = player.GetActionManager().GetAction(actionName);
6056
6057 if (action_array)
6058 {
6059 action_array.RemoveItem(action);
6060 }
6061 }
6062
6063
6064
6066 {
6067 ActionOverrideData overrideData = new ActionOverrideData();
6071
6073 if (!actionMap)
6074 {
6077 }
6078
6079 actionMap.Insert(this.
Type(), overrideData);
6080
6081 }
6082
6084
6086
6087
6089 {
6092
6095
6096 string config_to_search = "CfgVehicles";
6097 string muzzle_owner_config;
6098
6100 {
6101 if (IsInherited(Weapon))
6102 config_to_search = "CfgWeapons";
6103
6104 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6105
6106 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
6107
6109
6110 if (config_OnFire_subclass_count > 0)
6111 {
6112 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
6113
6114 for (int i = 0; i < config_OnFire_subclass_count; i++)
6115 {
6116 string particle_class = "";
6118 string config_OnFire_entry = config_OnFire_class + particle_class;
6119 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
6120 WPOF_array.Insert(WPOF);
6121 }
6122
6123
6125 }
6126 }
6127
6129 {
6130 config_to_search = "CfgWeapons";
6131 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6132
6133 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
6134
6136
6137 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
6138 {
6139 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
6140
6141 for (i = 0; i < config_OnBulletCasingEject_count; i++)
6142 {
6143 string particle_class2 = "";
6145 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
6146 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
6147 WPOBE_array.Insert(WPOBE);
6148 }
6149
6150
6152 }
6153 }
6154 }
6155
6156
6158 {
6161
6163 {
6164 string config_to_search = "CfgVehicles";
6165
6166 if (IsInherited(Weapon))
6167 config_to_search = "CfgWeapons";
6168
6169 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6170 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
6171
6172 if (
GetGame().ConfigIsExisting(config_OnOverheating_class))
6173 {
6174
6176
6178 {
6180 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
6182 return;
6183 }
6184
6187
6188
6189
6191 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
6192
6193 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
6194 {
6195 string particle_class = "";
6197 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
6199
6200 if (entry_type == CT_CLASS)
6201 {
6202 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
6203 WPOOH_array.Insert(WPOF);
6204 }
6205 }
6206
6207
6209 }
6210 }
6211 }
6212
6214 {
6216 }
6217
6219 {
6221 {
6223
6226
6229
6230 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6231 }
6232 }
6233
6235 {
6237 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6238
6240 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6241
6243 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6244
6246 {
6248 }
6249 }
6250
6252 {
6254 }
6255
6257 {
6260 else
6262
6264 {
6267 }
6268 else
6269 {
6272
6275 }
6276
6278 }
6279
6281 {
6283 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6284 }
6285
6287 {
6289 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6291 }
6292
6294 {
6296 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6297 }
6298
6300 {
6303
6304 OverheatingParticle OP = new OverheatingParticle();
6309
6311 }
6312
6314 {
6317
6318 return -1;
6319 }
6320
6322 {
6324 {
6327
6328 for (int i = count; i > 0; --i)
6329 {
6330 int id = i - 1;
6333
6336
6337 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
6338 {
6339 if (p)
6340 {
6343 }
6344 }
6345 }
6346 }
6347 }
6348
6350 {
6352 {
6354 {
6355 int id = i - 1;
6357
6358 if (OP)
6359 {
6361
6362 if (p)
6363 {
6365 }
6366
6367 delete OP;
6368 }
6369 }
6370
6373 }
6374 }
6375
6378 {
6379 return 0.0;
6380 }
6381
6382
6384 {
6385 return 250;
6386 }
6387
6389 {
6390 return 0;
6391 }
6392
6395 {
6397 return true;
6398
6399 return false;
6400 }
6401
6404 {
6407
6409 {
6411 }
6412 else
6413 {
6414
6416 }
6417
6419 }
6420
6427 {
6428 return -1;
6429 }
6430
6431
6432
6433
6435 {
6437 {
6439 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6440
6441 if (r_index >= 0)
6442 {
6443 InventoryLocation r_il = new InventoryLocation;
6444 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6445
6446 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6449 {
6450 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6451 }
6453 {
6454 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6455 }
6456
6457 }
6458
6459 player.GetHumanInventory().ClearUserReservedLocation(this);
6460 }
6461
6464 }
6465
6466
6467
6468
6470 {
6471 return ItemBase.m_DebugActionsMask;
6472 }
6473
6475 {
6476 return ItemBase.m_DebugActionsMask & mask;
6477 }
6478
6480 {
6481 ItemBase.m_DebugActionsMask = mask;
6482 }
6483
6485 {
6486 ItemBase.m_DebugActionsMask |= mask;
6487 }
6488
6490 {
6491 ItemBase.m_DebugActionsMask &= ~mask;
6492 }
6493
6495 {
6497 {
6499 }
6500 else
6501 {
6503 }
6504 }
6505
6506
6508 {
6509 if (GetEconomyProfile())
6510 {
6511 float q_max = GetEconomyProfile().GetQuantityMax();
6512 if (q_max > 0)
6513 {
6514 float q_min = GetEconomyProfile().GetQuantityMin();
6515 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
6516
6518 {
6519 ComponentEnergyManager comp = GetCompEM();
6521 {
6523 }
6524 }
6526 {
6528
6529 }
6530
6531 }
6532 }
6533 }
6534
6537 {
6538 EntityAI parent = GetHierarchyParent();
6539
6540 if (parent)
6541 {
6542 InventoryLocation inventory_location_to_lock = new InventoryLocation;
6543 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
6544 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
6545 }
6546 }
6547
6550 {
6551 EntityAI parent = GetHierarchyParent();
6552
6553 if (parent)
6554 {
6555 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
6556 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
6557 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
6558 }
6559 }
6560
6562 {
6563
6564
6565
6566
6568
6570 {
6571 if (ScriptInputUserData.CanStoreInputUserData())
6572 {
6573 ScriptInputUserData ctx = new ScriptInputUserData;
6579 ctx.
Write(use_stack_max);
6582
6584 {
6585 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
6586 }
6587 }
6588 }
6589 else if (!
GetGame().IsMultiplayer())
6590 {
6592 }
6593 }
6594
6596 {
6598 }
6599
6601 {
6603 }
6604
6606 {
6608 }
6609
6611 {
6612
6613 return false;
6614 }
6615
6617 {
6618 return false;
6619 }
6620
6624 {
6625 return false;
6626 }
6627
6629 {
6630 return "";
6631 }
6632
6634
6636 {
6637 return false;
6638 }
6639
6641 {
6642 return true;
6643 }
6644
6645
6646
6648 {
6649 return true;
6650 }
6651
6653 {
6654 return true;
6655 }
6656
6658 {
6659 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6661 }
6662
6664 {
6666 }
6667
6669 {
6671 if (!is_being_placed)
6673 SetSynchDirty();
6674 }
6675
6676
6678
6680 {
6682 }
6683
6685 {
6687 }
6688
6690 {
6691 return 1;
6692 }
6693
6695 {
6696 return false;
6697 }
6698
6700 {
6702 SetSynchDirty();
6703 }
6704
6705
6706
6707
6708
6709
6710
6711
6712
6713
6714
6715
6716
6717
6718
6719
6720
6721
6722
6723
6724
6725
6726
6727
6728
6729
6730
6731
6732
6733
6734
6735
6736
6737
6738
6740 {
6741 super.OnMovedInsideCargo(container);
6742
6743 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6744 }
6745
6746 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
6747 {
6748 super.EEItemLocationChanged(oldLoc,newLoc);
6749
6750 PlayerBase new_player = null;
6751 PlayerBase old_player = null;
6752
6753 if (newLoc.GetParent())
6754 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
6755
6756 if (oldLoc.GetParent())
6757 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
6758
6760 {
6761 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
6762
6763 if (r_index >= 0)
6764 {
6765 InventoryLocation r_il = new InventoryLocation;
6766 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6767
6768 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6771 {
6772 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6773 }
6775 {
6776 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6777 }
6778
6779 }
6780 }
6781
6783 {
6784 if (new_player)
6785 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
6786
6787 if (new_player == old_player)
6788 {
6789
6790 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
6791 {
6793 {
6794 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
6795 {
6796 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6797 }
6798 }
6799 else
6800 {
6801 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6802 }
6803 }
6804
6805 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
6806 {
6807 int type = oldLoc.GetType();
6809 {
6810 oldLoc.GetParent().GetOnSetLock().Invoke(this);
6811 }
6813 {
6814 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
6815 }
6816 }
6817 if (!m_OldLocation)
6818 {
6819 m_OldLocation = new InventoryLocation;
6820 }
6821 m_OldLocation.Copy(oldLoc);
6822 }
6823 else
6824 {
6825 if (m_OldLocation)
6826 {
6827 m_OldLocation.Reset();
6828 }
6829 }
6830
6832 }
6833 else
6834 {
6835 if (new_player)
6836 {
6837 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
6838 if (res_index >= 0)
6839 {
6840 InventoryLocation il = new InventoryLocation;
6841 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
6843 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
6846 {
6847 il.
GetParent().GetOnReleaseLock().Invoke(it);
6848 }
6850 {
6852 }
6853
6854 }
6855 }
6857 {
6858
6860 }
6861
6862 if (m_OldLocation)
6863 {
6864 m_OldLocation.Reset();
6865 }
6866 }
6867 }
6868
6869 override void EOnContact(IEntity other, Contact extra)
6870 {
6872 {
6873 int liquidType = -1;
6875 if (impactSpeed > 0.0)
6876 {
6878 #ifndef SERVER
6880 #else
6882 SetSynchDirty();
6883 #endif
6885 }
6886 }
6887
6888 #ifdef SERVER
6889 if (GetCompEM() && GetCompEM().IsPlugged())
6890 {
6891 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
6892 GetCompEM().UnplugThis();
6893 }
6894 #endif
6895 }
6896
6898
6900 {
6902 }
6903
6905 {
6906
6907 }
6908
6910 {
6911 super.OnItemLocationChanged(old_owner, new_owner);
6912
6913 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
6914 PlayerBase playerNew = PlayerBase.Cast(new_owner);
6915
6916 if (!relatedPlayer && playerNew)
6917 relatedPlayer = playerNew;
6918
6919 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
6920 {
6922 if (actionMgr)
6923 {
6924 ActionBase currentAction = actionMgr.GetRunningAction();
6925 if (currentAction)
6927 }
6928 }
6929
6930 Man ownerPlayerOld = null;
6931 Man ownerPlayerNew = null;
6932
6933 if (old_owner)
6934 {
6935 if (old_owner.
IsMan())
6936 {
6937 ownerPlayerOld = Man.Cast(old_owner);
6938 }
6939 else
6940 {
6941 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
6942 }
6943 }
6944 else
6945 {
6947 {
6949
6950 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
6951 {
6952 GetCompEM().UnplugThis();
6953 }
6954 }
6955 }
6956
6957 if (new_owner)
6958 {
6959 if (new_owner.
IsMan())
6960 {
6961 ownerPlayerNew = Man.Cast(new_owner);
6962 }
6963 else
6964 {
6965 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
6966 }
6967 }
6968
6969 if (ownerPlayerOld != ownerPlayerNew)
6970 {
6971 if (ownerPlayerOld)
6972 {
6973 array<EntityAI> subItemsExit = new array<EntityAI>;
6975 for (int i = 0; i < subItemsExit.Count(); i++)
6976 {
6979 }
6980 }
6981
6982 if (ownerPlayerNew)
6983 {
6984 array<EntityAI> subItemsEnter = new array<EntityAI>;
6986 for (int j = 0; j < subItemsEnter.Count(); j++)
6987 {
6990 }
6991 }
6992 }
6993 else if (ownerPlayerNew != null)
6994 {
6995 PlayerBase nplayer;
6996 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
6997 {
6998 array<EntityAI> subItemsUpdate = new array<EntityAI>;
7000 for (int k = 0; k < subItemsUpdate.Count(); k++)
7001 {
7003 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
7004 }
7005 }
7006 }
7007
7008 if (old_owner)
7009 old_owner.OnChildItemRemoved(this);
7010 if (new_owner)
7011 new_owner.OnChildItemReceived(this);
7012 }
7013
7014
7016 {
7017 super.EEDelete(parent);
7018 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
7019 if (player)
7020 {
7022
7023 if (player.IsAlive())
7024 {
7025 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7026 if (r_index >= 0)
7027 {
7028 InventoryLocation r_il = new InventoryLocation;
7029 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7030
7031 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7034 {
7035 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7036 }
7038 {
7039 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7040 }
7041
7042 }
7043
7044 player.RemoveQuickBarEntityShortcut(this);
7045 }
7046 }
7047 }
7048
7050 {
7051 super.EEKilled(killer);
7052
7055 {
7056 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
7057 {
7058 if (IsMagazine())
7059 {
7060 if (Magazine.Cast(this).GetAmmoCount() > 0)
7061 {
7063 }
7064 }
7065 else
7066 {
7068 }
7069 }
7070 }
7071 }
7072
7074 {
7075 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7076
7077 super.OnWasAttached(parent, slot_id);
7078
7081
7083 }
7084
7086 {
7087 super.OnWasDetached(parent, slot_id);
7088
7091 }
7092
7094 {
7095 int idx;
7098
7099 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7100 if (inventory_slots.Count() < 1)
7101 {
7102 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
7103 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
7104 }
7105 else
7106 {
7107 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
7108 }
7109
7110 idx = inventory_slots.Find(slot);
7111 if (idx < 0)
7112 return "";
7113
7114 return attach_types.Get(idx);
7115 }
7116
7118 {
7119 int idx = -1;
7120 string slot;
7121
7124
7125 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7126 if (inventory_slots.Count() < 1)
7127 {
7128 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
7129 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7130 }
7131 else
7132 {
7133 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
7134 if (detach_types.Count() < 1)
7135 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7136 }
7137
7138 for (int i = 0; i < inventory_slots.Count(); i++)
7139 {
7140 slot = inventory_slots.Get(i);
7141 }
7142
7143 if (slot != "")
7144 {
7145 if (detach_types.Count() == 1)
7146 idx = 0;
7147 else
7148 idx = inventory_slots.Find(slot);
7149 }
7150 if (idx < 0)
7151 return "";
7152
7153 return detach_types.Get(idx);
7154 }
7155
7157 {
7158
7160
7161
7162 float min_time = 1;
7163 float max_time = 3;
7164 float delay = Math.RandomFloat(min_time, max_time);
7165
7166 explode_timer.Run(delay, this, "DoAmmoExplosion");
7167 }
7168
7170 {
7171 Magazine magazine = Magazine.Cast(this);
7172 int pop_sounds_count = 6;
7173 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
7174
7175
7176 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
7177 string sound_name = pop_sounds[ sound_idx ];
7179
7180
7181 magazine.ServerAddAmmoCount(-1);
7182
7183
7184 float min_temp_to_explode = 100;
7185
7186 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
7187 {
7189 }
7190 }
7191
7192
7193 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
7194 {
7195 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
7196
7197 const int CHANCE_DAMAGE_CARGO = 4;
7198 const int CHANCE_DAMAGE_ATTACHMENT = 1;
7199 const int CHANCE_DAMAGE_NOTHING = 2;
7200
7202 {
7203 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
7204 int chances;
7205 int rnd;
7206
7207 if (GetInventory().GetCargo())
7208 {
7209 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7210 rnd = Math.RandomInt(0,chances);
7211
7212 if (rnd < CHANCE_DAMAGE_CARGO)
7213 {
7215 }
7216 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
7217 {
7219 }
7220 }
7221 else
7222 {
7223 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7224 rnd = Math.RandomInt(0,chances);
7225
7226 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
7227 {
7229 }
7230 }
7231 }
7232 }
7233
7235 {
7236 if (GetInventory().GetCargo())
7237 {
7238 int item_count = GetInventory().GetCargo().GetItemCount();
7239 if (item_count > 0)
7240 {
7241 int random_pick = Math.RandomInt(0, item_count);
7243 if (!item.IsExplosive())
7244 {
7245 item.AddHealth("","",damage);
7246 return true;
7247 }
7248 }
7249 }
7250 return false;
7251 }
7252
7254 {
7255 int attachment_count = GetInventory().AttachmentCount();
7256 if (attachment_count > 0)
7257 {
7258 int random_pick = Math.RandomInt(0, attachment_count);
7259 ItemBase attachment =
ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
7260 if (!attachment.IsExplosive())
7261 {
7262 attachment.AddHealth("","",damage);
7263 return true;
7264 }
7265 }
7266 return false;
7267 }
7268
7270 {
7272 }
7273
7275 {
7277 return GetInventory().CanRemoveEntity();
7278
7279 return false;
7280 }
7281
7283 {
7284
7286 return false;
7287
7288
7290 return false;
7291
7292
7293
7295 if (delta == 0)
7296 return false;
7297
7298
7299 return true;
7300 }
7301
7303 {
7305 {
7306 if (ScriptInputUserData.CanStoreInputUserData())
7307 {
7308 ScriptInputUserData ctx = new ScriptInputUserData;
7313 ctx.
Write(destination_entity);
7317 }
7318 }
7319 else if (!
GetGame().IsMultiplayer())
7320 {
7322 }
7323 }
7324
7326 {
7327 float split_quantity_new;
7331 InventoryLocation loc = new InventoryLocation;
7332
7333 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7334 {
7336 split_quantity_new = stack_max;
7337 else
7339
7341 {
7342 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7343 if (new_item)
7344 {
7345 new_item.SetResultOfSplit(true);
7346 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7348 new_item.
SetQuantity(split_quantity_new,
false,
true);
7349 }
7350 }
7351 }
7352 else if (destination_entity && slot_id == -1)
7353 {
7354 if (quantity > stack_max)
7355 split_quantity_new = stack_max;
7356 else
7357 split_quantity_new = quantity;
7358
7360 {
7362 {
7365 }
7366
7367 if (new_item)
7368 {
7369 new_item.SetResultOfSplit(true);
7370 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7372 new_item.
SetQuantity(split_quantity_new,
false,
true);
7373 }
7374 }
7375 }
7376 else
7377 {
7378 if (stack_max != 0)
7379 {
7381 {
7383 }
7384
7385 if (split_quantity_new == 0)
7386 {
7387 if (!
GetGame().IsMultiplayer())
7388 player.PhysicalPredictiveDropItem(this);
7389 else
7390 player.ServerDropEntity(this);
7391 return;
7392 }
7393
7395 {
7397
7398 if (new_item)
7399 {
7400 new_item.SetResultOfSplit(true);
7401 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7404 new_item.PlaceOnSurface();
7405 }
7406 }
7407 }
7408 }
7409 }
7410
7412 {
7413 float split_quantity_new;
7417 InventoryLocation loc = new InventoryLocation;
7418
7419 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7420 {
7422 split_quantity_new = stack_max;
7423 else
7425
7427 {
7428 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7429 if (new_item)
7430 {
7431 new_item.SetResultOfSplit(true);
7432 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7434 new_item.
SetQuantity(split_quantity_new,
false,
true);
7435 }
7436 }
7437 }
7438 else if (destination_entity && slot_id == -1)
7439 {
7440 if (quantity > stack_max)
7441 split_quantity_new = stack_max;
7442 else
7443 split_quantity_new = quantity;
7444
7446 {
7448 {
7451 }
7452
7453 if (new_item)
7454 {
7455 new_item.SetResultOfSplit(true);
7456 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7458 new_item.
SetQuantity(split_quantity_new,
false,
true);
7459 }
7460 }
7461 }
7462 else
7463 {
7464 if (stack_max != 0)
7465 {
7467 {
7469 }
7470
7472 {
7474
7475 if (new_item)
7476 {
7477 new_item.SetResultOfSplit(true);
7478 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7481 new_item.PlaceOnSurface();
7482 }
7483 }
7484 }
7485 }
7486 }
7487
7489 {
7491 {
7492 if (ScriptInputUserData.CanStoreInputUserData())
7493 {
7494 ScriptInputUserData ctx = new ScriptInputUserData;
7499 dst.WriteToContext(ctx);
7501 }
7502 }
7503 else if (!
GetGame().IsMultiplayer())
7504 {
7506 }
7507 }
7508
7510 {
7512 {
7513 if (ScriptInputUserData.CanStoreInputUserData())
7514 {
7515 ScriptInputUserData ctx = new ScriptInputUserData;
7520 ctx.
Write(destination_entity);
7526 }
7527 }
7528 else if (!
GetGame().IsMultiplayer())
7529 {
7531 }
7532 }
7533
7535 {
7537 }
7538
7540 {
7542 float split_quantity_new;
7544 if (dst.IsValid())
7545 {
7546 int slot_id = dst.GetSlot();
7548
7549 if (quantity > stack_max)
7550 split_quantity_new = stack_max;
7551 else
7552 split_quantity_new = quantity;
7553
7555 {
7557
7558 if (new_item)
7559 {
7560 new_item.SetResultOfSplit(true);
7561 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7563 new_item.
SetQuantity(split_quantity_new,
false,
true);
7564 }
7565
7566 return new_item;
7567 }
7568 }
7569
7570 return null;
7571 }
7572
7574 {
7576 float split_quantity_new;
7578 if (destination_entity)
7579 {
7581 if (quantity > stackable)
7582 split_quantity_new = stackable;
7583 else
7584 split_quantity_new = quantity;
7585
7587 {
7588 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
7589 if (new_item)
7590 {
7591 new_item.SetResultOfSplit(true);
7592 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7594 new_item.
SetQuantity(split_quantity_new,
false,
true);
7595 }
7596 }
7597 }
7598 }
7599
7601 {
7603 {
7604 if (ScriptInputUserData.CanStoreInputUserData())
7605 {
7606 ScriptInputUserData ctx = new ScriptInputUserData;
7611 ItemBase destination_entity =
this;
7612 ctx.
Write(destination_entity);
7616 }
7617 }
7618 else if (!
GetGame().IsMultiplayer())
7619 {
7621 }
7622 }
7623
7625 {
7627 float split_quantity_new;
7629 if (player)
7630 {
7632 if (quantity > stackable)
7633 split_quantity_new = stackable;
7634 else
7635 split_quantity_new = quantity;
7636
7638 {
7639 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
7640 new_item =
ItemBase.Cast(in_hands);
7641 if (new_item)
7642 {
7643 new_item.SetResultOfSplit(true);
7644 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7646 new_item.SetQuantity(split_quantity_new, false, true);
7647 }
7648 }
7649 }
7650 }
7651
7653 {
7655 float split_quantity_new = Math.Floor(quantity * 0.5);
7656
7658 return;
7659
7661
7662 if (new_item)
7663 {
7664 if (new_item.GetQuantityMax() < split_quantity_new)
7665 {
7666 split_quantity_new = new_item.GetQuantityMax();
7667 }
7668
7669 new_item.SetResultOfSplit(true);
7670 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7671
7673 {
7676 }
7677 else
7678 {
7680 new_item.
SetQuantity(split_quantity_new,
false,
true);
7681 }
7682 }
7683 }
7684
7686 {
7688 float split_quantity_new = Math.Floor(quantity / 2);
7689
7691 return;
7692
7693 InventoryLocation invloc = new InventoryLocation;
7695
7697 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
7698
7699 if (new_item)
7700 {
7701 if (new_item.GetQuantityMax() < split_quantity_new)
7702 {
7703 split_quantity_new = new_item.GetQuantityMax();
7704 }
7706 {
7709 }
7710 else if (split_quantity_new > 1)
7711 {
7713 new_item.
SetQuantity(split_quantity_new,
false,
true);
7714 }
7715 }
7716 }
7717
7720 {
7721 SetWeightDirty();
7723
7724 if (parent)
7725 parent.OnAttachmentQuantityChangedEx(this, delta);
7726
7728 {
7730 {
7732 }
7734 {
7735 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
7737 }
7738 }
7739
7740 }
7741
7744 {
7745
7746 }
7747
7750 {
7752 }
7753
7755 {
7756 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
7757
7759 {
7760 if (newLevel == GameConstants.STATE_RUINED)
7761 {
7763 EntityAI parent = GetHierarchyParent();
7764 if (parent && parent.IsFireplace())
7765 {
7766 CargoBase cargo = GetInventory().GetCargo();
7767 if (cargo)
7768 {
7770 {
7772 }
7773 }
7774 }
7775 }
7776
7778 {
7779
7781 return;
7782 }
7783
7784 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
7785 {
7787 }
7788 }
7789 }
7790
7791
7793 {
7794 super.OnRightClick();
7795
7797 {
7799 {
7800 if (ScriptInputUserData.CanStoreInputUserData())
7801 {
7802 EntityAI root = GetHierarchyRoot();
7803 Man playerOwner = GetHierarchyRootPlayer();
7804 InventoryLocation dst = new InventoryLocation;
7805
7806
7807 if (!playerOwner && root && root == this)
7808 {
7810 }
7811 else
7812 {
7813
7814 GetInventory().GetCurrentInventoryLocation(dst);
7816 {
7819 {
7821 }
7822 else
7823 {
7825
7826
7827 if (
GetGame().
GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
7828 {
7830 }
7831 else
7832 {
7833 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
7834 }
7835 }
7836 }
7837 }
7838
7839 ScriptInputUserData ctx = new ScriptInputUserData;
7847 }
7848 }
7849 else if (!
GetGame().IsMultiplayer())
7850 {
7852 }
7853 }
7854 }
7855
7857 {
7858 if (root)
7859 {
7860 vector m4[4];
7861 root.GetTransform(m4);
7862 dst.SetGround(this, m4);
7863 }
7864 else
7865 {
7866 GetInventory().GetCurrentInventoryLocation(dst);
7867 }
7868 }
7869
7870 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
7871 {
7872
7873 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
7874 return false;
7875
7876 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
7877 return false;
7878
7879
7881 return false;
7882
7883
7884 Magazine mag = Magazine.Cast(this);
7885 if (mag)
7886 {
7887 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
7888 return false;
7889
7890 if (stack_max_limit)
7891 {
7892 Magazine other_mag = Magazine.Cast(other_item);
7893 if (other_item)
7894 {
7895 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
7896 return false;
7897 }
7898
7899 }
7900 }
7901 else
7902 {
7903
7905 return false;
7906
7908 return false;
7909 }
7910
7911 PlayerBase player = null;
7912 if (CastTo(player, GetHierarchyRootPlayer()))
7913 {
7914 if (player.GetInventory().HasAttachment(this))
7915 return false;
7916
7917 if (player.IsItemsToDelete())
7918 return false;
7919 }
7920
7921 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
7922 return false;
7923
7924 int slotID;
7926 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
7927 return false;
7928
7929 return true;
7930 }
7931
7933 {
7935 }
7936
7938 {
7939 return m_IsResultOfSplit;
7940 }
7941
7943 {
7944 m_IsResultOfSplit = value;
7945 }
7946
7948 {
7950 }
7951
7953 {
7954 float other_item_quantity = other_item.GetQuantity();
7955 float this_free_space;
7956
7958
7960
7961 if (other_item_quantity > this_free_space)
7962 {
7963 return this_free_space;
7964 }
7965 else
7966 {
7967 return other_item_quantity;
7968 }
7969 }
7970
7972 {
7974 }
7975
7977 {
7979 return;
7980
7981 if (!IsMagazine() && other_item)
7982 {
7984 if (quantity_used != 0)
7985 {
7986 float hp1 = GetHealth01("","");
7987 float hp2 = other_item.GetHealth01("","");
7988 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
7989 hpResult = hpResult / (
GetQuantity() + quantity_used);
7990
7991 hpResult *= GetMaxHealth();
7992 Math.Round(hpResult);
7993 SetHealth("", "Health", hpResult);
7994
7996 other_item.AddQuantity(-quantity_used);
7997 }
7998 }
8000 }
8001
8003 {
8004 #ifdef SERVER
8005 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
8006 GetHierarchyParent().IncreaseLifetimeUp();
8007 #endif
8008 };
8009
8011 {
8012 PlayerBase p = PlayerBase.Cast(player);
8013
8014 array<int> recipesIds = p.m_Recipes;
8015 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8016 if (moduleRecipesManager)
8017 {
8018 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
8019 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
8020 }
8021
8022 for (int i = 0;i < recipesIds.Count(); i++)
8023 {
8024 int key = recipesIds.Get(i);
8025 string recipeName = moduleRecipesManager.GetRecipeName(key);
8027 }
8028 }
8029
8030
8031 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
8032 {
8033 super.GetDebugActions(outputList);
8034
8035
8041
8042
8047
8052
8053
8057
8058
8060 {
8064 }
8065
8068
8069
8073
8075
8076 InventoryLocation loc = new InventoryLocation();
8077 GetInventory().GetCurrentInventoryLocation(loc);
8079 {
8080 if (Gizmo_IsSupported())
8083 }
8084
8086 }
8087
8088
8089
8090
8092 {
8093 super.OnAction(action_id, player, ctx);
8094
8096 {
8097 switch (action_id)
8098 {
8101 return true;
8104 return true;
8105 }
8106 }
8107
8109 {
8110 switch (action_id)
8111 {
8113 Delete();
8114 return true;
8115 }
8116 }
8117
8118 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
8119 {
8120 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8121 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
8122 PlayerBase p = PlayerBase.Cast(player);
8123 if (
EActions.RECIPES_RANGE_START < 1000)
8124 {
8125 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
8126 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
8127 }
8128 }
8129 #ifndef SERVER
8130 else if (action_id ==
EActions.WATCH_PLAYER)
8131 {
8132 PluginDeveloper.SetDeveloperItemClientEx(player);
8133 }
8134 #endif
8136 {
8137 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
8138 {
8139 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
8140 OnDebugButtonPressServer(id + 1);
8141 }
8142
8143 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
8144 {
8145 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
8147 }
8148
8149 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
8150 {
8151 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
8153 }
8154
8155 else if (action_id ==
EActions.ADD_QUANTITY)
8156 {
8157 if (IsMagazine())
8158 {
8159 Magazine mag = Magazine.Cast(this);
8160 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
8161 }
8162 else
8163 {
8165 }
8166
8167 if (m_EM)
8168 {
8169 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
8170 }
8171
8172 }
8173
8174 else if (action_id ==
EActions.REMOVE_QUANTITY)
8175 {
8176 if (IsMagazine())
8177 {
8178 Magazine mag2 = Magazine.Cast(this);
8179 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
8180 }
8181 else
8182 {
8184 }
8185 if (m_EM)
8186 {
8187 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
8188 }
8189
8190 }
8191
8192 else if (action_id ==
EActions.SET_QUANTITY_0)
8193 {
8195
8196 if (m_EM)
8197 {
8198 m_EM.SetEnergy(0);
8199 }
8200 }
8201
8202 else if (action_id ==
EActions.SET_MAX_QUANTITY)
8203 {
8205
8206 if (m_EM)
8207 {
8208 m_EM.SetEnergy(m_EM.GetEnergyMax());
8209 }
8210 }
8211
8212 else if (action_id ==
EActions.ADD_HEALTH)
8213 {
8214 AddHealth("","",GetMaxHealth("","Health")/5);
8215 }
8216 else if (action_id ==
EActions.REMOVE_HEALTH)
8217 {
8218 AddHealth("","",-GetMaxHealth("","Health")/5);
8219 }
8220 else if (action_id ==
EActions.DESTROY_HEALTH)
8221 {
8222 SetHealth01("","",0);
8223 }
8224 else if (action_id ==
EActions.WATCH_ITEM)
8225 {
8227 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
8228 #ifdef DEVELOPER
8229 SetDebugDeveloper_item(this);
8230 #endif
8231 }
8232
8233 else if (action_id ==
EActions.ADD_TEMPERATURE)
8234 {
8235 AddTemperature(20);
8236
8237 }
8238
8239 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
8240 {
8241 AddTemperature(-20);
8242
8243 }
8244
8245 else if (action_id ==
EActions.FLIP_FROZEN)
8246 {
8247 SetFrozen(!GetIsFrozen());
8248
8249 }
8250
8251 else if (action_id ==
EActions.ADD_WETNESS)
8252 {
8254
8255 }
8256
8257 else if (action_id ==
EActions.REMOVE_WETNESS)
8258 {
8260
8261 }
8262
8263 else if (action_id ==
EActions.LIQUIDTYPE_UP)
8264 {
8267
8268
8269 }
8270
8271 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
8272 {
8275 }
8276
8277 else if (action_id ==
EActions.MAKE_SPECIAL)
8278 {
8279 auto debugParams = DebugSpawnParams.WithPlayer(player);
8280 OnDebugSpawnEx(debugParams);
8281 }
8282
8283 }
8284
8285
8286 return false;
8287 }
8288
8289
8290
8291
8295
8298
8299
8300
8302 {
8303 return false;
8304 }
8305
8306
8308 {
8309 return true;
8310 }
8311
8312
8314 {
8315 return true;
8316 }
8317
8318
8319
8321 {
8322 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
8324 }
8325
8328 {
8329 return null;
8330 }
8331
8333 {
8334 return false;
8335 }
8336
8338 {
8339 return false;
8340 }
8341
8345
8346
8348 {
8349 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8350 return module_repairing.CanRepair(this, item_repair_kit);
8351 }
8352
8353
8354 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
8355 {
8356 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8357 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
8358 }
8359
8360
8362 {
8363
8364
8365
8366
8367
8368
8369
8370
8371 return 1;
8372 }
8373
8374
8375
8377 {
8379 }
8380
8381
8382
8384 {
8386 }
8387
8388
8397 {
8398 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8399
8400 if (player)
8401 {
8402 player.MessageStatus(text);
8403 }
8404 }
8405
8406
8415 {
8416 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8417
8418 if (player)
8419 {
8420 player.MessageAction(text);
8421 }
8422 }
8423
8424
8433 {
8434 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8435
8436 if (player)
8437 {
8438 player.MessageFriendly(text);
8439 }
8440 }
8441
8442
8451 {
8452 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8453
8454 if (player)
8455 {
8456 player.MessageImportant(text);
8457 }
8458 }
8459
8461 {
8462 return true;
8463 }
8464
8465
8466 override bool KindOf(
string tag)
8467 {
8468 bool found = false;
8469 string item_name = this.
GetType();
8472
8473 int array_size = item_tag_array.Count();
8474 for (int i = 0; i < array_size; i++)
8475 {
8476 if (item_tag_array.Get(i) == tag)
8477 {
8478 found = true;
8479 break;
8480 }
8481 }
8482 return found;
8483 }
8484
8485
8487 {
8488
8489 super.OnRPC(sender, rpc_type,ctx);
8490
8491
8492 switch (rpc_type)
8493 {
8494 #ifndef SERVER
8495 case ERPCs.RPC_SOUND_LOCK_ATTACH:
8496 Param2<bool, string> p = new Param2<bool, string>(false, "");
8497
8499 return;
8500
8501 bool play = p.param1;
8502 string soundSet = p.param2;
8503
8504 if (play)
8505 {
8507 {
8509 {
8511 }
8512 }
8513 else
8514 {
8516 }
8517 }
8518 else
8519 {
8521 }
8522
8523 break;
8524 #endif
8525
8526 }
8527
8529 {
8531 }
8532 }
8533
8534
8535
8536
8538 {
8539 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8540 return plugin.GetID(
name);
8541 }
8542
8544 {
8545 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8546 return plugin.GetName(id);
8547 }
8548
8551 {
8552
8553
8554 int varFlags;
8555 if (!ctx.
Read(varFlags))
8556 return;
8557
8558 if (varFlags & ItemVariableFlags.FLOAT)
8559 {
8561 }
8562 }
8563
8565 {
8566
8567 super.SerializeNumericalVars(floats_out);
8568
8569
8570
8572 {
8574 }
8575
8577 {
8579 }
8580
8582 {
8584 }
8585
8587 {
8592 }
8593
8595 {
8597 }
8598 }
8599
8601 {
8602
8603 super.DeSerializeNumericalVars(floats);
8604
8605
8606 int index = 0;
8607 int mask = Math.Round(floats.Get(index));
8608
8609 index++;
8610
8612 {
8614 {
8616 }
8617 else
8618 {
8619 float quantity = floats.Get(index);
8621 }
8622 index++;
8623 }
8624
8626 {
8627 float wet = floats.Get(index);
8629 index++;
8630 }
8631
8633 {
8634 int liquidtype = Math.Round(floats.Get(index));
8636 index++;
8637 }
8638
8640 {
8642 index++;
8644 index++;
8646 index++;
8648 index++;
8649 }
8650
8652 {
8653 int cleanness = Math.Round(floats.Get(index));
8655 index++;
8656 }
8657 }
8658
8660 {
8661 super.WriteVarsToCTX(ctx);
8662
8663
8665 {
8667 }
8668
8670 {
8672 }
8673
8675 {
8677 }
8678
8680 {
8681 int r,g,b,a;
8687 }
8688
8690 {
8692 }
8693 }
8694
8696 {
8697 if (!super.ReadVarsFromCTX(ctx,version))
8698 return false;
8699
8700 int intValue;
8701 float value;
8702
8703 if (version < 140)
8704 {
8705 if (!ctx.
Read(intValue))
8706 return false;
8707
8708 m_VariablesMask = intValue;
8709 }
8710
8712 {
8713 if (!ctx.
Read(value))
8714 return false;
8715
8717 {
8719 }
8720 else
8721 {
8723 }
8724 }
8725
8726 if (version < 140)
8727 {
8729 {
8730 if (!ctx.
Read(value))
8731 return false;
8732 SetTemperatureDirect(value);
8733 }
8734 }
8735
8737 {
8738 if (!ctx.
Read(value))
8739 return false;
8741 }
8742
8744 {
8745 if (!ctx.
Read(intValue))
8746 return false;
8748 }
8749
8751 {
8752 int r,g,b,a;
8754 return false;
8756 return false;
8758 return false;
8760 return false;
8761
8763 }
8764
8766 {
8767 if (!ctx.
Read(intValue))
8768 return false;
8770 }
8771
8772 if (version >= 138 && version < 140)
8773 {
8775 {
8776 if (!ctx.
Read(intValue))
8777 return false;
8778 SetFrozen(intValue);
8779 }
8780 }
8781
8782 return true;
8783 }
8784
8785
8787 {
8790 {
8792 }
8793
8794 if (!super.OnStoreLoad(ctx, version))
8795 {
8797 return false;
8798 }
8799
8800 if (version >= 114)
8801 {
8802 bool hasQuickBarIndexSaved;
8803
8804 if (!ctx.
Read(hasQuickBarIndexSaved))
8805 {
8807 return false;
8808 }
8809
8810 if (hasQuickBarIndexSaved)
8811 {
8812 int itmQBIndex;
8813
8814
8815 if (!ctx.
Read(itmQBIndex))
8816 {
8818 return false;
8819 }
8820
8821 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
8822 if (itmQBIndex != -1 && parentPlayer)
8823 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
8824 }
8825 }
8826 else
8827 {
8828
8829 PlayerBase player;
8830 int itemQBIndex;
8831 if (version ==
int.
MAX)
8832 {
8833 if (!ctx.
Read(itemQBIndex))
8834 {
8836 return false;
8837 }
8838 }
8839 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
8840 {
8841
8842 if (!ctx.
Read(itemQBIndex))
8843 {
8845 return false;
8846 }
8847 if (itemQBIndex != -1 && player)
8848 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
8849 }
8850 }
8851
8852 if (version < 140)
8853 {
8854
8855 if (!LoadVariables(ctx, version))
8856 {
8858 return false;
8859 }
8860 }
8861
8862
8864 {
8866 return false;
8867 }
8868 if (version >= 132)
8869 {
8871 if (raib)
8872 {
8874 {
8876 return false;
8877 }
8878 }
8879 }
8880
8882 return true;
8883 }
8884
8885
8886
8888 {
8889 super.OnStoreSave(ctx);
8890
8891 PlayerBase player;
8892 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
8893 {
8895
8896 int itemQBIndex = -1;
8897 itemQBIndex = player.FindQuickBarEntityIndex(this);
8898 ctx.
Write(itemQBIndex);
8899 }
8900 else
8901 {
8903 }
8904
8906
8908 if (raib)
8909 {
8911 }
8912 }
8913
8914
8916 {
8917 super.AfterStoreLoad();
8918
8920 {
8922 }
8923
8925 {
8928 }
8929 }
8930
8932 {
8933 super.EEOnAfterLoad();
8934
8936 {
8938 }
8939
8942 }
8943
8945 {
8946 return false;
8947 }
8948
8949
8950
8952 {
8954 {
8955 #ifdef PLATFORM_CONSOLE
8956
8958 {
8960 if (menu)
8961 {
8963 }
8964 }
8965 #endif
8966 }
8967
8969 {
8972 }
8973
8975 {
8976 SetWeightDirty();
8978 }
8980 {
8983 }
8984
8986 {
8989 }
8991 {
8994 }
8995
8996 super.OnVariablesSynchronized();
8997 }
8998
8999
9000
9002 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
9003 {
9004 if (!IsServerCheck(allow_client))
9005 return false;
9006
9008 return false;
9009
9012
9013 if (value <= (min + 0.001))
9014 value = min;
9015
9016 if (value == min)
9017 {
9018 if (destroy_config)
9019 {
9020 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
9021 if (dstr)
9022 {
9024 this.Delete();
9025 return true;
9026 }
9027 }
9028 else if (destroy_forced)
9029 {
9031 this.Delete();
9032 return true;
9033 }
9034
9036 }
9037
9040
9042 {
9044
9045 if (delta)
9047 }
9048
9050
9051 return false;
9052 }
9053
9054
9056 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9057 {
9059 }
9060
9062 {
9065 }
9066
9068 {
9071 }
9072
9074 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9075 {
9076 float value_clamped = Math.Clamp(value, 0, 1);
9078 SetQuantity(result, destroy_config, destroy_forced);
9079 }
9080
9081
9084 {
9086 }
9087
9089 {
9091 }
9092
9093
9094
9095
9096
9097
9098
9099
9100
9101
9103 {
9104 int slot = -1;
9105 if (GetInventory())
9106 {
9107 InventoryLocation il = new InventoryLocation;
9108 GetInventory().GetCurrentInventoryLocation(il);
9110 }
9111
9113 }
9114
9116 {
9117 float quantity_max = 0;
9118
9120 {
9121 if (attSlotID != -1)
9122 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
9123
9124 if (quantity_max <= 0)
9126 }
9127
9128 if (quantity_max <= 0)
9130
9131 return quantity_max;
9132 }
9133
9135 {
9137 }
9138
9140 {
9142 }
9143
9144
9146 {
9148 }
9149
9151 {
9153 }
9154
9156 {
9158 }
9159
9160
9162 {
9163
9164 float weightEx = GetWeightEx();
9165 float special = GetInventoryAndCargoWeight();
9166 return weightEx - special;
9167 }
9168
9169
9171 {
9173 }
9174
9176 {
9178 {
9179 #ifdef DEVELOPER
9180 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9181 {
9182 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
9184 }
9185 #endif
9186
9188 }
9189 else if (HasEnergyManager())
9190 {
9191 #ifdef DEVELOPER
9192 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9193 {
9194 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
9195 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
9196 }
9197 #endif
9198 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
9199 }
9200 else
9201 {
9202 #ifdef DEVELOPER
9203 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9204 {
9205 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
9206 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
9207 }
9208 #endif
9209 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
9210 }
9211 }
9212
9215 {
9216 int item_count = 0;
9218
9219 if (GetInventory().GetCargo() != NULL)
9220 {
9221 item_count = GetInventory().GetCargo().GetItemCount();
9222 }
9223
9224 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
9225 {
9226 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
9227 if (item)
9228 item_count += item.GetNumberOfItems();
9229 }
9230 return item_count;
9231 }
9232
9235 {
9236 float weight = 0;
9237 float wetness = 1;
9238 if (include_wetness)
9241 {
9242 weight = wetness * m_ConfigWeight;
9243 }
9245 {
9246 weight = 1;
9247 }
9248 return weight;
9249 }
9250
9251
9252
9254 {
9255 if ((
GetGame().IsServer() || !
GetGame().IsMultiplayer()) && GetInventory())
9256 {
9257 GameInventory inv = GetInventory();
9258 array<EntityAI> items = new array<EntityAI>;
9260 for (int i = 0; i < items.Count(); i++)
9261 {
9263 if (item)
9264 {
9266 }
9267 }
9268 }
9269 }
9270
9271
9272
9273
9275 {
9276 float energy = 0;
9277 if (HasEnergyManager())
9278 {
9279 energy = GetCompEM().GetEnergy();
9280 }
9281 return energy;
9282 }
9283
9284
9286 {
9287 super.OnEnergyConsumed();
9288
9290 }
9291
9293 {
9294 super.OnEnergyAdded();
9295
9297 }
9298
9299
9301 {
9302 if (
GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
9303 {
9305 {
9306 float energy_0to1 = GetCompEM().GetEnergy0To1();
9308 }
9309 }
9310 }
9311
9312
9314 {
9315 return ConfigGetFloat("heatIsolation");
9316 }
9317
9319 {
9321 }
9322
9324 {
9325 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
9326 if (
GetGame().ConfigIsExisting(paramPath))
9328
9329 return 0.0;
9330 }
9331
9333 {
9334 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
9335 if (
GetGame().ConfigIsExisting(paramPath))
9337
9338 return 0.0;
9339 }
9340
9341 override void SetWet(
float value,
bool allow_client =
false)
9342 {
9343 if (!IsServerCheck(allow_client))
9344 return;
9345
9348
9350
9351 m_VarWet = Math.Clamp(value, min, max);
9352
9354 {
9357 }
9358 }
9359
9360 override void AddWet(
float value)
9361 {
9363 }
9364
9366 {
9368 }
9369
9371 {
9373 }
9374
9376 {
9378 }
9379
9381 {
9383 }
9384
9386 {
9388 }
9389
9391 {
9394 if (newLevel != oldLevel)
9395 {
9397 }
9398 }
9399
9401 {
9402 SetWeightDirty();
9403 }
9404
9406 {
9407 return GetWetLevelInternal(
m_VarWet);
9408 }
9409
9410
9411
9413 {
9415 }
9416
9418 {
9420 }
9421
9423 {
9425 }
9426
9428 {
9430 }
9431
9432
9433
9435 {
9436 if (ConfigIsExisting("itemModelLength"))
9437 {
9438 return ConfigGetFloat("itemModelLength");
9439 }
9440 return 0;
9441 }
9442
9444 {
9445 if (ConfigIsExisting("itemAttachOffset"))
9446 {
9447 return ConfigGetFloat("itemAttachOffset");
9448 }
9449 return 0;
9450 }
9451
9452 override void SetCleanness(
int value,
bool allow_client =
false)
9453 {
9454 if (!IsServerCheck(allow_client))
9455 return;
9456
9458
9460
9463 }
9464
9466 {
9468 }
9469
9471 {
9472 return true;
9473 }
9474
9475
9476
9477
9479 {
9481 }
9482
9484 {
9486 }
9487
9488
9489
9490
9491 override void SetColor(
int r,
int g,
int b,
int a)
9492 {
9498 }
9500 override void GetColor(out
int r,out
int g,out
int b,out
int a)
9501 {
9506 }
9507
9509 {
9511 }
9512
9515 {
9516 int r,g,b,a;
9518 r = r/255;
9519 g = g/255;
9520 b = b/255;
9521 a = a/255;
9522 return MiscGameplayFunctions.GetColorString(r, g, b, a);
9523 }
9524
9525
9526
9527 override void SetLiquidType(
int value,
bool allow_client =
false)
9528 {
9529 if (!IsServerCheck(allow_client))
9530 return;
9531
9536 }
9537
9539 {
9540 return ConfigGetInt("varLiquidTypeInit");
9541 }
9542
9544 {
9546 }
9547
9549 {
9551 SetFrozen(false);
9552 }
9553
9556 {
9557 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9558 }
9559
9560
9563 {
9564 PlayerBase nplayer;
9565 if (PlayerBase.CastTo(nplayer, player))
9566 {
9568
9569 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9570 }
9571 }
9572
9573
9576 {
9577 PlayerBase nplayer;
9578 if (PlayerBase.CastTo(nplayer,player))
9579 {
9580
9581 nplayer.SetEnableQuickBarEntityShortcut(this,false);
9582
9583 }
9584
9585
9586 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
9587
9588
9589 if (HasEnergyManager())
9590 {
9591 GetCompEM().UpdatePlugState();
9592 }
9593 }
9594
9595
9597 {
9598 super.OnPlacementStarted(player);
9599
9601 }
9602
9603 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
9604 {
9606 {
9607 m_AdminLog.OnPlacementComplete(player,
this);
9608 }
9609
9610 super.OnPlacementComplete(player, position, orientation);
9611 }
9612
9613
9614
9615
9616
9618 {
9620 {
9621 return true;
9622 }
9623 else
9624 {
9625 return false;
9626 }
9627 }
9628
9629
9631 {
9633 {
9635 }
9636 }
9637
9638
9640 {
9642 }
9643
9645 {
9647 }
9648
9649 override void InsertAgent(
int agent,
float count = 1)
9650 {
9651 if (count < 1)
9652 return;
9653
9655 }
9656
9659 {
9661 }
9662
9663
9665 {
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
9697
9698
9699
9700
9701
9702
9703
9704
9705
9706
9707
9708
9709
9711 {
9713 return false;
9714 return true;
9715 }
9716
9718 {
9719
9721 }
9722
9723
9726 {
9727 super.CheckForRoofLimited(timeTresholdMS);
9728
9730 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
9731 {
9732 m_PreviousRoofTestTime = time;
9733 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
9734 }
9735 }
9736
9737
9739 {
9741 {
9742 return 0;
9743 }
9744
9745 if (GetInventory().GetAttachmentSlotsCount() != 0)
9746 {
9747 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
9748 if (filter)
9749 return filter.GetProtectionLevel(type, false, system);
9750 else
9751 return 0;
9752 }
9753
9754 string subclassPath, entryName;
9755
9756 switch (type)
9757 {
9759 entryName = "biological";
9760 break;
9762 entryName = "chemical";
9763 break;
9764 default:
9765 entryName = "biological";
9766 break;
9767 }
9768
9769 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
9770
9772 }
9773
9774
9775
9778 {
9779 if (!IsMagazine())
9781
9783 }
9784
9785
9786
9787
9788
9793 {
9794 return true;
9795 }
9796
9798 {
9800 }
9801
9802
9803
9804
9805
9807 {
9808 if (parent)
9809 {
9810 if (parent.IsInherited(DayZInfected))
9811 return true;
9812
9813 if (!parent.IsRuined())
9814 return true;
9815 }
9816
9817 return true;
9818 }
9819
9821 {
9822 if (!super.CanPutAsAttachment(parent))
9823 {
9824 return false;
9825 }
9826
9827 if (!IsRuined() && !parent.IsRuined())
9828 {
9829 return true;
9830 }
9831
9832 return false;
9833 }
9834
9836 {
9837
9838
9839
9840
9841 return super.CanReceiveItemIntoCargo(item);
9842 }
9843
9845 {
9846
9847
9848
9849
9850 GameInventory attachmentInv = attachment.GetInventory();
9852 {
9853 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
9854 return false;
9855 }
9856
9857 InventoryLocation loc = new InventoryLocation();
9858 attachment.GetInventory().GetCurrentInventoryLocation(loc);
9859 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
9860 return false;
9861
9862 return super.CanReceiveAttachment(attachment, slotId);
9863 }
9864
9866 {
9867 if (!super.CanReleaseAttachment(attachment))
9868 return false;
9869
9870 return GetInventory().AreChildrenAccessible();
9871 }
9872
9873
9874
9875
9876
9877
9878
9879
9880
9881
9882
9883
9884
9885
9886
9887
9888
9889
9890
9891
9892
9894 {
9895 int id = muzzle_owner.GetMuzzleID();
9896 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
9897
9898 if (WPOF_array)
9899 {
9900 for (int i = 0; i < WPOF_array.Count(); i++)
9901 {
9902 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
9903
9904 if (WPOF)
9905 {
9906 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
9907 }
9908 }
9909 }
9910 }
9911
9912
9914 {
9915 int id = muzzle_owner.GetMuzzleID();
9917
9918 if (WPOBE_array)
9919 {
9920 for (int i = 0; i < WPOBE_array.Count(); i++)
9921 {
9922 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
9923
9924 if (WPOBE)
9925 {
9926 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
9927 }
9928 }
9929 }
9930 }
9931
9932
9934 {
9935 int id = muzzle_owner.GetMuzzleID();
9936 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9937
9938 if (WPOOH_array)
9939 {
9940 for (int i = 0; i < WPOOH_array.Count(); i++)
9941 {
9942 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9943
9944 if (WPOOH)
9945 {
9946 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
9947 }
9948 }
9949 }
9950 }
9951
9952
9954 {
9955 int id = muzzle_owner.GetMuzzleID();
9956 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9957
9958 if (WPOOH_array)
9959 {
9960 for (int i = 0; i < WPOOH_array.Count(); i++)
9961 {
9962 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9963
9964 if (WPOOH)
9965 {
9966 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9967 }
9968 }
9969 }
9970 }
9971
9972
9974 {
9975 int id = muzzle_owner.GetMuzzleID();
9976 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9977
9978 if (WPOOH_array)
9979 {
9980 for (int i = 0; i < WPOOH_array.Count(); i++)
9981 {
9982 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9983
9984 if (WPOOH)
9985 {
9986 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9987 }
9988 }
9989 }
9990 }
9991
9992
9993
9995 {
9997 {
9998 return true;
9999 }
10000
10001 return false;
10002 }
10003
10005 {
10007 {
10008 return true;
10009 }
10010
10011 return false;
10012 }
10013
10015 {
10017 {
10018 return true;
10019 }
10020
10021 return false;
10022 }
10023
10025 {
10026 return false;
10027 }
10028
10031 {
10032 return UATimeSpent.DEFAULT_DEPLOY;
10033 }
10034
10035
10036
10037
10039 {
10041 SetSynchDirty();
10042 }
10043
10045 {
10047 }
10048
10049
10051 {
10052 return false;
10053 }
10054
10057 {
10058 string att_type = "None";
10059
10060 if (ConfigIsExisting("soundAttType"))
10061 {
10062 att_type = ConfigGetString("soundAttType");
10063 }
10064
10066 }
10067
10069 {
10071 }
10072
10073
10074
10075
10076
10082
10084 {
10087
10089 }
10090
10091
10093 {
10095 return;
10096
10098
10101
10104
10105 SoundParameters params = new SoundParameters();
10109 }
10110
10111
10113 {
10115 return;
10116
10118 SetSynchDirty();
10119
10122 }
10123
10124
10126 {
10128 return;
10129
10131 SetSynchDirty();
10132
10135 }
10136
10138 {
10140 }
10141
10143 {
10145 }
10146
10149 {
10150 if (!
GetGame().IsDedicatedServer())
10151 {
10152 if (ConfigIsExisting("attachSoundSet"))
10153 {
10154 string cfg_path = "";
10155 string soundset = "";
10156 string type_name =
GetType();
10157
10160 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
10161 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
10162
10163 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
10164 {
10165 for (int i = 0; i < cfg_soundset_array.Count(); i++)
10166 {
10167 if (cfg_slot_array[i] == slot_type)
10168 {
10169 soundset = cfg_soundset_array[i];
10170 break;
10171 }
10172 }
10173 }
10174
10175 if (soundset != "")
10176 {
10177 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
10179 }
10180 }
10181 }
10182 }
10183
10185 {
10186
10187 }
10188
10189 void OnApply(PlayerBase player);
10190
10192 {
10193 return 1.0;
10194 };
10195
10197 {
10199 }
10200
10202 {
10204 }
10205
10207
10209 {
10210 SetDynamicPhysicsLifeTime(0.01);
10212 }
10213
10215 {
10216 array<string> zone_names = new array<string>;
10217 GetDamageZones(zone_names);
10218 for (int i = 0; i < zone_names.Count(); i++)
10219 {
10220 SetHealthMax(zone_names.Get(i),"Health");
10221 }
10222 SetHealthMax("","Health");
10223 }
10224
10227 {
10228 float global_health = GetHealth01("","Health");
10229 array<string> zones = new array<string>;
10230 GetDamageZones(zones);
10231
10232 for (int i = 0; i < zones.Count(); i++)
10233 {
10234 SetHealth01(zones.Get(i),"Health",global_health);
10235 }
10236 }
10237
10240 {
10241 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
10242 }
10243
10245 {
10246 if (!hasRootAsPlayer)
10247 {
10248 if (refParentIB)
10249 {
10250
10251 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
10252 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
10253
10254 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
10255 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
10256
10259 }
10260 else
10261 {
10262
10265 }
10266 }
10267 }
10268
10270 {
10272 {
10273 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
10274 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
10275 {
10276 float heatPermCoef = 1.0;
10278 while (ent)
10279 {
10280 heatPermCoef *= ent.GetHeatPermeabilityCoef();
10281 ent = ent.GetHierarchyParent();
10282 }
10283
10284 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
10285 }
10286 }
10287 }
10288
10290 {
10291
10292 EntityAI parent = GetHierarchyParent();
10293 if (!parent)
10294 {
10295 hasParent = false;
10296 hasRootAsPlayer = false;
10297 }
10298 else
10299 {
10300 hasParent = true;
10301 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
10302 refParentIB =
ItemBase.Cast(parent);
10303 }
10304 }
10305
10306 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
10307 {
10308
10309 }
10310
10312 {
10313
10314 return false;
10315 }
10316
10318 {
10319
10320
10321 return false;
10322 }
10323
10325 {
10326
10327 return false;
10328 }
10329
10332 {
10333 return !GetIsFrozen() &&
IsOpen();
10334 }
10335
10337 {
10338 bool hasParent = false, hasRootAsPlayer = false;
10340
10341 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
10342 bool foodDecay =
g_Game.IsFoodDecayEnabled();
10343
10344 if (wwtu || foodDecay)
10345 {
10349
10350 if (processWetness || processTemperature || processDecay)
10351 {
10353
10354 if (processWetness)
10355 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
10356
10357 if (processTemperature)
10359
10360 if (processDecay)
10361 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
10362 }
10363 }
10364 }
10365
10368 {
10370 }
10371
10373 {
10376
10377 return super.GetTemperatureFreezeThreshold();
10378 }
10379
10381 {
10384
10385 return super.GetTemperatureThawThreshold();
10386 }
10387
10389 {
10392
10393 return super.GetItemOverheatThreshold();
10394 }
10395
10397 {
10399 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
10400
10401 return super.GetTemperatureFreezeTime();
10402 }
10403
10405 {
10407 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
10408
10409 return super.GetTemperatureThawTime();
10410 }
10411
10416
10418 {
10419 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
10420 }
10421
10423 {
10424 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
10425 }
10426
10429 {
10431 }
10432
10434 {
10436 }
10437
10439 {
10441 }
10442
10445 {
10446 return null;
10447 }
10448
10451 {
10452 return false;
10453 }
10454
10456 {
10458 {
10461 if (!trg)
10462 {
10464 explosive = this;
10465 }
10466
10467 explosive.PairRemote(trg);
10469
10470 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
10471 trg.SetPersistentPairID(persistentID);
10472 explosive.SetPersistentPairID(persistentID);
10473
10474 return true;
10475 }
10476 return false;
10477 }
10478
10481 {
10482 float ret = 1.0;
10485 ret *= GetHealth01();
10486
10487 return ret;
10488 }
10489
10490 #ifdef DEVELOPER
10491 override void SetDebugItem()
10492 {
10493 super.SetDebugItem();
10494 _itemBase = this;
10495 }
10496
10498 {
10499 string text = super.GetDebugText();
10500
10502 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
10503
10504 return text;
10505 }
10506 #endif
10507
10509 {
10510 return true;
10511 }
10512
10514
10516
10518 {
10521 }
10522
10523
10531
10547}
10548
10550{
10552 if (entity)
10553 {
10554 bool is_item = entity.IsInherited(
ItemBase);
10555 if (is_item && full_quantity)
10556 {
10559 }
10560 }
10561 else
10562 {
10564 return NULL;
10565 }
10566 return entity;
10567}
10568
10570{
10571 if (item)
10572 {
10573 if (health > 0)
10574 item.SetHealth("", "", health);
10575
10576 if (item.CanHaveTemperature())
10577 {
10579 if (item.CanFreeze())
10580 item.SetFrozen(false);
10581 }
10582
10583 if (item.HasEnergyManager())
10584 {
10585 if (quantity >= 0)
10586 {
10587 item.GetCompEM().SetEnergy0To1(quantity);
10588 }
10589 else
10590 {
10592 }
10593 }
10594 else if (item.IsMagazine())
10595 {
10596 Magazine mag = Magazine.Cast(item);
10597 if (quantity >= 0)
10598 {
10599 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
10600 }
10601 else
10602 {
10604 }
10605
10606 }
10607 else
10608 {
10609 if (quantity >= 0)
10610 {
10611 item.SetQuantityNormalized(quantity, false);
10612 }
10613 else
10614 {
10616 }
10617
10618 }
10619 }
10620}
10621
10622#ifdef DEVELOPER
10624#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.