5790{
5792 {
5793 return true;
5794 }
5795};
5796
5797
5798
5800{
5804
5806
5809
5810
5811
5812
5813
5822
5828
5833
5838
5859 protected bool m_IsResultOfSplit
5860
5862
5867
5868
5869
5871
5875
5876
5877
5879
5882
5883
5884
5890
5891
5899
5902
5903
5905
5906
5908
5909
5914
5915
5920
5921
5923
5924
5926 {
5931
5932 if (!
GetGame().IsDedicatedServer())
5933 {
5935 {
5937
5939 {
5941 }
5942 }
5943
5946 }
5947
5948 m_OldLocation = null;
5949
5951 {
5953 }
5954
5955 if (ConfigIsExisting("headSelectionsToHide"))
5956 {
5959 }
5960
5962 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
5963 {
5965 }
5966
5968
5969 m_IsResultOfSplit = false;
5970
5972 }
5973
5975 {
5976 super.InitItemVariables();
5977
5983 m_Count = ConfigGetInt(
"count");
5984
5987
5992
5995
6000
6012
6016
6017
6020 if (ConfigIsExisting("canBeSplit"))
6021 {
6024 }
6025
6027 if (ConfigIsExisting("itemBehaviour"))
6029
6030
6033 RegisterNetSyncVariableInt("m_VarLiquidType");
6034 RegisterNetSyncVariableInt("m_Cleanness",0,1);
6035
6036 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
6037 RegisterNetSyncVariableFloat("m_ImpactSpeed");
6038 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
6039
6040 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
6041 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
6042 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
6043 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
6044
6045 RegisterNetSyncVariableBool("m_IsBeingPlaced");
6046 RegisterNetSyncVariableBool("m_IsTakeable");
6047 RegisterNetSyncVariableBool("m_IsHologram");
6048
6051 {
6054 }
6055
6057
6059 if (ConfigIsExisting("temperaturePerQuantityWeight"))
6061
6062 }
6063
6065 {
6067 }
6068
6070 {
6073 {
6078 }
6079 }
6080
6081 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
6082 {
6084 {
6087 }
6088
6090 }
6091
6093 {
6099 }
6100
6102
6104 {
6106
6107 if (!action)
6108 {
6109 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
6110 return;
6111 }
6112
6114 if (!ai)
6115 {
6117 return;
6118 }
6119
6121 if (!action_array)
6122 {
6123 action_array = new array<ActionBase_Basic>;
6125 }
6126 if (LogManager.IsActionLogEnable())
6127 {
6128 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
6129 }
6130
6131 if (action_array.Find(action) != -1)
6132 {
6133 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
6134 }
6135 else
6136 {
6137 action_array.Insert(action);
6138 }
6139 }
6140
6142 {
6144 ActionBase action = player.GetActionManager().GetAction(actionName);
6147
6148 if (action_array)
6149 {
6150 action_array.RemoveItem(action);
6151 }
6152 }
6153
6154
6155
6157 {
6158 ActionOverrideData overrideData = new ActionOverrideData();
6162
6164 if (!actionMap)
6165 {
6168 }
6169
6170 actionMap.Insert(this.
Type(), overrideData);
6171
6172 }
6173
6175
6177
6178
6180 {
6183
6186
6187 string config_to_search = "CfgVehicles";
6188 string muzzle_owner_config;
6189
6191 {
6192 if (IsInherited(Weapon))
6193 config_to_search = "CfgWeapons";
6194
6195 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6196
6197 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
6198
6200
6201 if (config_OnFire_subclass_count > 0)
6202 {
6203 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
6204
6205 for (int i = 0; i < config_OnFire_subclass_count; i++)
6206 {
6207 string particle_class = "";
6209 string config_OnFire_entry = config_OnFire_class + particle_class;
6210 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
6211 WPOF_array.Insert(WPOF);
6212 }
6213
6214
6216 }
6217 }
6218
6220 {
6221 config_to_search = "CfgWeapons";
6222 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6223
6224 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
6225
6227
6228 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
6229 {
6230 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
6231
6232 for (i = 0; i < config_OnBulletCasingEject_count; i++)
6233 {
6234 string particle_class2 = "";
6236 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
6237 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
6238 WPOBE_array.Insert(WPOBE);
6239 }
6240
6241
6243 }
6244 }
6245 }
6246
6247
6249 {
6252
6254 {
6255 string config_to_search = "CfgVehicles";
6256
6257 if (IsInherited(Weapon))
6258 config_to_search = "CfgWeapons";
6259
6260 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6261 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
6262
6263 if (
GetGame().ConfigIsExisting(config_OnOverheating_class))
6264 {
6265
6267
6269 {
6271 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
6273 return;
6274 }
6275
6278
6279
6280
6282 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
6283
6284 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
6285 {
6286 string particle_class = "";
6288 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
6290
6291 if (entry_type == CT_CLASS)
6292 {
6293 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
6294 WPOOH_array.Insert(WPOF);
6295 }
6296 }
6297
6298
6300 }
6301 }
6302 }
6303
6305 {
6307 }
6308
6310 {
6312 {
6314
6317
6320
6321 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6322 }
6323 }
6324
6326 {
6328 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6329
6331 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6332
6334 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6335
6337 {
6339 }
6340 }
6341
6343 {
6345 }
6346
6348 {
6351 else
6353
6355 {
6358 }
6359 else
6360 {
6363
6366 }
6367
6369 }
6370
6372 {
6374 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6375 }
6376
6378 {
6380 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6382 }
6383
6385 {
6387 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6388 }
6389
6391 {
6394
6395 OverheatingParticle OP = new OverheatingParticle();
6400
6402 }
6403
6405 {
6408
6409 return -1;
6410 }
6411
6413 {
6415 {
6418
6419 for (int i = count; i > 0; --i)
6420 {
6421 int id = i - 1;
6424
6427
6428 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
6429 {
6430 if (p)
6431 {
6434 }
6435 }
6436 }
6437 }
6438 }
6439
6441 {
6443 {
6445 {
6446 int id = i - 1;
6448
6449 if (OP)
6450 {
6452
6453 if (p)
6454 {
6456 }
6457
6458 delete OP;
6459 }
6460 }
6461
6464 }
6465 }
6466
6469 {
6470 return 0.0;
6471 }
6472
6473
6475 {
6476 return 250;
6477 }
6478
6480 {
6481 return 0;
6482 }
6483
6486 {
6488 return true;
6489
6490 return false;
6491 }
6492
6495 {
6498
6500 {
6502 }
6503 else
6504 {
6505
6507 }
6508
6510 }
6511
6518 {
6519 return -1;
6520 }
6521
6522
6523
6524
6526 {
6528 {
6530 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6531
6532 if (r_index >= 0)
6533 {
6534 InventoryLocation r_il = new InventoryLocation;
6535 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6536
6537 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6540 {
6541 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6542 }
6544 {
6545 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6546 }
6547
6548 }
6549
6550 player.GetHumanInventory().ClearUserReservedLocation(this);
6551 }
6552
6555 }
6556
6557
6558
6559
6561 {
6562 return ItemBase.m_DebugActionsMask;
6563 }
6564
6566 {
6567 return ItemBase.m_DebugActionsMask & mask;
6568 }
6569
6571 {
6572 ItemBase.m_DebugActionsMask = mask;
6573 }
6574
6576 {
6577 ItemBase.m_DebugActionsMask |= mask;
6578 }
6579
6581 {
6582 ItemBase.m_DebugActionsMask &= ~mask;
6583 }
6584
6586 {
6588 {
6590 }
6591 else
6592 {
6594 }
6595 }
6596
6597
6599 {
6600 if (GetEconomyProfile())
6601 {
6602 float q_max = GetEconomyProfile().GetQuantityMax();
6603 if (q_max > 0)
6604 {
6605 float q_min = GetEconomyProfile().GetQuantityMin();
6606 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
6607
6609 {
6610 ComponentEnergyManager comp = GetCompEM();
6612 {
6614 }
6615 }
6617 {
6619
6620 }
6621
6622 }
6623 }
6624 }
6625
6628 {
6629 EntityAI parent = GetHierarchyParent();
6630
6631 if (parent)
6632 {
6633 InventoryLocation inventory_location_to_lock = new InventoryLocation;
6634 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
6635 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
6636 }
6637 }
6638
6641 {
6642 EntityAI parent = GetHierarchyParent();
6643
6644 if (parent)
6645 {
6646 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
6647 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
6648 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
6649 }
6650 }
6651
6653 {
6654
6655
6656
6657
6659
6661 {
6662 if (ScriptInputUserData.CanStoreInputUserData())
6663 {
6664 ScriptInputUserData ctx = new ScriptInputUserData;
6670 ctx.
Write(use_stack_max);
6673
6675 {
6676 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
6677 }
6678 }
6679 }
6680 else if (!
GetGame().IsMultiplayer())
6681 {
6683 }
6684 }
6685
6687 {
6689 }
6690
6692 {
6694 }
6695
6697 {
6699 }
6700
6702 {
6703
6704 return false;
6705 }
6706
6708 {
6709 return false;
6710 }
6711
6715 {
6716 return false;
6717 }
6718
6720 {
6721 return "";
6722 }
6723
6725
6727 {
6728 return false;
6729 }
6730
6732 {
6733 return true;
6734 }
6735
6736
6737
6739 {
6740 return true;
6741 }
6742
6744 {
6745 return true;
6746 }
6747
6749 {
6750 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6752 }
6753
6755 {
6757 }
6758
6760 {
6762 if (!is_being_placed)
6764 SetSynchDirty();
6765 }
6766
6767
6769
6771 {
6773 }
6774
6776 {
6778 }
6779
6781 {
6782 return 1;
6783 }
6784
6786 {
6787 return false;
6788 }
6789
6791 {
6793 SetSynchDirty();
6794 }
6795
6796
6797
6798
6799
6800
6801
6802
6803
6804
6805
6806
6807
6808
6809
6810
6811
6812
6813
6814
6815
6816
6817
6818
6819
6820
6821
6822
6823
6824
6825
6826
6827
6828
6829
6831 {
6832 super.OnMovedInsideCargo(container);
6833
6834 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6835 }
6836
6837 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
6838 {
6839 super.EEItemLocationChanged(oldLoc,newLoc);
6840
6841 PlayerBase new_player = null;
6842 PlayerBase old_player = null;
6843
6844 if (newLoc.GetParent())
6845 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
6846
6847 if (oldLoc.GetParent())
6848 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
6849
6851 {
6852 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
6853
6854 if (r_index >= 0)
6855 {
6856 InventoryLocation r_il = new InventoryLocation;
6857 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6858
6859 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6862 {
6863 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6864 }
6866 {
6867 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6868 }
6869
6870 }
6871 }
6872
6874 {
6875 if (new_player)
6876 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
6877
6878 if (new_player == old_player)
6879 {
6880
6881 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
6882 {
6884 {
6885 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
6886 {
6887 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6888 }
6889 }
6890 else
6891 {
6892 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6893 }
6894 }
6895
6896 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
6897 {
6898 int type = oldLoc.GetType();
6900 {
6901 oldLoc.GetParent().GetOnSetLock().Invoke(this);
6902 }
6904 {
6905 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
6906 }
6907 }
6908 if (!m_OldLocation)
6909 {
6910 m_OldLocation = new InventoryLocation;
6911 }
6912 m_OldLocation.Copy(oldLoc);
6913 }
6914 else
6915 {
6916 if (m_OldLocation)
6917 {
6918 m_OldLocation.Reset();
6919 }
6920 }
6921
6923 }
6924 else
6925 {
6926 if (new_player)
6927 {
6928 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
6929 if (res_index >= 0)
6930 {
6931 InventoryLocation il = new InventoryLocation;
6932 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
6934 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
6937 {
6938 il.
GetParent().GetOnReleaseLock().Invoke(it);
6939 }
6941 {
6943 }
6944
6945 }
6946 }
6948 {
6949
6951 }
6952
6953 if (m_OldLocation)
6954 {
6955 m_OldLocation.Reset();
6956 }
6957 }
6958 }
6959
6960 override void EOnContact(IEntity other, Contact extra)
6961 {
6963 {
6964 int liquidType = -1;
6966 if (impactSpeed > 0.0)
6967 {
6969 #ifndef SERVER
6971 #else
6973 SetSynchDirty();
6974 #endif
6976 }
6977 }
6978
6979 #ifdef SERVER
6980 if (GetCompEM() && GetCompEM().IsPlugged())
6981 {
6982 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
6983 GetCompEM().UnplugThis();
6984 }
6985 #endif
6986 }
6987
6989
6991 {
6993 }
6994
6996 {
6997
6998 }
6999
7001 {
7002 super.OnItemLocationChanged(old_owner, new_owner);
7003
7004 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
7005 PlayerBase playerNew = PlayerBase.Cast(new_owner);
7006
7007 if (!relatedPlayer && playerNew)
7008 relatedPlayer = playerNew;
7009
7010 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
7011 {
7013 if (actionMgr)
7014 {
7015 ActionBase currentAction = actionMgr.GetRunningAction();
7016 if (currentAction)
7018 }
7019 }
7020
7021 Man ownerPlayerOld = null;
7022 Man ownerPlayerNew = null;
7023
7024 if (old_owner)
7025 {
7026 if (old_owner.
IsMan())
7027 {
7028 ownerPlayerOld = Man.Cast(old_owner);
7029 }
7030 else
7031 {
7032 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
7033 }
7034 }
7035 else
7036 {
7038 {
7040
7041 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
7042 {
7043 GetCompEM().UnplugThis();
7044 }
7045 }
7046 }
7047
7048 if (new_owner)
7049 {
7050 if (new_owner.
IsMan())
7051 {
7052 ownerPlayerNew = Man.Cast(new_owner);
7053 }
7054 else
7055 {
7056 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
7057 }
7058 }
7059
7060 if (ownerPlayerOld != ownerPlayerNew)
7061 {
7062 if (ownerPlayerOld)
7063 {
7064 array<EntityAI> subItemsExit = new array<EntityAI>;
7066 for (int i = 0; i < subItemsExit.Count(); i++)
7067 {
7070 }
7071 }
7072
7073 if (ownerPlayerNew)
7074 {
7075 array<EntityAI> subItemsEnter = new array<EntityAI>;
7077 for (int j = 0; j < subItemsEnter.Count(); j++)
7078 {
7081 }
7082 }
7083 }
7084 else if (ownerPlayerNew != null)
7085 {
7086 PlayerBase nplayer;
7087 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
7088 {
7089 array<EntityAI> subItemsUpdate = new array<EntityAI>;
7091 for (int k = 0; k < subItemsUpdate.Count(); k++)
7092 {
7094 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
7095 }
7096 }
7097 }
7098
7099 if (old_owner)
7100 old_owner.OnChildItemRemoved(this);
7101 if (new_owner)
7102 new_owner.OnChildItemReceived(this);
7103 }
7104
7105
7107 {
7108 super.EEDelete(parent);
7109 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
7110 if (player)
7111 {
7113
7114 if (player.IsAlive())
7115 {
7116 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7117 if (r_index >= 0)
7118 {
7119 InventoryLocation r_il = new InventoryLocation;
7120 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7121
7122 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7125 {
7126 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7127 }
7129 {
7130 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7131 }
7132
7133 }
7134
7135 player.RemoveQuickBarEntityShortcut(this);
7136 }
7137 }
7138 }
7139
7141 {
7142 super.EEKilled(killer);
7143
7146 {
7147 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
7148 {
7149 if (IsMagazine())
7150 {
7151 if (Magazine.Cast(this).GetAmmoCount() > 0)
7152 {
7154 }
7155 }
7156 else
7157 {
7159 }
7160 }
7161 }
7162 }
7163
7165 {
7166 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7167
7168 super.OnWasAttached(parent, slot_id);
7169
7172
7174 }
7175
7177 {
7178 super.OnWasDetached(parent, slot_id);
7179
7182 }
7183
7185 {
7186 int idx;
7189
7190 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7191 if (inventory_slots.Count() < 1)
7192 {
7193 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
7194 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
7195 }
7196 else
7197 {
7198 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
7199 }
7200
7201 idx = inventory_slots.Find(slot);
7202 if (idx < 0)
7203 return "";
7204
7205 return attach_types.Get(idx);
7206 }
7207
7209 {
7210 int idx = -1;
7211 string slot;
7212
7215
7216 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7217 if (inventory_slots.Count() < 1)
7218 {
7219 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
7220 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7221 }
7222 else
7223 {
7224 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
7225 if (detach_types.Count() < 1)
7226 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7227 }
7228
7229 for (int i = 0; i < inventory_slots.Count(); i++)
7230 {
7231 slot = inventory_slots.Get(i);
7232 }
7233
7234 if (slot != "")
7235 {
7236 if (detach_types.Count() == 1)
7237 idx = 0;
7238 else
7239 idx = inventory_slots.Find(slot);
7240 }
7241 if (idx < 0)
7242 return "";
7243
7244 return detach_types.Get(idx);
7245 }
7246
7248 {
7249
7251
7252
7253 float min_time = 1;
7254 float max_time = 3;
7255 float delay = Math.RandomFloat(min_time, max_time);
7256
7257 explode_timer.Run(delay, this, "DoAmmoExplosion");
7258 }
7259
7261 {
7262 Magazine magazine = Magazine.Cast(this);
7263 int pop_sounds_count = 6;
7264 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
7265
7266
7267 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
7268 string sound_name = pop_sounds[ sound_idx ];
7270
7271
7272 magazine.ServerAddAmmoCount(-1);
7273
7274
7275 float min_temp_to_explode = 100;
7276
7277 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
7278 {
7280 }
7281 }
7282
7283
7284 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
7285 {
7286 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
7287
7288 const int CHANCE_DAMAGE_CARGO = 4;
7289 const int CHANCE_DAMAGE_ATTACHMENT = 1;
7290 const int CHANCE_DAMAGE_NOTHING = 2;
7291
7293 {
7294 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
7295 int chances;
7296 int rnd;
7297
7298 if (GetInventory().GetCargo())
7299 {
7300 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7301 rnd = Math.RandomInt(0,chances);
7302
7303 if (rnd < CHANCE_DAMAGE_CARGO)
7304 {
7306 }
7307 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
7308 {
7310 }
7311 }
7312 else
7313 {
7314 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7315 rnd = Math.RandomInt(0,chances);
7316
7317 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
7318 {
7320 }
7321 }
7322 }
7323 }
7324
7326 {
7327 if (GetInventory().GetCargo())
7328 {
7329 int item_count = GetInventory().GetCargo().GetItemCount();
7330 if (item_count > 0)
7331 {
7332 int random_pick = Math.RandomInt(0, item_count);
7334 if (!item.IsExplosive())
7335 {
7336 item.AddHealth("","",damage);
7337 return true;
7338 }
7339 }
7340 }
7341 return false;
7342 }
7343
7345 {
7346 int attachment_count = GetInventory().AttachmentCount();
7347 if (attachment_count > 0)
7348 {
7349 int random_pick = Math.RandomInt(0, attachment_count);
7350 ItemBase attachment =
ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
7351 if (!attachment.IsExplosive())
7352 {
7353 attachment.AddHealth("","",damage);
7354 return true;
7355 }
7356 }
7357 return false;
7358 }
7359
7361 {
7363 }
7364
7366 {
7368 return GetInventory().CanRemoveEntity();
7369
7370 return false;
7371 }
7372
7374 {
7375
7377 return false;
7378
7379
7381 return false;
7382
7383
7384
7386 if (delta == 0)
7387 return false;
7388
7389
7390 return true;
7391 }
7392
7394 {
7396 {
7397 if (ScriptInputUserData.CanStoreInputUserData())
7398 {
7399 ScriptInputUserData ctx = new ScriptInputUserData;
7404 ctx.
Write(destination_entity);
7408 }
7409 }
7410 else if (!
GetGame().IsMultiplayer())
7411 {
7413 }
7414 }
7415
7417 {
7418 float split_quantity_new;
7422 InventoryLocation loc = new InventoryLocation;
7423
7424 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7425 {
7427 split_quantity_new = stack_max;
7428 else
7430
7432 {
7433 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7434 if (new_item)
7435 {
7436 new_item.SetResultOfSplit(true);
7437 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7439 new_item.
SetQuantity(split_quantity_new,
false,
true);
7440 }
7441 }
7442 }
7443 else if (destination_entity && slot_id == -1)
7444 {
7445 if (quantity > stack_max)
7446 split_quantity_new = stack_max;
7447 else
7448 split_quantity_new = quantity;
7449
7451 {
7453 {
7456 }
7457
7458 if (new_item)
7459 {
7460 new_item.SetResultOfSplit(true);
7461 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7463 new_item.
SetQuantity(split_quantity_new,
false,
true);
7464 }
7465 }
7466 }
7467 else
7468 {
7469 if (stack_max != 0)
7470 {
7472 {
7474 }
7475
7476 if (split_quantity_new == 0)
7477 {
7478 if (!
GetGame().IsMultiplayer())
7479 player.PhysicalPredictiveDropItem(this);
7480 else
7481 player.ServerDropEntity(this);
7482 return;
7483 }
7484
7486 {
7488
7489 if (new_item)
7490 {
7491 new_item.SetResultOfSplit(true);
7492 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7495 new_item.PlaceOnSurface();
7496 }
7497 }
7498 }
7499 }
7500 }
7501
7503 {
7504 float split_quantity_new;
7508 InventoryLocation loc = new InventoryLocation;
7509
7510 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7511 {
7513 split_quantity_new = stack_max;
7514 else
7516
7518 {
7519 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7520 if (new_item)
7521 {
7522 new_item.SetResultOfSplit(true);
7523 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7525 new_item.
SetQuantity(split_quantity_new,
false,
true);
7526 }
7527 }
7528 }
7529 else if (destination_entity && slot_id == -1)
7530 {
7531 if (quantity > stack_max)
7532 split_quantity_new = stack_max;
7533 else
7534 split_quantity_new = quantity;
7535
7537 {
7539 {
7542 }
7543
7544 if (new_item)
7545 {
7546 new_item.SetResultOfSplit(true);
7547 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7549 new_item.
SetQuantity(split_quantity_new,
false,
true);
7550 }
7551 }
7552 }
7553 else
7554 {
7555 if (stack_max != 0)
7556 {
7558 {
7560 }
7561
7563 {
7565
7566 if (new_item)
7567 {
7568 new_item.SetResultOfSplit(true);
7569 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7572 new_item.PlaceOnSurface();
7573 }
7574 }
7575 }
7576 }
7577 }
7578
7580 {
7582 {
7583 if (ScriptInputUserData.CanStoreInputUserData())
7584 {
7585 ScriptInputUserData ctx = new ScriptInputUserData;
7590 dst.WriteToContext(ctx);
7592 }
7593 }
7594 else if (!
GetGame().IsMultiplayer())
7595 {
7597 }
7598 }
7599
7601 {
7603 {
7604 if (ScriptInputUserData.CanStoreInputUserData())
7605 {
7606 ScriptInputUserData ctx = new ScriptInputUserData;
7611 ctx.
Write(destination_entity);
7617 }
7618 }
7619 else if (!
GetGame().IsMultiplayer())
7620 {
7622 }
7623 }
7624
7626 {
7628 }
7629
7631 {
7633 float split_quantity_new;
7635 if (dst.IsValid())
7636 {
7637 int slot_id = dst.GetSlot();
7639
7640 if (quantity > stack_max)
7641 split_quantity_new = stack_max;
7642 else
7643 split_quantity_new = quantity;
7644
7646 {
7648
7649 if (new_item)
7650 {
7651 new_item.SetResultOfSplit(true);
7652 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7654 new_item.
SetQuantity(split_quantity_new,
false,
true);
7655 }
7656
7657 return new_item;
7658 }
7659 }
7660
7661 return null;
7662 }
7663
7665 {
7667 float split_quantity_new;
7669 if (destination_entity)
7670 {
7672 if (quantity > stackable)
7673 split_quantity_new = stackable;
7674 else
7675 split_quantity_new = quantity;
7676
7678 {
7679 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
7680 if (new_item)
7681 {
7682 new_item.SetResultOfSplit(true);
7683 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7685 new_item.
SetQuantity(split_quantity_new,
false,
true);
7686 }
7687 }
7688 }
7689 }
7690
7692 {
7694 {
7695 if (ScriptInputUserData.CanStoreInputUserData())
7696 {
7697 ScriptInputUserData ctx = new ScriptInputUserData;
7702 ItemBase destination_entity =
this;
7703 ctx.
Write(destination_entity);
7707 }
7708 }
7709 else if (!
GetGame().IsMultiplayer())
7710 {
7712 }
7713 }
7714
7716 {
7718 float split_quantity_new;
7720 if (player)
7721 {
7723 if (quantity > stackable)
7724 split_quantity_new = stackable;
7725 else
7726 split_quantity_new = quantity;
7727
7729 {
7730 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
7731 new_item =
ItemBase.Cast(in_hands);
7732 if (new_item)
7733 {
7734 new_item.SetResultOfSplit(true);
7735 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7737 new_item.SetQuantity(split_quantity_new, false, true);
7738 }
7739 }
7740 }
7741 }
7742
7744 {
7746 float split_quantity_new = Math.Floor(quantity * 0.5);
7747
7749 return;
7750
7752
7753 if (new_item)
7754 {
7755 if (new_item.GetQuantityMax() < split_quantity_new)
7756 {
7757 split_quantity_new = new_item.GetQuantityMax();
7758 }
7759
7760 new_item.SetResultOfSplit(true);
7761 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7762
7764 {
7767 }
7768 else
7769 {
7771 new_item.
SetQuantity(split_quantity_new,
false,
true);
7772 }
7773 }
7774 }
7775
7777 {
7779 float split_quantity_new = Math.Floor(quantity / 2);
7780
7782 return;
7783
7784 InventoryLocation invloc = new InventoryLocation;
7786
7788 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
7789
7790 if (new_item)
7791 {
7792 if (new_item.GetQuantityMax() < split_quantity_new)
7793 {
7794 split_quantity_new = new_item.GetQuantityMax();
7795 }
7797 {
7800 }
7801 else if (split_quantity_new > 1)
7802 {
7804 new_item.
SetQuantity(split_quantity_new,
false,
true);
7805 }
7806 }
7807 }
7808
7811 {
7812 SetWeightDirty();
7814
7815 if (parent)
7816 parent.OnAttachmentQuantityChangedEx(this, delta);
7817
7819 {
7821 {
7823 }
7825 {
7826 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
7828 }
7829 }
7830
7831 }
7832
7835 {
7836
7837 }
7838
7841 {
7843 }
7844
7846 {
7847 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
7848
7850 {
7851 if (newLevel == GameConstants.STATE_RUINED)
7852 {
7854 EntityAI parent = GetHierarchyParent();
7855 if (parent && parent.IsFireplace())
7856 {
7857 CargoBase cargo = GetInventory().GetCargo();
7858 if (cargo)
7859 {
7861 {
7863 }
7864 }
7865 }
7866 }
7867
7869 {
7870
7872 return;
7873 }
7874
7875 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
7876 {
7878 }
7879 }
7880 }
7881
7882
7884 {
7885 super.OnRightClick();
7886
7888 {
7890 {
7891 if (ScriptInputUserData.CanStoreInputUserData())
7892 {
7893 EntityAI root = GetHierarchyRoot();
7894 Man playerOwner = GetHierarchyRootPlayer();
7895 InventoryLocation dst = new InventoryLocation;
7896
7897
7898 if (!playerOwner && root && root == this)
7899 {
7901 }
7902 else
7903 {
7904
7905 GetInventory().GetCurrentInventoryLocation(dst);
7907 {
7910 {
7912 }
7913 else
7914 {
7916
7917
7918 if (
GetGame().
GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
7919 {
7921 }
7922 else
7923 {
7924 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
7925 }
7926 }
7927 }
7928 }
7929
7930 ScriptInputUserData ctx = new ScriptInputUserData;
7938 }
7939 }
7940 else if (!
GetGame().IsMultiplayer())
7941 {
7943 }
7944 }
7945 }
7946
7948 {
7949 if (root)
7950 {
7951 vector m4[4];
7952 root.GetTransform(m4);
7953 dst.SetGround(this, m4);
7954 }
7955 else
7956 {
7957 GetInventory().GetCurrentInventoryLocation(dst);
7958 }
7959 }
7960
7961 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
7962 {
7963
7964 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
7965 return false;
7966
7967 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
7968 return false;
7969
7970
7972 return false;
7973
7974
7975 Magazine mag = Magazine.Cast(this);
7976 if (mag)
7977 {
7978 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
7979 return false;
7980
7981 if (stack_max_limit)
7982 {
7983 Magazine other_mag = Magazine.Cast(other_item);
7984 if (other_item)
7985 {
7986 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
7987 return false;
7988 }
7989
7990 }
7991 }
7992 else
7993 {
7994
7996 return false;
7997
7999 return false;
8000 }
8001
8002 PlayerBase player = null;
8003 if (CastTo(player, GetHierarchyRootPlayer()))
8004 {
8005 if (player.GetInventory().HasAttachment(this))
8006 return false;
8007
8008 if (player.IsItemsToDelete())
8009 return false;
8010 }
8011
8012 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
8013 return false;
8014
8015 int slotID;
8017 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
8018 return false;
8019
8020 return true;
8021 }
8022
8024 {
8026 }
8027
8029 {
8030 return m_IsResultOfSplit;
8031 }
8032
8034 {
8035 m_IsResultOfSplit = value;
8036 }
8037
8039 {
8041 }
8042
8044 {
8045 float other_item_quantity = other_item.GetQuantity();
8046 float this_free_space;
8047
8049
8051
8052 if (other_item_quantity > this_free_space)
8053 {
8054 return this_free_space;
8055 }
8056 else
8057 {
8058 return other_item_quantity;
8059 }
8060 }
8061
8063 {
8065 }
8066
8068 {
8070 return;
8071
8072 if (!IsMagazine() && other_item)
8073 {
8075 if (quantity_used != 0)
8076 {
8077 float hp1 = GetHealth01("","");
8078 float hp2 = other_item.GetHealth01("","");
8079 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
8080 hpResult = hpResult / (
GetQuantity() + quantity_used);
8081
8082 hpResult *= GetMaxHealth();
8083 Math.Round(hpResult);
8084 SetHealth("", "Health", hpResult);
8085
8087 other_item.AddQuantity(-quantity_used);
8088 }
8089 }
8091 }
8092
8094 {
8095 #ifdef SERVER
8096 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
8097 GetHierarchyParent().IncreaseLifetimeUp();
8098 #endif
8099 };
8100
8102 {
8103 PlayerBase p = PlayerBase.Cast(player);
8104
8105 array<int> recipesIds = p.m_Recipes;
8106 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8107 if (moduleRecipesManager)
8108 {
8109 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
8110 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
8111 }
8112
8113 for (int i = 0;i < recipesIds.Count(); i++)
8114 {
8115 int key = recipesIds.Get(i);
8116 string recipeName = moduleRecipesManager.GetRecipeName(key);
8118 }
8119 }
8120
8121
8122 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
8123 {
8124 super.GetDebugActions(outputList);
8125
8126
8132
8133
8138
8143
8144
8148
8149
8151 {
8155 }
8156
8159
8160
8164
8166
8167 InventoryLocation loc = new InventoryLocation();
8168 GetInventory().GetCurrentInventoryLocation(loc);
8170 {
8171 if (Gizmo_IsSupported())
8174 }
8175
8177 }
8178
8179
8180
8181
8183 {
8184 super.OnAction(action_id, player, ctx);
8185
8187 {
8188 switch (action_id)
8189 {
8192 return true;
8195 return true;
8196 }
8197 }
8198
8200 {
8201 switch (action_id)
8202 {
8204 Delete();
8205 return true;
8206 }
8207 }
8208
8209 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
8210 {
8211 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8212 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
8213 PlayerBase p = PlayerBase.Cast(player);
8214 if (
EActions.RECIPES_RANGE_START < 1000)
8215 {
8216 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
8217 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
8218 }
8219 }
8220 #ifndef SERVER
8221 else if (action_id ==
EActions.WATCH_PLAYER)
8222 {
8223 PluginDeveloper.SetDeveloperItemClientEx(player);
8224 }
8225 #endif
8227 {
8228 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
8229 {
8230 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
8231 OnDebugButtonPressServer(id + 1);
8232 }
8233
8234 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
8235 {
8236 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
8238 }
8239
8240 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
8241 {
8242 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
8244 }
8245
8246 else if (action_id ==
EActions.ADD_QUANTITY)
8247 {
8248 if (IsMagazine())
8249 {
8250 Magazine mag = Magazine.Cast(this);
8251 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
8252 }
8253 else
8254 {
8256 }
8257
8258 if (m_EM)
8259 {
8260 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
8261 }
8262
8263 }
8264
8265 else if (action_id ==
EActions.REMOVE_QUANTITY)
8266 {
8267 if (IsMagazine())
8268 {
8269 Magazine mag2 = Magazine.Cast(this);
8270 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
8271 }
8272 else
8273 {
8275 }
8276 if (m_EM)
8277 {
8278 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
8279 }
8280
8281 }
8282
8283 else if (action_id ==
EActions.SET_QUANTITY_0)
8284 {
8286
8287 if (m_EM)
8288 {
8289 m_EM.SetEnergy(0);
8290 }
8291 }
8292
8293 else if (action_id ==
EActions.SET_MAX_QUANTITY)
8294 {
8296
8297 if (m_EM)
8298 {
8299 m_EM.SetEnergy(m_EM.GetEnergyMax());
8300 }
8301 }
8302
8303 else if (action_id ==
EActions.ADD_HEALTH)
8304 {
8305 AddHealth("","",GetMaxHealth("","Health")/5);
8306 }
8307 else if (action_id ==
EActions.REMOVE_HEALTH)
8308 {
8309 AddHealth("","",-GetMaxHealth("","Health")/5);
8310 }
8311 else if (action_id ==
EActions.DESTROY_HEALTH)
8312 {
8313 SetHealth01("","",0);
8314 }
8315 else if (action_id ==
EActions.WATCH_ITEM)
8316 {
8318 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
8319 #ifdef DEVELOPER
8320 SetDebugDeveloper_item(this);
8321 #endif
8322 }
8323
8324 else if (action_id ==
EActions.ADD_TEMPERATURE)
8325 {
8326 AddTemperature(20);
8327
8328 }
8329
8330 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
8331 {
8332 AddTemperature(-20);
8333
8334 }
8335
8336 else if (action_id ==
EActions.FLIP_FROZEN)
8337 {
8338 SetFrozen(!GetIsFrozen());
8339
8340 }
8341
8342 else if (action_id ==
EActions.ADD_WETNESS)
8343 {
8345
8346 }
8347
8348 else if (action_id ==
EActions.REMOVE_WETNESS)
8349 {
8351
8352 }
8353
8354 else if (action_id ==
EActions.LIQUIDTYPE_UP)
8355 {
8358
8359
8360 }
8361
8362 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
8363 {
8366 }
8367
8368 else if (action_id ==
EActions.MAKE_SPECIAL)
8369 {
8370 auto debugParams = DebugSpawnParams.WithPlayer(player);
8371 OnDebugSpawnEx(debugParams);
8372 }
8373
8374 }
8375
8376
8377 return false;
8378 }
8379
8380
8381
8382
8386
8389
8390
8391
8393 {
8394 return false;
8395 }
8396
8397
8399 {
8400 return true;
8401 }
8402
8403
8405 {
8406 return true;
8407 }
8408
8409
8410
8412 {
8413 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
8415 }
8416
8419 {
8420 return null;
8421 }
8422
8424 {
8425 return false;
8426 }
8427
8429 {
8430 return false;
8431 }
8432
8436
8437
8439 {
8440 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8441 return module_repairing.CanRepair(this, item_repair_kit);
8442 }
8443
8444
8445 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
8446 {
8447 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8448 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
8449 }
8450
8451
8453 {
8454
8455
8456
8457
8458
8459
8460
8461
8462 return 1;
8463 }
8464
8465
8466
8468 {
8470 }
8471
8472
8473
8475 {
8477 }
8478
8479
8488 {
8489 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8490
8491 if (player)
8492 {
8493 player.MessageStatus(text);
8494 }
8495 }
8496
8497
8506 {
8507 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8508
8509 if (player)
8510 {
8511 player.MessageAction(text);
8512 }
8513 }
8514
8515
8524 {
8525 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8526
8527 if (player)
8528 {
8529 player.MessageFriendly(text);
8530 }
8531 }
8532
8533
8542 {
8543 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8544
8545 if (player)
8546 {
8547 player.MessageImportant(text);
8548 }
8549 }
8550
8552 {
8553 return true;
8554 }
8555
8556
8557 override bool KindOf(
string tag)
8558 {
8559 bool found = false;
8560 string item_name = this.
GetType();
8563
8564 int array_size = item_tag_array.Count();
8565 for (int i = 0; i < array_size; i++)
8566 {
8567 if (item_tag_array.Get(i) == tag)
8568 {
8569 found = true;
8570 break;
8571 }
8572 }
8573 return found;
8574 }
8575
8576
8578 {
8579
8580 super.OnRPC(sender, rpc_type,ctx);
8581
8582
8583 switch (rpc_type)
8584 {
8585 #ifndef SERVER
8586 case ERPCs.RPC_SOUND_LOCK_ATTACH:
8587 Param2<bool, string> p = new Param2<bool, string>(false, "");
8588
8590 return;
8591
8592 bool play = p.param1;
8593 string soundSet = p.param2;
8594
8595 if (play)
8596 {
8598 {
8600 {
8602 }
8603 }
8604 else
8605 {
8607 }
8608 }
8609 else
8610 {
8612 }
8613
8614 break;
8615 #endif
8616
8617 }
8618
8620 {
8622 }
8623 }
8624
8625
8626
8627
8629 {
8630 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8631 return plugin.GetID(
name);
8632 }
8633
8635 {
8636 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8637 return plugin.GetName(id);
8638 }
8639
8642 {
8643
8644
8645 int varFlags;
8646 if (!ctx.
Read(varFlags))
8647 return;
8648
8649 if (varFlags & ItemVariableFlags.FLOAT)
8650 {
8652 }
8653 }
8654
8656 {
8657
8658 super.SerializeNumericalVars(floats_out);
8659
8660
8661
8663 {
8665 }
8666
8668 {
8670 }
8671
8673 {
8675 }
8676
8678 {
8683 }
8684
8686 {
8688 }
8689 }
8690
8692 {
8693
8694 super.DeSerializeNumericalVars(floats);
8695
8696
8697 int index = 0;
8698 int mask = Math.Round(floats.Get(index));
8699
8700 index++;
8701
8703 {
8705 {
8707 }
8708 else
8709 {
8710 float quantity = floats.Get(index);
8712 }
8713 index++;
8714 }
8715
8717 {
8718 float wet = floats.Get(index);
8720 index++;
8721 }
8722
8724 {
8725 int liquidtype = Math.Round(floats.Get(index));
8727 index++;
8728 }
8729
8731 {
8733 index++;
8735 index++;
8737 index++;
8739 index++;
8740 }
8741
8743 {
8744 int cleanness = Math.Round(floats.Get(index));
8746 index++;
8747 }
8748 }
8749
8751 {
8752 super.WriteVarsToCTX(ctx);
8753
8754
8756 {
8758 }
8759
8761 {
8763 }
8764
8766 {
8768 }
8769
8771 {
8772 int r,g,b,a;
8778 }
8779
8781 {
8783 }
8784 }
8785
8787 {
8788 if (!super.ReadVarsFromCTX(ctx,version))
8789 return false;
8790
8791 int intValue;
8792 float value;
8793
8794 if (version < 140)
8795 {
8796 if (!ctx.
Read(intValue))
8797 return false;
8798
8799 m_VariablesMask = intValue;
8800 }
8801
8803 {
8804 if (!ctx.
Read(value))
8805 return false;
8806
8808 {
8810 }
8811 else
8812 {
8814 }
8815 }
8816
8817 if (version < 140)
8818 {
8820 {
8821 if (!ctx.
Read(value))
8822 return false;
8823 SetTemperatureDirect(value);
8824 }
8825 }
8826
8828 {
8829 if (!ctx.
Read(value))
8830 return false;
8832 }
8833
8835 {
8836 if (!ctx.
Read(intValue))
8837 return false;
8839 }
8840
8842 {
8843 int r,g,b,a;
8845 return false;
8847 return false;
8849 return false;
8851 return false;
8852
8854 }
8855
8857 {
8858 if (!ctx.
Read(intValue))
8859 return false;
8861 }
8862
8863 if (version >= 138 && version < 140)
8864 {
8866 {
8867 if (!ctx.
Read(intValue))
8868 return false;
8869 SetFrozen(intValue);
8870 }
8871 }
8872
8873 return true;
8874 }
8875
8876
8878 {
8881 {
8883 }
8884
8885 if (!super.OnStoreLoad(ctx, version))
8886 {
8888 return false;
8889 }
8890
8891 if (version >= 114)
8892 {
8893 bool hasQuickBarIndexSaved;
8894
8895 if (!ctx.
Read(hasQuickBarIndexSaved))
8896 {
8898 return false;
8899 }
8900
8901 if (hasQuickBarIndexSaved)
8902 {
8903 int itmQBIndex;
8904
8905
8906 if (!ctx.
Read(itmQBIndex))
8907 {
8909 return false;
8910 }
8911
8912 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
8913 if (itmQBIndex != -1 && parentPlayer)
8914 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
8915 }
8916 }
8917 else
8918 {
8919
8920 PlayerBase player;
8921 int itemQBIndex;
8922 if (version ==
int.
MAX)
8923 {
8924 if (!ctx.
Read(itemQBIndex))
8925 {
8927 return false;
8928 }
8929 }
8930 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
8931 {
8932
8933 if (!ctx.
Read(itemQBIndex))
8934 {
8936 return false;
8937 }
8938 if (itemQBIndex != -1 && player)
8939 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
8940 }
8941 }
8942
8943 if (version < 140)
8944 {
8945
8946 if (!LoadVariables(ctx, version))
8947 {
8949 return false;
8950 }
8951 }
8952
8953
8955 {
8957 return false;
8958 }
8959 if (version >= 132)
8960 {
8962 if (raib)
8963 {
8965 {
8967 return false;
8968 }
8969 }
8970 }
8971
8973 return true;
8974 }
8975
8976
8977
8979 {
8980 super.OnStoreSave(ctx);
8981
8982 PlayerBase player;
8983 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
8984 {
8986
8987 int itemQBIndex = -1;
8988 itemQBIndex = player.FindQuickBarEntityIndex(this);
8989 ctx.
Write(itemQBIndex);
8990 }
8991 else
8992 {
8994 }
8995
8997
8999 if (raib)
9000 {
9002 }
9003 }
9004
9005
9007 {
9008 super.AfterStoreLoad();
9009
9011 {
9013 }
9014
9016 {
9019 }
9020 }
9021
9023 {
9024 super.EEOnAfterLoad();
9025
9027 {
9029 }
9030
9033 }
9034
9036 {
9037 return false;
9038 }
9039
9040
9041
9043 {
9045 {
9046 #ifdef PLATFORM_CONSOLE
9047
9049 {
9051 if (menu)
9052 {
9054 }
9055 }
9056 #endif
9057 }
9058
9060 {
9063 }
9064
9066 {
9067 SetWeightDirty();
9069 }
9071 {
9074 }
9075
9077 {
9080 }
9082 {
9085 }
9086
9087 super.OnVariablesSynchronized();
9088 }
9089
9090
9091
9093 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
9094 {
9095 if (!IsServerCheck(allow_client))
9096 return false;
9097
9099 return false;
9100
9103
9104 if (value <= (min + 0.001))
9105 value = min;
9106
9107 if (value == min)
9108 {
9109 if (destroy_config)
9110 {
9111 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
9112 if (dstr)
9113 {
9115 this.Delete();
9116 return true;
9117 }
9118 }
9119 else if (destroy_forced)
9120 {
9122 this.Delete();
9123 return true;
9124 }
9125
9127 }
9128
9131
9133 {
9135
9136 if (delta)
9138 }
9139
9141
9142 return false;
9143 }
9144
9145
9147 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9148 {
9150 }
9151
9153 {
9156 }
9157
9159 {
9162 }
9163
9165 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9166 {
9167 float value_clamped = Math.Clamp(value, 0, 1);
9169 SetQuantity(result, destroy_config, destroy_forced);
9170 }
9171
9172
9175 {
9177 }
9178
9180 {
9182 }
9183
9184
9185
9186
9187
9188
9189
9190
9191
9192
9194 {
9195 int slot = -1;
9196 if (GetInventory())
9197 {
9198 InventoryLocation il = new InventoryLocation;
9199 GetInventory().GetCurrentInventoryLocation(il);
9201 }
9202
9204 }
9205
9207 {
9208 float quantity_max = 0;
9209
9211 {
9212 if (attSlotID != -1)
9213 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
9214
9215 if (quantity_max <= 0)
9217 }
9218
9219 if (quantity_max <= 0)
9221
9222 return quantity_max;
9223 }
9224
9226 {
9228 }
9229
9231 {
9233 }
9234
9235
9237 {
9239 }
9240
9242 {
9244 }
9245
9247 {
9249 }
9250
9251
9253 {
9254
9255 float weightEx = GetWeightEx();
9256 float special = GetInventoryAndCargoWeight();
9257 return weightEx - special;
9258 }
9259
9260
9262 {
9264 }
9265
9267 {
9269 {
9270 #ifdef DEVELOPER
9271 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9272 {
9273 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
9275 }
9276 #endif
9277
9279 }
9280 else if (HasEnergyManager())
9281 {
9282 #ifdef DEVELOPER
9283 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9284 {
9285 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
9286 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
9287 }
9288 #endif
9289 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
9290 }
9291 else
9292 {
9293 #ifdef DEVELOPER
9294 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9295 {
9296 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
9297 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
9298 }
9299 #endif
9300 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
9301 }
9302 }
9303
9306 {
9307 int item_count = 0;
9309
9310 if (GetInventory().GetCargo() != NULL)
9311 {
9312 item_count = GetInventory().GetCargo().GetItemCount();
9313 }
9314
9315 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
9316 {
9317 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
9318 if (item)
9319 item_count += item.GetNumberOfItems();
9320 }
9321 return item_count;
9322 }
9323
9326 {
9327 float weight = 0;
9328 float wetness = 1;
9329 if (include_wetness)
9332 {
9333 weight = wetness * m_ConfigWeight;
9334 }
9336 {
9337 weight = 1;
9338 }
9339 return weight;
9340 }
9341
9342
9343
9345 {
9346 if ((
GetGame().IsServer() || !
GetGame().IsMultiplayer()) && GetInventory())
9347 {
9348 GameInventory inv = GetInventory();
9349 array<EntityAI> items = new array<EntityAI>;
9351 for (int i = 0; i < items.Count(); i++)
9352 {
9354 if (item)
9355 {
9357 }
9358 }
9359 }
9360 }
9361
9362
9363
9364
9366 {
9367 float energy = 0;
9368 if (HasEnergyManager())
9369 {
9370 energy = GetCompEM().GetEnergy();
9371 }
9372 return energy;
9373 }
9374
9375
9377 {
9378 super.OnEnergyConsumed();
9379
9381 }
9382
9384 {
9385 super.OnEnergyAdded();
9386
9388 }
9389
9390
9392 {
9393 if (
GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
9394 {
9396 {
9397 float energy_0to1 = GetCompEM().GetEnergy0To1();
9399 }
9400 }
9401 }
9402
9403
9405 {
9406 return ConfigGetFloat("heatIsolation");
9407 }
9408
9410 {
9412 }
9413
9415 {
9416 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
9417 if (
GetGame().ConfigIsExisting(paramPath))
9419
9420 return 0.0;
9421 }
9422
9424 {
9425 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
9426 if (
GetGame().ConfigIsExisting(paramPath))
9428
9429 return 0.0;
9430 }
9431
9432 override void SetWet(
float value,
bool allow_client =
false)
9433 {
9434 if (!IsServerCheck(allow_client))
9435 return;
9436
9439
9441
9442 m_VarWet = Math.Clamp(value, min, max);
9443
9445 {
9448 }
9449 }
9450
9451 override void AddWet(
float value)
9452 {
9454 }
9455
9457 {
9459 }
9460
9462 {
9464 }
9465
9467 {
9469 }
9470
9472 {
9474 }
9475
9477 {
9479 }
9480
9482 {
9485 if (newLevel != oldLevel)
9486 {
9488 }
9489 }
9490
9492 {
9493 SetWeightDirty();
9494 }
9495
9497 {
9498 return GetWetLevelInternal(
m_VarWet);
9499 }
9500
9501
9502
9504 {
9506 }
9507
9509 {
9511 }
9512
9514 {
9516 }
9517
9519 {
9521 }
9522
9523
9524
9526 {
9527 if (ConfigIsExisting("itemModelLength"))
9528 {
9529 return ConfigGetFloat("itemModelLength");
9530 }
9531 return 0;
9532 }
9533
9535 {
9536 if (ConfigIsExisting("itemAttachOffset"))
9537 {
9538 return ConfigGetFloat("itemAttachOffset");
9539 }
9540 return 0;
9541 }
9542
9543 override void SetCleanness(
int value,
bool allow_client =
false)
9544 {
9545 if (!IsServerCheck(allow_client))
9546 return;
9547
9549
9551
9554 }
9555
9557 {
9559 }
9560
9562 {
9563 return true;
9564 }
9565
9566
9567
9568
9570 {
9572 }
9573
9575 {
9577 }
9578
9579
9580
9581
9582 override void SetColor(
int r,
int g,
int b,
int a)
9583 {
9589 }
9591 override void GetColor(out
int r,out
int g,out
int b,out
int a)
9592 {
9597 }
9598
9600 {
9602 }
9603
9606 {
9607 int r,g,b,a;
9609 r = r/255;
9610 g = g/255;
9611 b = b/255;
9612 a = a/255;
9613 return MiscGameplayFunctions.GetColorString(r, g, b, a);
9614 }
9615
9616
9617
9618 override void SetLiquidType(
int value,
bool allow_client =
false)
9619 {
9620 if (!IsServerCheck(allow_client))
9621 return;
9622
9627 }
9628
9630 {
9631 return ConfigGetInt("varLiquidTypeInit");
9632 }
9633
9635 {
9637 }
9638
9640 {
9642 SetFrozen(false);
9643 }
9644
9647 {
9648 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9649 }
9650
9651
9654 {
9655 PlayerBase nplayer;
9656 if (PlayerBase.CastTo(nplayer, player))
9657 {
9659
9660 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9661 }
9662 }
9663
9664
9667 {
9668 PlayerBase nplayer;
9669 if (PlayerBase.CastTo(nplayer,player))
9670 {
9671
9672 nplayer.SetEnableQuickBarEntityShortcut(this,false);
9673
9674 }
9675
9676
9677 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
9678
9679
9680 if (HasEnergyManager())
9681 {
9682 GetCompEM().UpdatePlugState();
9683 }
9684 }
9685
9686
9688 {
9689 super.OnPlacementStarted(player);
9690
9692 }
9693
9694 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
9695 {
9697 {
9698 m_AdminLog.OnPlacementComplete(player,
this);
9699 }
9700
9701 super.OnPlacementComplete(player, position, orientation);
9702 }
9703
9704
9705
9706
9707
9709 {
9711 {
9712 return true;
9713 }
9714 else
9715 {
9716 return false;
9717 }
9718 }
9719
9720
9722 {
9724 {
9726 }
9727 }
9728
9729
9731 {
9733 }
9734
9736 {
9738 }
9739
9740 override void InsertAgent(
int agent,
float count = 1)
9741 {
9742 if (count < 1)
9743 return;
9744
9746 }
9747
9750 {
9752 }
9753
9754
9756 {
9758 }
9759
9760
9761
9762
9763
9764
9765
9766
9767
9768
9769
9770
9771
9772
9773
9774
9775
9776
9777
9778
9779
9780
9781
9782
9783
9784
9785
9786
9787
9788
9789
9790
9791
9792
9793
9794
9795
9796
9797
9798
9799
9800
9802 {
9804 return false;
9805 return true;
9806 }
9807
9809 {
9810
9812 }
9813
9814
9817 {
9818 super.CheckForRoofLimited(timeTresholdMS);
9819
9821 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
9822 {
9823 m_PreviousRoofTestTime = time;
9824 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
9825 }
9826 }
9827
9828
9830 {
9832 {
9833 return 0;
9834 }
9835
9836 if (GetInventory().GetAttachmentSlotsCount() != 0)
9837 {
9838 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
9839 if (filter)
9840 return filter.GetProtectionLevel(type, false, system);
9841 else
9842 return 0;
9843 }
9844
9845 string subclassPath, entryName;
9846
9847 switch (type)
9848 {
9850 entryName = "biological";
9851 break;
9853 entryName = "chemical";
9854 break;
9855 default:
9856 entryName = "biological";
9857 break;
9858 }
9859
9860 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
9861
9863 }
9864
9865
9866
9869 {
9870 if (!IsMagazine())
9872
9874 }
9875
9876
9877
9878
9879
9884 {
9885 return true;
9886 }
9887
9889 {
9891 }
9892
9893
9894
9895
9896
9898 {
9899 if (parent)
9900 {
9901 if (parent.IsInherited(DayZInfected))
9902 return true;
9903
9904 if (!parent.IsRuined())
9905 return true;
9906 }
9907
9908 return true;
9909 }
9910
9912 {
9913 if (!super.CanPutAsAttachment(parent))
9914 {
9915 return false;
9916 }
9917
9918 if (!IsRuined() && !parent.IsRuined())
9919 {
9920 return true;
9921 }
9922
9923 return false;
9924 }
9925
9927 {
9928
9929
9930
9931
9932 return super.CanReceiveItemIntoCargo(item);
9933 }
9934
9936 {
9937
9938
9939
9940
9941 GameInventory attachmentInv = attachment.GetInventory();
9943 {
9944 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
9945 return false;
9946 }
9947
9948 InventoryLocation loc = new InventoryLocation();
9949 attachment.GetInventory().GetCurrentInventoryLocation(loc);
9950 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
9951 return false;
9952
9953 return super.CanReceiveAttachment(attachment, slotId);
9954 }
9955
9957 {
9958 if (!super.CanReleaseAttachment(attachment))
9959 return false;
9960
9961 return GetInventory().AreChildrenAccessible();
9962 }
9963
9964
9965
9966
9967
9968
9969
9970
9971
9972
9973
9974
9975
9976
9977
9978
9979
9980
9981
9982
9983
9985 {
9986 int id = muzzle_owner.GetMuzzleID();
9987 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
9988
9989 if (WPOF_array)
9990 {
9991 for (int i = 0; i < WPOF_array.Count(); i++)
9992 {
9993 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
9994
9995 if (WPOF)
9996 {
9997 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
9998 }
9999 }
10000 }
10001 }
10002
10003
10005 {
10006 int id = muzzle_owner.GetMuzzleID();
10008
10009 if (WPOBE_array)
10010 {
10011 for (int i = 0; i < WPOBE_array.Count(); i++)
10012 {
10013 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
10014
10015 if (WPOBE)
10016 {
10017 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10018 }
10019 }
10020 }
10021 }
10022
10023
10025 {
10026 int id = muzzle_owner.GetMuzzleID();
10027 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10028
10029 if (WPOOH_array)
10030 {
10031 for (int i = 0; i < WPOOH_array.Count(); i++)
10032 {
10033 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10034
10035 if (WPOOH)
10036 {
10037 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10038 }
10039 }
10040 }
10041 }
10042
10043
10045 {
10046 int id = muzzle_owner.GetMuzzleID();
10047 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10048
10049 if (WPOOH_array)
10050 {
10051 for (int i = 0; i < WPOOH_array.Count(); i++)
10052 {
10053 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10054
10055 if (WPOOH)
10056 {
10057 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10058 }
10059 }
10060 }
10061 }
10062
10063
10065 {
10066 int id = muzzle_owner.GetMuzzleID();
10067 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10068
10069 if (WPOOH_array)
10070 {
10071 for (int i = 0; i < WPOOH_array.Count(); i++)
10072 {
10073 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10074
10075 if (WPOOH)
10076 {
10077 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10078 }
10079 }
10080 }
10081 }
10082
10083
10084
10086 {
10088 {
10089 return true;
10090 }
10091
10092 return false;
10093 }
10094
10096 {
10098 {
10099 return true;
10100 }
10101
10102 return false;
10103 }
10104
10106 {
10108 {
10109 return true;
10110 }
10111
10112 return false;
10113 }
10114
10116 {
10117 return false;
10118 }
10119
10122 {
10123 return UATimeSpent.DEFAULT_DEPLOY;
10124 }
10125
10126
10127
10128
10130 {
10132 SetSynchDirty();
10133 }
10134
10136 {
10138 }
10139
10140
10142 {
10143 return false;
10144 }
10145
10148 {
10149 string att_type = "None";
10150
10151 if (ConfigIsExisting("soundAttType"))
10152 {
10153 att_type = ConfigGetString("soundAttType");
10154 }
10155
10157 }
10158
10160 {
10162 }
10163
10164
10165
10166
10167
10173
10175 {
10178
10180 }
10181
10182
10184 {
10186 return;
10187
10189
10192
10195
10196 SoundParameters params = new SoundParameters();
10200 }
10201
10202
10204 {
10206 return;
10207
10209 SetSynchDirty();
10210
10213 }
10214
10215
10217 {
10219 return;
10220
10222 SetSynchDirty();
10223
10226 }
10227
10229 {
10231 }
10232
10234 {
10236 }
10237
10240 {
10241 if (!
GetGame().IsDedicatedServer())
10242 {
10243 if (ConfigIsExisting("attachSoundSet"))
10244 {
10245 string cfg_path = "";
10246 string soundset = "";
10247 string type_name =
GetType();
10248
10251 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
10252 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
10253
10254 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
10255 {
10256 for (int i = 0; i < cfg_soundset_array.Count(); i++)
10257 {
10258 if (cfg_slot_array[i] == slot_type)
10259 {
10260 soundset = cfg_soundset_array[i];
10261 break;
10262 }
10263 }
10264 }
10265
10266 if (soundset != "")
10267 {
10268 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
10270 }
10271 }
10272 }
10273 }
10274
10276 {
10277
10278 }
10279
10280 void OnApply(PlayerBase player);
10281
10283 {
10284 return 1.0;
10285 };
10286
10288 {
10290 }
10291
10293 {
10295 }
10296
10298
10300 {
10301 SetDynamicPhysicsLifeTime(0.01);
10303 }
10304
10306 {
10307 array<string> zone_names = new array<string>;
10308 GetDamageZones(zone_names);
10309 for (int i = 0; i < zone_names.Count(); i++)
10310 {
10311 SetHealthMax(zone_names.Get(i),"Health");
10312 }
10313 SetHealthMax("","Health");
10314 }
10315
10318 {
10319 float global_health = GetHealth01("","Health");
10320 array<string> zones = new array<string>;
10321 GetDamageZones(zones);
10322
10323 for (int i = 0; i < zones.Count(); i++)
10324 {
10325 SetHealth01(zones.Get(i),"Health",global_health);
10326 }
10327 }
10328
10331 {
10332 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
10333 }
10334
10336 {
10337 if (!hasRootAsPlayer)
10338 {
10339 if (refParentIB)
10340 {
10341
10342 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
10343 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
10344
10345 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
10346 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
10347
10350 }
10351 else
10352 {
10353
10356 }
10357 }
10358 }
10359
10361 {
10363 {
10364 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
10365 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
10366 {
10367 float heatPermCoef = 1.0;
10369 while (ent)
10370 {
10371 heatPermCoef *= ent.GetHeatPermeabilityCoef();
10372 ent = ent.GetHierarchyParent();
10373 }
10374
10375 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
10376 }
10377 }
10378 }
10379
10381 {
10382
10383 EntityAI parent = GetHierarchyParent();
10384 if (!parent)
10385 {
10386 hasParent = false;
10387 hasRootAsPlayer = false;
10388 }
10389 else
10390 {
10391 hasParent = true;
10392 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
10393 refParentIB =
ItemBase.Cast(parent);
10394 }
10395 }
10396
10397 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
10398 {
10399
10400 }
10401
10403 {
10404
10405 return false;
10406 }
10407
10409 {
10410
10411
10412 return false;
10413 }
10414
10416 {
10417
10418 return false;
10419 }
10420
10423 {
10424 return !GetIsFrozen() &&
IsOpen();
10425 }
10426
10428 {
10429 bool hasParent = false, hasRootAsPlayer = false;
10431
10432 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
10433 bool foodDecay =
g_Game.IsFoodDecayEnabled();
10434
10435 if (wwtu || foodDecay)
10436 {
10440
10441 if (processWetness || processTemperature || processDecay)
10442 {
10444
10445 if (processWetness)
10446 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
10447
10448 if (processTemperature)
10450
10451 if (processDecay)
10452 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
10453 }
10454 }
10455 }
10456
10459 {
10461 }
10462
10464 {
10467
10468 return super.GetTemperatureFreezeThreshold();
10469 }
10470
10472 {
10475
10476 return super.GetTemperatureThawThreshold();
10477 }
10478
10480 {
10483
10484 return super.GetItemOverheatThreshold();
10485 }
10486
10488 {
10490 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
10491
10492 return super.GetTemperatureFreezeTime();
10493 }
10494
10496 {
10498 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
10499
10500 return super.GetTemperatureThawTime();
10501 }
10502
10507
10509 {
10510 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
10511 }
10512
10514 {
10515 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
10516 }
10517
10520 {
10522 }
10523
10525 {
10527 }
10528
10530 {
10532 }
10533
10536 {
10537 return null;
10538 }
10539
10542 {
10543 return false;
10544 }
10545
10547 {
10549 {
10552 if (!trg)
10553 {
10555 explosive = this;
10556 }
10557
10558 explosive.PairRemote(trg);
10560
10561 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
10562 trg.SetPersistentPairID(persistentID);
10563 explosive.SetPersistentPairID(persistentID);
10564
10565 return true;
10566 }
10567 return false;
10568 }
10569
10572 {
10573 float ret = 1.0;
10576 ret *= GetHealth01();
10577
10578 return ret;
10579 }
10580
10581 #ifdef DEVELOPER
10582 override void SetDebugItem()
10583 {
10584 super.SetDebugItem();
10585 _itemBase = this;
10586 }
10587
10589 {
10590 string text = super.GetDebugText();
10591
10593 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
10594
10595 return text;
10596 }
10597 #endif
10598
10600 {
10601 return true;
10602 }
10603
10605
10607
10609 {
10612 }
10613
10614
10622
10638}
10639
10641{
10643 if (entity)
10644 {
10645 bool is_item = entity.IsInherited(
ItemBase);
10646 if (is_item && full_quantity)
10647 {
10650 }
10651 }
10652 else
10653 {
10655 return NULL;
10656 }
10657 return entity;
10658}
10659
10661{
10662 if (item)
10663 {
10664 if (health > 0)
10665 item.SetHealth("", "", health);
10666
10667 if (item.CanHaveTemperature())
10668 {
10670 if (item.CanFreeze())
10671 item.SetFrozen(false);
10672 }
10673
10674 if (item.HasEnergyManager())
10675 {
10676 if (quantity >= 0)
10677 {
10678 item.GetCompEM().SetEnergy0To1(quantity);
10679 }
10680 else
10681 {
10683 }
10684 }
10685 else if (item.IsMagazine())
10686 {
10687 Magazine mag = Magazine.Cast(item);
10688 if (quantity >= 0)
10689 {
10690 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
10691 }
10692 else
10693 {
10695 }
10696
10697 }
10698 else
10699 {
10700 if (quantity >= 0)
10701 {
10702 item.SetQuantityNormalized(quantity, false);
10703 }
10704 else
10705 {
10707 }
10708
10709 }
10710 }
10711}
10712
10713#ifdef DEVELOPER
10715#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.