5844{
5846 {
5847 return true;
5848 }
5849};
5850
5851
5852
5854{
5858
5860
5863
5864
5865
5866
5867
5876
5882
5887
5892
5913 protected bool m_IsResultOfSplit
5914
5916
5921
5922
5923
5925
5929
5930
5931
5933
5936
5937
5938
5944
5945
5953
5956
5957
5959
5960
5962
5963
5968
5969
5974
5975
5977
5978
5980 {
5985
5986 if (!
GetGame().IsDedicatedServer())
5987 {
5989 {
5991
5993 {
5995 }
5996 }
5997
6000 }
6001
6002 m_OldLocation = null;
6003
6005 {
6007 }
6008
6009 if (ConfigIsExisting("headSelectionsToHide"))
6010 {
6013 }
6014
6016 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
6017 {
6019 }
6020
6022
6023 m_IsResultOfSplit = false;
6024
6026 }
6027
6029 {
6030 super.InitItemVariables();
6031
6037 m_Count = ConfigGetInt(
"count");
6038
6041
6046
6049
6054
6066
6070
6071
6074 if (ConfigIsExisting("canBeSplit"))
6075 {
6078 }
6079
6081 if (ConfigIsExisting("itemBehaviour"))
6083
6084
6087 RegisterNetSyncVariableInt("m_VarLiquidType");
6088 RegisterNetSyncVariableInt("m_Cleanness",0,1);
6089
6090 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
6091 RegisterNetSyncVariableFloat("m_ImpactSpeed");
6092 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
6093
6094 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
6095 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
6096 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
6097 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
6098
6099 RegisterNetSyncVariableBool("m_IsBeingPlaced");
6100 RegisterNetSyncVariableBool("m_IsTakeable");
6101 RegisterNetSyncVariableBool("m_IsHologram");
6102
6105 {
6108 }
6109
6111
6113 if (ConfigIsExisting("temperaturePerQuantityWeight"))
6115
6116 }
6117
6119 {
6121 }
6122
6124 {
6127 {
6132 }
6133 }
6134
6135 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
6136 {
6138 {
6141 }
6142
6144 }
6145
6147 {
6153 }
6154
6156
6158 {
6160
6161 if (!action)
6162 {
6163 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
6164 return;
6165 }
6166
6168 if (!ai)
6169 {
6171 return;
6172 }
6173
6175 if (!action_array)
6176 {
6177 action_array = new array<ActionBase_Basic>;
6179 }
6180 if (LogManager.IsActionLogEnable())
6181 {
6182 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
6183 }
6184
6185 if (action_array.Find(action) != -1)
6186 {
6187 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
6188 }
6189 else
6190 {
6191 action_array.Insert(action);
6192 }
6193 }
6194
6196 {
6198 ActionBase action = player.GetActionManager().GetAction(actionName);
6201
6202 if (action_array)
6203 {
6204 action_array.RemoveItem(action);
6205 }
6206 }
6207
6208
6209
6211 {
6212 ActionOverrideData overrideData = new ActionOverrideData();
6216
6218 if (!actionMap)
6219 {
6222 }
6223
6224 actionMap.Insert(this.
Type(), overrideData);
6225
6226 }
6227
6229
6231
6232
6234 {
6237
6240
6241 string config_to_search = "CfgVehicles";
6242 string muzzle_owner_config;
6243
6245 {
6246 if (IsInherited(Weapon))
6247 config_to_search = "CfgWeapons";
6248
6249 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6250
6251 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
6252
6254
6255 if (config_OnFire_subclass_count > 0)
6256 {
6257 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
6258
6259 for (int i = 0; i < config_OnFire_subclass_count; i++)
6260 {
6261 string particle_class = "";
6263 string config_OnFire_entry = config_OnFire_class + particle_class;
6264 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
6265 WPOF_array.Insert(WPOF);
6266 }
6267
6268
6270 }
6271 }
6272
6274 {
6275 config_to_search = "CfgWeapons";
6276 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6277
6278 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
6279
6281
6282 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
6283 {
6284 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
6285
6286 for (i = 0; i < config_OnBulletCasingEject_count; i++)
6287 {
6288 string particle_class2 = "";
6290 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
6291 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
6292 WPOBE_array.Insert(WPOBE);
6293 }
6294
6295
6297 }
6298 }
6299 }
6300
6301
6303 {
6306
6308 {
6309 string config_to_search = "CfgVehicles";
6310
6311 if (IsInherited(Weapon))
6312 config_to_search = "CfgWeapons";
6313
6314 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6315 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
6316
6317 if (
GetGame().ConfigIsExisting(config_OnOverheating_class))
6318 {
6319
6321
6323 {
6325 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
6327 return;
6328 }
6329
6332
6333
6334
6336 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
6337
6338 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
6339 {
6340 string particle_class = "";
6342 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
6344
6345 if (entry_type == CT_CLASS)
6346 {
6347 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
6348 WPOOH_array.Insert(WPOF);
6349 }
6350 }
6351
6352
6354 }
6355 }
6356 }
6357
6359 {
6361 }
6362
6364 {
6366 {
6368
6371
6374
6375 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6376 }
6377 }
6378
6380 {
6382 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6383
6385 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6386
6388 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6389
6391 {
6393 }
6394 }
6395
6397 {
6399 }
6400
6402 {
6405 else
6407
6409 {
6412 }
6413 else
6414 {
6417
6420 }
6421
6423 }
6424
6426 {
6428 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6429 }
6430
6432 {
6434 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6436 }
6437
6439 {
6441 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6442 }
6443
6445 {
6448
6449 OverheatingParticle OP = new OverheatingParticle();
6454
6456 }
6457
6459 {
6462
6463 return -1;
6464 }
6465
6467 {
6469 {
6472
6473 for (int i = count; i > 0; --i)
6474 {
6475 int id = i - 1;
6478
6481
6482 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
6483 {
6484 if (p)
6485 {
6488 }
6489 }
6490 }
6491 }
6492 }
6493
6495 {
6497 {
6499 {
6500 int id = i - 1;
6502
6503 if (OP)
6504 {
6506
6507 if (p)
6508 {
6510 }
6511
6512 delete OP;
6513 }
6514 }
6515
6518 }
6519 }
6520
6523 {
6524 return 0.0;
6525 }
6526
6527
6529 {
6530 return 250;
6531 }
6532
6534 {
6535 return 0;
6536 }
6537
6540 {
6542 return true;
6543
6544 return false;
6545 }
6546
6549 {
6552
6554 {
6556 }
6557 else
6558 {
6559
6561 }
6562
6564 }
6565
6572 {
6573 return -1;
6574 }
6575
6576
6577
6578
6580 {
6582 {
6584 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6585
6586 if (r_index >= 0)
6587 {
6588 InventoryLocation r_il = new InventoryLocation;
6589 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6590
6591 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6594 {
6595 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6596 }
6598 {
6599 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6600 }
6601
6602 }
6603
6604 player.GetHumanInventory().ClearUserReservedLocation(this);
6605 }
6606
6609 }
6610
6611
6612
6613
6615 {
6616 return ItemBase.m_DebugActionsMask;
6617 }
6618
6620 {
6621 return ItemBase.m_DebugActionsMask & mask;
6622 }
6623
6625 {
6626 ItemBase.m_DebugActionsMask = mask;
6627 }
6628
6630 {
6631 ItemBase.m_DebugActionsMask |= mask;
6632 }
6633
6635 {
6636 ItemBase.m_DebugActionsMask &= ~mask;
6637 }
6638
6640 {
6642 {
6644 }
6645 else
6646 {
6648 }
6649 }
6650
6651
6653 {
6654 if (GetEconomyProfile())
6655 {
6656 float q_max = GetEconomyProfile().GetQuantityMax();
6657 if (q_max > 0)
6658 {
6659 float q_min = GetEconomyProfile().GetQuantityMin();
6660 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
6661
6663 {
6664 ComponentEnergyManager comp = GetCompEM();
6666 {
6668 }
6669 }
6671 {
6673
6674 }
6675
6676 }
6677 }
6678 }
6679
6682 {
6683 EntityAI parent = GetHierarchyParent();
6684
6685 if (parent)
6686 {
6687 InventoryLocation inventory_location_to_lock = new InventoryLocation;
6688 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
6689 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
6690 }
6691 }
6692
6695 {
6696 EntityAI parent = GetHierarchyParent();
6697
6698 if (parent)
6699 {
6700 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
6701 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
6702 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
6703 }
6704 }
6705
6707 {
6708
6709
6710
6711
6713
6715 {
6716 if (ScriptInputUserData.CanStoreInputUserData())
6717 {
6718 ScriptInputUserData ctx = new ScriptInputUserData;
6724 ctx.
Write(use_stack_max);
6727
6729 {
6730 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
6731 }
6732 }
6733 }
6734 else if (!
GetGame().IsMultiplayer())
6735 {
6737 }
6738 }
6739
6741 {
6743 }
6744
6746 {
6748 }
6749
6751 {
6753 }
6754
6756 {
6757
6758 return false;
6759 }
6760
6762 {
6763 return false;
6764 }
6765
6769 {
6770 return false;
6771 }
6772
6774 {
6775 return "";
6776 }
6777
6779
6781 {
6782 return false;
6783 }
6784
6786 {
6787 return true;
6788 }
6789
6790
6791
6793 {
6794 return true;
6795 }
6796
6798 {
6799 return true;
6800 }
6801
6803 {
6804 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6806 }
6807
6809 {
6811 }
6812
6814 {
6816 if (!is_being_placed)
6818 SetSynchDirty();
6819 }
6820
6821
6823
6825 {
6827 }
6828
6830 {
6832 }
6833
6835 {
6836 return 1;
6837 }
6838
6840 {
6841 return false;
6842 }
6843
6845 {
6847 SetSynchDirty();
6848 }
6849
6850
6851
6852
6853
6854
6855
6856
6857
6858
6859
6860
6861
6862
6863
6864
6865
6866
6867
6868
6869
6870
6871
6872
6873
6874
6875
6876
6877
6878
6879
6880
6881
6882
6883
6885 {
6886 super.OnMovedInsideCargo(container);
6887
6888 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6889 }
6890
6891 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
6892 {
6893 super.EEItemLocationChanged(oldLoc,newLoc);
6894
6895 PlayerBase new_player = null;
6896 PlayerBase old_player = null;
6897
6898 if (newLoc.GetParent())
6899 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
6900
6901 if (oldLoc.GetParent())
6902 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
6903
6905 {
6906 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
6907
6908 if (r_index >= 0)
6909 {
6910 InventoryLocation r_il = new InventoryLocation;
6911 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6912
6913 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6916 {
6917 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6918 }
6920 {
6921 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6922 }
6923
6924 }
6925 }
6926
6928 {
6929 if (new_player)
6930 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
6931
6932 if (new_player == old_player)
6933 {
6934
6935 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
6936 {
6938 {
6939 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
6940 {
6941 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6942 }
6943 }
6944 else
6945 {
6946 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6947 }
6948 }
6949
6950 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
6951 {
6952 int type = oldLoc.GetType();
6954 {
6955 oldLoc.GetParent().GetOnSetLock().Invoke(this);
6956 }
6958 {
6959 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
6960 }
6961 }
6962 if (!m_OldLocation)
6963 {
6964 m_OldLocation = new InventoryLocation;
6965 }
6966 m_OldLocation.Copy(oldLoc);
6967 }
6968 else
6969 {
6970 if (m_OldLocation)
6971 {
6972 m_OldLocation.Reset();
6973 }
6974 }
6975
6977 }
6978 else
6979 {
6980 if (new_player)
6981 {
6982 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
6983 if (res_index >= 0)
6984 {
6985 InventoryLocation il = new InventoryLocation;
6986 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
6988 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
6991 {
6992 il.
GetParent().GetOnReleaseLock().Invoke(it);
6993 }
6995 {
6997 }
6998
6999 }
7000 }
7002 {
7003
7005 }
7006
7007 if (m_OldLocation)
7008 {
7009 m_OldLocation.Reset();
7010 }
7011 }
7012 }
7013
7014 override void EOnContact(IEntity other, Contact extra)
7015 {
7017 {
7018 int liquidType = -1;
7020 if (impactSpeed > 0.0)
7021 {
7023 #ifndef SERVER
7025 #else
7027 SetSynchDirty();
7028 #endif
7030 }
7031 }
7032
7033 #ifdef SERVER
7034 if (GetCompEM() && GetCompEM().IsPlugged())
7035 {
7036 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
7037 GetCompEM().UnplugThis();
7038 }
7039 #endif
7040 }
7041
7043
7045 {
7047 }
7048
7050 {
7051
7052 }
7053
7055 {
7056 super.OnItemLocationChanged(old_owner, new_owner);
7057
7058 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
7059 PlayerBase playerNew = PlayerBase.Cast(new_owner);
7060
7061 if (!relatedPlayer && playerNew)
7062 relatedPlayer = playerNew;
7063
7064 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
7065 {
7067 if (actionMgr)
7068 {
7069 ActionBase currentAction = actionMgr.GetRunningAction();
7070 if (currentAction)
7072 }
7073 }
7074
7075 Man ownerPlayerOld = null;
7076 Man ownerPlayerNew = null;
7077
7078 if (old_owner)
7079 {
7080 if (old_owner.
IsMan())
7081 {
7082 ownerPlayerOld = Man.Cast(old_owner);
7083 }
7084 else
7085 {
7086 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
7087 }
7088 }
7089 else
7090 {
7092 {
7094
7095 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
7096 {
7097 GetCompEM().UnplugThis();
7098 }
7099 }
7100 }
7101
7102 if (new_owner)
7103 {
7104 if (new_owner.
IsMan())
7105 {
7106 ownerPlayerNew = Man.Cast(new_owner);
7107 }
7108 else
7109 {
7110 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
7111 }
7112 }
7113
7114 if (ownerPlayerOld != ownerPlayerNew)
7115 {
7116 if (ownerPlayerOld)
7117 {
7118 array<EntityAI> subItemsExit = new array<EntityAI>;
7120 for (int i = 0; i < subItemsExit.Count(); i++)
7121 {
7124 }
7125 }
7126
7127 if (ownerPlayerNew)
7128 {
7129 array<EntityAI> subItemsEnter = new array<EntityAI>;
7131 for (int j = 0; j < subItemsEnter.Count(); j++)
7132 {
7135 }
7136 }
7137 }
7138 else if (ownerPlayerNew != null)
7139 {
7140 PlayerBase nplayer;
7141 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
7142 {
7143 array<EntityAI> subItemsUpdate = new array<EntityAI>;
7145 for (int k = 0; k < subItemsUpdate.Count(); k++)
7146 {
7148 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
7149 }
7150 }
7151 }
7152
7153 if (old_owner)
7154 old_owner.OnChildItemRemoved(this);
7155 if (new_owner)
7156 new_owner.OnChildItemReceived(this);
7157 }
7158
7159
7161 {
7162 super.EEDelete(parent);
7163 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
7164 if (player)
7165 {
7167
7168 if (player.IsAlive())
7169 {
7170 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7171 if (r_index >= 0)
7172 {
7173 InventoryLocation r_il = new InventoryLocation;
7174 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7175
7176 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7179 {
7180 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7181 }
7183 {
7184 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7185 }
7186
7187 }
7188
7189 player.RemoveQuickBarEntityShortcut(this);
7190 }
7191 }
7192 }
7193
7195 {
7196 super.EEKilled(killer);
7197
7200 {
7201 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
7202 {
7203 if (IsMagazine())
7204 {
7205 if (Magazine.Cast(this).GetAmmoCount() > 0)
7206 {
7208 }
7209 }
7210 else
7211 {
7213 }
7214 }
7215 }
7216 }
7217
7219 {
7220 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7221
7222 super.OnWasAttached(parent, slot_id);
7223
7226
7228 }
7229
7231 {
7232 super.OnWasDetached(parent, slot_id);
7233
7236 }
7237
7239 {
7240 int idx;
7243
7244 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7245 if (inventory_slots.Count() < 1)
7246 {
7247 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
7248 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
7249 }
7250 else
7251 {
7252 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
7253 }
7254
7255 idx = inventory_slots.Find(slot);
7256 if (idx < 0)
7257 return "";
7258
7259 return attach_types.Get(idx);
7260 }
7261
7263 {
7264 int idx = -1;
7265 string slot;
7266
7269
7270 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7271 if (inventory_slots.Count() < 1)
7272 {
7273 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
7274 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7275 }
7276 else
7277 {
7278 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
7279 if (detach_types.Count() < 1)
7280 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7281 }
7282
7283 for (int i = 0; i < inventory_slots.Count(); i++)
7284 {
7285 slot = inventory_slots.Get(i);
7286 }
7287
7288 if (slot != "")
7289 {
7290 if (detach_types.Count() == 1)
7291 idx = 0;
7292 else
7293 idx = inventory_slots.Find(slot);
7294 }
7295 if (idx < 0)
7296 return "";
7297
7298 return detach_types.Get(idx);
7299 }
7300
7302 {
7303
7305
7306
7307 float min_time = 1;
7308 float max_time = 3;
7309 float delay = Math.RandomFloat(min_time, max_time);
7310
7311 explode_timer.Run(delay, this, "DoAmmoExplosion");
7312 }
7313
7315 {
7316 Magazine magazine = Magazine.Cast(this);
7317 int pop_sounds_count = 6;
7318 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
7319
7320
7321 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
7322 string sound_name = pop_sounds[ sound_idx ];
7324
7325
7326 magazine.ServerAddAmmoCount(-1);
7327
7328
7329 float min_temp_to_explode = 100;
7330
7331 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
7332 {
7334 }
7335 }
7336
7337
7338 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
7339 {
7340 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
7341
7342 const int CHANCE_DAMAGE_CARGO = 4;
7343 const int CHANCE_DAMAGE_ATTACHMENT = 1;
7344 const int CHANCE_DAMAGE_NOTHING = 2;
7345
7347 {
7348 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
7349 int chances;
7350 int rnd;
7351
7352 if (GetInventory().GetCargo())
7353 {
7354 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7355 rnd = Math.RandomInt(0,chances);
7356
7357 if (rnd < CHANCE_DAMAGE_CARGO)
7358 {
7360 }
7361 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
7362 {
7364 }
7365 }
7366 else
7367 {
7368 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7369 rnd = Math.RandomInt(0,chances);
7370
7371 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
7372 {
7374 }
7375 }
7376 }
7377 }
7378
7380 {
7381 if (GetInventory().GetCargo())
7382 {
7383 int item_count = GetInventory().GetCargo().GetItemCount();
7384 if (item_count > 0)
7385 {
7386 int random_pick = Math.RandomInt(0, item_count);
7388 if (!item.IsExplosive())
7389 {
7390 item.AddHealth("","",damage);
7391 return true;
7392 }
7393 }
7394 }
7395 return false;
7396 }
7397
7399 {
7400 int attachment_count = GetInventory().AttachmentCount();
7401 if (attachment_count > 0)
7402 {
7403 int random_pick = Math.RandomInt(0, attachment_count);
7404 ItemBase attachment =
ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
7405 if (!attachment.IsExplosive())
7406 {
7407 attachment.AddHealth("","",damage);
7408 return true;
7409 }
7410 }
7411 return false;
7412 }
7413
7415 {
7417 }
7418
7420 {
7422 return GetInventory().CanRemoveEntity();
7423
7424 return false;
7425 }
7426
7428 {
7429
7431 return false;
7432
7433
7435 return false;
7436
7437
7438
7440 if (delta == 0)
7441 return false;
7442
7443
7444 return true;
7445 }
7446
7448 {
7450 {
7451 if (ScriptInputUserData.CanStoreInputUserData())
7452 {
7453 ScriptInputUserData ctx = new ScriptInputUserData;
7458 ctx.
Write(destination_entity);
7462 }
7463 }
7464 else if (!
GetGame().IsMultiplayer())
7465 {
7467 }
7468 }
7469
7471 {
7472 float split_quantity_new;
7476 InventoryLocation loc = new InventoryLocation;
7477
7478 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7479 {
7481 split_quantity_new = stack_max;
7482 else
7484
7486 {
7487 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7488 if (new_item)
7489 {
7490 new_item.SetResultOfSplit(true);
7491 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7493 new_item.
SetQuantity(split_quantity_new,
false,
true);
7494 }
7495 }
7496 }
7497 else if (destination_entity && slot_id == -1)
7498 {
7499 if (quantity > stack_max)
7500 split_quantity_new = stack_max;
7501 else
7502 split_quantity_new = quantity;
7503
7505 {
7507 {
7510 }
7511
7512 if (new_item)
7513 {
7514 new_item.SetResultOfSplit(true);
7515 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7517 new_item.
SetQuantity(split_quantity_new,
false,
true);
7518 }
7519 }
7520 }
7521 else
7522 {
7523 if (stack_max != 0)
7524 {
7526 {
7528 }
7529
7530 if (split_quantity_new == 0)
7531 {
7532 if (!
GetGame().IsMultiplayer())
7533 player.PhysicalPredictiveDropItem(this);
7534 else
7535 player.ServerDropEntity(this);
7536 return;
7537 }
7538
7540 {
7542
7543 if (new_item)
7544 {
7545 new_item.SetResultOfSplit(true);
7546 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7549 new_item.PlaceOnSurface();
7550 }
7551 }
7552 }
7553 }
7554 }
7555
7557 {
7558 float split_quantity_new;
7562 InventoryLocation loc = new InventoryLocation;
7563
7564 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7565 {
7567 split_quantity_new = stack_max;
7568 else
7570
7572 {
7573 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7574 if (new_item)
7575 {
7576 new_item.SetResultOfSplit(true);
7577 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7579 new_item.
SetQuantity(split_quantity_new,
false,
true);
7580 }
7581 }
7582 }
7583 else if (destination_entity && slot_id == -1)
7584 {
7585 if (quantity > stack_max)
7586 split_quantity_new = stack_max;
7587 else
7588 split_quantity_new = quantity;
7589
7591 {
7593 {
7596 }
7597
7598 if (new_item)
7599 {
7600 new_item.SetResultOfSplit(true);
7601 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7603 new_item.
SetQuantity(split_quantity_new,
false,
true);
7604 }
7605 }
7606 }
7607 else
7608 {
7609 if (stack_max != 0)
7610 {
7612 {
7614 }
7615
7617 {
7619
7620 if (new_item)
7621 {
7622 new_item.SetResultOfSplit(true);
7623 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7626 new_item.PlaceOnSurface();
7627 }
7628 }
7629 }
7630 }
7631 }
7632
7634 {
7636 {
7637 if (ScriptInputUserData.CanStoreInputUserData())
7638 {
7639 ScriptInputUserData ctx = new ScriptInputUserData;
7644 dst.WriteToContext(ctx);
7646 }
7647 }
7648 else if (!
GetGame().IsMultiplayer())
7649 {
7651 }
7652 }
7653
7655 {
7657 {
7658 if (ScriptInputUserData.CanStoreInputUserData())
7659 {
7660 ScriptInputUserData ctx = new ScriptInputUserData;
7665 ctx.
Write(destination_entity);
7671 }
7672 }
7673 else if (!
GetGame().IsMultiplayer())
7674 {
7676 }
7677 }
7678
7680 {
7682 }
7683
7685 {
7687 float split_quantity_new;
7689 if (dst.IsValid())
7690 {
7691 int slot_id = dst.GetSlot();
7693
7694 if (quantity > stack_max)
7695 split_quantity_new = stack_max;
7696 else
7697 split_quantity_new = quantity;
7698
7700 {
7702
7703 if (new_item)
7704 {
7705 new_item.SetResultOfSplit(true);
7706 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7708 new_item.
SetQuantity(split_quantity_new,
false,
true);
7709 }
7710
7711 return new_item;
7712 }
7713 }
7714
7715 return null;
7716 }
7717
7719 {
7721 float split_quantity_new;
7723 if (destination_entity)
7724 {
7726 if (quantity > stackable)
7727 split_quantity_new = stackable;
7728 else
7729 split_quantity_new = quantity;
7730
7732 {
7733 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
7734 if (new_item)
7735 {
7736 new_item.SetResultOfSplit(true);
7737 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7739 new_item.
SetQuantity(split_quantity_new,
false,
true);
7740 }
7741 }
7742 }
7743 }
7744
7746 {
7748 {
7749 if (ScriptInputUserData.CanStoreInputUserData())
7750 {
7751 ScriptInputUserData ctx = new ScriptInputUserData;
7756 ItemBase destination_entity =
this;
7757 ctx.
Write(destination_entity);
7761 }
7762 }
7763 else if (!
GetGame().IsMultiplayer())
7764 {
7766 }
7767 }
7768
7770 {
7772 float split_quantity_new;
7774 if (player)
7775 {
7777 if (quantity > stackable)
7778 split_quantity_new = stackable;
7779 else
7780 split_quantity_new = quantity;
7781
7783 {
7784 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
7785 new_item =
ItemBase.Cast(in_hands);
7786 if (new_item)
7787 {
7788 new_item.SetResultOfSplit(true);
7789 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7791 new_item.SetQuantity(split_quantity_new, false, true);
7792 }
7793 }
7794 }
7795 }
7796
7798 {
7800 float split_quantity_new = Math.Floor(quantity * 0.5);
7801
7803 return;
7804
7806
7807 if (new_item)
7808 {
7809 if (new_item.GetQuantityMax() < split_quantity_new)
7810 {
7811 split_quantity_new = new_item.GetQuantityMax();
7812 }
7813
7814 new_item.SetResultOfSplit(true);
7815 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7816
7818 {
7821 }
7822 else
7823 {
7825 new_item.
SetQuantity(split_quantity_new,
false,
true);
7826 }
7827 }
7828 }
7829
7831 {
7833 float split_quantity_new = Math.Floor(quantity / 2);
7834
7836 return;
7837
7838 InventoryLocation invloc = new InventoryLocation;
7840
7842 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
7843
7844 if (new_item)
7845 {
7846 if (new_item.GetQuantityMax() < split_quantity_new)
7847 {
7848 split_quantity_new = new_item.GetQuantityMax();
7849 }
7851 {
7854 }
7855 else if (split_quantity_new > 1)
7856 {
7858 new_item.
SetQuantity(split_quantity_new,
false,
true);
7859 }
7860 }
7861 }
7862
7865 {
7866 SetWeightDirty();
7868
7869 if (parent)
7870 parent.OnAttachmentQuantityChangedEx(this, delta);
7871
7873 {
7875 {
7877 }
7879 {
7880 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
7882 }
7883 }
7884
7885 }
7886
7889 {
7890
7891 }
7892
7895 {
7897 }
7898
7900 {
7901 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
7902
7904 {
7905 if (newLevel == GameConstants.STATE_RUINED)
7906 {
7908 EntityAI parent = GetHierarchyParent();
7909 if (parent && parent.IsFireplace())
7910 {
7911 CargoBase cargo = GetInventory().GetCargo();
7912 if (cargo)
7913 {
7915 {
7917 }
7918 }
7919 }
7920 }
7921
7923 {
7924
7926 return;
7927 }
7928
7929 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
7930 {
7932 }
7933 }
7934 }
7935
7936
7938 {
7939 super.OnRightClick();
7940
7942 {
7944 {
7945 if (ScriptInputUserData.CanStoreInputUserData())
7946 {
7947 EntityAI root = GetHierarchyRoot();
7948 Man playerOwner = GetHierarchyRootPlayer();
7949 InventoryLocation dst = new InventoryLocation;
7950
7951
7952 if (!playerOwner && root && root == this)
7953 {
7955 }
7956 else
7957 {
7958
7959 GetInventory().GetCurrentInventoryLocation(dst);
7961 {
7964 {
7966 }
7967 else
7968 {
7970
7971
7972 if (
GetGame().
GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
7973 {
7975 }
7976 else
7977 {
7978 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
7979 }
7980 }
7981 }
7982 }
7983
7984 ScriptInputUserData ctx = new ScriptInputUserData;
7992 }
7993 }
7994 else if (!
GetGame().IsMultiplayer())
7995 {
7997 }
7998 }
7999 }
8000
8002 {
8003 if (root)
8004 {
8005 vector m4[4];
8006 root.GetTransform(m4);
8007 dst.SetGround(this, m4);
8008 }
8009 else
8010 {
8011 GetInventory().GetCurrentInventoryLocation(dst);
8012 }
8013 }
8014
8015 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
8016 {
8017
8018 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
8019 return false;
8020
8021 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
8022 return false;
8023
8024
8026 return false;
8027
8028
8029 Magazine mag = Magazine.Cast(this);
8030 if (mag)
8031 {
8032 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
8033 return false;
8034
8035 if (stack_max_limit)
8036 {
8037 Magazine other_mag = Magazine.Cast(other_item);
8038 if (other_item)
8039 {
8040 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
8041 return false;
8042 }
8043
8044 }
8045 }
8046 else
8047 {
8048
8050 return false;
8051
8053 return false;
8054 }
8055
8056 PlayerBase player = null;
8057 if (CastTo(player, GetHierarchyRootPlayer()))
8058 {
8059 if (player.GetInventory().HasAttachment(this))
8060 return false;
8061
8062 if (player.IsItemsToDelete())
8063 return false;
8064 }
8065
8066 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
8067 return false;
8068
8069 int slotID;
8071 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
8072 return false;
8073
8074 return true;
8075 }
8076
8078 {
8080 }
8081
8083 {
8084 return m_IsResultOfSplit;
8085 }
8086
8088 {
8089 m_IsResultOfSplit = value;
8090 }
8091
8093 {
8095 }
8096
8098 {
8099 float other_item_quantity = other_item.GetQuantity();
8100 float this_free_space;
8101
8103
8105
8106 if (other_item_quantity > this_free_space)
8107 {
8108 return this_free_space;
8109 }
8110 else
8111 {
8112 return other_item_quantity;
8113 }
8114 }
8115
8117 {
8119 }
8120
8122 {
8124 return;
8125
8126 if (!IsMagazine() && other_item)
8127 {
8129 if (quantity_used != 0)
8130 {
8131 float hp1 = GetHealth01("","");
8132 float hp2 = other_item.GetHealth01("","");
8133 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
8134 hpResult = hpResult / (
GetQuantity() + quantity_used);
8135
8136 hpResult *= GetMaxHealth();
8137 Math.Round(hpResult);
8138 SetHealth("", "Health", hpResult);
8139
8141 other_item.AddQuantity(-quantity_used);
8142 }
8143 }
8145 }
8146
8148 {
8149 #ifdef SERVER
8150 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
8151 GetHierarchyParent().IncreaseLifetimeUp();
8152 #endif
8153 };
8154
8156 {
8157 PlayerBase p = PlayerBase.Cast(player);
8158
8159 array<int> recipesIds = p.m_Recipes;
8160 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8161 if (moduleRecipesManager)
8162 {
8163 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
8164 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
8165 }
8166
8167 for (int i = 0;i < recipesIds.Count(); i++)
8168 {
8169 int key = recipesIds.Get(i);
8170 string recipeName = moduleRecipesManager.GetRecipeName(key);
8172 }
8173 }
8174
8175
8176 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
8177 {
8178 super.GetDebugActions(outputList);
8179
8180
8186
8187
8192
8197
8198
8202
8203
8205 {
8209 }
8210
8213
8214
8218
8220
8221 InventoryLocation loc = new InventoryLocation();
8222 GetInventory().GetCurrentInventoryLocation(loc);
8224 {
8225 if (Gizmo_IsSupported())
8228 }
8229
8231 }
8232
8233
8234
8235
8237 {
8238 super.OnAction(action_id, player, ctx);
8239
8241 {
8242 switch (action_id)
8243 {
8246 return true;
8249 return true;
8250 }
8251 }
8252
8254 {
8255 switch (action_id)
8256 {
8258 Delete();
8259 return true;
8260 }
8261 }
8262
8263 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
8264 {
8265 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8266 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
8267 PlayerBase p = PlayerBase.Cast(player);
8268 if (
EActions.RECIPES_RANGE_START < 1000)
8269 {
8270 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
8271 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
8272 }
8273 }
8274 #ifndef SERVER
8275 else if (action_id ==
EActions.WATCH_PLAYER)
8276 {
8277 PluginDeveloper.SetDeveloperItemClientEx(player);
8278 }
8279 #endif
8281 {
8282 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
8283 {
8284 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
8285 OnDebugButtonPressServer(id + 1);
8286 }
8287
8288 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
8289 {
8290 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
8292 }
8293
8294 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
8295 {
8296 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
8298 }
8299
8300 else if (action_id ==
EActions.ADD_QUANTITY)
8301 {
8302 if (IsMagazine())
8303 {
8304 Magazine mag = Magazine.Cast(this);
8305 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
8306 }
8307 else
8308 {
8310 }
8311
8312 if (m_EM)
8313 {
8314 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
8315 }
8316
8317 }
8318
8319 else if (action_id ==
EActions.REMOVE_QUANTITY)
8320 {
8321 if (IsMagazine())
8322 {
8323 Magazine mag2 = Magazine.Cast(this);
8324 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
8325 }
8326 else
8327 {
8329 }
8330 if (m_EM)
8331 {
8332 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
8333 }
8334
8335 }
8336
8337 else if (action_id ==
EActions.SET_QUANTITY_0)
8338 {
8340
8341 if (m_EM)
8342 {
8343 m_EM.SetEnergy(0);
8344 }
8345 }
8346
8347 else if (action_id ==
EActions.SET_MAX_QUANTITY)
8348 {
8350
8351 if (m_EM)
8352 {
8353 m_EM.SetEnergy(m_EM.GetEnergyMax());
8354 }
8355 }
8356
8357 else if (action_id ==
EActions.ADD_HEALTH)
8358 {
8359 AddHealth("","",GetMaxHealth("","Health")/5);
8360 }
8361 else if (action_id ==
EActions.REMOVE_HEALTH)
8362 {
8363 AddHealth("","",-GetMaxHealth("","Health")/5);
8364 }
8365 else if (action_id ==
EActions.DESTROY_HEALTH)
8366 {
8367 SetHealth01("","",0);
8368 }
8369 else if (action_id ==
EActions.WATCH_ITEM)
8370 {
8372 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
8373 #ifdef DEVELOPER
8374 SetDebugDeveloper_item(this);
8375 #endif
8376 }
8377
8378 else if (action_id ==
EActions.ADD_TEMPERATURE)
8379 {
8380 AddTemperature(20);
8381
8382 }
8383
8384 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
8385 {
8386 AddTemperature(-20);
8387
8388 }
8389
8390 else if (action_id ==
EActions.FLIP_FROZEN)
8391 {
8392 SetFrozen(!GetIsFrozen());
8393
8394 }
8395
8396 else if (action_id ==
EActions.ADD_WETNESS)
8397 {
8399
8400 }
8401
8402 else if (action_id ==
EActions.REMOVE_WETNESS)
8403 {
8405
8406 }
8407
8408 else if (action_id ==
EActions.LIQUIDTYPE_UP)
8409 {
8412
8413
8414 }
8415
8416 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
8417 {
8420 }
8421
8422 else if (action_id ==
EActions.MAKE_SPECIAL)
8423 {
8424 auto debugParams = DebugSpawnParams.WithPlayer(player);
8425 OnDebugSpawnEx(debugParams);
8426 }
8427
8428 }
8429
8430
8431 return false;
8432 }
8433
8434
8435
8436
8440
8443
8444
8445
8447 {
8448 return false;
8449 }
8450
8451
8453 {
8454 return true;
8455 }
8456
8457
8459 {
8460 return true;
8461 }
8462
8463
8464
8466 {
8467 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
8469 }
8470
8473 {
8474 return null;
8475 }
8476
8478 {
8479 return false;
8480 }
8481
8483 {
8484 return false;
8485 }
8486
8490
8491
8493 {
8494 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8495 return module_repairing.CanRepair(this, item_repair_kit);
8496 }
8497
8498
8499 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
8500 {
8501 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8502 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
8503 }
8504
8505
8507 {
8508
8509
8510
8511
8512
8513
8514
8515
8516 return 1;
8517 }
8518
8519
8520
8522 {
8524 }
8525
8526
8527
8529 {
8531 }
8532
8533
8542 {
8543 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8544
8545 if (player)
8546 {
8547 player.MessageStatus(text);
8548 }
8549 }
8550
8551
8560 {
8561 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8562
8563 if (player)
8564 {
8565 player.MessageAction(text);
8566 }
8567 }
8568
8569
8578 {
8579 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8580
8581 if (player)
8582 {
8583 player.MessageFriendly(text);
8584 }
8585 }
8586
8587
8596 {
8597 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8598
8599 if (player)
8600 {
8601 player.MessageImportant(text);
8602 }
8603 }
8604
8606 {
8607 return true;
8608 }
8609
8610
8611 override bool KindOf(
string tag)
8612 {
8613 bool found = false;
8614 string item_name = this.
GetType();
8617
8618 int array_size = item_tag_array.Count();
8619 for (int i = 0; i < array_size; i++)
8620 {
8621 if (item_tag_array.Get(i) == tag)
8622 {
8623 found = true;
8624 break;
8625 }
8626 }
8627 return found;
8628 }
8629
8630
8632 {
8633
8634 super.OnRPC(sender, rpc_type,ctx);
8635
8636
8637 switch (rpc_type)
8638 {
8639 #ifndef SERVER
8640 case ERPCs.RPC_SOUND_LOCK_ATTACH:
8641 Param2<bool, string> p = new Param2<bool, string>(false, "");
8642
8644 return;
8645
8646 bool play = p.param1;
8647 string soundSet = p.param2;
8648
8649 if (play)
8650 {
8652 {
8654 {
8656 }
8657 }
8658 else
8659 {
8661 }
8662 }
8663 else
8664 {
8666 }
8667
8668 break;
8669 #endif
8670
8671 }
8672
8674 {
8676 }
8677 }
8678
8679
8680
8681
8683 {
8684 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8685 return plugin.GetID(
name);
8686 }
8687
8689 {
8690 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8691 return plugin.GetName(id);
8692 }
8693
8696 {
8697
8698
8699 int varFlags;
8700 if (!ctx.
Read(varFlags))
8701 return;
8702
8703 if (varFlags & ItemVariableFlags.FLOAT)
8704 {
8706 }
8707 }
8708
8710 {
8711
8712 super.SerializeNumericalVars(floats_out);
8713
8714
8715
8717 {
8719 }
8720
8722 {
8724 }
8725
8727 {
8729 }
8730
8732 {
8737 }
8738
8740 {
8742 }
8743 }
8744
8746 {
8747
8748 super.DeSerializeNumericalVars(floats);
8749
8750
8751 int index = 0;
8752 int mask = Math.Round(floats.Get(index));
8753
8754 index++;
8755
8757 {
8759 {
8761 }
8762 else
8763 {
8764 float quantity = floats.Get(index);
8766 }
8767 index++;
8768 }
8769
8771 {
8772 float wet = floats.Get(index);
8774 index++;
8775 }
8776
8778 {
8779 int liquidtype = Math.Round(floats.Get(index));
8781 index++;
8782 }
8783
8785 {
8787 index++;
8789 index++;
8791 index++;
8793 index++;
8794 }
8795
8797 {
8798 int cleanness = Math.Round(floats.Get(index));
8800 index++;
8801 }
8802 }
8803
8805 {
8806 super.WriteVarsToCTX(ctx);
8807
8808
8810 {
8812 }
8813
8815 {
8817 }
8818
8820 {
8822 }
8823
8825 {
8826 int r,g,b,a;
8832 }
8833
8835 {
8837 }
8838 }
8839
8841 {
8842 if (!super.ReadVarsFromCTX(ctx,version))
8843 return false;
8844
8845 int intValue;
8846 float value;
8847
8848 if (version < 140)
8849 {
8850 if (!ctx.
Read(intValue))
8851 return false;
8852
8853 m_VariablesMask = intValue;
8854 }
8855
8857 {
8858 if (!ctx.
Read(value))
8859 return false;
8860
8862 {
8864 }
8865 else
8866 {
8868 }
8869 }
8870
8871 if (version < 140)
8872 {
8874 {
8875 if (!ctx.
Read(value))
8876 return false;
8877 SetTemperatureDirect(value);
8878 }
8879 }
8880
8882 {
8883 if (!ctx.
Read(value))
8884 return false;
8886 }
8887
8889 {
8890 if (!ctx.
Read(intValue))
8891 return false;
8893 }
8894
8896 {
8897 int r,g,b,a;
8899 return false;
8901 return false;
8903 return false;
8905 return false;
8906
8908 }
8909
8911 {
8912 if (!ctx.
Read(intValue))
8913 return false;
8915 }
8916
8917 if (version >= 138 && version < 140)
8918 {
8920 {
8921 if (!ctx.
Read(intValue))
8922 return false;
8923 SetFrozen(intValue);
8924 }
8925 }
8926
8927 return true;
8928 }
8929
8930
8932 {
8935 {
8937 }
8938
8939 if (!super.OnStoreLoad(ctx, version))
8940 {
8942 return false;
8943 }
8944
8945 if (version >= 114)
8946 {
8947 bool hasQuickBarIndexSaved;
8948
8949 if (!ctx.
Read(hasQuickBarIndexSaved))
8950 {
8952 return false;
8953 }
8954
8955 if (hasQuickBarIndexSaved)
8956 {
8957 int itmQBIndex;
8958
8959
8960 if (!ctx.
Read(itmQBIndex))
8961 {
8963 return false;
8964 }
8965
8966 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
8967 if (itmQBIndex != -1 && parentPlayer)
8968 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
8969 }
8970 }
8971 else
8972 {
8973
8974 PlayerBase player;
8975 int itemQBIndex;
8976 if (version ==
int.
MAX)
8977 {
8978 if (!ctx.
Read(itemQBIndex))
8979 {
8981 return false;
8982 }
8983 }
8984 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
8985 {
8986
8987 if (!ctx.
Read(itemQBIndex))
8988 {
8990 return false;
8991 }
8992 if (itemQBIndex != -1 && player)
8993 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
8994 }
8995 }
8996
8997 if (version < 140)
8998 {
8999
9000 if (!LoadVariables(ctx, version))
9001 {
9003 return false;
9004 }
9005 }
9006
9007
9009 {
9011 return false;
9012 }
9013 if (version >= 132)
9014 {
9016 if (raib)
9017 {
9019 {
9021 return false;
9022 }
9023 }
9024 }
9025
9027 return true;
9028 }
9029
9030
9031
9033 {
9034 super.OnStoreSave(ctx);
9035
9036 PlayerBase player;
9037 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
9038 {
9040
9041 int itemQBIndex = -1;
9042 itemQBIndex = player.FindQuickBarEntityIndex(this);
9043 ctx.
Write(itemQBIndex);
9044 }
9045 else
9046 {
9048 }
9049
9051
9053 if (raib)
9054 {
9056 }
9057 }
9058
9059
9061 {
9062 super.AfterStoreLoad();
9063
9065 {
9067 }
9068
9070 {
9073 }
9074 }
9075
9077 {
9078 super.EEOnAfterLoad();
9079
9081 {
9083 }
9084
9087 }
9088
9090 {
9091 return false;
9092 }
9093
9094
9095
9097 {
9099 {
9100 #ifdef PLATFORM_CONSOLE
9101
9103 {
9105 if (menu)
9106 {
9108 }
9109 }
9110 #endif
9111 }
9112
9114 {
9117 }
9118
9120 {
9121 SetWeightDirty();
9123 }
9125 {
9128 }
9129
9131 {
9134 }
9136 {
9139 }
9140
9141 super.OnVariablesSynchronized();
9142 }
9143
9144
9145
9147 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
9148 {
9149 if (!IsServerCheck(allow_client))
9150 return false;
9151
9153 return false;
9154
9157
9158 if (value <= (min + 0.001))
9159 value = min;
9160
9161 if (value == min)
9162 {
9163 if (destroy_config)
9164 {
9165 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
9166 if (dstr)
9167 {
9169 this.Delete();
9170 return true;
9171 }
9172 }
9173 else if (destroy_forced)
9174 {
9176 this.Delete();
9177 return true;
9178 }
9179
9181 }
9182
9185
9187 {
9189
9190 if (delta)
9192 }
9193
9195
9196 return false;
9197 }
9198
9199
9201 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9202 {
9204 }
9205
9207 {
9210 }
9211
9213 {
9216 }
9217
9219 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9220 {
9221 float value_clamped = Math.Clamp(value, 0, 1);
9223 SetQuantity(result, destroy_config, destroy_forced);
9224 }
9225
9226
9229 {
9231 }
9232
9234 {
9236 }
9237
9238
9239
9240
9241
9242
9243
9244
9245
9246
9248 {
9249 int slot = -1;
9250 if (GetInventory())
9251 {
9252 InventoryLocation il = new InventoryLocation;
9253 GetInventory().GetCurrentInventoryLocation(il);
9255 }
9256
9258 }
9259
9261 {
9262 float quantity_max = 0;
9263
9265 {
9266 if (attSlotID != -1)
9267 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
9268
9269 if (quantity_max <= 0)
9271 }
9272
9273 if (quantity_max <= 0)
9275
9276 return quantity_max;
9277 }
9278
9280 {
9282 }
9283
9285 {
9287 }
9288
9289
9291 {
9293 }
9294
9296 {
9298 }
9299
9301 {
9303 }
9304
9305
9307 {
9308
9309 float weightEx = GetWeightEx();
9310 float special = GetInventoryAndCargoWeight();
9311 return weightEx - special;
9312 }
9313
9314
9316 {
9318 }
9319
9321 {
9323 {
9324 #ifdef DEVELOPER
9325 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9326 {
9327 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
9329 }
9330 #endif
9331
9333 }
9334 else if (HasEnergyManager())
9335 {
9336 #ifdef DEVELOPER
9337 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9338 {
9339 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
9340 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
9341 }
9342 #endif
9343 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
9344 }
9345 else
9346 {
9347 #ifdef DEVELOPER
9348 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9349 {
9350 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
9351 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
9352 }
9353 #endif
9354 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
9355 }
9356 }
9357
9360 {
9361 int item_count = 0;
9363
9364 if (GetInventory().GetCargo() != NULL)
9365 {
9366 item_count = GetInventory().GetCargo().GetItemCount();
9367 }
9368
9369 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
9370 {
9371 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
9372 if (item)
9373 item_count += item.GetNumberOfItems();
9374 }
9375 return item_count;
9376 }
9377
9380 {
9381 float weight = 0;
9382 float wetness = 1;
9383 if (include_wetness)
9386 {
9387 weight = wetness * m_ConfigWeight;
9388 }
9390 {
9391 weight = 1;
9392 }
9393 return weight;
9394 }
9395
9396
9397
9399 {
9400 if ((
GetGame().IsServer() || !
GetGame().IsMultiplayer()) && GetInventory())
9401 {
9402 GameInventory inv = GetInventory();
9403 array<EntityAI> items = new array<EntityAI>;
9405 for (int i = 0; i < items.Count(); i++)
9406 {
9408 if (item)
9409 {
9411 }
9412 }
9413 }
9414 }
9415
9416
9417
9418
9420 {
9421 float energy = 0;
9422 if (HasEnergyManager())
9423 {
9424 energy = GetCompEM().GetEnergy();
9425 }
9426 return energy;
9427 }
9428
9429
9431 {
9432 super.OnEnergyConsumed();
9433
9435 }
9436
9438 {
9439 super.OnEnergyAdded();
9440
9442 }
9443
9444
9446 {
9447 if (
GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
9448 {
9450 {
9451 float energy_0to1 = GetCompEM().GetEnergy0To1();
9453 }
9454 }
9455 }
9456
9457
9459 {
9460 return ConfigGetFloat("heatIsolation");
9461 }
9462
9464 {
9466 }
9467
9469 {
9470 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
9471 if (
GetGame().ConfigIsExisting(paramPath))
9473
9474 return 0.0;
9475 }
9476
9478 {
9479 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
9480 if (
GetGame().ConfigIsExisting(paramPath))
9482
9483 return 0.0;
9484 }
9485
9486 override void SetWet(
float value,
bool allow_client =
false)
9487 {
9488 if (!IsServerCheck(allow_client))
9489 return;
9490
9493
9495
9496 m_VarWet = Math.Clamp(value, min, max);
9497
9499 {
9502 }
9503 }
9504
9505 override void AddWet(
float value)
9506 {
9508 }
9509
9511 {
9513 }
9514
9516 {
9518 }
9519
9521 {
9523 }
9524
9526 {
9528 }
9529
9531 {
9533 }
9534
9536 {
9539 if (newLevel != oldLevel)
9540 {
9542 }
9543 }
9544
9546 {
9547 SetWeightDirty();
9548 }
9549
9551 {
9552 return GetWetLevelInternal(
m_VarWet);
9553 }
9554
9555
9556
9558 {
9560 }
9561
9563 {
9565 }
9566
9568 {
9570 }
9571
9573 {
9575 }
9576
9577
9578
9580 {
9581 if (ConfigIsExisting("itemModelLength"))
9582 {
9583 return ConfigGetFloat("itemModelLength");
9584 }
9585 return 0;
9586 }
9587
9589 {
9590 if (ConfigIsExisting("itemAttachOffset"))
9591 {
9592 return ConfigGetFloat("itemAttachOffset");
9593 }
9594 return 0;
9595 }
9596
9597 override void SetCleanness(
int value,
bool allow_client =
false)
9598 {
9599 if (!IsServerCheck(allow_client))
9600 return;
9601
9603
9605
9608 }
9609
9611 {
9613 }
9614
9616 {
9617 return true;
9618 }
9619
9620
9621
9622
9624 {
9626 }
9627
9629 {
9631 }
9632
9633
9634
9635
9636 override void SetColor(
int r,
int g,
int b,
int a)
9637 {
9643 }
9645 override void GetColor(out
int r,out
int g,out
int b,out
int a)
9646 {
9651 }
9652
9654 {
9656 }
9657
9660 {
9661 int r,g,b,a;
9663 r = r/255;
9664 g = g/255;
9665 b = b/255;
9666 a = a/255;
9667 return MiscGameplayFunctions.GetColorString(r, g, b, a);
9668 }
9669
9670
9671
9672 override void SetLiquidType(
int value,
bool allow_client =
false)
9673 {
9674 if (!IsServerCheck(allow_client))
9675 return;
9676
9681 }
9682
9684 {
9685 return ConfigGetInt("varLiquidTypeInit");
9686 }
9687
9689 {
9691 }
9692
9694 {
9696 SetFrozen(false);
9697 }
9698
9701 {
9702 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9703 }
9704
9705
9708 {
9709 PlayerBase nplayer;
9710 if (PlayerBase.CastTo(nplayer, player))
9711 {
9713
9714 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9715 }
9716 }
9717
9718
9721 {
9722 PlayerBase nplayer;
9723 if (PlayerBase.CastTo(nplayer,player))
9724 {
9725
9726 nplayer.SetEnableQuickBarEntityShortcut(this,false);
9727
9728 }
9729
9730
9731 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
9732
9733
9734 if (HasEnergyManager())
9735 {
9736 GetCompEM().UpdatePlugState();
9737 }
9738 }
9739
9740
9742 {
9743 super.OnPlacementStarted(player);
9744
9746 }
9747
9748 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
9749 {
9751 {
9752 m_AdminLog.OnPlacementComplete(player,
this);
9753 }
9754
9755 super.OnPlacementComplete(player, position, orientation);
9756 }
9757
9758
9759
9760
9761
9763 {
9765 {
9766 return true;
9767 }
9768 else
9769 {
9770 return false;
9771 }
9772 }
9773
9774
9776 {
9778 {
9780 }
9781 }
9782
9783
9785 {
9787 }
9788
9790 {
9792 }
9793
9794 override void InsertAgent(
int agent,
float count = 1)
9795 {
9796 if (count < 1)
9797 return;
9798
9800 }
9801
9804 {
9806 }
9807
9808
9810 {
9812 }
9813
9814
9815
9816
9817
9818
9819
9820
9821
9822
9823
9824
9825
9826
9827
9828
9829
9830
9831
9832
9833
9834
9835
9836
9837
9838
9839
9840
9841
9842
9843
9844
9845
9846
9847
9848
9849
9850
9851
9852
9853
9854
9856 {
9858 return false;
9859 return true;
9860 }
9861
9863 {
9864
9866 }
9867
9868
9871 {
9872 super.CheckForRoofLimited(timeTresholdMS);
9873
9875 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
9876 {
9877 m_PreviousRoofTestTime = time;
9878 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
9879 }
9880 }
9881
9882
9884 {
9886 {
9887 return 0;
9888 }
9889
9890 if (GetInventory().GetAttachmentSlotsCount() != 0)
9891 {
9892 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
9893 if (filter)
9894 return filter.GetProtectionLevel(type, false, system);
9895 else
9896 return 0;
9897 }
9898
9899 string subclassPath, entryName;
9900
9901 switch (type)
9902 {
9904 entryName = "biological";
9905 break;
9907 entryName = "chemical";
9908 break;
9909 default:
9910 entryName = "biological";
9911 break;
9912 }
9913
9914 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
9915
9917 }
9918
9919
9920
9923 {
9924 if (!IsMagazine())
9926
9928 }
9929
9930
9931
9932
9933
9938 {
9939 return true;
9940 }
9941
9943 {
9945 }
9946
9947
9948
9949
9950
9952 {
9953 if (parent)
9954 {
9955 if (parent.IsInherited(DayZInfected))
9956 return true;
9957
9958 if (!parent.IsRuined())
9959 return true;
9960 }
9961
9962 return true;
9963 }
9964
9966 {
9967 if (!super.CanPutAsAttachment(parent))
9968 {
9969 return false;
9970 }
9971
9972 if (!IsRuined() && !parent.IsRuined())
9973 {
9974 return true;
9975 }
9976
9977 return false;
9978 }
9979
9981 {
9982
9983
9984
9985
9986 return super.CanReceiveItemIntoCargo(item);
9987 }
9988
9990 {
9991
9992
9993
9994
9995 GameInventory attachmentInv = attachment.GetInventory();
9997 {
9998 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
9999 return false;
10000 }
10001
10002 InventoryLocation loc = new InventoryLocation();
10003 attachment.GetInventory().GetCurrentInventoryLocation(loc);
10004 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
10005 return false;
10006
10007 return super.CanReceiveAttachment(attachment, slotId);
10008 }
10009
10011 {
10012 if (!super.CanReleaseAttachment(attachment))
10013 return false;
10014
10015 return GetInventory().AreChildrenAccessible();
10016 }
10017
10018
10019
10020
10021
10022
10023
10024
10025
10026
10027
10028
10029
10030
10031
10032
10033
10034
10035
10036
10037
10039 {
10040 int id = muzzle_owner.GetMuzzleID();
10041 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
10042
10043 if (WPOF_array)
10044 {
10045 for (int i = 0; i < WPOF_array.Count(); i++)
10046 {
10047 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
10048
10049 if (WPOF)
10050 {
10051 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
10052 }
10053 }
10054 }
10055 }
10056
10057
10059 {
10060 int id = muzzle_owner.GetMuzzleID();
10062
10063 if (WPOBE_array)
10064 {
10065 for (int i = 0; i < WPOBE_array.Count(); i++)
10066 {
10067 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
10068
10069 if (WPOBE)
10070 {
10071 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10072 }
10073 }
10074 }
10075 }
10076
10077
10079 {
10080 int id = muzzle_owner.GetMuzzleID();
10081 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10082
10083 if (WPOOH_array)
10084 {
10085 for (int i = 0; i < WPOOH_array.Count(); i++)
10086 {
10087 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10088
10089 if (WPOOH)
10090 {
10091 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10092 }
10093 }
10094 }
10095 }
10096
10097
10099 {
10100 int id = muzzle_owner.GetMuzzleID();
10101 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10102
10103 if (WPOOH_array)
10104 {
10105 for (int i = 0; i < WPOOH_array.Count(); i++)
10106 {
10107 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10108
10109 if (WPOOH)
10110 {
10111 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10112 }
10113 }
10114 }
10115 }
10116
10117
10119 {
10120 int id = muzzle_owner.GetMuzzleID();
10121 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10122
10123 if (WPOOH_array)
10124 {
10125 for (int i = 0; i < WPOOH_array.Count(); i++)
10126 {
10127 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10128
10129 if (WPOOH)
10130 {
10131 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10132 }
10133 }
10134 }
10135 }
10136
10137
10138
10140 {
10142 {
10143 return true;
10144 }
10145
10146 return false;
10147 }
10148
10150 {
10152 {
10153 return true;
10154 }
10155
10156 return false;
10157 }
10158
10160 {
10162 {
10163 return true;
10164 }
10165
10166 return false;
10167 }
10168
10170 {
10171 return false;
10172 }
10173
10176 {
10177 return UATimeSpent.DEFAULT_DEPLOY;
10178 }
10179
10180
10181
10182
10184 {
10186 SetSynchDirty();
10187 }
10188
10190 {
10192 }
10193
10194
10196 {
10197 return false;
10198 }
10199
10202 {
10203 string att_type = "None";
10204
10205 if (ConfigIsExisting("soundAttType"))
10206 {
10207 att_type = ConfigGetString("soundAttType");
10208 }
10209
10211 }
10212
10214 {
10216 }
10217
10218
10219
10220
10221
10227
10229 {
10232
10234 }
10235
10236
10238 {
10240 return;
10241
10243
10246
10249
10250 SoundParameters params = new SoundParameters();
10254 }
10255
10256
10258 {
10260 return;
10261
10263 SetSynchDirty();
10264
10267 }
10268
10269
10271 {
10273 return;
10274
10276 SetSynchDirty();
10277
10280 }
10281
10283 {
10285 }
10286
10288 {
10290 }
10291
10294 {
10295 if (!
GetGame().IsDedicatedServer())
10296 {
10297 if (ConfigIsExisting("attachSoundSet"))
10298 {
10299 string cfg_path = "";
10300 string soundset = "";
10301 string type_name =
GetType();
10302
10305 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
10306 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
10307
10308 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
10309 {
10310 for (int i = 0; i < cfg_soundset_array.Count(); i++)
10311 {
10312 if (cfg_slot_array[i] == slot_type)
10313 {
10314 soundset = cfg_soundset_array[i];
10315 break;
10316 }
10317 }
10318 }
10319
10320 if (soundset != "")
10321 {
10322 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
10324 }
10325 }
10326 }
10327 }
10328
10330 {
10331
10332 }
10333
10334 void OnApply(PlayerBase player);
10335
10337 {
10338 return 1.0;
10339 };
10340
10342 {
10344 }
10345
10347 {
10349 }
10350
10352
10354 {
10355 SetDynamicPhysicsLifeTime(0.01);
10357 }
10358
10360 {
10361 array<string> zone_names = new array<string>;
10362 GetDamageZones(zone_names);
10363 for (int i = 0; i < zone_names.Count(); i++)
10364 {
10365 SetHealthMax(zone_names.Get(i),"Health");
10366 }
10367 SetHealthMax("","Health");
10368 }
10369
10372 {
10373 float global_health = GetHealth01("","Health");
10374 array<string> zones = new array<string>;
10375 GetDamageZones(zones);
10376
10377 for (int i = 0; i < zones.Count(); i++)
10378 {
10379 SetHealth01(zones.Get(i),"Health",global_health);
10380 }
10381 }
10382
10385 {
10386 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
10387 }
10388
10390 {
10391 if (!hasRootAsPlayer)
10392 {
10393 if (refParentIB)
10394 {
10395
10396 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
10397 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
10398
10399 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
10400 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
10401
10404 }
10405 else
10406 {
10407
10410 }
10411 }
10412 }
10413
10415 {
10417 {
10418 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
10419 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
10420 {
10421 float heatPermCoef = 1.0;
10423 while (ent)
10424 {
10425 heatPermCoef *= ent.GetHeatPermeabilityCoef();
10426 ent = ent.GetHierarchyParent();
10427 }
10428
10429 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
10430 }
10431 }
10432 }
10433
10435 {
10436
10437 EntityAI parent = GetHierarchyParent();
10438 if (!parent)
10439 {
10440 hasParent = false;
10441 hasRootAsPlayer = false;
10442 }
10443 else
10444 {
10445 hasParent = true;
10446 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
10447 refParentIB =
ItemBase.Cast(parent);
10448 }
10449 }
10450
10451 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
10452 {
10453
10454 }
10455
10457 {
10458
10459 return false;
10460 }
10461
10463 {
10464
10465
10466 return false;
10467 }
10468
10470 {
10471
10472 return false;
10473 }
10474
10477 {
10478 return !GetIsFrozen() &&
IsOpen();
10479 }
10480
10482 {
10483 bool hasParent = false, hasRootAsPlayer = false;
10485
10486 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
10487 bool foodDecay =
g_Game.IsFoodDecayEnabled();
10488
10489 if (wwtu || foodDecay)
10490 {
10494
10495 if (processWetness || processTemperature || processDecay)
10496 {
10498
10499 if (processWetness)
10500 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
10501
10502 if (processTemperature)
10504
10505 if (processDecay)
10506 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
10507 }
10508 }
10509 }
10510
10513 {
10515 }
10516
10518 {
10521
10522 return super.GetTemperatureFreezeThreshold();
10523 }
10524
10526 {
10529
10530 return super.GetTemperatureThawThreshold();
10531 }
10532
10534 {
10537
10538 return super.GetItemOverheatThreshold();
10539 }
10540
10542 {
10544 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
10545
10546 return super.GetTemperatureFreezeTime();
10547 }
10548
10550 {
10552 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
10553
10554 return super.GetTemperatureThawTime();
10555 }
10556
10561
10563 {
10564 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
10565 }
10566
10568 {
10569 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
10570 }
10571
10574 {
10576 }
10577
10579 {
10581 }
10582
10584 {
10586 }
10587
10590 {
10591 return null;
10592 }
10593
10596 {
10597 return false;
10598 }
10599
10601 {
10603 {
10606 if (!trg)
10607 {
10609 explosive = this;
10610 }
10611
10612 explosive.PairRemote(trg);
10614
10615 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
10616 trg.SetPersistentPairID(persistentID);
10617 explosive.SetPersistentPairID(persistentID);
10618
10619 return true;
10620 }
10621 return false;
10622 }
10623
10626 {
10627 float ret = 1.0;
10630 ret *= GetHealth01();
10631
10632 return ret;
10633 }
10634
10635 #ifdef DEVELOPER
10636 override void SetDebugItem()
10637 {
10638 super.SetDebugItem();
10639 _itemBase = this;
10640 }
10641
10643 {
10644 string text = super.GetDebugText();
10645
10647 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
10648
10649 return text;
10650 }
10651 #endif
10652
10654 {
10655 return true;
10656 }
10657
10659
10661
10663 {
10666 }
10667
10668
10676
10692}
10693
10695{
10697 if (entity)
10698 {
10699 bool is_item = entity.IsInherited(
ItemBase);
10700 if (is_item && full_quantity)
10701 {
10704 }
10705 }
10706 else
10707 {
10709 return NULL;
10710 }
10711 return entity;
10712}
10713
10715{
10716 if (item)
10717 {
10718 if (health > 0)
10719 item.SetHealth("", "", health);
10720
10721 if (item.CanHaveTemperature())
10722 {
10724 if (item.CanFreeze())
10725 item.SetFrozen(false);
10726 }
10727
10728 if (item.HasEnergyManager())
10729 {
10730 if (quantity >= 0)
10731 {
10732 item.GetCompEM().SetEnergy0To1(quantity);
10733 }
10734 else
10735 {
10737 }
10738 }
10739 else if (item.IsMagazine())
10740 {
10741 Magazine mag = Magazine.Cast(item);
10742 if (quantity >= 0)
10743 {
10744 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
10745 }
10746 else
10747 {
10749 }
10750
10751 }
10752 else
10753 {
10754 if (quantity >= 0)
10755 {
10756 item.SetQuantityNormalized(quantity, false);
10757 }
10758 else
10759 {
10761 }
10762
10763 }
10764 }
10765}
10766
10767#ifdef DEVELOPER
10769#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.