5755{
5757 {
5758 return true;
5759 }
5760};
5761
5762
5763
5765{
5769
5771
5774
5775
5776
5777
5778
5787
5793
5798
5803
5824 protected bool m_IsResultOfSplit
5825
5827
5832
5833
5834
5836
5840
5841
5842
5844
5847
5848
5849
5855
5856
5864
5867
5868
5870
5871
5873
5874
5879
5880
5885
5886
5888
5889
5891 {
5896
5897 if (!
GetGame().IsDedicatedServer())
5898 {
5900 {
5902
5904 {
5906 }
5907 }
5908
5911 }
5912
5913 m_OldLocation = null;
5914
5916 {
5918 }
5919
5920 if (ConfigIsExisting("headSelectionsToHide"))
5921 {
5924 }
5925
5927 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
5928 {
5930 }
5931
5933
5934 m_IsResultOfSplit = false;
5935
5937 }
5938
5940 {
5941 super.InitItemVariables();
5942
5948 m_Count = ConfigGetInt(
"count");
5949
5952
5957
5960
5965
5977
5981
5982
5985 if (ConfigIsExisting("canBeSplit"))
5986 {
5989 }
5990
5992 if (ConfigIsExisting("itemBehaviour"))
5994
5995
5998 RegisterNetSyncVariableInt("m_VarLiquidType");
5999 RegisterNetSyncVariableInt("m_Cleanness",0,1);
6000
6001 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
6002 RegisterNetSyncVariableFloat("m_ImpactSpeed");
6003 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
6004
6005 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
6006 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
6007 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
6008 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
6009
6010 RegisterNetSyncVariableBool("m_IsBeingPlaced");
6011 RegisterNetSyncVariableBool("m_IsTakeable");
6012 RegisterNetSyncVariableBool("m_IsHologram");
6013
6016 {
6019 }
6020
6022
6024 if (ConfigIsExisting("temperaturePerQuantityWeight"))
6026
6027 }
6028
6030 {
6032 }
6033
6035 {
6038 {
6043 }
6044 }
6045
6046 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
6047 {
6049 {
6052 }
6053
6055 }
6056
6058 {
6064 }
6065
6067
6069 {
6071
6072 if (!action)
6073 {
6074 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
6075 return;
6076 }
6077
6079 if (!ai)
6080 {
6082 return;
6083 }
6084
6086 if (!action_array)
6087 {
6088 action_array = new array<ActionBase_Basic>;
6090 }
6091 if (LogManager.IsActionLogEnable())
6092 {
6093 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
6094 }
6095
6096 if (action_array.Find(action) != -1)
6097 {
6098 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
6099 }
6100 else
6101 {
6102 action_array.Insert(action);
6103 }
6104 }
6105
6107 {
6109 ActionBase action = player.GetActionManager().GetAction(actionName);
6112
6113 if (action_array)
6114 {
6115 action_array.RemoveItem(action);
6116 }
6117 }
6118
6119
6120
6122 {
6123 ActionOverrideData overrideData = new ActionOverrideData();
6127
6129 if (!actionMap)
6130 {
6133 }
6134
6135 actionMap.Insert(this.
Type(), overrideData);
6136
6137 }
6138
6140
6142
6143
6145 {
6148
6151
6152 string config_to_search = "CfgVehicles";
6153 string muzzle_owner_config;
6154
6156 {
6157 if (IsInherited(Weapon))
6158 config_to_search = "CfgWeapons";
6159
6160 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6161
6162 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
6163
6165
6166 if (config_OnFire_subclass_count > 0)
6167 {
6168 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
6169
6170 for (int i = 0; i < config_OnFire_subclass_count; i++)
6171 {
6172 string particle_class = "";
6174 string config_OnFire_entry = config_OnFire_class + particle_class;
6175 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
6176 WPOF_array.Insert(WPOF);
6177 }
6178
6179
6181 }
6182 }
6183
6185 {
6186 config_to_search = "CfgWeapons";
6187 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6188
6189 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
6190
6192
6193 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
6194 {
6195 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
6196
6197 for (i = 0; i < config_OnBulletCasingEject_count; i++)
6198 {
6199 string particle_class2 = "";
6201 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
6202 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
6203 WPOBE_array.Insert(WPOBE);
6204 }
6205
6206
6208 }
6209 }
6210 }
6211
6212
6214 {
6217
6219 {
6220 string config_to_search = "CfgVehicles";
6221
6222 if (IsInherited(Weapon))
6223 config_to_search = "CfgWeapons";
6224
6225 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6226 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
6227
6228 if (
GetGame().ConfigIsExisting(config_OnOverheating_class))
6229 {
6230
6232
6234 {
6236 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
6238 return;
6239 }
6240
6243
6244
6245
6247 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
6248
6249 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
6250 {
6251 string particle_class = "";
6253 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
6255
6256 if (entry_type == CT_CLASS)
6257 {
6258 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
6259 WPOOH_array.Insert(WPOF);
6260 }
6261 }
6262
6263
6265 }
6266 }
6267 }
6268
6270 {
6272 }
6273
6275 {
6277 {
6279
6282
6285
6286 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6287 }
6288 }
6289
6291 {
6293 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6294
6296 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6297
6299 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6300
6302 {
6304 }
6305 }
6306
6308 {
6310 }
6311
6313 {
6316 else
6318
6320 {
6323 }
6324 else
6325 {
6328
6331 }
6332
6334 }
6335
6337 {
6339 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6340 }
6341
6343 {
6345 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6347 }
6348
6350 {
6352 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6353 }
6354
6356 {
6359
6360 OverheatingParticle OP = new OverheatingParticle();
6365
6367 }
6368
6370 {
6373
6374 return -1;
6375 }
6376
6378 {
6380 {
6383
6384 for (int i = count; i > 0; --i)
6385 {
6386 int id = i - 1;
6389
6392
6393 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
6394 {
6395 if (p)
6396 {
6399 }
6400 }
6401 }
6402 }
6403 }
6404
6406 {
6408 {
6410 {
6411 int id = i - 1;
6413
6414 if (OP)
6415 {
6417
6418 if (p)
6419 {
6421 }
6422
6423 delete OP;
6424 }
6425 }
6426
6429 }
6430 }
6431
6434 {
6435 return 0.0;
6436 }
6437
6438
6440 {
6441 return 250;
6442 }
6443
6445 {
6446 return 0;
6447 }
6448
6451 {
6453 return true;
6454
6455 return false;
6456 }
6457
6460 {
6463
6465 {
6467 }
6468 else
6469 {
6470
6472 }
6473
6475 }
6476
6483 {
6484 return -1;
6485 }
6486
6487
6488
6489
6491 {
6493 {
6495 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6496
6497 if (r_index >= 0)
6498 {
6499 InventoryLocation r_il = new InventoryLocation;
6500 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6501
6502 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6505 {
6506 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6507 }
6509 {
6510 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6511 }
6512
6513 }
6514
6515 player.GetHumanInventory().ClearUserReservedLocation(this);
6516 }
6517
6520 }
6521
6522
6523
6524
6526 {
6527 return ItemBase.m_DebugActionsMask;
6528 }
6529
6531 {
6532 return ItemBase.m_DebugActionsMask & mask;
6533 }
6534
6536 {
6537 ItemBase.m_DebugActionsMask = mask;
6538 }
6539
6541 {
6542 ItemBase.m_DebugActionsMask |= mask;
6543 }
6544
6546 {
6547 ItemBase.m_DebugActionsMask &= ~mask;
6548 }
6549
6551 {
6553 {
6555 }
6556 else
6557 {
6559 }
6560 }
6561
6562
6564 {
6565 if (GetEconomyProfile())
6566 {
6567 float q_max = GetEconomyProfile().GetQuantityMax();
6568 if (q_max > 0)
6569 {
6570 float q_min = GetEconomyProfile().GetQuantityMin();
6571 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
6572
6574 {
6575 ComponentEnergyManager comp = GetCompEM();
6577 {
6579 }
6580 }
6582 {
6584
6585 }
6586
6587 }
6588 }
6589 }
6590
6593 {
6594 EntityAI parent = GetHierarchyParent();
6595
6596 if (parent)
6597 {
6598 InventoryLocation inventory_location_to_lock = new InventoryLocation;
6599 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
6600 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
6601 }
6602 }
6603
6606 {
6607 EntityAI parent = GetHierarchyParent();
6608
6609 if (parent)
6610 {
6611 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
6612 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
6613 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
6614 }
6615 }
6616
6618 {
6619
6620
6621
6622
6624
6626 {
6627 if (ScriptInputUserData.CanStoreInputUserData())
6628 {
6629 ScriptInputUserData ctx = new ScriptInputUserData;
6635 ctx.
Write(use_stack_max);
6638
6640 {
6641 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
6642 }
6643 }
6644 }
6645 else if (!
GetGame().IsMultiplayer())
6646 {
6648 }
6649 }
6650
6652 {
6654 }
6655
6657 {
6659 }
6660
6662 {
6664 }
6665
6667 {
6668
6669 return false;
6670 }
6671
6673 {
6674 return false;
6675 }
6676
6680 {
6681 return false;
6682 }
6683
6685 {
6686 return "";
6687 }
6688
6690
6692 {
6693 return false;
6694 }
6695
6697 {
6698 return true;
6699 }
6700
6701
6702
6704 {
6705 return true;
6706 }
6707
6709 {
6710 return true;
6711 }
6712
6714 {
6715 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6717 }
6718
6720 {
6722 }
6723
6725 {
6727 if (!is_being_placed)
6729 SetSynchDirty();
6730 }
6731
6732
6734
6736 {
6738 }
6739
6741 {
6743 }
6744
6746 {
6747 return 1;
6748 }
6749
6751 {
6752 return false;
6753 }
6754
6756 {
6758 SetSynchDirty();
6759 }
6760
6761
6762
6763
6764
6765
6766
6767
6768
6769
6770
6771
6772
6773
6774
6775
6776
6777
6778
6779
6780
6781
6782
6783
6784
6785
6786
6787
6788
6789
6790
6791
6792
6793
6794
6796 {
6797 super.OnMovedInsideCargo(container);
6798
6799 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6800 }
6801
6802 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
6803 {
6804 super.EEItemLocationChanged(oldLoc,newLoc);
6805
6806 PlayerBase new_player = null;
6807 PlayerBase old_player = null;
6808
6809 if (newLoc.GetParent())
6810 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
6811
6812 if (oldLoc.GetParent())
6813 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
6814
6816 {
6817 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
6818
6819 if (r_index >= 0)
6820 {
6821 InventoryLocation r_il = new InventoryLocation;
6822 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6823
6824 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6827 {
6828 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6829 }
6831 {
6832 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6833 }
6834
6835 }
6836 }
6837
6839 {
6840 if (new_player)
6841 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
6842
6843 if (new_player == old_player)
6844 {
6845
6846 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
6847 {
6849 {
6850 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
6851 {
6852 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6853 }
6854 }
6855 else
6856 {
6857 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6858 }
6859 }
6860
6861 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
6862 {
6863 int type = oldLoc.GetType();
6865 {
6866 oldLoc.GetParent().GetOnSetLock().Invoke(this);
6867 }
6869 {
6870 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
6871 }
6872 }
6873 if (!m_OldLocation)
6874 {
6875 m_OldLocation = new InventoryLocation;
6876 }
6877 m_OldLocation.Copy(oldLoc);
6878 }
6879 else
6880 {
6881 if (m_OldLocation)
6882 {
6883 m_OldLocation.Reset();
6884 }
6885 }
6886
6888 }
6889 else
6890 {
6891 if (new_player)
6892 {
6893 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
6894 if (res_index >= 0)
6895 {
6896 InventoryLocation il = new InventoryLocation;
6897 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
6899 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
6902 {
6903 il.
GetParent().GetOnReleaseLock().Invoke(it);
6904 }
6906 {
6908 }
6909
6910 }
6911 }
6913 {
6914
6916 }
6917
6918 if (m_OldLocation)
6919 {
6920 m_OldLocation.Reset();
6921 }
6922 }
6923 }
6924
6925 override void EOnContact(IEntity other, Contact extra)
6926 {
6928 {
6929 int liquidType = -1;
6931 if (impactSpeed > 0.0)
6932 {
6934 #ifndef SERVER
6936 #else
6938 SetSynchDirty();
6939 #endif
6941 }
6942 }
6943
6944 #ifdef SERVER
6945 if (GetCompEM() && GetCompEM().IsPlugged())
6946 {
6947 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
6948 GetCompEM().UnplugThis();
6949 }
6950 #endif
6951 }
6952
6954
6956 {
6958 }
6959
6961 {
6962
6963 }
6964
6966 {
6967 super.OnItemLocationChanged(old_owner, new_owner);
6968
6969 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
6970 PlayerBase playerNew = PlayerBase.Cast(new_owner);
6971
6972 if (!relatedPlayer && playerNew)
6973 relatedPlayer = playerNew;
6974
6975 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
6976 {
6978 if (actionMgr)
6979 {
6980 ActionBase currentAction = actionMgr.GetRunningAction();
6981 if (currentAction)
6983 }
6984 }
6985
6986 Man ownerPlayerOld = null;
6987 Man ownerPlayerNew = null;
6988
6989 if (old_owner)
6990 {
6991 if (old_owner.
IsMan())
6992 {
6993 ownerPlayerOld = Man.Cast(old_owner);
6994 }
6995 else
6996 {
6997 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
6998 }
6999 }
7000 else
7001 {
7003 {
7005
7006 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
7007 {
7008 GetCompEM().UnplugThis();
7009 }
7010 }
7011 }
7012
7013 if (new_owner)
7014 {
7015 if (new_owner.
IsMan())
7016 {
7017 ownerPlayerNew = Man.Cast(new_owner);
7018 }
7019 else
7020 {
7021 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
7022 }
7023 }
7024
7025 if (ownerPlayerOld != ownerPlayerNew)
7026 {
7027 if (ownerPlayerOld)
7028 {
7029 array<EntityAI> subItemsExit = new array<EntityAI>;
7031 for (int i = 0; i < subItemsExit.Count(); i++)
7032 {
7035 }
7036 }
7037
7038 if (ownerPlayerNew)
7039 {
7040 array<EntityAI> subItemsEnter = new array<EntityAI>;
7042 for (int j = 0; j < subItemsEnter.Count(); j++)
7043 {
7046 }
7047 }
7048 }
7049 else if (ownerPlayerNew != null)
7050 {
7051 PlayerBase nplayer;
7052 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
7053 {
7054 array<EntityAI> subItemsUpdate = new array<EntityAI>;
7056 for (int k = 0; k < subItemsUpdate.Count(); k++)
7057 {
7059 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
7060 }
7061 }
7062 }
7063
7064 if (old_owner)
7065 old_owner.OnChildItemRemoved(this);
7066 if (new_owner)
7067 new_owner.OnChildItemReceived(this);
7068 }
7069
7070
7072 {
7073 super.EEDelete(parent);
7074 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
7075 if (player)
7076 {
7078
7079 if (player.IsAlive())
7080 {
7081 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7082 if (r_index >= 0)
7083 {
7084 InventoryLocation r_il = new InventoryLocation;
7085 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7086
7087 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7090 {
7091 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7092 }
7094 {
7095 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7096 }
7097
7098 }
7099
7100 player.RemoveQuickBarEntityShortcut(this);
7101 }
7102 }
7103 }
7104
7106 {
7107 super.EEKilled(killer);
7108
7111 {
7112 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
7113 {
7114 if (IsMagazine())
7115 {
7116 if (Magazine.Cast(this).GetAmmoCount() > 0)
7117 {
7119 }
7120 }
7121 else
7122 {
7124 }
7125 }
7126 }
7127 }
7128
7130 {
7131 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7132
7133 super.OnWasAttached(parent, slot_id);
7134
7137
7139 }
7140
7142 {
7143 super.OnWasDetached(parent, slot_id);
7144
7147 }
7148
7150 {
7151 int idx;
7154
7155 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7156 if (inventory_slots.Count() < 1)
7157 {
7158 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
7159 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
7160 }
7161 else
7162 {
7163 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
7164 }
7165
7166 idx = inventory_slots.Find(slot);
7167 if (idx < 0)
7168 return "";
7169
7170 return attach_types.Get(idx);
7171 }
7172
7174 {
7175 int idx = -1;
7176 string slot;
7177
7180
7181 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7182 if (inventory_slots.Count() < 1)
7183 {
7184 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
7185 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7186 }
7187 else
7188 {
7189 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
7190 if (detach_types.Count() < 1)
7191 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7192 }
7193
7194 for (int i = 0; i < inventory_slots.Count(); i++)
7195 {
7196 slot = inventory_slots.Get(i);
7197 }
7198
7199 if (slot != "")
7200 {
7201 if (detach_types.Count() == 1)
7202 idx = 0;
7203 else
7204 idx = inventory_slots.Find(slot);
7205 }
7206 if (idx < 0)
7207 return "";
7208
7209 return detach_types.Get(idx);
7210 }
7211
7213 {
7214
7216
7217
7218 float min_time = 1;
7219 float max_time = 3;
7220 float delay = Math.RandomFloat(min_time, max_time);
7221
7222 explode_timer.Run(delay, this, "DoAmmoExplosion");
7223 }
7224
7226 {
7227 Magazine magazine = Magazine.Cast(this);
7228 int pop_sounds_count = 6;
7229 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
7230
7231
7232 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
7233 string sound_name = pop_sounds[ sound_idx ];
7235
7236
7237 magazine.ServerAddAmmoCount(-1);
7238
7239
7240 float min_temp_to_explode = 100;
7241
7242 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
7243 {
7245 }
7246 }
7247
7248
7249 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
7250 {
7251 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
7252
7253 const int CHANCE_DAMAGE_CARGO = 4;
7254 const int CHANCE_DAMAGE_ATTACHMENT = 1;
7255 const int CHANCE_DAMAGE_NOTHING = 2;
7256
7258 {
7259 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
7260 int chances;
7261 int rnd;
7262
7263 if (GetInventory().GetCargo())
7264 {
7265 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7266 rnd = Math.RandomInt(0,chances);
7267
7268 if (rnd < CHANCE_DAMAGE_CARGO)
7269 {
7271 }
7272 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
7273 {
7275 }
7276 }
7277 else
7278 {
7279 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7280 rnd = Math.RandomInt(0,chances);
7281
7282 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
7283 {
7285 }
7286 }
7287 }
7288 }
7289
7291 {
7292 if (GetInventory().GetCargo())
7293 {
7294 int item_count = GetInventory().GetCargo().GetItemCount();
7295 if (item_count > 0)
7296 {
7297 int random_pick = Math.RandomInt(0, item_count);
7299 if (!item.IsExplosive())
7300 {
7301 item.AddHealth("","",damage);
7302 return true;
7303 }
7304 }
7305 }
7306 return false;
7307 }
7308
7310 {
7311 int attachment_count = GetInventory().AttachmentCount();
7312 if (attachment_count > 0)
7313 {
7314 int random_pick = Math.RandomInt(0, attachment_count);
7315 ItemBase attachment =
ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
7316 if (!attachment.IsExplosive())
7317 {
7318 attachment.AddHealth("","",damage);
7319 return true;
7320 }
7321 }
7322 return false;
7323 }
7324
7326 {
7328 }
7329
7331 {
7333 return GetInventory().CanRemoveEntity();
7334
7335 return false;
7336 }
7337
7339 {
7340
7342 return false;
7343
7344
7346 return false;
7347
7348
7349
7351 if (delta == 0)
7352 return false;
7353
7354
7355 return true;
7356 }
7357
7359 {
7361 {
7362 if (ScriptInputUserData.CanStoreInputUserData())
7363 {
7364 ScriptInputUserData ctx = new ScriptInputUserData;
7369 ctx.
Write(destination_entity);
7373 }
7374 }
7375 else if (!
GetGame().IsMultiplayer())
7376 {
7378 }
7379 }
7380
7382 {
7383 float split_quantity_new;
7387 InventoryLocation loc = new InventoryLocation;
7388
7389 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7390 {
7392 split_quantity_new = stack_max;
7393 else
7395
7397 {
7398 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7399 if (new_item)
7400 {
7401 new_item.SetResultOfSplit(true);
7402 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7404 new_item.
SetQuantity(split_quantity_new,
false,
true);
7405 }
7406 }
7407 }
7408 else if (destination_entity && slot_id == -1)
7409 {
7410 if (quantity > stack_max)
7411 split_quantity_new = stack_max;
7412 else
7413 split_quantity_new = quantity;
7414
7416 {
7418 {
7421 }
7422
7423 if (new_item)
7424 {
7425 new_item.SetResultOfSplit(true);
7426 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7428 new_item.
SetQuantity(split_quantity_new,
false,
true);
7429 }
7430 }
7431 }
7432 else
7433 {
7434 if (stack_max != 0)
7435 {
7437 {
7439 }
7440
7441 if (split_quantity_new == 0)
7442 {
7443 if (!
GetGame().IsMultiplayer())
7444 player.PhysicalPredictiveDropItem(this);
7445 else
7446 player.ServerDropEntity(this);
7447 return;
7448 }
7449
7451 {
7453
7454 if (new_item)
7455 {
7456 new_item.SetResultOfSplit(true);
7457 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7460 new_item.PlaceOnSurface();
7461 }
7462 }
7463 }
7464 }
7465 }
7466
7468 {
7469 float split_quantity_new;
7473 InventoryLocation loc = new InventoryLocation;
7474
7475 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7476 {
7478 split_quantity_new = stack_max;
7479 else
7481
7483 {
7484 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7485 if (new_item)
7486 {
7487 new_item.SetResultOfSplit(true);
7488 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7490 new_item.
SetQuantity(split_quantity_new,
false,
true);
7491 }
7492 }
7493 }
7494 else if (destination_entity && slot_id == -1)
7495 {
7496 if (quantity > stack_max)
7497 split_quantity_new = stack_max;
7498 else
7499 split_quantity_new = quantity;
7500
7502 {
7504 {
7507 }
7508
7509 if (new_item)
7510 {
7511 new_item.SetResultOfSplit(true);
7512 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7514 new_item.
SetQuantity(split_quantity_new,
false,
true);
7515 }
7516 }
7517 }
7518 else
7519 {
7520 if (stack_max != 0)
7521 {
7523 {
7525 }
7526
7528 {
7530
7531 if (new_item)
7532 {
7533 new_item.SetResultOfSplit(true);
7534 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7537 new_item.PlaceOnSurface();
7538 }
7539 }
7540 }
7541 }
7542 }
7543
7545 {
7547 {
7548 if (ScriptInputUserData.CanStoreInputUserData())
7549 {
7550 ScriptInputUserData ctx = new ScriptInputUserData;
7555 dst.WriteToContext(ctx);
7557 }
7558 }
7559 else if (!
GetGame().IsMultiplayer())
7560 {
7562 }
7563 }
7564
7566 {
7568 {
7569 if (ScriptInputUserData.CanStoreInputUserData())
7570 {
7571 ScriptInputUserData ctx = new ScriptInputUserData;
7576 ctx.
Write(destination_entity);
7582 }
7583 }
7584 else if (!
GetGame().IsMultiplayer())
7585 {
7587 }
7588 }
7589
7591 {
7593 }
7594
7596 {
7598 float split_quantity_new;
7600 if (dst.IsValid())
7601 {
7602 int slot_id = dst.GetSlot();
7604
7605 if (quantity > stack_max)
7606 split_quantity_new = stack_max;
7607 else
7608 split_quantity_new = quantity;
7609
7611 {
7613
7614 if (new_item)
7615 {
7616 new_item.SetResultOfSplit(true);
7617 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7619 new_item.
SetQuantity(split_quantity_new,
false,
true);
7620 }
7621
7622 return new_item;
7623 }
7624 }
7625
7626 return null;
7627 }
7628
7630 {
7632 float split_quantity_new;
7634 if (destination_entity)
7635 {
7637 if (quantity > stackable)
7638 split_quantity_new = stackable;
7639 else
7640 split_quantity_new = quantity;
7641
7643 {
7644 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
7645 if (new_item)
7646 {
7647 new_item.SetResultOfSplit(true);
7648 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7650 new_item.
SetQuantity(split_quantity_new,
false,
true);
7651 }
7652 }
7653 }
7654 }
7655
7657 {
7659 {
7660 if (ScriptInputUserData.CanStoreInputUserData())
7661 {
7662 ScriptInputUserData ctx = new ScriptInputUserData;
7667 ItemBase destination_entity =
this;
7668 ctx.
Write(destination_entity);
7672 }
7673 }
7674 else if (!
GetGame().IsMultiplayer())
7675 {
7677 }
7678 }
7679
7681 {
7683 float split_quantity_new;
7685 if (player)
7686 {
7688 if (quantity > stackable)
7689 split_quantity_new = stackable;
7690 else
7691 split_quantity_new = quantity;
7692
7694 {
7695 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
7696 new_item =
ItemBase.Cast(in_hands);
7697 if (new_item)
7698 {
7699 new_item.SetResultOfSplit(true);
7700 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7702 new_item.SetQuantity(split_quantity_new, false, true);
7703 }
7704 }
7705 }
7706 }
7707
7709 {
7711 float split_quantity_new = Math.Floor(quantity * 0.5);
7712
7714 return;
7715
7717
7718 if (new_item)
7719 {
7720 if (new_item.GetQuantityMax() < split_quantity_new)
7721 {
7722 split_quantity_new = new_item.GetQuantityMax();
7723 }
7724
7725 new_item.SetResultOfSplit(true);
7726 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7727
7729 {
7732 }
7733 else
7734 {
7736 new_item.
SetQuantity(split_quantity_new,
false,
true);
7737 }
7738 }
7739 }
7740
7742 {
7744 float split_quantity_new = Math.Floor(quantity / 2);
7745
7747 return;
7748
7749 InventoryLocation invloc = new InventoryLocation;
7751
7753 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
7754
7755 if (new_item)
7756 {
7757 if (new_item.GetQuantityMax() < split_quantity_new)
7758 {
7759 split_quantity_new = new_item.GetQuantityMax();
7760 }
7762 {
7765 }
7766 else if (split_quantity_new > 1)
7767 {
7769 new_item.
SetQuantity(split_quantity_new,
false,
true);
7770 }
7771 }
7772 }
7773
7776 {
7777 SetWeightDirty();
7779
7780 if (parent)
7781 parent.OnAttachmentQuantityChangedEx(this, delta);
7782
7784 {
7786 {
7788 }
7790 {
7791 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
7793 }
7794 }
7795
7796 }
7797
7800 {
7801
7802 }
7803
7806 {
7808 }
7809
7811 {
7812 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
7813
7815 {
7816 if (newLevel == GameConstants.STATE_RUINED)
7817 {
7819 EntityAI parent = GetHierarchyParent();
7820 if (parent && parent.IsFireplace())
7821 {
7822 CargoBase cargo = GetInventory().GetCargo();
7823 if (cargo)
7824 {
7826 {
7828 }
7829 }
7830 }
7831 }
7832
7834 {
7835
7837 return;
7838 }
7839
7840 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
7841 {
7843 }
7844 }
7845 }
7846
7847
7849 {
7850 super.OnRightClick();
7851
7853 {
7855 {
7856 if (ScriptInputUserData.CanStoreInputUserData())
7857 {
7858 EntityAI root = GetHierarchyRoot();
7859 Man playerOwner = GetHierarchyRootPlayer();
7860 InventoryLocation dst = new InventoryLocation;
7861
7862
7863 if (!playerOwner && root && root == this)
7864 {
7866 }
7867 else
7868 {
7869
7870 GetInventory().GetCurrentInventoryLocation(dst);
7872 {
7875 {
7877 }
7878 else
7879 {
7881
7882
7883 if (
GetGame().
GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
7884 {
7886 }
7887 else
7888 {
7889 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
7890 }
7891 }
7892 }
7893 }
7894
7895 ScriptInputUserData ctx = new ScriptInputUserData;
7903 }
7904 }
7905 else if (!
GetGame().IsMultiplayer())
7906 {
7908 }
7909 }
7910 }
7911
7913 {
7914 if (root)
7915 {
7916 vector m4[4];
7917 root.GetTransform(m4);
7918 dst.SetGround(this, m4);
7919 }
7920 else
7921 {
7922 GetInventory().GetCurrentInventoryLocation(dst);
7923 }
7924 }
7925
7926 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
7927 {
7928
7929 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
7930 return false;
7931
7932 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
7933 return false;
7934
7935
7937 return false;
7938
7939
7940 Magazine mag = Magazine.Cast(this);
7941 if (mag)
7942 {
7943 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
7944 return false;
7945
7946 if (stack_max_limit)
7947 {
7948 Magazine other_mag = Magazine.Cast(other_item);
7949 if (other_item)
7950 {
7951 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
7952 return false;
7953 }
7954
7955 }
7956 }
7957 else
7958 {
7959
7961 return false;
7962
7964 return false;
7965 }
7966
7967 PlayerBase player = null;
7968 if (CastTo(player, GetHierarchyRootPlayer()))
7969 {
7970 if (player.GetInventory().HasAttachment(this))
7971 return false;
7972
7973 if (player.IsItemsToDelete())
7974 return false;
7975 }
7976
7977 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
7978 return false;
7979
7980 int slotID;
7982 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
7983 return false;
7984
7985 return true;
7986 }
7987
7989 {
7991 }
7992
7994 {
7995 return m_IsResultOfSplit;
7996 }
7997
7999 {
8000 m_IsResultOfSplit = value;
8001 }
8002
8004 {
8006 }
8007
8009 {
8010 float other_item_quantity = other_item.GetQuantity();
8011 float this_free_space;
8012
8014
8016
8017 if (other_item_quantity > this_free_space)
8018 {
8019 return this_free_space;
8020 }
8021 else
8022 {
8023 return other_item_quantity;
8024 }
8025 }
8026
8028 {
8030 }
8031
8033 {
8035 return;
8036
8037 if (!IsMagazine() && other_item)
8038 {
8040 if (quantity_used != 0)
8041 {
8042 float hp1 = GetHealth01("","");
8043 float hp2 = other_item.GetHealth01("","");
8044 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
8045 hpResult = hpResult / (
GetQuantity() + quantity_used);
8046
8047 hpResult *= GetMaxHealth();
8048 Math.Round(hpResult);
8049 SetHealth("", "Health", hpResult);
8050
8052 other_item.AddQuantity(-quantity_used);
8053 }
8054 }
8056 }
8057
8059 {
8060 #ifdef SERVER
8061 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
8062 GetHierarchyParent().IncreaseLifetimeUp();
8063 #endif
8064 };
8065
8067 {
8068 PlayerBase p = PlayerBase.Cast(player);
8069
8070 array<int> recipesIds = p.m_Recipes;
8071 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8072 if (moduleRecipesManager)
8073 {
8074 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
8075 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
8076 }
8077
8078 for (int i = 0;i < recipesIds.Count(); i++)
8079 {
8080 int key = recipesIds.Get(i);
8081 string recipeName = moduleRecipesManager.GetRecipeName(key);
8083 }
8084 }
8085
8086
8087 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
8088 {
8089 super.GetDebugActions(outputList);
8090
8091
8097
8098
8103
8108
8109
8113
8114
8116 {
8120 }
8121
8124
8125
8129
8131
8132 InventoryLocation loc = new InventoryLocation();
8133 GetInventory().GetCurrentInventoryLocation(loc);
8135 {
8136 if (Gizmo_IsSupported())
8139 }
8140
8142 }
8143
8144
8145
8146
8148 {
8149 super.OnAction(action_id, player, ctx);
8150
8152 {
8153 switch (action_id)
8154 {
8157 return true;
8160 return true;
8161 }
8162 }
8163
8165 {
8166 switch (action_id)
8167 {
8169 Delete();
8170 return true;
8171 }
8172 }
8173
8174 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
8175 {
8176 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8177 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
8178 PlayerBase p = PlayerBase.Cast(player);
8179 if (
EActions.RECIPES_RANGE_START < 1000)
8180 {
8181 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
8182 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
8183 }
8184 }
8185 #ifndef SERVER
8186 else if (action_id ==
EActions.WATCH_PLAYER)
8187 {
8188 PluginDeveloper.SetDeveloperItemClientEx(player);
8189 }
8190 #endif
8192 {
8193 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
8194 {
8195 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
8196 OnDebugButtonPressServer(id + 1);
8197 }
8198
8199 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
8200 {
8201 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
8203 }
8204
8205 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
8206 {
8207 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
8209 }
8210
8211 else if (action_id ==
EActions.ADD_QUANTITY)
8212 {
8213 if (IsMagazine())
8214 {
8215 Magazine mag = Magazine.Cast(this);
8216 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
8217 }
8218 else
8219 {
8221 }
8222
8223 if (m_EM)
8224 {
8225 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
8226 }
8227
8228 }
8229
8230 else if (action_id ==
EActions.REMOVE_QUANTITY)
8231 {
8232 if (IsMagazine())
8233 {
8234 Magazine mag2 = Magazine.Cast(this);
8235 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
8236 }
8237 else
8238 {
8240 }
8241 if (m_EM)
8242 {
8243 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
8244 }
8245
8246 }
8247
8248 else if (action_id ==
EActions.SET_QUANTITY_0)
8249 {
8251
8252 if (m_EM)
8253 {
8254 m_EM.SetEnergy(0);
8255 }
8256 }
8257
8258 else if (action_id ==
EActions.SET_MAX_QUANTITY)
8259 {
8261
8262 if (m_EM)
8263 {
8264 m_EM.SetEnergy(m_EM.GetEnergyMax());
8265 }
8266 }
8267
8268 else if (action_id ==
EActions.ADD_HEALTH)
8269 {
8270 AddHealth("","",GetMaxHealth("","Health")/5);
8271 }
8272 else if (action_id ==
EActions.REMOVE_HEALTH)
8273 {
8274 AddHealth("","",-GetMaxHealth("","Health")/5);
8275 }
8276 else if (action_id ==
EActions.DESTROY_HEALTH)
8277 {
8278 SetHealth01("","",0);
8279 }
8280 else if (action_id ==
EActions.WATCH_ITEM)
8281 {
8283 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
8284 #ifdef DEVELOPER
8285 SetDebugDeveloper_item(this);
8286 #endif
8287 }
8288
8289 else if (action_id ==
EActions.ADD_TEMPERATURE)
8290 {
8291 AddTemperature(20);
8292
8293 }
8294
8295 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
8296 {
8297 AddTemperature(-20);
8298
8299 }
8300
8301 else if (action_id ==
EActions.FLIP_FROZEN)
8302 {
8303 SetFrozen(!GetIsFrozen());
8304
8305 }
8306
8307 else if (action_id ==
EActions.ADD_WETNESS)
8308 {
8310
8311 }
8312
8313 else if (action_id ==
EActions.REMOVE_WETNESS)
8314 {
8316
8317 }
8318
8319 else if (action_id ==
EActions.LIQUIDTYPE_UP)
8320 {
8323
8324
8325 }
8326
8327 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
8328 {
8331 }
8332
8333 else if (action_id ==
EActions.MAKE_SPECIAL)
8334 {
8335 auto debugParams = DebugSpawnParams.WithPlayer(player);
8336 OnDebugSpawnEx(debugParams);
8337 }
8338
8339 }
8340
8341
8342 return false;
8343 }
8344
8345
8346
8347
8351
8354
8355
8356
8358 {
8359 return false;
8360 }
8361
8362
8364 {
8365 return true;
8366 }
8367
8368
8370 {
8371 return true;
8372 }
8373
8374
8375
8377 {
8378 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
8380 }
8381
8384 {
8385 return null;
8386 }
8387
8389 {
8390 return false;
8391 }
8392
8394 {
8395 return false;
8396 }
8397
8401
8402
8404 {
8405 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8406 return module_repairing.CanRepair(this, item_repair_kit);
8407 }
8408
8409
8410 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
8411 {
8412 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8413 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
8414 }
8415
8416
8418 {
8419
8420
8421
8422
8423
8424
8425
8426
8427 return 1;
8428 }
8429
8430
8431
8433 {
8435 }
8436
8437
8438
8440 {
8442 }
8443
8444
8453 {
8454 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8455
8456 if (player)
8457 {
8458 player.MessageStatus(text);
8459 }
8460 }
8461
8462
8471 {
8472 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8473
8474 if (player)
8475 {
8476 player.MessageAction(text);
8477 }
8478 }
8479
8480
8489 {
8490 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8491
8492 if (player)
8493 {
8494 player.MessageFriendly(text);
8495 }
8496 }
8497
8498
8507 {
8508 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8509
8510 if (player)
8511 {
8512 player.MessageImportant(text);
8513 }
8514 }
8515
8517 {
8518 return true;
8519 }
8520
8521
8522 override bool KindOf(
string tag)
8523 {
8524 bool found = false;
8525 string item_name = this.
GetType();
8528
8529 int array_size = item_tag_array.Count();
8530 for (int i = 0; i < array_size; i++)
8531 {
8532 if (item_tag_array.Get(i) == tag)
8533 {
8534 found = true;
8535 break;
8536 }
8537 }
8538 return found;
8539 }
8540
8541
8543 {
8544
8545 super.OnRPC(sender, rpc_type,ctx);
8546
8547
8548 switch (rpc_type)
8549 {
8550 #ifndef SERVER
8551 case ERPCs.RPC_SOUND_LOCK_ATTACH:
8552 Param2<bool, string> p = new Param2<bool, string>(false, "");
8553
8555 return;
8556
8557 bool play = p.param1;
8558 string soundSet = p.param2;
8559
8560 if (play)
8561 {
8563 {
8565 {
8567 }
8568 }
8569 else
8570 {
8572 }
8573 }
8574 else
8575 {
8577 }
8578
8579 break;
8580 #endif
8581
8582 }
8583
8585 {
8587 }
8588 }
8589
8590
8591
8592
8594 {
8595 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8596 return plugin.GetID(
name);
8597 }
8598
8600 {
8601 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8602 return plugin.GetName(id);
8603 }
8604
8607 {
8608
8609
8610 int varFlags;
8611 if (!ctx.
Read(varFlags))
8612 return;
8613
8614 if (varFlags & ItemVariableFlags.FLOAT)
8615 {
8617 }
8618 }
8619
8621 {
8622
8623 super.SerializeNumericalVars(floats_out);
8624
8625
8626
8628 {
8630 }
8631
8633 {
8635 }
8636
8638 {
8640 }
8641
8643 {
8648 }
8649
8651 {
8653 }
8654 }
8655
8657 {
8658
8659 super.DeSerializeNumericalVars(floats);
8660
8661
8662 int index = 0;
8663 int mask = Math.Round(floats.Get(index));
8664
8665 index++;
8666
8668 {
8670 {
8672 }
8673 else
8674 {
8675 float quantity = floats.Get(index);
8677 }
8678 index++;
8679 }
8680
8682 {
8683 float wet = floats.Get(index);
8685 index++;
8686 }
8687
8689 {
8690 int liquidtype = Math.Round(floats.Get(index));
8692 index++;
8693 }
8694
8696 {
8698 index++;
8700 index++;
8702 index++;
8704 index++;
8705 }
8706
8708 {
8709 int cleanness = Math.Round(floats.Get(index));
8711 index++;
8712 }
8713 }
8714
8716 {
8717 super.WriteVarsToCTX(ctx);
8718
8719
8721 {
8723 }
8724
8726 {
8728 }
8729
8731 {
8733 }
8734
8736 {
8737 int r,g,b,a;
8743 }
8744
8746 {
8748 }
8749 }
8750
8752 {
8753 if (!super.ReadVarsFromCTX(ctx,version))
8754 return false;
8755
8756 int intValue;
8757 float value;
8758
8759 if (version < 140)
8760 {
8761 if (!ctx.
Read(intValue))
8762 return false;
8763
8764 m_VariablesMask = intValue;
8765 }
8766
8768 {
8769 if (!ctx.
Read(value))
8770 return false;
8771
8773 {
8775 }
8776 else
8777 {
8779 }
8780 }
8781
8782 if (version < 140)
8783 {
8785 {
8786 if (!ctx.
Read(value))
8787 return false;
8788 SetTemperatureDirect(value);
8789 }
8790 }
8791
8793 {
8794 if (!ctx.
Read(value))
8795 return false;
8797 }
8798
8800 {
8801 if (!ctx.
Read(intValue))
8802 return false;
8804 }
8805
8807 {
8808 int r,g,b,a;
8810 return false;
8812 return false;
8814 return false;
8816 return false;
8817
8819 }
8820
8822 {
8823 if (!ctx.
Read(intValue))
8824 return false;
8826 }
8827
8828 if (version >= 138 && version < 140)
8829 {
8831 {
8832 if (!ctx.
Read(intValue))
8833 return false;
8834 SetFrozen(intValue);
8835 }
8836 }
8837
8838 return true;
8839 }
8840
8841
8843 {
8846 {
8848 }
8849
8850 if (!super.OnStoreLoad(ctx, version))
8851 {
8853 return false;
8854 }
8855
8856 if (version >= 114)
8857 {
8858 bool hasQuickBarIndexSaved;
8859
8860 if (!ctx.
Read(hasQuickBarIndexSaved))
8861 {
8863 return false;
8864 }
8865
8866 if (hasQuickBarIndexSaved)
8867 {
8868 int itmQBIndex;
8869
8870
8871 if (!ctx.
Read(itmQBIndex))
8872 {
8874 return false;
8875 }
8876
8877 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
8878 if (itmQBIndex != -1 && parentPlayer)
8879 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
8880 }
8881 }
8882 else
8883 {
8884
8885 PlayerBase player;
8886 int itemQBIndex;
8887 if (version ==
int.
MAX)
8888 {
8889 if (!ctx.
Read(itemQBIndex))
8890 {
8892 return false;
8893 }
8894 }
8895 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
8896 {
8897
8898 if (!ctx.
Read(itemQBIndex))
8899 {
8901 return false;
8902 }
8903 if (itemQBIndex != -1 && player)
8904 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
8905 }
8906 }
8907
8908 if (version < 140)
8909 {
8910
8911 if (!LoadVariables(ctx, version))
8912 {
8914 return false;
8915 }
8916 }
8917
8918
8920 {
8922 return false;
8923 }
8924 if (version >= 132)
8925 {
8927 if (raib)
8928 {
8930 {
8932 return false;
8933 }
8934 }
8935 }
8936
8938 return true;
8939 }
8940
8941
8942
8944 {
8945 super.OnStoreSave(ctx);
8946
8947 PlayerBase player;
8948 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
8949 {
8951
8952 int itemQBIndex = -1;
8953 itemQBIndex = player.FindQuickBarEntityIndex(this);
8954 ctx.
Write(itemQBIndex);
8955 }
8956 else
8957 {
8959 }
8960
8962
8964 if (raib)
8965 {
8967 }
8968 }
8969
8970
8972 {
8973 super.AfterStoreLoad();
8974
8976 {
8978 }
8979
8981 {
8984 }
8985 }
8986
8988 {
8989 super.EEOnAfterLoad();
8990
8992 {
8994 }
8995
8998 }
8999
9001 {
9002 return false;
9003 }
9004
9005
9006
9008 {
9010 {
9011 #ifdef PLATFORM_CONSOLE
9012
9014 {
9016 if (menu)
9017 {
9019 }
9020 }
9021 #endif
9022 }
9023
9025 {
9028 }
9029
9031 {
9032 SetWeightDirty();
9034 }
9036 {
9039 }
9040
9042 {
9045 }
9047 {
9050 }
9051
9052 super.OnVariablesSynchronized();
9053 }
9054
9055
9056
9058 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
9059 {
9060 if (!IsServerCheck(allow_client))
9061 return false;
9062
9064 return false;
9065
9068
9069 if (value <= (min + 0.001))
9070 value = min;
9071
9072 if (value == min)
9073 {
9074 if (destroy_config)
9075 {
9076 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
9077 if (dstr)
9078 {
9080 this.Delete();
9081 return true;
9082 }
9083 }
9084 else if (destroy_forced)
9085 {
9087 this.Delete();
9088 return true;
9089 }
9090
9092 }
9093
9096
9098 {
9100
9101 if (delta)
9103 }
9104
9106
9107 return false;
9108 }
9109
9110
9112 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9113 {
9115 }
9116
9118 {
9121 }
9122
9124 {
9127 }
9128
9130 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9131 {
9132 float value_clamped = Math.Clamp(value, 0, 1);
9134 SetQuantity(result, destroy_config, destroy_forced);
9135 }
9136
9137
9140 {
9142 }
9143
9145 {
9147 }
9148
9149
9150
9151
9152
9153
9154
9155
9156
9157
9159 {
9160 int slot = -1;
9161 if (GetInventory())
9162 {
9163 InventoryLocation il = new InventoryLocation;
9164 GetInventory().GetCurrentInventoryLocation(il);
9166 }
9167
9169 }
9170
9172 {
9173 float quantity_max = 0;
9174
9176 {
9177 if (attSlotID != -1)
9178 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
9179
9180 if (quantity_max <= 0)
9182 }
9183
9184 if (quantity_max <= 0)
9186
9187 return quantity_max;
9188 }
9189
9191 {
9193 }
9194
9196 {
9198 }
9199
9200
9202 {
9204 }
9205
9207 {
9209 }
9210
9212 {
9214 }
9215
9216
9218 {
9219
9220 float weightEx = GetWeightEx();
9221 float special = GetInventoryAndCargoWeight();
9222 return weightEx - special;
9223 }
9224
9225
9227 {
9229 }
9230
9232 {
9234 {
9235 #ifdef DEVELOPER
9236 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9237 {
9238 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
9240 }
9241 #endif
9242
9244 }
9245 else if (HasEnergyManager())
9246 {
9247 #ifdef DEVELOPER
9248 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9249 {
9250 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
9251 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
9252 }
9253 #endif
9254 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
9255 }
9256 else
9257 {
9258 #ifdef DEVELOPER
9259 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9260 {
9261 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
9262 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
9263 }
9264 #endif
9265 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
9266 }
9267 }
9268
9271 {
9272 int item_count = 0;
9274
9275 if (GetInventory().GetCargo() != NULL)
9276 {
9277 item_count = GetInventory().GetCargo().GetItemCount();
9278 }
9279
9280 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
9281 {
9282 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
9283 if (item)
9284 item_count += item.GetNumberOfItems();
9285 }
9286 return item_count;
9287 }
9288
9291 {
9292 float weight = 0;
9293 float wetness = 1;
9294 if (include_wetness)
9297 {
9298 weight = wetness * m_ConfigWeight;
9299 }
9301 {
9302 weight = 1;
9303 }
9304 return weight;
9305 }
9306
9307
9308
9310 {
9311 if ((
GetGame().IsServer() || !
GetGame().IsMultiplayer()) && GetInventory())
9312 {
9313 GameInventory inv = GetInventory();
9314 array<EntityAI> items = new array<EntityAI>;
9316 for (int i = 0; i < items.Count(); i++)
9317 {
9319 if (item)
9320 {
9322 }
9323 }
9324 }
9325 }
9326
9327
9328
9329
9331 {
9332 float energy = 0;
9333 if (HasEnergyManager())
9334 {
9335 energy = GetCompEM().GetEnergy();
9336 }
9337 return energy;
9338 }
9339
9340
9342 {
9343 super.OnEnergyConsumed();
9344
9346 }
9347
9349 {
9350 super.OnEnergyAdded();
9351
9353 }
9354
9355
9357 {
9358 if (
GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
9359 {
9361 {
9362 float energy_0to1 = GetCompEM().GetEnergy0To1();
9364 }
9365 }
9366 }
9367
9368
9370 {
9371 return ConfigGetFloat("heatIsolation");
9372 }
9373
9375 {
9377 }
9378
9380 {
9381 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
9382 if (
GetGame().ConfigIsExisting(paramPath))
9384
9385 return 0.0;
9386 }
9387
9389 {
9390 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
9391 if (
GetGame().ConfigIsExisting(paramPath))
9393
9394 return 0.0;
9395 }
9396
9397 override void SetWet(
float value,
bool allow_client =
false)
9398 {
9399 if (!IsServerCheck(allow_client))
9400 return;
9401
9404
9406
9407 m_VarWet = Math.Clamp(value, min, max);
9408
9410 {
9413 }
9414 }
9415
9416 override void AddWet(
float value)
9417 {
9419 }
9420
9422 {
9424 }
9425
9427 {
9429 }
9430
9432 {
9434 }
9435
9437 {
9439 }
9440
9442 {
9444 }
9445
9447 {
9450 if (newLevel != oldLevel)
9451 {
9453 }
9454 }
9455
9457 {
9458 SetWeightDirty();
9459 }
9460
9462 {
9463 return GetWetLevelInternal(
m_VarWet);
9464 }
9465
9466
9467
9469 {
9471 }
9472
9474 {
9476 }
9477
9479 {
9481 }
9482
9484 {
9486 }
9487
9488
9489
9491 {
9492 if (ConfigIsExisting("itemModelLength"))
9493 {
9494 return ConfigGetFloat("itemModelLength");
9495 }
9496 return 0;
9497 }
9498
9500 {
9501 if (ConfigIsExisting("itemAttachOffset"))
9502 {
9503 return ConfigGetFloat("itemAttachOffset");
9504 }
9505 return 0;
9506 }
9507
9508 override void SetCleanness(
int value,
bool allow_client =
false)
9509 {
9510 if (!IsServerCheck(allow_client))
9511 return;
9512
9514
9516
9519 }
9520
9522 {
9524 }
9525
9527 {
9528 return true;
9529 }
9530
9531
9532
9533
9535 {
9537 }
9538
9540 {
9542 }
9543
9544
9545
9546
9547 override void SetColor(
int r,
int g,
int b,
int a)
9548 {
9554 }
9556 override void GetColor(out
int r,out
int g,out
int b,out
int a)
9557 {
9562 }
9563
9565 {
9567 }
9568
9571 {
9572 int r,g,b,a;
9574 r = r/255;
9575 g = g/255;
9576 b = b/255;
9577 a = a/255;
9578 return MiscGameplayFunctions.GetColorString(r, g, b, a);
9579 }
9580
9581
9582
9583 override void SetLiquidType(
int value,
bool allow_client =
false)
9584 {
9585 if (!IsServerCheck(allow_client))
9586 return;
9587
9592 }
9593
9595 {
9596 return ConfigGetInt("varLiquidTypeInit");
9597 }
9598
9600 {
9602 }
9603
9605 {
9607 SetFrozen(false);
9608 }
9609
9612 {
9613 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9614 }
9615
9616
9619 {
9620 PlayerBase nplayer;
9621 if (PlayerBase.CastTo(nplayer, player))
9622 {
9624
9625 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9626 }
9627 }
9628
9629
9632 {
9633 PlayerBase nplayer;
9634 if (PlayerBase.CastTo(nplayer,player))
9635 {
9636
9637 nplayer.SetEnableQuickBarEntityShortcut(this,false);
9638
9639 }
9640
9641
9642 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
9643
9644
9645 if (HasEnergyManager())
9646 {
9647 GetCompEM().UpdatePlugState();
9648 }
9649 }
9650
9651
9653 {
9654 super.OnPlacementStarted(player);
9655
9657 }
9658
9659 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
9660 {
9662 {
9663 m_AdminLog.OnPlacementComplete(player,
this);
9664 }
9665
9666 super.OnPlacementComplete(player, position, orientation);
9667 }
9668
9669
9670
9671
9672
9674 {
9676 {
9677 return true;
9678 }
9679 else
9680 {
9681 return false;
9682 }
9683 }
9684
9685
9687 {
9689 {
9691 }
9692 }
9693
9694
9696 {
9698 }
9699
9701 {
9703 }
9704
9705 override void InsertAgent(
int agent,
float count = 1)
9706 {
9707 if (count < 1)
9708 return;
9709
9711 }
9712
9715 {
9717 }
9718
9719
9721 {
9723 }
9724
9725
9726
9727
9728
9729
9730
9731
9732
9733
9734
9735
9736
9737
9738
9739
9740
9741
9742
9743
9744
9745
9746
9747
9748
9749
9750
9751
9752
9753
9754
9755
9756
9757
9758
9759
9760
9761
9762
9763
9764
9765
9767 {
9769 return false;
9770 return true;
9771 }
9772
9774 {
9775
9777 }
9778
9779
9782 {
9783 super.CheckForRoofLimited(timeTresholdMS);
9784
9786 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
9787 {
9788 m_PreviousRoofTestTime = time;
9789 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
9790 }
9791 }
9792
9793
9795 {
9797 {
9798 return 0;
9799 }
9800
9801 if (GetInventory().GetAttachmentSlotsCount() != 0)
9802 {
9803 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
9804 if (filter)
9805 return filter.GetProtectionLevel(type, false, system);
9806 else
9807 return 0;
9808 }
9809
9810 string subclassPath, entryName;
9811
9812 switch (type)
9813 {
9815 entryName = "biological";
9816 break;
9818 entryName = "chemical";
9819 break;
9820 default:
9821 entryName = "biological";
9822 break;
9823 }
9824
9825 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
9826
9828 }
9829
9830
9831
9834 {
9835 if (!IsMagazine())
9837
9839 }
9840
9841
9842
9843
9844
9849 {
9850 return true;
9851 }
9852
9854 {
9856 }
9857
9858
9859
9860
9861
9863 {
9864 if (parent)
9865 {
9866 if (parent.IsInherited(DayZInfected))
9867 return true;
9868
9869 if (!parent.IsRuined())
9870 return true;
9871 }
9872
9873 return true;
9874 }
9875
9877 {
9878 if (!super.CanPutAsAttachment(parent))
9879 {
9880 return false;
9881 }
9882
9883 if (!IsRuined() && !parent.IsRuined())
9884 {
9885 return true;
9886 }
9887
9888 return false;
9889 }
9890
9892 {
9893
9894
9895
9896
9897 return super.CanReceiveItemIntoCargo(item);
9898 }
9899
9901 {
9902
9903
9904
9905
9906 GameInventory attachmentInv = attachment.GetInventory();
9908 {
9909 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
9910 return false;
9911 }
9912
9913 InventoryLocation loc = new InventoryLocation();
9914 attachment.GetInventory().GetCurrentInventoryLocation(loc);
9915 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
9916 return false;
9917
9918 return super.CanReceiveAttachment(attachment, slotId);
9919 }
9920
9922 {
9923 if (!super.CanReleaseAttachment(attachment))
9924 return false;
9925
9926 return GetInventory().AreChildrenAccessible();
9927 }
9928
9929
9930
9931
9932
9933
9934
9935
9936
9937
9938
9939
9940
9941
9942
9943
9944
9945
9946
9947
9948
9950 {
9951 int id = muzzle_owner.GetMuzzleID();
9952 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
9953
9954 if (WPOF_array)
9955 {
9956 for (int i = 0; i < WPOF_array.Count(); i++)
9957 {
9958 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
9959
9960 if (WPOF)
9961 {
9962 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
9963 }
9964 }
9965 }
9966 }
9967
9968
9970 {
9971 int id = muzzle_owner.GetMuzzleID();
9973
9974 if (WPOBE_array)
9975 {
9976 for (int i = 0; i < WPOBE_array.Count(); i++)
9977 {
9978 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
9979
9980 if (WPOBE)
9981 {
9982 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
9983 }
9984 }
9985 }
9986 }
9987
9988
9990 {
9991 int id = muzzle_owner.GetMuzzleID();
9992 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9993
9994 if (WPOOH_array)
9995 {
9996 for (int i = 0; i < WPOOH_array.Count(); i++)
9997 {
9998 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9999
10000 if (WPOOH)
10001 {
10002 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10003 }
10004 }
10005 }
10006 }
10007
10008
10010 {
10011 int id = muzzle_owner.GetMuzzleID();
10012 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10013
10014 if (WPOOH_array)
10015 {
10016 for (int i = 0; i < WPOOH_array.Count(); i++)
10017 {
10018 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10019
10020 if (WPOOH)
10021 {
10022 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10023 }
10024 }
10025 }
10026 }
10027
10028
10030 {
10031 int id = muzzle_owner.GetMuzzleID();
10032 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10033
10034 if (WPOOH_array)
10035 {
10036 for (int i = 0; i < WPOOH_array.Count(); i++)
10037 {
10038 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10039
10040 if (WPOOH)
10041 {
10042 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10043 }
10044 }
10045 }
10046 }
10047
10048
10049
10051 {
10053 {
10054 return true;
10055 }
10056
10057 return false;
10058 }
10059
10061 {
10063 {
10064 return true;
10065 }
10066
10067 return false;
10068 }
10069
10071 {
10073 {
10074 return true;
10075 }
10076
10077 return false;
10078 }
10079
10081 {
10082 return false;
10083 }
10084
10087 {
10088 return UATimeSpent.DEFAULT_DEPLOY;
10089 }
10090
10091
10092
10093
10095 {
10097 SetSynchDirty();
10098 }
10099
10101 {
10103 }
10104
10105
10107 {
10108 return false;
10109 }
10110
10113 {
10114 string att_type = "None";
10115
10116 if (ConfigIsExisting("soundAttType"))
10117 {
10118 att_type = ConfigGetString("soundAttType");
10119 }
10120
10122 }
10123
10125 {
10127 }
10128
10129
10130
10131
10132
10138
10140 {
10143
10145 }
10146
10147
10149 {
10151 return;
10152
10154
10157
10160
10161 SoundParameters params = new SoundParameters();
10165 }
10166
10167
10169 {
10171 return;
10172
10174 SetSynchDirty();
10175
10178 }
10179
10180
10182 {
10184 return;
10185
10187 SetSynchDirty();
10188
10191 }
10192
10194 {
10196 }
10197
10199 {
10201 }
10202
10205 {
10206 if (!
GetGame().IsDedicatedServer())
10207 {
10208 if (ConfigIsExisting("attachSoundSet"))
10209 {
10210 string cfg_path = "";
10211 string soundset = "";
10212 string type_name =
GetType();
10213
10216 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
10217 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
10218
10219 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
10220 {
10221 for (int i = 0; i < cfg_soundset_array.Count(); i++)
10222 {
10223 if (cfg_slot_array[i] == slot_type)
10224 {
10225 soundset = cfg_soundset_array[i];
10226 break;
10227 }
10228 }
10229 }
10230
10231 if (soundset != "")
10232 {
10233 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
10235 }
10236 }
10237 }
10238 }
10239
10241 {
10242
10243 }
10244
10245 void OnApply(PlayerBase player);
10246
10248 {
10249 return 1.0;
10250 };
10251
10253 {
10255 }
10256
10258 {
10260 }
10261
10263
10265 {
10266 SetDynamicPhysicsLifeTime(0.01);
10268 }
10269
10271 {
10272 array<string> zone_names = new array<string>;
10273 GetDamageZones(zone_names);
10274 for (int i = 0; i < zone_names.Count(); i++)
10275 {
10276 SetHealthMax(zone_names.Get(i),"Health");
10277 }
10278 SetHealthMax("","Health");
10279 }
10280
10283 {
10284 float global_health = GetHealth01("","Health");
10285 array<string> zones = new array<string>;
10286 GetDamageZones(zones);
10287
10288 for (int i = 0; i < zones.Count(); i++)
10289 {
10290 SetHealth01(zones.Get(i),"Health",global_health);
10291 }
10292 }
10293
10296 {
10297 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
10298 }
10299
10301 {
10302 if (!hasRootAsPlayer)
10303 {
10304 if (refParentIB)
10305 {
10306
10307 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
10308 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
10309
10310 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
10311 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
10312
10315 }
10316 else
10317 {
10318
10321 }
10322 }
10323 }
10324
10326 {
10328 {
10329 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
10330 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
10331 {
10332 float heatPermCoef = 1.0;
10334 while (ent)
10335 {
10336 heatPermCoef *= ent.GetHeatPermeabilityCoef();
10337 ent = ent.GetHierarchyParent();
10338 }
10339
10340 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
10341 }
10342 }
10343 }
10344
10346 {
10347
10348 EntityAI parent = GetHierarchyParent();
10349 if (!parent)
10350 {
10351 hasParent = false;
10352 hasRootAsPlayer = false;
10353 }
10354 else
10355 {
10356 hasParent = true;
10357 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
10358 refParentIB =
ItemBase.Cast(parent);
10359 }
10360 }
10361
10362 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
10363 {
10364
10365 }
10366
10368 {
10369
10370 return false;
10371 }
10372
10374 {
10375
10376
10377 return false;
10378 }
10379
10381 {
10382
10383 return false;
10384 }
10385
10388 {
10389 return !GetIsFrozen() &&
IsOpen();
10390 }
10391
10393 {
10394 bool hasParent = false, hasRootAsPlayer = false;
10396
10397 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
10398 bool foodDecay =
g_Game.IsFoodDecayEnabled();
10399
10400 if (wwtu || foodDecay)
10401 {
10405
10406 if (processWetness || processTemperature || processDecay)
10407 {
10409
10410 if (processWetness)
10411 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
10412
10413 if (processTemperature)
10415
10416 if (processDecay)
10417 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
10418 }
10419 }
10420 }
10421
10424 {
10426 }
10427
10429 {
10432
10433 return super.GetTemperatureFreezeThreshold();
10434 }
10435
10437 {
10440
10441 return super.GetTemperatureThawThreshold();
10442 }
10443
10445 {
10448
10449 return super.GetItemOverheatThreshold();
10450 }
10451
10453 {
10455 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
10456
10457 return super.GetTemperatureFreezeTime();
10458 }
10459
10461 {
10463 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
10464
10465 return super.GetTemperatureThawTime();
10466 }
10467
10472
10474 {
10475 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
10476 }
10477
10479 {
10480 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
10481 }
10482
10485 {
10487 }
10488
10490 {
10492 }
10493
10495 {
10497 }
10498
10501 {
10502 return null;
10503 }
10504
10507 {
10508 return false;
10509 }
10510
10512 {
10514 {
10517 if (!trg)
10518 {
10520 explosive = this;
10521 }
10522
10523 explosive.PairRemote(trg);
10525
10526 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
10527 trg.SetPersistentPairID(persistentID);
10528 explosive.SetPersistentPairID(persistentID);
10529
10530 return true;
10531 }
10532 return false;
10533 }
10534
10537 {
10538 float ret = 1.0;
10541 ret *= GetHealth01();
10542
10543 return ret;
10544 }
10545
10546 #ifdef DEVELOPER
10547 override void SetDebugItem()
10548 {
10549 super.SetDebugItem();
10550 _itemBase = this;
10551 }
10552
10554 {
10555 string text = super.GetDebugText();
10556
10558 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
10559
10560 return text;
10561 }
10562 #endif
10563
10565 {
10566 return true;
10567 }
10568
10570
10572
10574 {
10577 }
10578
10579
10587
10603}
10604
10606{
10608 if (entity)
10609 {
10610 bool is_item = entity.IsInherited(
ItemBase);
10611 if (is_item && full_quantity)
10612 {
10615 }
10616 }
10617 else
10618 {
10620 return NULL;
10621 }
10622 return entity;
10623}
10624
10626{
10627 if (item)
10628 {
10629 if (health > 0)
10630 item.SetHealth("", "", health);
10631
10632 if (item.CanHaveTemperature())
10633 {
10635 if (item.CanFreeze())
10636 item.SetFrozen(false);
10637 }
10638
10639 if (item.HasEnergyManager())
10640 {
10641 if (quantity >= 0)
10642 {
10643 item.GetCompEM().SetEnergy0To1(quantity);
10644 }
10645 else
10646 {
10648 }
10649 }
10650 else if (item.IsMagazine())
10651 {
10652 Magazine mag = Magazine.Cast(item);
10653 if (quantity >= 0)
10654 {
10655 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
10656 }
10657 else
10658 {
10660 }
10661
10662 }
10663 else
10664 {
10665 if (quantity >= 0)
10666 {
10667 item.SetQuantityNormalized(quantity, false);
10668 }
10669 else
10670 {
10672 }
10673
10674 }
10675 }
10676}
10677
10678#ifdef DEVELOPER
10680#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.