5829{
5831 {
5832 return true;
5833 }
5834};
5835
5836
5837
5839{
5843
5845
5848
5849
5850
5851
5852
5861
5867
5872
5877
5898 protected bool m_IsResultOfSplit
5899
5901
5906
5907
5908
5910
5914
5915
5916
5918
5921
5922
5923
5929
5930
5938
5941
5942
5944
5945
5947
5948
5953
5954
5959
5960
5962
5963
5965 {
5970
5971 if (!
GetGame().IsDedicatedServer())
5972 {
5974 {
5976
5978 {
5980 }
5981 }
5982
5985 }
5986
5987 m_OldLocation = null;
5988
5990 {
5992 }
5993
5994 if (ConfigIsExisting("headSelectionsToHide"))
5995 {
5998 }
5999
6001 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
6002 {
6004 }
6005
6007
6008 m_IsResultOfSplit = false;
6009
6011 }
6012
6014 {
6015 super.InitItemVariables();
6016
6022 m_Count = ConfigGetInt(
"count");
6023
6026
6031
6034
6039
6051
6055
6056
6059 if (ConfigIsExisting("canBeSplit"))
6060 {
6063 }
6064
6066 if (ConfigIsExisting("itemBehaviour"))
6068
6069
6072 RegisterNetSyncVariableInt("m_VarLiquidType");
6073 RegisterNetSyncVariableInt("m_Cleanness",0,1);
6074
6075 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
6076 RegisterNetSyncVariableFloat("m_ImpactSpeed");
6077 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
6078
6079 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
6080 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
6081 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
6082 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
6083
6084 RegisterNetSyncVariableBool("m_IsBeingPlaced");
6085 RegisterNetSyncVariableBool("m_IsTakeable");
6086 RegisterNetSyncVariableBool("m_IsHologram");
6087
6090 {
6093 }
6094
6096
6098 if (ConfigIsExisting("temperaturePerQuantityWeight"))
6100
6101 }
6102
6104 {
6106 }
6107
6109 {
6112 {
6117 }
6118 }
6119
6120 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
6121 {
6123 {
6126 }
6127
6129 }
6130
6132 {
6138 }
6139
6141
6143 {
6145
6146 if (!action)
6147 {
6148 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
6149 return;
6150 }
6151
6153 if (!ai)
6154 {
6156 return;
6157 }
6158
6160 if (!action_array)
6161 {
6162 action_array = new array<ActionBase_Basic>;
6164 }
6165 if (LogManager.IsActionLogEnable())
6166 {
6167 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
6168 }
6169
6170 if (action_array.Find(action) != -1)
6171 {
6172 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
6173 }
6174 else
6175 {
6176 action_array.Insert(action);
6177 }
6178 }
6179
6181 {
6183 ActionBase action = player.GetActionManager().GetAction(actionName);
6186
6187 if (action_array)
6188 {
6189 action_array.RemoveItem(action);
6190 }
6191 }
6192
6193
6194
6196 {
6197 ActionOverrideData overrideData = new ActionOverrideData();
6201
6203 if (!actionMap)
6204 {
6207 }
6208
6209 actionMap.Insert(this.
Type(), overrideData);
6210
6211 }
6212
6214
6216
6217
6219 {
6222
6225
6226 string config_to_search = "CfgVehicles";
6227 string muzzle_owner_config;
6228
6230 {
6231 if (IsInherited(Weapon))
6232 config_to_search = "CfgWeapons";
6233
6234 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6235
6236 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
6237
6239
6240 if (config_OnFire_subclass_count > 0)
6241 {
6242 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
6243
6244 for (int i = 0; i < config_OnFire_subclass_count; i++)
6245 {
6246 string particle_class = "";
6248 string config_OnFire_entry = config_OnFire_class + particle_class;
6249 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
6250 WPOF_array.Insert(WPOF);
6251 }
6252
6253
6255 }
6256 }
6257
6259 {
6260 config_to_search = "CfgWeapons";
6261 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6262
6263 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
6264
6266
6267 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
6268 {
6269 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
6270
6271 for (i = 0; i < config_OnBulletCasingEject_count; i++)
6272 {
6273 string particle_class2 = "";
6275 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
6276 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
6277 WPOBE_array.Insert(WPOBE);
6278 }
6279
6280
6282 }
6283 }
6284 }
6285
6286
6288 {
6291
6293 {
6294 string config_to_search = "CfgVehicles";
6295
6296 if (IsInherited(Weapon))
6297 config_to_search = "CfgWeapons";
6298
6299 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6300 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
6301
6302 if (
GetGame().ConfigIsExisting(config_OnOverheating_class))
6303 {
6304
6306
6308 {
6310 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
6312 return;
6313 }
6314
6317
6318
6319
6321 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
6322
6323 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
6324 {
6325 string particle_class = "";
6327 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
6329
6330 if (entry_type == CT_CLASS)
6331 {
6332 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
6333 WPOOH_array.Insert(WPOF);
6334 }
6335 }
6336
6337
6339 }
6340 }
6341 }
6342
6344 {
6346 }
6347
6349 {
6351 {
6353
6356
6359
6360 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6361 }
6362 }
6363
6365 {
6367 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6368
6370 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6371
6373 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6374
6376 {
6378 }
6379 }
6380
6382 {
6384 }
6385
6387 {
6390 else
6392
6394 {
6397 }
6398 else
6399 {
6402
6405 }
6406
6408 }
6409
6411 {
6413 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6414 }
6415
6417 {
6419 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6421 }
6422
6424 {
6426 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6427 }
6428
6430 {
6433
6434 OverheatingParticle OP = new OverheatingParticle();
6439
6441 }
6442
6444 {
6447
6448 return -1;
6449 }
6450
6452 {
6454 {
6457
6458 for (int i = count; i > 0; --i)
6459 {
6460 int id = i - 1;
6463
6466
6467 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
6468 {
6469 if (p)
6470 {
6473 }
6474 }
6475 }
6476 }
6477 }
6478
6480 {
6482 {
6484 {
6485 int id = i - 1;
6487
6488 if (OP)
6489 {
6491
6492 if (p)
6493 {
6495 }
6496
6497 delete OP;
6498 }
6499 }
6500
6503 }
6504 }
6505
6508 {
6509 return 0.0;
6510 }
6511
6512
6514 {
6515 return 250;
6516 }
6517
6519 {
6520 return 0;
6521 }
6522
6525 {
6527 return true;
6528
6529 return false;
6530 }
6531
6534 {
6537
6539 {
6541 }
6542 else
6543 {
6544
6546 }
6547
6549 }
6550
6557 {
6558 return -1;
6559 }
6560
6561
6562
6563
6565 {
6567 {
6569 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6570
6571 if (r_index >= 0)
6572 {
6573 InventoryLocation r_il = new InventoryLocation;
6574 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6575
6576 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6579 {
6580 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6581 }
6583 {
6584 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6585 }
6586
6587 }
6588
6589 player.GetHumanInventory().ClearUserReservedLocation(this);
6590 }
6591
6594 }
6595
6596
6597
6598
6600 {
6601 return ItemBase.m_DebugActionsMask;
6602 }
6603
6605 {
6606 return ItemBase.m_DebugActionsMask & mask;
6607 }
6608
6610 {
6611 ItemBase.m_DebugActionsMask = mask;
6612 }
6613
6615 {
6616 ItemBase.m_DebugActionsMask |= mask;
6617 }
6618
6620 {
6621 ItemBase.m_DebugActionsMask &= ~mask;
6622 }
6623
6625 {
6627 {
6629 }
6630 else
6631 {
6633 }
6634 }
6635
6636
6638 {
6639 if (GetEconomyProfile())
6640 {
6641 float q_max = GetEconomyProfile().GetQuantityMax();
6642 if (q_max > 0)
6643 {
6644 float q_min = GetEconomyProfile().GetQuantityMin();
6645 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
6646
6648 {
6649 ComponentEnergyManager comp = GetCompEM();
6651 {
6653 }
6654 }
6656 {
6658
6659 }
6660
6661 }
6662 }
6663 }
6664
6667 {
6668 EntityAI parent = GetHierarchyParent();
6669
6670 if (parent)
6671 {
6672 InventoryLocation inventory_location_to_lock = new InventoryLocation;
6673 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
6674 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
6675 }
6676 }
6677
6680 {
6681 EntityAI parent = GetHierarchyParent();
6682
6683 if (parent)
6684 {
6685 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
6686 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
6687 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
6688 }
6689 }
6690
6692 {
6693
6694
6695
6696
6698
6700 {
6701 if (ScriptInputUserData.CanStoreInputUserData())
6702 {
6703 ScriptInputUserData ctx = new ScriptInputUserData;
6709 ctx.
Write(use_stack_max);
6712
6714 {
6715 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
6716 }
6717 }
6718 }
6719 else if (!
GetGame().IsMultiplayer())
6720 {
6722 }
6723 }
6724
6726 {
6728 }
6729
6731 {
6733 }
6734
6736 {
6738 }
6739
6741 {
6742
6743 return false;
6744 }
6745
6747 {
6748 return false;
6749 }
6750
6754 {
6755 return false;
6756 }
6757
6759 {
6760 return "";
6761 }
6762
6764
6766 {
6767 return false;
6768 }
6769
6771 {
6772 return true;
6773 }
6774
6775
6776
6778 {
6779 return true;
6780 }
6781
6783 {
6784 return true;
6785 }
6786
6788 {
6789 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6791 }
6792
6794 {
6796 }
6797
6799 {
6801 if (!is_being_placed)
6803 SetSynchDirty();
6804 }
6805
6806
6808
6810 {
6812 }
6813
6815 {
6817 }
6818
6820 {
6821 return 1;
6822 }
6823
6825 {
6826 return false;
6827 }
6828
6830 {
6832 SetSynchDirty();
6833 }
6834
6835
6836
6837
6838
6839
6840
6841
6842
6843
6844
6845
6846
6847
6848
6849
6850
6851
6852
6853
6854
6855
6856
6857
6858
6859
6860
6861
6862
6863
6864
6865
6866
6867
6868
6870 {
6871 super.OnMovedInsideCargo(container);
6872
6873 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6874 }
6875
6876 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
6877 {
6878 super.EEItemLocationChanged(oldLoc,newLoc);
6879
6880 PlayerBase new_player = null;
6881 PlayerBase old_player = null;
6882
6883 if (newLoc.GetParent())
6884 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
6885
6886 if (oldLoc.GetParent())
6887 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
6888
6890 {
6891 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
6892
6893 if (r_index >= 0)
6894 {
6895 InventoryLocation r_il = new InventoryLocation;
6896 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6897
6898 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6901 {
6902 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6903 }
6905 {
6906 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6907 }
6908
6909 }
6910 }
6911
6913 {
6914 if (new_player)
6915 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
6916
6917 if (new_player == old_player)
6918 {
6919
6920 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
6921 {
6923 {
6924 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
6925 {
6926 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6927 }
6928 }
6929 else
6930 {
6931 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6932 }
6933 }
6934
6935 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
6936 {
6937 int type = oldLoc.GetType();
6939 {
6940 oldLoc.GetParent().GetOnSetLock().Invoke(this);
6941 }
6943 {
6944 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
6945 }
6946 }
6947 if (!m_OldLocation)
6948 {
6949 m_OldLocation = new InventoryLocation;
6950 }
6951 m_OldLocation.Copy(oldLoc);
6952 }
6953 else
6954 {
6955 if (m_OldLocation)
6956 {
6957 m_OldLocation.Reset();
6958 }
6959 }
6960
6962 }
6963 else
6964 {
6965 if (new_player)
6966 {
6967 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
6968 if (res_index >= 0)
6969 {
6970 InventoryLocation il = new InventoryLocation;
6971 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
6973 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
6976 {
6977 il.
GetParent().GetOnReleaseLock().Invoke(it);
6978 }
6980 {
6982 }
6983
6984 }
6985 }
6987 {
6988
6990 }
6991
6992 if (m_OldLocation)
6993 {
6994 m_OldLocation.Reset();
6995 }
6996 }
6997 }
6998
6999 override void EOnContact(IEntity other, Contact extra)
7000 {
7002 {
7003 int liquidType = -1;
7005 if (impactSpeed > 0.0)
7006 {
7008 #ifndef SERVER
7010 #else
7012 SetSynchDirty();
7013 #endif
7015 }
7016 }
7017
7018 #ifdef SERVER
7019 if (GetCompEM() && GetCompEM().IsPlugged())
7020 {
7021 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
7022 GetCompEM().UnplugThis();
7023 }
7024 #endif
7025 }
7026
7028
7030 {
7032 }
7033
7035 {
7036
7037 }
7038
7040 {
7041 super.OnItemLocationChanged(old_owner, new_owner);
7042
7043 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
7044 PlayerBase playerNew = PlayerBase.Cast(new_owner);
7045
7046 if (!relatedPlayer && playerNew)
7047 relatedPlayer = playerNew;
7048
7049 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
7050 {
7052 if (actionMgr)
7053 {
7054 ActionBase currentAction = actionMgr.GetRunningAction();
7055 if (currentAction)
7057 }
7058 }
7059
7060 Man ownerPlayerOld = null;
7061 Man ownerPlayerNew = null;
7062
7063 if (old_owner)
7064 {
7065 if (old_owner.
IsMan())
7066 {
7067 ownerPlayerOld = Man.Cast(old_owner);
7068 }
7069 else
7070 {
7071 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
7072 }
7073 }
7074 else
7075 {
7077 {
7079
7080 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
7081 {
7082 GetCompEM().UnplugThis();
7083 }
7084 }
7085 }
7086
7087 if (new_owner)
7088 {
7089 if (new_owner.
IsMan())
7090 {
7091 ownerPlayerNew = Man.Cast(new_owner);
7092 }
7093 else
7094 {
7095 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
7096 }
7097 }
7098
7099 if (ownerPlayerOld != ownerPlayerNew)
7100 {
7101 if (ownerPlayerOld)
7102 {
7103 array<EntityAI> subItemsExit = new array<EntityAI>;
7105 for (int i = 0; i < subItemsExit.Count(); i++)
7106 {
7109 }
7110 }
7111
7112 if (ownerPlayerNew)
7113 {
7114 array<EntityAI> subItemsEnter = new array<EntityAI>;
7116 for (int j = 0; j < subItemsEnter.Count(); j++)
7117 {
7120 }
7121 }
7122 }
7123 else if (ownerPlayerNew != null)
7124 {
7125 PlayerBase nplayer;
7126 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
7127 {
7128 array<EntityAI> subItemsUpdate = new array<EntityAI>;
7130 for (int k = 0; k < subItemsUpdate.Count(); k++)
7131 {
7133 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
7134 }
7135 }
7136 }
7137
7138 if (old_owner)
7139 old_owner.OnChildItemRemoved(this);
7140 if (new_owner)
7141 new_owner.OnChildItemReceived(this);
7142 }
7143
7144
7146 {
7147 super.EEDelete(parent);
7148 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
7149 if (player)
7150 {
7152
7153 if (player.IsAlive())
7154 {
7155 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7156 if (r_index >= 0)
7157 {
7158 InventoryLocation r_il = new InventoryLocation;
7159 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7160
7161 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7164 {
7165 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7166 }
7168 {
7169 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7170 }
7171
7172 }
7173
7174 player.RemoveQuickBarEntityShortcut(this);
7175 }
7176 }
7177 }
7178
7180 {
7181 super.EEKilled(killer);
7182
7185 {
7186 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
7187 {
7188 if (IsMagazine())
7189 {
7190 if (Magazine.Cast(this).GetAmmoCount() > 0)
7191 {
7193 }
7194 }
7195 else
7196 {
7198 }
7199 }
7200 }
7201 }
7202
7204 {
7205 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7206
7207 super.OnWasAttached(parent, slot_id);
7208
7211
7213 }
7214
7216 {
7217 super.OnWasDetached(parent, slot_id);
7218
7221 }
7222
7224 {
7225 int idx;
7228
7229 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7230 if (inventory_slots.Count() < 1)
7231 {
7232 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
7233 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
7234 }
7235 else
7236 {
7237 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
7238 }
7239
7240 idx = inventory_slots.Find(slot);
7241 if (idx < 0)
7242 return "";
7243
7244 return attach_types.Get(idx);
7245 }
7246
7248 {
7249 int idx = -1;
7250 string slot;
7251
7254
7255 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7256 if (inventory_slots.Count() < 1)
7257 {
7258 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
7259 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7260 }
7261 else
7262 {
7263 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
7264 if (detach_types.Count() < 1)
7265 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7266 }
7267
7268 for (int i = 0; i < inventory_slots.Count(); i++)
7269 {
7270 slot = inventory_slots.Get(i);
7271 }
7272
7273 if (slot != "")
7274 {
7275 if (detach_types.Count() == 1)
7276 idx = 0;
7277 else
7278 idx = inventory_slots.Find(slot);
7279 }
7280 if (idx < 0)
7281 return "";
7282
7283 return detach_types.Get(idx);
7284 }
7285
7287 {
7288
7290
7291
7292 float min_time = 1;
7293 float max_time = 3;
7294 float delay = Math.RandomFloat(min_time, max_time);
7295
7296 explode_timer.Run(delay, this, "DoAmmoExplosion");
7297 }
7298
7300 {
7301 Magazine magazine = Magazine.Cast(this);
7302 int pop_sounds_count = 6;
7303 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
7304
7305
7306 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
7307 string sound_name = pop_sounds[ sound_idx ];
7309
7310
7311 magazine.ServerAddAmmoCount(-1);
7312
7313
7314 float min_temp_to_explode = 100;
7315
7316 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
7317 {
7319 }
7320 }
7321
7322
7323 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
7324 {
7325 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
7326
7327 const int CHANCE_DAMAGE_CARGO = 4;
7328 const int CHANCE_DAMAGE_ATTACHMENT = 1;
7329 const int CHANCE_DAMAGE_NOTHING = 2;
7330
7332 {
7333 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
7334 int chances;
7335 int rnd;
7336
7337 if (GetInventory().GetCargo())
7338 {
7339 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7340 rnd = Math.RandomInt(0,chances);
7341
7342 if (rnd < CHANCE_DAMAGE_CARGO)
7343 {
7345 }
7346 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
7347 {
7349 }
7350 }
7351 else
7352 {
7353 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7354 rnd = Math.RandomInt(0,chances);
7355
7356 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
7357 {
7359 }
7360 }
7361 }
7362 }
7363
7365 {
7366 if (GetInventory().GetCargo())
7367 {
7368 int item_count = GetInventory().GetCargo().GetItemCount();
7369 if (item_count > 0)
7370 {
7371 int random_pick = Math.RandomInt(0, item_count);
7373 if (!item.IsExplosive())
7374 {
7375 item.AddHealth("","",damage);
7376 return true;
7377 }
7378 }
7379 }
7380 return false;
7381 }
7382
7384 {
7385 int attachment_count = GetInventory().AttachmentCount();
7386 if (attachment_count > 0)
7387 {
7388 int random_pick = Math.RandomInt(0, attachment_count);
7389 ItemBase attachment =
ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
7390 if (!attachment.IsExplosive())
7391 {
7392 attachment.AddHealth("","",damage);
7393 return true;
7394 }
7395 }
7396 return false;
7397 }
7398
7400 {
7402 }
7403
7405 {
7407 return GetInventory().CanRemoveEntity();
7408
7409 return false;
7410 }
7411
7413 {
7414
7416 return false;
7417
7418
7420 return false;
7421
7422
7423
7425 if (delta == 0)
7426 return false;
7427
7428
7429 return true;
7430 }
7431
7433 {
7435 {
7436 if (ScriptInputUserData.CanStoreInputUserData())
7437 {
7438 ScriptInputUserData ctx = new ScriptInputUserData;
7443 ctx.
Write(destination_entity);
7447 }
7448 }
7449 else if (!
GetGame().IsMultiplayer())
7450 {
7452 }
7453 }
7454
7456 {
7457 float split_quantity_new;
7461 InventoryLocation loc = new InventoryLocation;
7462
7463 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7464 {
7466 split_quantity_new = stack_max;
7467 else
7469
7471 {
7472 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7473 if (new_item)
7474 {
7475 new_item.SetResultOfSplit(true);
7476 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7478 new_item.
SetQuantity(split_quantity_new,
false,
true);
7479 }
7480 }
7481 }
7482 else if (destination_entity && slot_id == -1)
7483 {
7484 if (quantity > stack_max)
7485 split_quantity_new = stack_max;
7486 else
7487 split_quantity_new = quantity;
7488
7490 {
7492 {
7495 }
7496
7497 if (new_item)
7498 {
7499 new_item.SetResultOfSplit(true);
7500 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7502 new_item.
SetQuantity(split_quantity_new,
false,
true);
7503 }
7504 }
7505 }
7506 else
7507 {
7508 if (stack_max != 0)
7509 {
7511 {
7513 }
7514
7515 if (split_quantity_new == 0)
7516 {
7517 if (!
GetGame().IsMultiplayer())
7518 player.PhysicalPredictiveDropItem(this);
7519 else
7520 player.ServerDropEntity(this);
7521 return;
7522 }
7523
7525 {
7527
7528 if (new_item)
7529 {
7530 new_item.SetResultOfSplit(true);
7531 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7534 new_item.PlaceOnSurface();
7535 }
7536 }
7537 }
7538 }
7539 }
7540
7542 {
7543 float split_quantity_new;
7547 InventoryLocation loc = new InventoryLocation;
7548
7549 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7550 {
7552 split_quantity_new = stack_max;
7553 else
7555
7557 {
7558 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7559 if (new_item)
7560 {
7561 new_item.SetResultOfSplit(true);
7562 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7564 new_item.
SetQuantity(split_quantity_new,
false,
true);
7565 }
7566 }
7567 }
7568 else if (destination_entity && slot_id == -1)
7569 {
7570 if (quantity > stack_max)
7571 split_quantity_new = stack_max;
7572 else
7573 split_quantity_new = quantity;
7574
7576 {
7578 {
7581 }
7582
7583 if (new_item)
7584 {
7585 new_item.SetResultOfSplit(true);
7586 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7588 new_item.
SetQuantity(split_quantity_new,
false,
true);
7589 }
7590 }
7591 }
7592 else
7593 {
7594 if (stack_max != 0)
7595 {
7597 {
7599 }
7600
7602 {
7604
7605 if (new_item)
7606 {
7607 new_item.SetResultOfSplit(true);
7608 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7611 new_item.PlaceOnSurface();
7612 }
7613 }
7614 }
7615 }
7616 }
7617
7619 {
7621 {
7622 if (ScriptInputUserData.CanStoreInputUserData())
7623 {
7624 ScriptInputUserData ctx = new ScriptInputUserData;
7629 dst.WriteToContext(ctx);
7631 }
7632 }
7633 else if (!
GetGame().IsMultiplayer())
7634 {
7636 }
7637 }
7638
7640 {
7642 {
7643 if (ScriptInputUserData.CanStoreInputUserData())
7644 {
7645 ScriptInputUserData ctx = new ScriptInputUserData;
7650 ctx.
Write(destination_entity);
7656 }
7657 }
7658 else if (!
GetGame().IsMultiplayer())
7659 {
7661 }
7662 }
7663
7665 {
7667 }
7668
7670 {
7672 float split_quantity_new;
7674 if (dst.IsValid())
7675 {
7676 int slot_id = dst.GetSlot();
7678
7679 if (quantity > stack_max)
7680 split_quantity_new = stack_max;
7681 else
7682 split_quantity_new = quantity;
7683
7685 {
7687
7688 if (new_item)
7689 {
7690 new_item.SetResultOfSplit(true);
7691 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7693 new_item.
SetQuantity(split_quantity_new,
false,
true);
7694 }
7695
7696 return new_item;
7697 }
7698 }
7699
7700 return null;
7701 }
7702
7704 {
7706 float split_quantity_new;
7708 if (destination_entity)
7709 {
7711 if (quantity > stackable)
7712 split_quantity_new = stackable;
7713 else
7714 split_quantity_new = quantity;
7715
7717 {
7718 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
7719 if (new_item)
7720 {
7721 new_item.SetResultOfSplit(true);
7722 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7724 new_item.
SetQuantity(split_quantity_new,
false,
true);
7725 }
7726 }
7727 }
7728 }
7729
7731 {
7733 {
7734 if (ScriptInputUserData.CanStoreInputUserData())
7735 {
7736 ScriptInputUserData ctx = new ScriptInputUserData;
7741 ItemBase destination_entity =
this;
7742 ctx.
Write(destination_entity);
7746 }
7747 }
7748 else if (!
GetGame().IsMultiplayer())
7749 {
7751 }
7752 }
7753
7755 {
7757 float split_quantity_new;
7759 if (player)
7760 {
7762 if (quantity > stackable)
7763 split_quantity_new = stackable;
7764 else
7765 split_quantity_new = quantity;
7766
7768 {
7769 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
7770 new_item =
ItemBase.Cast(in_hands);
7771 if (new_item)
7772 {
7773 new_item.SetResultOfSplit(true);
7774 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7776 new_item.SetQuantity(split_quantity_new, false, true);
7777 }
7778 }
7779 }
7780 }
7781
7783 {
7785 float split_quantity_new = Math.Floor(quantity * 0.5);
7786
7788 return;
7789
7791
7792 if (new_item)
7793 {
7794 if (new_item.GetQuantityMax() < split_quantity_new)
7795 {
7796 split_quantity_new = new_item.GetQuantityMax();
7797 }
7798
7799 new_item.SetResultOfSplit(true);
7800 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7801
7803 {
7806 }
7807 else
7808 {
7810 new_item.
SetQuantity(split_quantity_new,
false,
true);
7811 }
7812 }
7813 }
7814
7816 {
7818 float split_quantity_new = Math.Floor(quantity / 2);
7819
7821 return;
7822
7823 InventoryLocation invloc = new InventoryLocation;
7825
7827 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
7828
7829 if (new_item)
7830 {
7831 if (new_item.GetQuantityMax() < split_quantity_new)
7832 {
7833 split_quantity_new = new_item.GetQuantityMax();
7834 }
7836 {
7839 }
7840 else if (split_quantity_new > 1)
7841 {
7843 new_item.
SetQuantity(split_quantity_new,
false,
true);
7844 }
7845 }
7846 }
7847
7850 {
7851 SetWeightDirty();
7853
7854 if (parent)
7855 parent.OnAttachmentQuantityChangedEx(this, delta);
7856
7858 {
7860 {
7862 }
7864 {
7865 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
7867 }
7868 }
7869
7870 }
7871
7874 {
7875
7876 }
7877
7880 {
7882 }
7883
7885 {
7886 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
7887
7889 {
7890 if (newLevel == GameConstants.STATE_RUINED)
7891 {
7893 EntityAI parent = GetHierarchyParent();
7894 if (parent && parent.IsFireplace())
7895 {
7896 CargoBase cargo = GetInventory().GetCargo();
7897 if (cargo)
7898 {
7900 {
7902 }
7903 }
7904 }
7905 }
7906
7908 {
7909
7911 return;
7912 }
7913
7914 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
7915 {
7917 }
7918 }
7919 }
7920
7921
7923 {
7924 super.OnRightClick();
7925
7927 {
7929 {
7930 if (ScriptInputUserData.CanStoreInputUserData())
7931 {
7932 EntityAI root = GetHierarchyRoot();
7933 Man playerOwner = GetHierarchyRootPlayer();
7934 InventoryLocation dst = new InventoryLocation;
7935
7936
7937 if (!playerOwner && root && root == this)
7938 {
7940 }
7941 else
7942 {
7943
7944 GetInventory().GetCurrentInventoryLocation(dst);
7946 {
7949 {
7951 }
7952 else
7953 {
7955
7956
7957 if (
GetGame().
GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
7958 {
7960 }
7961 else
7962 {
7963 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
7964 }
7965 }
7966 }
7967 }
7968
7969 ScriptInputUserData ctx = new ScriptInputUserData;
7977 }
7978 }
7979 else if (!
GetGame().IsMultiplayer())
7980 {
7982 }
7983 }
7984 }
7985
7987 {
7988 if (root)
7989 {
7990 vector m4[4];
7991 root.GetTransform(m4);
7992 dst.SetGround(this, m4);
7993 }
7994 else
7995 {
7996 GetInventory().GetCurrentInventoryLocation(dst);
7997 }
7998 }
7999
8000 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
8001 {
8002
8003 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
8004 return false;
8005
8006 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
8007 return false;
8008
8009
8011 return false;
8012
8013
8014 Magazine mag = Magazine.Cast(this);
8015 if (mag)
8016 {
8017 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
8018 return false;
8019
8020 if (stack_max_limit)
8021 {
8022 Magazine other_mag = Magazine.Cast(other_item);
8023 if (other_item)
8024 {
8025 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
8026 return false;
8027 }
8028
8029 }
8030 }
8031 else
8032 {
8033
8035 return false;
8036
8038 return false;
8039 }
8040
8041 PlayerBase player = null;
8042 if (CastTo(player, GetHierarchyRootPlayer()))
8043 {
8044 if (player.GetInventory().HasAttachment(this))
8045 return false;
8046
8047 if (player.IsItemsToDelete())
8048 return false;
8049 }
8050
8051 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
8052 return false;
8053
8054 int slotID;
8056 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
8057 return false;
8058
8059 return true;
8060 }
8061
8063 {
8065 }
8066
8068 {
8069 return m_IsResultOfSplit;
8070 }
8071
8073 {
8074 m_IsResultOfSplit = value;
8075 }
8076
8078 {
8080 }
8081
8083 {
8084 float other_item_quantity = other_item.GetQuantity();
8085 float this_free_space;
8086
8088
8090
8091 if (other_item_quantity > this_free_space)
8092 {
8093 return this_free_space;
8094 }
8095 else
8096 {
8097 return other_item_quantity;
8098 }
8099 }
8100
8102 {
8104 }
8105
8107 {
8109 return;
8110
8111 if (!IsMagazine() && other_item)
8112 {
8114 if (quantity_used != 0)
8115 {
8116 float hp1 = GetHealth01("","");
8117 float hp2 = other_item.GetHealth01("","");
8118 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
8119 hpResult = hpResult / (
GetQuantity() + quantity_used);
8120
8121 hpResult *= GetMaxHealth();
8122 Math.Round(hpResult);
8123 SetHealth("", "Health", hpResult);
8124
8126 other_item.AddQuantity(-quantity_used);
8127 }
8128 }
8130 }
8131
8133 {
8134 #ifdef SERVER
8135 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
8136 GetHierarchyParent().IncreaseLifetimeUp();
8137 #endif
8138 };
8139
8141 {
8142 PlayerBase p = PlayerBase.Cast(player);
8143
8144 array<int> recipesIds = p.m_Recipes;
8145 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8146 if (moduleRecipesManager)
8147 {
8148 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
8149 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
8150 }
8151
8152 for (int i = 0;i < recipesIds.Count(); i++)
8153 {
8154 int key = recipesIds.Get(i);
8155 string recipeName = moduleRecipesManager.GetRecipeName(key);
8157 }
8158 }
8159
8160
8161 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
8162 {
8163 super.GetDebugActions(outputList);
8164
8165
8171
8172
8177
8182
8183
8187
8188
8190 {
8194 }
8195
8198
8199
8203
8205
8206 InventoryLocation loc = new InventoryLocation();
8207 GetInventory().GetCurrentInventoryLocation(loc);
8209 {
8210 if (Gizmo_IsSupported())
8213 }
8214
8216 }
8217
8218
8219
8220
8222 {
8223 super.OnAction(action_id, player, ctx);
8224
8226 {
8227 switch (action_id)
8228 {
8231 return true;
8234 return true;
8235 }
8236 }
8237
8239 {
8240 switch (action_id)
8241 {
8243 Delete();
8244 return true;
8245 }
8246 }
8247
8248 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
8249 {
8250 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8251 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
8252 PlayerBase p = PlayerBase.Cast(player);
8253 if (
EActions.RECIPES_RANGE_START < 1000)
8254 {
8255 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
8256 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
8257 }
8258 }
8259 #ifndef SERVER
8260 else if (action_id ==
EActions.WATCH_PLAYER)
8261 {
8262 PluginDeveloper.SetDeveloperItemClientEx(player);
8263 }
8264 #endif
8266 {
8267 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
8268 {
8269 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
8270 OnDebugButtonPressServer(id + 1);
8271 }
8272
8273 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
8274 {
8275 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
8277 }
8278
8279 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
8280 {
8281 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
8283 }
8284
8285 else if (action_id ==
EActions.ADD_QUANTITY)
8286 {
8287 if (IsMagazine())
8288 {
8289 Magazine mag = Magazine.Cast(this);
8290 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
8291 }
8292 else
8293 {
8295 }
8296
8297 if (m_EM)
8298 {
8299 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
8300 }
8301
8302 }
8303
8304 else if (action_id ==
EActions.REMOVE_QUANTITY)
8305 {
8306 if (IsMagazine())
8307 {
8308 Magazine mag2 = Magazine.Cast(this);
8309 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
8310 }
8311 else
8312 {
8314 }
8315 if (m_EM)
8316 {
8317 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
8318 }
8319
8320 }
8321
8322 else if (action_id ==
EActions.SET_QUANTITY_0)
8323 {
8325
8326 if (m_EM)
8327 {
8328 m_EM.SetEnergy(0);
8329 }
8330 }
8331
8332 else if (action_id ==
EActions.SET_MAX_QUANTITY)
8333 {
8335
8336 if (m_EM)
8337 {
8338 m_EM.SetEnergy(m_EM.GetEnergyMax());
8339 }
8340 }
8341
8342 else if (action_id ==
EActions.ADD_HEALTH)
8343 {
8344 AddHealth("","",GetMaxHealth("","Health")/5);
8345 }
8346 else if (action_id ==
EActions.REMOVE_HEALTH)
8347 {
8348 AddHealth("","",-GetMaxHealth("","Health")/5);
8349 }
8350 else if (action_id ==
EActions.DESTROY_HEALTH)
8351 {
8352 SetHealth01("","",0);
8353 }
8354 else if (action_id ==
EActions.WATCH_ITEM)
8355 {
8357 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
8358 #ifdef DEVELOPER
8359 SetDebugDeveloper_item(this);
8360 #endif
8361 }
8362
8363 else if (action_id ==
EActions.ADD_TEMPERATURE)
8364 {
8365 AddTemperature(20);
8366
8367 }
8368
8369 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
8370 {
8371 AddTemperature(-20);
8372
8373 }
8374
8375 else if (action_id ==
EActions.FLIP_FROZEN)
8376 {
8377 SetFrozen(!GetIsFrozen());
8378
8379 }
8380
8381 else if (action_id ==
EActions.ADD_WETNESS)
8382 {
8384
8385 }
8386
8387 else if (action_id ==
EActions.REMOVE_WETNESS)
8388 {
8390
8391 }
8392
8393 else if (action_id ==
EActions.LIQUIDTYPE_UP)
8394 {
8397
8398
8399 }
8400
8401 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
8402 {
8405 }
8406
8407 else if (action_id ==
EActions.MAKE_SPECIAL)
8408 {
8409 auto debugParams = DebugSpawnParams.WithPlayer(player);
8410 OnDebugSpawnEx(debugParams);
8411 }
8412
8413 }
8414
8415
8416 return false;
8417 }
8418
8419
8420
8421
8425
8428
8429
8430
8432 {
8433 return false;
8434 }
8435
8436
8438 {
8439 return true;
8440 }
8441
8442
8444 {
8445 return true;
8446 }
8447
8448
8449
8451 {
8452 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
8454 }
8455
8458 {
8459 return null;
8460 }
8461
8463 {
8464 return false;
8465 }
8466
8468 {
8469 return false;
8470 }
8471
8475
8476
8478 {
8479 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8480 return module_repairing.CanRepair(this, item_repair_kit);
8481 }
8482
8483
8484 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
8485 {
8486 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8487 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
8488 }
8489
8490
8492 {
8493
8494
8495
8496
8497
8498
8499
8500
8501 return 1;
8502 }
8503
8504
8505
8507 {
8509 }
8510
8511
8512
8514 {
8516 }
8517
8518
8527 {
8528 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8529
8530 if (player)
8531 {
8532 player.MessageStatus(text);
8533 }
8534 }
8535
8536
8545 {
8546 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8547
8548 if (player)
8549 {
8550 player.MessageAction(text);
8551 }
8552 }
8553
8554
8563 {
8564 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8565
8566 if (player)
8567 {
8568 player.MessageFriendly(text);
8569 }
8570 }
8571
8572
8581 {
8582 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8583
8584 if (player)
8585 {
8586 player.MessageImportant(text);
8587 }
8588 }
8589
8591 {
8592 return true;
8593 }
8594
8595
8596 override bool KindOf(
string tag)
8597 {
8598 bool found = false;
8599 string item_name = this.
GetType();
8602
8603 int array_size = item_tag_array.Count();
8604 for (int i = 0; i < array_size; i++)
8605 {
8606 if (item_tag_array.Get(i) == tag)
8607 {
8608 found = true;
8609 break;
8610 }
8611 }
8612 return found;
8613 }
8614
8615
8617 {
8618
8619 super.OnRPC(sender, rpc_type,ctx);
8620
8621
8622 switch (rpc_type)
8623 {
8624 #ifndef SERVER
8625 case ERPCs.RPC_SOUND_LOCK_ATTACH:
8626 Param2<bool, string> p = new Param2<bool, string>(false, "");
8627
8629 return;
8630
8631 bool play = p.param1;
8632 string soundSet = p.param2;
8633
8634 if (play)
8635 {
8637 {
8639 {
8641 }
8642 }
8643 else
8644 {
8646 }
8647 }
8648 else
8649 {
8651 }
8652
8653 break;
8654 #endif
8655
8656 }
8657
8659 {
8661 }
8662 }
8663
8664
8665
8666
8668 {
8669 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8670 return plugin.GetID(
name);
8671 }
8672
8674 {
8675 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8676 return plugin.GetName(id);
8677 }
8678
8681 {
8682
8683
8684 int varFlags;
8685 if (!ctx.
Read(varFlags))
8686 return;
8687
8688 if (varFlags & ItemVariableFlags.FLOAT)
8689 {
8691 }
8692 }
8693
8695 {
8696
8697 super.SerializeNumericalVars(floats_out);
8698
8699
8700
8702 {
8704 }
8705
8707 {
8709 }
8710
8712 {
8714 }
8715
8717 {
8722 }
8723
8725 {
8727 }
8728 }
8729
8731 {
8732
8733 super.DeSerializeNumericalVars(floats);
8734
8735
8736 int index = 0;
8737 int mask = Math.Round(floats.Get(index));
8738
8739 index++;
8740
8742 {
8744 {
8746 }
8747 else
8748 {
8749 float quantity = floats.Get(index);
8751 }
8752 index++;
8753 }
8754
8756 {
8757 float wet = floats.Get(index);
8759 index++;
8760 }
8761
8763 {
8764 int liquidtype = Math.Round(floats.Get(index));
8766 index++;
8767 }
8768
8770 {
8772 index++;
8774 index++;
8776 index++;
8778 index++;
8779 }
8780
8782 {
8783 int cleanness = Math.Round(floats.Get(index));
8785 index++;
8786 }
8787 }
8788
8790 {
8791 super.WriteVarsToCTX(ctx);
8792
8793
8795 {
8797 }
8798
8800 {
8802 }
8803
8805 {
8807 }
8808
8810 {
8811 int r,g,b,a;
8817 }
8818
8820 {
8822 }
8823 }
8824
8826 {
8827 if (!super.ReadVarsFromCTX(ctx,version))
8828 return false;
8829
8830 int intValue;
8831 float value;
8832
8833 if (version < 140)
8834 {
8835 if (!ctx.
Read(intValue))
8836 return false;
8837
8838 m_VariablesMask = intValue;
8839 }
8840
8842 {
8843 if (!ctx.
Read(value))
8844 return false;
8845
8847 {
8849 }
8850 else
8851 {
8853 }
8854 }
8855
8856 if (version < 140)
8857 {
8859 {
8860 if (!ctx.
Read(value))
8861 return false;
8862 SetTemperatureDirect(value);
8863 }
8864 }
8865
8867 {
8868 if (!ctx.
Read(value))
8869 return false;
8871 }
8872
8874 {
8875 if (!ctx.
Read(intValue))
8876 return false;
8878 }
8879
8881 {
8882 int r,g,b,a;
8884 return false;
8886 return false;
8888 return false;
8890 return false;
8891
8893 }
8894
8896 {
8897 if (!ctx.
Read(intValue))
8898 return false;
8900 }
8901
8902 if (version >= 138 && version < 140)
8903 {
8905 {
8906 if (!ctx.
Read(intValue))
8907 return false;
8908 SetFrozen(intValue);
8909 }
8910 }
8911
8912 return true;
8913 }
8914
8915
8917 {
8920 {
8922 }
8923
8924 if (!super.OnStoreLoad(ctx, version))
8925 {
8927 return false;
8928 }
8929
8930 if (version >= 114)
8931 {
8932 bool hasQuickBarIndexSaved;
8933
8934 if (!ctx.
Read(hasQuickBarIndexSaved))
8935 {
8937 return false;
8938 }
8939
8940 if (hasQuickBarIndexSaved)
8941 {
8942 int itmQBIndex;
8943
8944
8945 if (!ctx.
Read(itmQBIndex))
8946 {
8948 return false;
8949 }
8950
8951 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
8952 if (itmQBIndex != -1 && parentPlayer)
8953 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
8954 }
8955 }
8956 else
8957 {
8958
8959 PlayerBase player;
8960 int itemQBIndex;
8961 if (version ==
int.
MAX)
8962 {
8963 if (!ctx.
Read(itemQBIndex))
8964 {
8966 return false;
8967 }
8968 }
8969 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
8970 {
8971
8972 if (!ctx.
Read(itemQBIndex))
8973 {
8975 return false;
8976 }
8977 if (itemQBIndex != -1 && player)
8978 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
8979 }
8980 }
8981
8982 if (version < 140)
8983 {
8984
8985 if (!LoadVariables(ctx, version))
8986 {
8988 return false;
8989 }
8990 }
8991
8992
8994 {
8996 return false;
8997 }
8998 if (version >= 132)
8999 {
9001 if (raib)
9002 {
9004 {
9006 return false;
9007 }
9008 }
9009 }
9010
9012 return true;
9013 }
9014
9015
9016
9018 {
9019 super.OnStoreSave(ctx);
9020
9021 PlayerBase player;
9022 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
9023 {
9025
9026 int itemQBIndex = -1;
9027 itemQBIndex = player.FindQuickBarEntityIndex(this);
9028 ctx.
Write(itemQBIndex);
9029 }
9030 else
9031 {
9033 }
9034
9036
9038 if (raib)
9039 {
9041 }
9042 }
9043
9044
9046 {
9047 super.AfterStoreLoad();
9048
9050 {
9052 }
9053
9055 {
9058 }
9059 }
9060
9062 {
9063 super.EEOnAfterLoad();
9064
9066 {
9068 }
9069
9072 }
9073
9075 {
9076 return false;
9077 }
9078
9079
9080
9082 {
9084 {
9085 #ifdef PLATFORM_CONSOLE
9086
9088 {
9090 if (menu)
9091 {
9093 }
9094 }
9095 #endif
9096 }
9097
9099 {
9102 }
9103
9105 {
9106 SetWeightDirty();
9108 }
9110 {
9113 }
9114
9116 {
9119 }
9121 {
9124 }
9125
9126 super.OnVariablesSynchronized();
9127 }
9128
9129
9130
9132 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
9133 {
9134 if (!IsServerCheck(allow_client))
9135 return false;
9136
9138 return false;
9139
9142
9143 if (value <= (min + 0.001))
9144 value = min;
9145
9146 if (value == min)
9147 {
9148 if (destroy_config)
9149 {
9150 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
9151 if (dstr)
9152 {
9154 this.Delete();
9155 return true;
9156 }
9157 }
9158 else if (destroy_forced)
9159 {
9161 this.Delete();
9162 return true;
9163 }
9164
9166 }
9167
9170
9172 {
9174
9175 if (delta)
9177 }
9178
9180
9181 return false;
9182 }
9183
9184
9186 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9187 {
9189 }
9190
9192 {
9195 }
9196
9198 {
9201 }
9202
9204 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9205 {
9206 float value_clamped = Math.Clamp(value, 0, 1);
9208 SetQuantity(result, destroy_config, destroy_forced);
9209 }
9210
9211
9214 {
9216 }
9217
9219 {
9221 }
9222
9223
9224
9225
9226
9227
9228
9229
9230
9231
9233 {
9234 int slot = -1;
9235 if (GetInventory())
9236 {
9237 InventoryLocation il = new InventoryLocation;
9238 GetInventory().GetCurrentInventoryLocation(il);
9240 }
9241
9243 }
9244
9246 {
9247 float quantity_max = 0;
9248
9250 {
9251 if (attSlotID != -1)
9252 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
9253
9254 if (quantity_max <= 0)
9256 }
9257
9258 if (quantity_max <= 0)
9260
9261 return quantity_max;
9262 }
9263
9265 {
9267 }
9268
9270 {
9272 }
9273
9274
9276 {
9278 }
9279
9281 {
9283 }
9284
9286 {
9288 }
9289
9290
9292 {
9293
9294 float weightEx = GetWeightEx();
9295 float special = GetInventoryAndCargoWeight();
9296 return weightEx - special;
9297 }
9298
9299
9301 {
9303 }
9304
9306 {
9308 {
9309 #ifdef DEVELOPER
9310 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9311 {
9312 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
9314 }
9315 #endif
9316
9318 }
9319 else if (HasEnergyManager())
9320 {
9321 #ifdef DEVELOPER
9322 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9323 {
9324 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
9325 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
9326 }
9327 #endif
9328 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
9329 }
9330 else
9331 {
9332 #ifdef DEVELOPER
9333 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9334 {
9335 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
9336 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
9337 }
9338 #endif
9339 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
9340 }
9341 }
9342
9345 {
9346 int item_count = 0;
9348
9349 if (GetInventory().GetCargo() != NULL)
9350 {
9351 item_count = GetInventory().GetCargo().GetItemCount();
9352 }
9353
9354 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
9355 {
9356 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
9357 if (item)
9358 item_count += item.GetNumberOfItems();
9359 }
9360 return item_count;
9361 }
9362
9365 {
9366 float weight = 0;
9367 float wetness = 1;
9368 if (include_wetness)
9371 {
9372 weight = wetness * m_ConfigWeight;
9373 }
9375 {
9376 weight = 1;
9377 }
9378 return weight;
9379 }
9380
9381
9382
9384 {
9385 if ((
GetGame().IsServer() || !
GetGame().IsMultiplayer()) && GetInventory())
9386 {
9387 GameInventory inv = GetInventory();
9388 array<EntityAI> items = new array<EntityAI>;
9390 for (int i = 0; i < items.Count(); i++)
9391 {
9393 if (item)
9394 {
9396 }
9397 }
9398 }
9399 }
9400
9401
9402
9403
9405 {
9406 float energy = 0;
9407 if (HasEnergyManager())
9408 {
9409 energy = GetCompEM().GetEnergy();
9410 }
9411 return energy;
9412 }
9413
9414
9416 {
9417 super.OnEnergyConsumed();
9418
9420 }
9421
9423 {
9424 super.OnEnergyAdded();
9425
9427 }
9428
9429
9431 {
9432 if (
GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
9433 {
9435 {
9436 float energy_0to1 = GetCompEM().GetEnergy0To1();
9438 }
9439 }
9440 }
9441
9442
9444 {
9445 return ConfigGetFloat("heatIsolation");
9446 }
9447
9449 {
9451 }
9452
9454 {
9455 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
9456 if (
GetGame().ConfigIsExisting(paramPath))
9458
9459 return 0.0;
9460 }
9461
9463 {
9464 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
9465 if (
GetGame().ConfigIsExisting(paramPath))
9467
9468 return 0.0;
9469 }
9470
9471 override void SetWet(
float value,
bool allow_client =
false)
9472 {
9473 if (!IsServerCheck(allow_client))
9474 return;
9475
9478
9480
9481 m_VarWet = Math.Clamp(value, min, max);
9482
9484 {
9487 }
9488 }
9489
9490 override void AddWet(
float value)
9491 {
9493 }
9494
9496 {
9498 }
9499
9501 {
9503 }
9504
9506 {
9508 }
9509
9511 {
9513 }
9514
9516 {
9518 }
9519
9521 {
9524 if (newLevel != oldLevel)
9525 {
9527 }
9528 }
9529
9531 {
9532 SetWeightDirty();
9533 }
9534
9536 {
9537 return GetWetLevelInternal(
m_VarWet);
9538 }
9539
9540
9541
9543 {
9545 }
9546
9548 {
9550 }
9551
9553 {
9555 }
9556
9558 {
9560 }
9561
9562
9563
9565 {
9566 if (ConfigIsExisting("itemModelLength"))
9567 {
9568 return ConfigGetFloat("itemModelLength");
9569 }
9570 return 0;
9571 }
9572
9574 {
9575 if (ConfigIsExisting("itemAttachOffset"))
9576 {
9577 return ConfigGetFloat("itemAttachOffset");
9578 }
9579 return 0;
9580 }
9581
9582 override void SetCleanness(
int value,
bool allow_client =
false)
9583 {
9584 if (!IsServerCheck(allow_client))
9585 return;
9586
9588
9590
9593 }
9594
9596 {
9598 }
9599
9601 {
9602 return true;
9603 }
9604
9605
9606
9607
9609 {
9611 }
9612
9614 {
9616 }
9617
9618
9619
9620
9621 override void SetColor(
int r,
int g,
int b,
int a)
9622 {
9628 }
9630 override void GetColor(out
int r,out
int g,out
int b,out
int a)
9631 {
9636 }
9637
9639 {
9641 }
9642
9645 {
9646 int r,g,b,a;
9648 r = r/255;
9649 g = g/255;
9650 b = b/255;
9651 a = a/255;
9652 return MiscGameplayFunctions.GetColorString(r, g, b, a);
9653 }
9654
9655
9656
9657 override void SetLiquidType(
int value,
bool allow_client =
false)
9658 {
9659 if (!IsServerCheck(allow_client))
9660 return;
9661
9666 }
9667
9669 {
9670 return ConfigGetInt("varLiquidTypeInit");
9671 }
9672
9674 {
9676 }
9677
9679 {
9681 SetFrozen(false);
9682 }
9683
9686 {
9687 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9688 }
9689
9690
9693 {
9694 PlayerBase nplayer;
9695 if (PlayerBase.CastTo(nplayer, player))
9696 {
9698
9699 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9700 }
9701 }
9702
9703
9706 {
9707 PlayerBase nplayer;
9708 if (PlayerBase.CastTo(nplayer,player))
9709 {
9710
9711 nplayer.SetEnableQuickBarEntityShortcut(this,false);
9712
9713 }
9714
9715
9716 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
9717
9718
9719 if (HasEnergyManager())
9720 {
9721 GetCompEM().UpdatePlugState();
9722 }
9723 }
9724
9725
9727 {
9728 super.OnPlacementStarted(player);
9729
9731 }
9732
9733 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
9734 {
9736 {
9737 m_AdminLog.OnPlacementComplete(player,
this);
9738 }
9739
9740 super.OnPlacementComplete(player, position, orientation);
9741 }
9742
9743
9744
9745
9746
9748 {
9750 {
9751 return true;
9752 }
9753 else
9754 {
9755 return false;
9756 }
9757 }
9758
9759
9761 {
9763 {
9765 }
9766 }
9767
9768
9770 {
9772 }
9773
9775 {
9777 }
9778
9779 override void InsertAgent(
int agent,
float count = 1)
9780 {
9781 if (count < 1)
9782 return;
9783
9785 }
9786
9789 {
9791 }
9792
9793
9795 {
9797 }
9798
9799
9800
9801
9802
9803
9804
9805
9806
9807
9808
9809
9810
9811
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
9841 {
9843 return false;
9844 return true;
9845 }
9846
9848 {
9849
9851 }
9852
9853
9856 {
9857 super.CheckForRoofLimited(timeTresholdMS);
9858
9860 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
9861 {
9862 m_PreviousRoofTestTime = time;
9863 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
9864 }
9865 }
9866
9867
9869 {
9871 {
9872 return 0;
9873 }
9874
9875 if (GetInventory().GetAttachmentSlotsCount() != 0)
9876 {
9877 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
9878 if (filter)
9879 return filter.GetProtectionLevel(type, false, system);
9880 else
9881 return 0;
9882 }
9883
9884 string subclassPath, entryName;
9885
9886 switch (type)
9887 {
9889 entryName = "biological";
9890 break;
9892 entryName = "chemical";
9893 break;
9894 default:
9895 entryName = "biological";
9896 break;
9897 }
9898
9899 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
9900
9902 }
9903
9904
9905
9908 {
9909 if (!IsMagazine())
9911
9913 }
9914
9915
9916
9917
9918
9923 {
9924 return true;
9925 }
9926
9928 {
9930 }
9931
9932
9933
9934
9935
9937 {
9938 if (parent)
9939 {
9940 if (parent.IsInherited(DayZInfected))
9941 return true;
9942
9943 if (!parent.IsRuined())
9944 return true;
9945 }
9946
9947 return true;
9948 }
9949
9951 {
9952 if (!super.CanPutAsAttachment(parent))
9953 {
9954 return false;
9955 }
9956
9957 if (!IsRuined() && !parent.IsRuined())
9958 {
9959 return true;
9960 }
9961
9962 return false;
9963 }
9964
9966 {
9967
9968
9969
9970
9971 return super.CanReceiveItemIntoCargo(item);
9972 }
9973
9975 {
9976
9977
9978
9979
9980 GameInventory attachmentInv = attachment.GetInventory();
9982 {
9983 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
9984 return false;
9985 }
9986
9987 InventoryLocation loc = new InventoryLocation();
9988 attachment.GetInventory().GetCurrentInventoryLocation(loc);
9989 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
9990 return false;
9991
9992 return super.CanReceiveAttachment(attachment, slotId);
9993 }
9994
9996 {
9997 if (!super.CanReleaseAttachment(attachment))
9998 return false;
9999
10000 return GetInventory().AreChildrenAccessible();
10001 }
10002
10003
10004
10005
10006
10007
10008
10009
10010
10011
10012
10013
10014
10015
10016
10017
10018
10019
10020
10021
10022
10024 {
10025 int id = muzzle_owner.GetMuzzleID();
10026 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
10027
10028 if (WPOF_array)
10029 {
10030 for (int i = 0; i < WPOF_array.Count(); i++)
10031 {
10032 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
10033
10034 if (WPOF)
10035 {
10036 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
10037 }
10038 }
10039 }
10040 }
10041
10042
10044 {
10045 int id = muzzle_owner.GetMuzzleID();
10047
10048 if (WPOBE_array)
10049 {
10050 for (int i = 0; i < WPOBE_array.Count(); i++)
10051 {
10052 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
10053
10054 if (WPOBE)
10055 {
10056 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10057 }
10058 }
10059 }
10060 }
10061
10062
10064 {
10065 int id = muzzle_owner.GetMuzzleID();
10066 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10067
10068 if (WPOOH_array)
10069 {
10070 for (int i = 0; i < WPOOH_array.Count(); i++)
10071 {
10072 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10073
10074 if (WPOOH)
10075 {
10076 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10077 }
10078 }
10079 }
10080 }
10081
10082
10084 {
10085 int id = muzzle_owner.GetMuzzleID();
10086 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10087
10088 if (WPOOH_array)
10089 {
10090 for (int i = 0; i < WPOOH_array.Count(); i++)
10091 {
10092 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10093
10094 if (WPOOH)
10095 {
10096 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10097 }
10098 }
10099 }
10100 }
10101
10102
10104 {
10105 int id = muzzle_owner.GetMuzzleID();
10106 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10107
10108 if (WPOOH_array)
10109 {
10110 for (int i = 0; i < WPOOH_array.Count(); i++)
10111 {
10112 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10113
10114 if (WPOOH)
10115 {
10116 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10117 }
10118 }
10119 }
10120 }
10121
10122
10123
10125 {
10127 {
10128 return true;
10129 }
10130
10131 return false;
10132 }
10133
10135 {
10137 {
10138 return true;
10139 }
10140
10141 return false;
10142 }
10143
10145 {
10147 {
10148 return true;
10149 }
10150
10151 return false;
10152 }
10153
10155 {
10156 return false;
10157 }
10158
10161 {
10162 return UATimeSpent.DEFAULT_DEPLOY;
10163 }
10164
10165
10166
10167
10169 {
10171 SetSynchDirty();
10172 }
10173
10175 {
10177 }
10178
10179
10181 {
10182 return false;
10183 }
10184
10187 {
10188 string att_type = "None";
10189
10190 if (ConfigIsExisting("soundAttType"))
10191 {
10192 att_type = ConfigGetString("soundAttType");
10193 }
10194
10196 }
10197
10199 {
10201 }
10202
10203
10204
10205
10206
10212
10214 {
10217
10219 }
10220
10221
10223 {
10225 return;
10226
10228
10231
10234
10235 SoundParameters params = new SoundParameters();
10239 }
10240
10241
10243 {
10245 return;
10246
10248 SetSynchDirty();
10249
10252 }
10253
10254
10256 {
10258 return;
10259
10261 SetSynchDirty();
10262
10265 }
10266
10268 {
10270 }
10271
10273 {
10275 }
10276
10279 {
10280 if (!
GetGame().IsDedicatedServer())
10281 {
10282 if (ConfigIsExisting("attachSoundSet"))
10283 {
10284 string cfg_path = "";
10285 string soundset = "";
10286 string type_name =
GetType();
10287
10290 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
10291 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
10292
10293 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
10294 {
10295 for (int i = 0; i < cfg_soundset_array.Count(); i++)
10296 {
10297 if (cfg_slot_array[i] == slot_type)
10298 {
10299 soundset = cfg_soundset_array[i];
10300 break;
10301 }
10302 }
10303 }
10304
10305 if (soundset != "")
10306 {
10307 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
10309 }
10310 }
10311 }
10312 }
10313
10315 {
10316
10317 }
10318
10319 void OnApply(PlayerBase player);
10320
10322 {
10323 return 1.0;
10324 };
10325
10327 {
10329 }
10330
10332 {
10334 }
10335
10337
10339 {
10340 SetDynamicPhysicsLifeTime(0.01);
10342 }
10343
10345 {
10346 array<string> zone_names = new array<string>;
10347 GetDamageZones(zone_names);
10348 for (int i = 0; i < zone_names.Count(); i++)
10349 {
10350 SetHealthMax(zone_names.Get(i),"Health");
10351 }
10352 SetHealthMax("","Health");
10353 }
10354
10357 {
10358 float global_health = GetHealth01("","Health");
10359 array<string> zones = new array<string>;
10360 GetDamageZones(zones);
10361
10362 for (int i = 0; i < zones.Count(); i++)
10363 {
10364 SetHealth01(zones.Get(i),"Health",global_health);
10365 }
10366 }
10367
10370 {
10371 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
10372 }
10373
10375 {
10376 if (!hasRootAsPlayer)
10377 {
10378 if (refParentIB)
10379 {
10380
10381 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
10382 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
10383
10384 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
10385 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
10386
10389 }
10390 else
10391 {
10392
10395 }
10396 }
10397 }
10398
10400 {
10402 {
10403 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
10404 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
10405 {
10406 float heatPermCoef = 1.0;
10408 while (ent)
10409 {
10410 heatPermCoef *= ent.GetHeatPermeabilityCoef();
10411 ent = ent.GetHierarchyParent();
10412 }
10413
10414 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
10415 }
10416 }
10417 }
10418
10420 {
10421
10422 EntityAI parent = GetHierarchyParent();
10423 if (!parent)
10424 {
10425 hasParent = false;
10426 hasRootAsPlayer = false;
10427 }
10428 else
10429 {
10430 hasParent = true;
10431 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
10432 refParentIB =
ItemBase.Cast(parent);
10433 }
10434 }
10435
10436 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
10437 {
10438
10439 }
10440
10442 {
10443
10444 return false;
10445 }
10446
10448 {
10449
10450
10451 return false;
10452 }
10453
10455 {
10456
10457 return false;
10458 }
10459
10462 {
10463 return !GetIsFrozen() &&
IsOpen();
10464 }
10465
10467 {
10468 bool hasParent = false, hasRootAsPlayer = false;
10470
10471 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
10472 bool foodDecay =
g_Game.IsFoodDecayEnabled();
10473
10474 if (wwtu || foodDecay)
10475 {
10479
10480 if (processWetness || processTemperature || processDecay)
10481 {
10483
10484 if (processWetness)
10485 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
10486
10487 if (processTemperature)
10489
10490 if (processDecay)
10491 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
10492 }
10493 }
10494 }
10495
10498 {
10500 }
10501
10503 {
10506
10507 return super.GetTemperatureFreezeThreshold();
10508 }
10509
10511 {
10514
10515 return super.GetTemperatureThawThreshold();
10516 }
10517
10519 {
10522
10523 return super.GetItemOverheatThreshold();
10524 }
10525
10527 {
10529 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
10530
10531 return super.GetTemperatureFreezeTime();
10532 }
10533
10535 {
10537 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
10538
10539 return super.GetTemperatureThawTime();
10540 }
10541
10546
10548 {
10549 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
10550 }
10551
10553 {
10554 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
10555 }
10556
10559 {
10561 }
10562
10564 {
10566 }
10567
10569 {
10571 }
10572
10575 {
10576 return null;
10577 }
10578
10581 {
10582 return false;
10583 }
10584
10586 {
10588 {
10591 if (!trg)
10592 {
10594 explosive = this;
10595 }
10596
10597 explosive.PairRemote(trg);
10599
10600 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
10601 trg.SetPersistentPairID(persistentID);
10602 explosive.SetPersistentPairID(persistentID);
10603
10604 return true;
10605 }
10606 return false;
10607 }
10608
10611 {
10612 float ret = 1.0;
10615 ret *= GetHealth01();
10616
10617 return ret;
10618 }
10619
10620 #ifdef DEVELOPER
10621 override void SetDebugItem()
10622 {
10623 super.SetDebugItem();
10624 _itemBase = this;
10625 }
10626
10628 {
10629 string text = super.GetDebugText();
10630
10632 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
10633
10634 return text;
10635 }
10636 #endif
10637
10639 {
10640 return true;
10641 }
10642
10644
10646
10648 {
10651 }
10652
10653
10661
10677}
10678
10680{
10682 if (entity)
10683 {
10684 bool is_item = entity.IsInherited(
ItemBase);
10685 if (is_item && full_quantity)
10686 {
10689 }
10690 }
10691 else
10692 {
10694 return NULL;
10695 }
10696 return entity;
10697}
10698
10700{
10701 if (item)
10702 {
10703 if (health > 0)
10704 item.SetHealth("", "", health);
10705
10706 if (item.CanHaveTemperature())
10707 {
10709 if (item.CanFreeze())
10710 item.SetFrozen(false);
10711 }
10712
10713 if (item.HasEnergyManager())
10714 {
10715 if (quantity >= 0)
10716 {
10717 item.GetCompEM().SetEnergy0To1(quantity);
10718 }
10719 else
10720 {
10722 }
10723 }
10724 else if (item.IsMagazine())
10725 {
10726 Magazine mag = Magazine.Cast(item);
10727 if (quantity >= 0)
10728 {
10729 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
10730 }
10731 else
10732 {
10734 }
10735
10736 }
10737 else
10738 {
10739 if (quantity >= 0)
10740 {
10741 item.SetQuantityNormalized(quantity, false);
10742 }
10743 else
10744 {
10746 }
10747
10748 }
10749 }
10750}
10751
10752#ifdef DEVELOPER
10754#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.