5644{
5646 {
5647 return true;
5648 }
5649};
5650
5651
5652
5654{
5658
5660
5663
5664
5665
5666
5667
5676
5682
5687
5692
5713 protected bool m_IsResultOfSplit
5714
5716
5721
5722
5723
5725
5729
5730
5731
5733
5736
5737
5738
5744
5745
5753
5756
5757
5759
5760
5762
5763
5768
5769
5774
5775
5777
5778
5780 {
5785
5786 if (!
GetGame().IsDedicatedServer())
5787 {
5789 {
5791
5793 {
5795 }
5796 }
5797
5800 }
5801
5802 m_OldLocation = null;
5803
5805 {
5807 }
5808
5809 if (ConfigIsExisting("headSelectionsToHide"))
5810 {
5813 }
5814
5816 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
5817 {
5819 }
5820
5822
5823 m_IsResultOfSplit = false;
5824
5826 }
5827
5829 {
5830 super.InitItemVariables();
5831
5837 m_Count = ConfigGetInt(
"count");
5838
5841
5846
5849
5854
5866
5870
5871
5874 if (ConfigIsExisting("canBeSplit"))
5875 {
5878 }
5879
5881 if (ConfigIsExisting("itemBehaviour"))
5883
5884
5887 RegisterNetSyncVariableInt("m_VarLiquidType");
5888 RegisterNetSyncVariableInt("m_Cleanness",0,1);
5889
5890 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
5891 RegisterNetSyncVariableFloat("m_ImpactSpeed");
5892 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
5893
5894 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
5895 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
5896 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
5897 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
5898
5899 RegisterNetSyncVariableBool("m_IsBeingPlaced");
5900 RegisterNetSyncVariableBool("m_IsTakeable");
5901 RegisterNetSyncVariableBool("m_IsHologram");
5902
5905 {
5908 }
5909
5911
5913 if (ConfigIsExisting("temperaturePerQuantityWeight"))
5915
5916 }
5917
5919 {
5921 }
5922
5924 {
5927 {
5932 }
5933 }
5934
5935 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
5936 {
5938 {
5941 }
5942
5944 }
5945
5947 {
5953 }
5954
5956
5958 {
5960
5961 if (!action)
5962 {
5963 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
5964 return;
5965 }
5966
5968 if (!ai)
5969 {
5971 return;
5972 }
5973
5975 if (!action_array)
5976 {
5977 action_array = new array<ActionBase_Basic>;
5979 }
5980 if (LogManager.IsActionLogEnable())
5981 {
5982 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
5983 }
5984
5985 if (action_array.Find(action) != -1)
5986 {
5987 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
5988 }
5989 else
5990 {
5991 action_array.Insert(action);
5992 }
5993 }
5994
5996 {
5998 ActionBase action = player.GetActionManager().GetAction(actionName);
6001
6002 if (action_array)
6003 {
6004 action_array.RemoveItem(action);
6005 }
6006 }
6007
6008
6009
6011 {
6012 ActionOverrideData overrideData = new ActionOverrideData();
6016
6018 if (!actionMap)
6019 {
6022 }
6023
6024 actionMap.Insert(this.
Type(), overrideData);
6025
6026 }
6027
6029
6031
6032
6034 {
6037
6040
6041 string config_to_search = "CfgVehicles";
6042 string muzzle_owner_config;
6043
6045 {
6046 if (IsInherited(Weapon))
6047 config_to_search = "CfgWeapons";
6048
6049 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6050
6051 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
6052
6054
6055 if (config_OnFire_subclass_count > 0)
6056 {
6057 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
6058
6059 for (int i = 0; i < config_OnFire_subclass_count; i++)
6060 {
6061 string particle_class = "";
6063 string config_OnFire_entry = config_OnFire_class + particle_class;
6064 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
6065 WPOF_array.Insert(WPOF);
6066 }
6067
6068
6070 }
6071 }
6072
6074 {
6075 config_to_search = "CfgWeapons";
6076 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6077
6078 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
6079
6081
6082 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
6083 {
6084 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
6085
6086 for (i = 0; i < config_OnBulletCasingEject_count; i++)
6087 {
6088 string particle_class2 = "";
6090 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
6091 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
6092 WPOBE_array.Insert(WPOBE);
6093 }
6094
6095
6097 }
6098 }
6099 }
6100
6101
6103 {
6106
6108 {
6109 string config_to_search = "CfgVehicles";
6110
6111 if (IsInherited(Weapon))
6112 config_to_search = "CfgWeapons";
6113
6114 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6115 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
6116
6117 if (
GetGame().ConfigIsExisting(config_OnOverheating_class))
6118 {
6119
6121
6123 {
6125 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
6127 return;
6128 }
6129
6132
6133
6134
6136 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
6137
6138 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
6139 {
6140 string particle_class = "";
6142 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
6144
6145 if (entry_type == CT_CLASS)
6146 {
6147 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
6148 WPOOH_array.Insert(WPOF);
6149 }
6150 }
6151
6152
6154 }
6155 }
6156 }
6157
6159 {
6161 }
6162
6164 {
6166 {
6168
6171
6174
6175 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6176 }
6177 }
6178
6180 {
6182 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6183
6185 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6186
6188 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6189
6191 {
6193 }
6194 }
6195
6197 {
6199 }
6200
6202 {
6205 else
6207
6209 {
6212 }
6213 else
6214 {
6217
6220 }
6221
6223 }
6224
6226 {
6228 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6229 }
6230
6232 {
6234 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6236 }
6237
6239 {
6241 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6242 }
6243
6245 {
6248
6249 OverheatingParticle OP = new OverheatingParticle();
6254
6256 }
6257
6259 {
6262
6263 return -1;
6264 }
6265
6267 {
6269 {
6272
6273 for (int i = count; i > 0; --i)
6274 {
6275 int id = i - 1;
6278
6281
6282 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
6283 {
6284 if (p)
6285 {
6288 }
6289 }
6290 }
6291 }
6292 }
6293
6295 {
6297 {
6299 {
6300 int id = i - 1;
6302
6303 if (OP)
6304 {
6306
6307 if (p)
6308 {
6310 }
6311
6312 delete OP;
6313 }
6314 }
6315
6318 }
6319 }
6320
6323 {
6324 return 0.0;
6325 }
6326
6327
6329 {
6330 return 250;
6331 }
6332
6334 {
6335 return 0;
6336 }
6337
6340 {
6342 return true;
6343
6344 return false;
6345 }
6346
6349 {
6352
6354 {
6356 }
6357 else
6358 {
6359
6361 }
6362
6364 }
6365
6372 {
6373 return -1;
6374 }
6375
6376
6377
6378
6380 {
6382 {
6384 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6385
6386 if (r_index >= 0)
6387 {
6388 InventoryLocation r_il = new InventoryLocation;
6389 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6390
6391 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6394 {
6395 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6396 }
6398 {
6399 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6400 }
6401
6402 }
6403
6404 player.GetHumanInventory().ClearUserReservedLocation(this);
6405 }
6406
6409 }
6410
6411
6412
6413
6415 {
6416 return ItemBase.m_DebugActionsMask;
6417 }
6418
6420 {
6421 return ItemBase.m_DebugActionsMask & mask;
6422 }
6423
6425 {
6426 ItemBase.m_DebugActionsMask = mask;
6427 }
6428
6430 {
6431 ItemBase.m_DebugActionsMask |= mask;
6432 }
6433
6435 {
6436 ItemBase.m_DebugActionsMask &= ~mask;
6437 }
6438
6440 {
6442 {
6444 }
6445 else
6446 {
6448 }
6449 }
6450
6451
6453 {
6454 if (GetEconomyProfile())
6455 {
6456 float q_max = GetEconomyProfile().GetQuantityMax();
6457 if (q_max > 0)
6458 {
6459 float q_min = GetEconomyProfile().GetQuantityMin();
6460 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
6461
6463 {
6464 ComponentEnergyManager comp = GetCompEM();
6466 {
6468 }
6469 }
6471 {
6473
6474 }
6475
6476 }
6477 }
6478 }
6479
6482 {
6483 EntityAI parent = GetHierarchyParent();
6484
6485 if (parent)
6486 {
6487 InventoryLocation inventory_location_to_lock = new InventoryLocation;
6488 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
6489 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
6490 }
6491 }
6492
6495 {
6496 EntityAI parent = GetHierarchyParent();
6497
6498 if (parent)
6499 {
6500 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
6501 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
6502 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
6503 }
6504 }
6505
6507 {
6508
6509
6510
6511
6513
6515 {
6516 if (ScriptInputUserData.CanStoreInputUserData())
6517 {
6518 ScriptInputUserData ctx = new ScriptInputUserData;
6524 ctx.
Write(use_stack_max);
6527
6529 {
6530 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
6531 }
6532 }
6533 }
6534 else if (!
GetGame().IsMultiplayer())
6535 {
6537 }
6538 }
6539
6541 {
6543 }
6544
6546 {
6548 }
6549
6551 {
6553 }
6554
6556 {
6557
6558 return false;
6559 }
6560
6562 {
6563 return false;
6564 }
6565
6569 {
6570 return false;
6571 }
6572
6574 {
6575 return "";
6576 }
6577
6579
6581 {
6582 return false;
6583 }
6584
6586 {
6587 return true;
6588 }
6589
6590
6591
6593 {
6594 return true;
6595 }
6596
6598 {
6599 return true;
6600 }
6601
6603 {
6604 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6606 }
6607
6609 {
6611 }
6612
6614 {
6616 if (!is_being_placed)
6618 SetSynchDirty();
6619 }
6620
6621
6623
6625 {
6627 }
6628
6630 {
6632 }
6633
6635 {
6636 return 1;
6637 }
6638
6640 {
6641 return false;
6642 }
6643
6645 {
6647 SetSynchDirty();
6648 }
6649
6650
6651
6652
6653
6654
6655
6656
6657
6658
6659
6660
6661
6662
6663
6664
6665
6666
6667
6668
6669
6670
6671
6672
6673
6674
6675
6676
6677
6678
6679
6680
6681
6682
6683
6685 {
6686 super.OnMovedInsideCargo(container);
6687
6688 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6689 }
6690
6691 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
6692 {
6693 super.EEItemLocationChanged(oldLoc,newLoc);
6694
6695 PlayerBase new_player = null;
6696 PlayerBase old_player = null;
6697
6698 if (newLoc.GetParent())
6699 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
6700
6701 if (oldLoc.GetParent())
6702 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
6703
6705 {
6706 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
6707
6708 if (r_index >= 0)
6709 {
6710 InventoryLocation r_il = new InventoryLocation;
6711 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6712
6713 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6716 {
6717 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6718 }
6720 {
6721 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6722 }
6723
6724 }
6725 }
6726
6728 {
6729 if (new_player)
6730 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
6731
6732 if (new_player == old_player)
6733 {
6734
6735 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
6736 {
6738 {
6739 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
6740 {
6741 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6742 }
6743 }
6744 else
6745 {
6746 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6747 }
6748 }
6749
6750 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
6751 {
6752 int type = oldLoc.GetType();
6754 {
6755 oldLoc.GetParent().GetOnSetLock().Invoke(this);
6756 }
6758 {
6759 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
6760 }
6761 }
6762 if (!m_OldLocation)
6763 {
6764 m_OldLocation = new InventoryLocation;
6765 }
6766 m_OldLocation.Copy(oldLoc);
6767 }
6768 else
6769 {
6770 if (m_OldLocation)
6771 {
6772 m_OldLocation.Reset();
6773 }
6774 }
6775
6777 }
6778 else
6779 {
6780 if (new_player)
6781 {
6782 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
6783 if (res_index >= 0)
6784 {
6785 InventoryLocation il = new InventoryLocation;
6786 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
6788 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
6791 {
6792 il.
GetParent().GetOnReleaseLock().Invoke(it);
6793 }
6795 {
6797 }
6798
6799 }
6800 }
6802 {
6803
6805 }
6806
6807 if (m_OldLocation)
6808 {
6809 m_OldLocation.Reset();
6810 }
6811 }
6812 }
6813
6814 override void EOnContact(IEntity other, Contact extra)
6815 {
6817 {
6818 int liquidType = -1;
6820 if (impactSpeed > 0.0)
6821 {
6823 #ifndef SERVER
6825 #else
6827 SetSynchDirty();
6828 #endif
6830 }
6831 }
6832
6833 #ifdef SERVER
6834 if (GetCompEM() && GetCompEM().IsPlugged())
6835 {
6836 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
6837 GetCompEM().UnplugThis();
6838 }
6839 #endif
6840 }
6841
6843
6845 {
6847 }
6848
6850 {
6851
6852 }
6853
6855 {
6856 super.OnItemLocationChanged(old_owner, new_owner);
6857
6858 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
6859 PlayerBase playerNew = PlayerBase.Cast(new_owner);
6860
6861 if (!relatedPlayer && playerNew)
6862 relatedPlayer = playerNew;
6863
6864 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
6865 {
6867 if (actionMgr)
6868 {
6869 ActionBase currentAction = actionMgr.GetRunningAction();
6870 if (currentAction)
6872 }
6873 }
6874
6875 Man ownerPlayerOld = null;
6876 Man ownerPlayerNew = null;
6877
6878 if (old_owner)
6879 {
6880 if (old_owner.
IsMan())
6881 {
6882 ownerPlayerOld = Man.Cast(old_owner);
6883 }
6884 else
6885 {
6886 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
6887 }
6888 }
6889 else
6890 {
6892 {
6894
6895 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
6896 {
6897 GetCompEM().UnplugThis();
6898 }
6899 }
6900 }
6901
6902 if (new_owner)
6903 {
6904 if (new_owner.
IsMan())
6905 {
6906 ownerPlayerNew = Man.Cast(new_owner);
6907 }
6908 else
6909 {
6910 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
6911 }
6912 }
6913
6914 if (ownerPlayerOld != ownerPlayerNew)
6915 {
6916 if (ownerPlayerOld)
6917 {
6918 array<EntityAI> subItemsExit = new array<EntityAI>;
6920 for (int i = 0; i < subItemsExit.Count(); i++)
6921 {
6924 }
6925 }
6926
6927 if (ownerPlayerNew)
6928 {
6929 array<EntityAI> subItemsEnter = new array<EntityAI>;
6931 for (int j = 0; j < subItemsEnter.Count(); j++)
6932 {
6935 }
6936 }
6937 }
6938 else if (ownerPlayerNew != null)
6939 {
6940 PlayerBase nplayer;
6941 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
6942 {
6943 array<EntityAI> subItemsUpdate = new array<EntityAI>;
6945 for (int k = 0; k < subItemsUpdate.Count(); k++)
6946 {
6948 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
6949 }
6950 }
6951 }
6952
6953 if (old_owner)
6954 old_owner.OnChildItemRemoved(this);
6955 if (new_owner)
6956 new_owner.OnChildItemReceived(this);
6957 }
6958
6959
6961 {
6962 super.EEDelete(parent);
6963 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
6964 if (player)
6965 {
6967
6968 if (player.IsAlive())
6969 {
6970 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6971 if (r_index >= 0)
6972 {
6973 InventoryLocation r_il = new InventoryLocation;
6974 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6975
6976 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6979 {
6980 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6981 }
6983 {
6984 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6985 }
6986
6987 }
6988
6989 player.RemoveQuickBarEntityShortcut(this);
6990 }
6991 }
6992 }
6993
6995 {
6996 super.EEKilled(killer);
6997
7000 {
7001 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
7002 {
7003 if (IsMagazine())
7004 {
7005 if (Magazine.Cast(this).GetAmmoCount() > 0)
7006 {
7008 }
7009 }
7010 else
7011 {
7013 }
7014 }
7015 }
7016 }
7017
7019 {
7020 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7021
7022 super.OnWasAttached(parent, slot_id);
7023
7026
7028 }
7029
7031 {
7032 super.OnWasDetached(parent, slot_id);
7033
7036 }
7037
7039 {
7040 int idx;
7043
7044 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7045 if (inventory_slots.Count() < 1)
7046 {
7047 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
7048 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
7049 }
7050 else
7051 {
7052 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
7053 }
7054
7055 idx = inventory_slots.Find(slot);
7056 if (idx < 0)
7057 return "";
7058
7059 return attach_types.Get(idx);
7060 }
7061
7063 {
7064 int idx = -1;
7065 string slot;
7066
7069
7070 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7071 if (inventory_slots.Count() < 1)
7072 {
7073 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
7074 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7075 }
7076 else
7077 {
7078 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
7079 if (detach_types.Count() < 1)
7080 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7081 }
7082
7083 for (int i = 0; i < inventory_slots.Count(); i++)
7084 {
7085 slot = inventory_slots.Get(i);
7086 }
7087
7088 if (slot != "")
7089 {
7090 if (detach_types.Count() == 1)
7091 idx = 0;
7092 else
7093 idx = inventory_slots.Find(slot);
7094 }
7095 if (idx < 0)
7096 return "";
7097
7098 return detach_types.Get(idx);
7099 }
7100
7102 {
7103
7105
7106
7107 float min_time = 1;
7108 float max_time = 3;
7109 float delay = Math.RandomFloat(min_time, max_time);
7110
7111 explode_timer.Run(delay, this, "DoAmmoExplosion");
7112 }
7113
7115 {
7116 Magazine magazine = Magazine.Cast(this);
7117 int pop_sounds_count = 6;
7118 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
7119
7120
7121 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
7122 string sound_name = pop_sounds[ sound_idx ];
7124
7125
7126 magazine.ServerAddAmmoCount(-1);
7127
7128
7129 float min_temp_to_explode = 100;
7130
7131 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
7132 {
7134 }
7135 }
7136
7137
7138 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
7139 {
7140 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
7141
7142 const int CHANCE_DAMAGE_CARGO = 4;
7143 const int CHANCE_DAMAGE_ATTACHMENT = 1;
7144 const int CHANCE_DAMAGE_NOTHING = 2;
7145
7147 {
7148 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
7149 int chances;
7150 int rnd;
7151
7152 if (GetInventory().GetCargo())
7153 {
7154 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7155 rnd = Math.RandomInt(0,chances);
7156
7157 if (rnd < CHANCE_DAMAGE_CARGO)
7158 {
7160 }
7161 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
7162 {
7164 }
7165 }
7166 else
7167 {
7168 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7169 rnd = Math.RandomInt(0,chances);
7170
7171 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
7172 {
7174 }
7175 }
7176 }
7177 }
7178
7180 {
7181 if (GetInventory().GetCargo())
7182 {
7183 int item_count = GetInventory().GetCargo().GetItemCount();
7184 if (item_count > 0)
7185 {
7186 int random_pick = Math.RandomInt(0, item_count);
7188 if (!item.IsExplosive())
7189 {
7190 item.AddHealth("","",damage);
7191 return true;
7192 }
7193 }
7194 }
7195 return false;
7196 }
7197
7199 {
7200 int attachment_count = GetInventory().AttachmentCount();
7201 if (attachment_count > 0)
7202 {
7203 int random_pick = Math.RandomInt(0, attachment_count);
7204 ItemBase attachment =
ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
7205 if (!attachment.IsExplosive())
7206 {
7207 attachment.AddHealth("","",damage);
7208 return true;
7209 }
7210 }
7211 return false;
7212 }
7213
7215 {
7217 }
7218
7220 {
7222 return GetInventory().CanRemoveEntity();
7223
7224 return false;
7225 }
7226
7228 {
7229
7231 return false;
7232
7233
7235 return false;
7236
7237
7238
7240 if (delta == 0)
7241 return false;
7242
7243
7244 return true;
7245 }
7246
7248 {
7250 {
7251 if (ScriptInputUserData.CanStoreInputUserData())
7252 {
7253 ScriptInputUserData ctx = new ScriptInputUserData;
7258 ctx.
Write(destination_entity);
7262 }
7263 }
7264 else if (!
GetGame().IsMultiplayer())
7265 {
7267 }
7268 }
7269
7271 {
7272 float split_quantity_new;
7276 InventoryLocation loc = new InventoryLocation;
7277
7278 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7279 {
7281 split_quantity_new = stack_max;
7282 else
7284
7286 {
7287 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7288 if (new_item)
7289 {
7290 new_item.SetResultOfSplit(true);
7291 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7293 new_item.
SetQuantity(split_quantity_new,
false,
true);
7294 }
7295 }
7296 }
7297 else if (destination_entity && slot_id == -1)
7298 {
7299 if (quantity > stack_max)
7300 split_quantity_new = stack_max;
7301 else
7302 split_quantity_new = quantity;
7303
7305 {
7307 {
7310 }
7311
7312 if (new_item)
7313 {
7314 new_item.SetResultOfSplit(true);
7315 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7317 new_item.
SetQuantity(split_quantity_new,
false,
true);
7318 }
7319 }
7320 }
7321 else
7322 {
7323 if (stack_max != 0)
7324 {
7326 {
7328 }
7329
7330 if (split_quantity_new == 0)
7331 {
7332 if (!
GetGame().IsMultiplayer())
7333 player.PhysicalPredictiveDropItem(this);
7334 else
7335 player.ServerDropEntity(this);
7336 return;
7337 }
7338
7340 {
7342
7343 if (new_item)
7344 {
7345 new_item.SetResultOfSplit(true);
7346 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7349 new_item.PlaceOnSurface();
7350 }
7351 }
7352 }
7353 }
7354 }
7355
7357 {
7358 float split_quantity_new;
7362 InventoryLocation loc = new InventoryLocation;
7363
7364 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7365 {
7367 split_quantity_new = stack_max;
7368 else
7370
7372 {
7373 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7374 if (new_item)
7375 {
7376 new_item.SetResultOfSplit(true);
7377 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7379 new_item.
SetQuantity(split_quantity_new,
false,
true);
7380 }
7381 }
7382 }
7383 else if (destination_entity && slot_id == -1)
7384 {
7385 if (quantity > stack_max)
7386 split_quantity_new = stack_max;
7387 else
7388 split_quantity_new = quantity;
7389
7391 {
7393 {
7396 }
7397
7398 if (new_item)
7399 {
7400 new_item.SetResultOfSplit(true);
7401 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7403 new_item.
SetQuantity(split_quantity_new,
false,
true);
7404 }
7405 }
7406 }
7407 else
7408 {
7409 if (stack_max != 0)
7410 {
7412 {
7414 }
7415
7417 {
7419
7420 if (new_item)
7421 {
7422 new_item.SetResultOfSplit(true);
7423 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7426 new_item.PlaceOnSurface();
7427 }
7428 }
7429 }
7430 }
7431 }
7432
7434 {
7436 {
7437 if (ScriptInputUserData.CanStoreInputUserData())
7438 {
7439 ScriptInputUserData ctx = new ScriptInputUserData;
7444 dst.WriteToContext(ctx);
7446 }
7447 }
7448 else if (!
GetGame().IsMultiplayer())
7449 {
7451 }
7452 }
7453
7455 {
7457 {
7458 if (ScriptInputUserData.CanStoreInputUserData())
7459 {
7460 ScriptInputUserData ctx = new ScriptInputUserData;
7465 ctx.
Write(destination_entity);
7471 }
7472 }
7473 else if (!
GetGame().IsMultiplayer())
7474 {
7476 }
7477 }
7478
7480 {
7482 }
7483
7485 {
7487 float split_quantity_new;
7489 if (dst.IsValid())
7490 {
7491 int slot_id = dst.GetSlot();
7493
7494 if (quantity > stack_max)
7495 split_quantity_new = stack_max;
7496 else
7497 split_quantity_new = quantity;
7498
7500 {
7502
7503 if (new_item)
7504 {
7505 new_item.SetResultOfSplit(true);
7506 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7508 new_item.
SetQuantity(split_quantity_new,
false,
true);
7509 }
7510
7511 return new_item;
7512 }
7513 }
7514
7515 return null;
7516 }
7517
7519 {
7521 float split_quantity_new;
7523 if (destination_entity)
7524 {
7526 if (quantity > stackable)
7527 split_quantity_new = stackable;
7528 else
7529 split_quantity_new = quantity;
7530
7532 {
7533 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
7534 if (new_item)
7535 {
7536 new_item.SetResultOfSplit(true);
7537 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7539 new_item.
SetQuantity(split_quantity_new,
false,
true);
7540 }
7541 }
7542 }
7543 }
7544
7546 {
7548 {
7549 if (ScriptInputUserData.CanStoreInputUserData())
7550 {
7551 ScriptInputUserData ctx = new ScriptInputUserData;
7556 ItemBase destination_entity =
this;
7557 ctx.
Write(destination_entity);
7561 }
7562 }
7563 else if (!
GetGame().IsMultiplayer())
7564 {
7566 }
7567 }
7568
7570 {
7572 float split_quantity_new;
7574 if (player)
7575 {
7577 if (quantity > stackable)
7578 split_quantity_new = stackable;
7579 else
7580 split_quantity_new = quantity;
7581
7583 {
7584 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
7585 new_item =
ItemBase.Cast(in_hands);
7586 if (new_item)
7587 {
7588 new_item.SetResultOfSplit(true);
7589 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7591 new_item.SetQuantity(split_quantity_new, false, true);
7592 }
7593 }
7594 }
7595 }
7596
7598 {
7600 float split_quantity_new = Math.Floor(quantity * 0.5);
7601
7603 return;
7604
7606
7607 if (new_item)
7608 {
7609 if (new_item.GetQuantityMax() < split_quantity_new)
7610 {
7611 split_quantity_new = new_item.GetQuantityMax();
7612 }
7613
7614 new_item.SetResultOfSplit(true);
7615 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7616
7618 {
7621 }
7622 else
7623 {
7625 new_item.
SetQuantity(split_quantity_new,
false,
true);
7626 }
7627 }
7628 }
7629
7631 {
7633 float split_quantity_new = Math.Floor(quantity / 2);
7634
7636 return;
7637
7638 InventoryLocation invloc = new InventoryLocation;
7640
7642 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
7643
7644 if (new_item)
7645 {
7646 if (new_item.GetQuantityMax() < split_quantity_new)
7647 {
7648 split_quantity_new = new_item.GetQuantityMax();
7649 }
7651 {
7654 }
7655 else if (split_quantity_new > 1)
7656 {
7658 new_item.
SetQuantity(split_quantity_new,
false,
true);
7659 }
7660 }
7661 }
7662
7665 {
7666 SetWeightDirty();
7668
7669 if (parent)
7670 parent.OnAttachmentQuantityChangedEx(this, delta);
7671
7673 {
7675 {
7677 }
7679 {
7680 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
7682 }
7683 }
7684
7685 }
7686
7689 {
7690
7691 }
7692
7695 {
7697 }
7698
7700 {
7701 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
7702
7704 {
7705 if (newLevel == GameConstants.STATE_RUINED)
7706 {
7708 EntityAI parent = GetHierarchyParent();
7709 if (parent && parent.IsFireplace())
7710 {
7711 CargoBase cargo = GetInventory().GetCargo();
7712 if (cargo)
7713 {
7715 {
7717 }
7718 }
7719 }
7720 }
7721
7723 {
7724
7726 return;
7727 }
7728
7729 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
7730 {
7732 }
7733 }
7734 }
7735
7736
7738 {
7739 super.OnRightClick();
7740
7742 {
7744 {
7745 if (ScriptInputUserData.CanStoreInputUserData())
7746 {
7747 EntityAI root = GetHierarchyRoot();
7748 Man playerOwner = GetHierarchyRootPlayer();
7749 InventoryLocation dst = new InventoryLocation;
7750
7751
7752 if (!playerOwner && root && root == this)
7753 {
7755 }
7756 else
7757 {
7758
7759 GetInventory().GetCurrentInventoryLocation(dst);
7761 {
7764 {
7766 }
7767 else
7768 {
7770
7771
7772 if (
GetGame().
GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
7773 {
7775 }
7776 else
7777 {
7778 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
7779 }
7780 }
7781 }
7782 }
7783
7784 ScriptInputUserData ctx = new ScriptInputUserData;
7792 }
7793 }
7794 else if (!
GetGame().IsMultiplayer())
7795 {
7797 }
7798 }
7799 }
7800
7802 {
7803 if (root)
7804 {
7805 vector m4[4];
7806 root.GetTransform(m4);
7807 dst.SetGround(this, m4);
7808 }
7809 else
7810 {
7811 GetInventory().GetCurrentInventoryLocation(dst);
7812 }
7813 }
7814
7815 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
7816 {
7817
7818 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
7819 return false;
7820
7821 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
7822 return false;
7823
7824
7826 return false;
7827
7828
7829 Magazine mag = Magazine.Cast(this);
7830 if (mag)
7831 {
7832 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
7833 return false;
7834
7835 if (stack_max_limit)
7836 {
7837 Magazine other_mag = Magazine.Cast(other_item);
7838 if (other_item)
7839 {
7840 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
7841 return false;
7842 }
7843
7844 }
7845 }
7846 else
7847 {
7848
7850 return false;
7851
7853 return false;
7854 }
7855
7856 PlayerBase player = null;
7857 if (CastTo(player, GetHierarchyRootPlayer()))
7858 {
7859 if (player.GetInventory().HasAttachment(this))
7860 return false;
7861
7862 if (player.IsItemsToDelete())
7863 return false;
7864 }
7865
7866 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
7867 return false;
7868
7869 int slotID;
7871 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
7872 return false;
7873
7874 return true;
7875 }
7876
7878 {
7880 }
7881
7883 {
7884 return m_IsResultOfSplit;
7885 }
7886
7888 {
7889 m_IsResultOfSplit = value;
7890 }
7891
7893 {
7895 }
7896
7898 {
7899 float other_item_quantity = other_item.GetQuantity();
7900 float this_free_space;
7901
7903
7905
7906 if (other_item_quantity > this_free_space)
7907 {
7908 return this_free_space;
7909 }
7910 else
7911 {
7912 return other_item_quantity;
7913 }
7914 }
7915
7917 {
7919 }
7920
7922 {
7924 return;
7925
7926 if (!IsMagazine() && other_item)
7927 {
7929 if (quantity_used != 0)
7930 {
7931 float hp1 = GetHealth01("","");
7932 float hp2 = other_item.GetHealth01("","");
7933 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
7934 hpResult = hpResult / (
GetQuantity() + quantity_used);
7935
7936 hpResult *= GetMaxHealth();
7937 Math.Round(hpResult);
7938 SetHealth("", "Health", hpResult);
7939
7941 other_item.AddQuantity(-quantity_used);
7942 }
7943 }
7945 }
7946
7948 {
7949 #ifdef SERVER
7950 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
7951 GetHierarchyParent().IncreaseLifetimeUp();
7952 #endif
7953 };
7954
7956 {
7957 PlayerBase p = PlayerBase.Cast(player);
7958
7959 array<int> recipesIds = p.m_Recipes;
7960 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
7961 if (moduleRecipesManager)
7962 {
7963 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
7964 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
7965 }
7966
7967 for (int i = 0;i < recipesIds.Count(); i++)
7968 {
7969 int key = recipesIds.Get(i);
7970 string recipeName = moduleRecipesManager.GetRecipeName(key);
7972 }
7973 }
7974
7975
7976 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
7977 {
7978 super.GetDebugActions(outputList);
7979
7980
7986
7987
7992
7997
7998
8002
8003
8005 {
8009 }
8010
8013
8014
8018
8020
8021 InventoryLocation loc = new InventoryLocation();
8022 GetInventory().GetCurrentInventoryLocation(loc);
8024 {
8025 if (Gizmo_IsSupported())
8028 }
8029
8031 }
8032
8033
8034
8035
8037 {
8038 super.OnAction(action_id, player, ctx);
8039
8041 {
8042 switch (action_id)
8043 {
8046 return true;
8049 return true;
8050 }
8051 }
8052
8054 {
8055 switch (action_id)
8056 {
8058 Delete();
8059 return true;
8060 }
8061 }
8062
8063 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
8064 {
8065 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8066 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
8067 PlayerBase p = PlayerBase.Cast(player);
8068 if (
EActions.RECIPES_RANGE_START < 1000)
8069 {
8070 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
8071 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
8072 }
8073 }
8074 #ifndef SERVER
8075 else if (action_id ==
EActions.WATCH_PLAYER)
8076 {
8077 PluginDeveloper.SetDeveloperItemClientEx(player);
8078 }
8079 #endif
8081 {
8082 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
8083 {
8084 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
8085 OnDebugButtonPressServer(id + 1);
8086 }
8087
8088 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
8089 {
8090 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
8092 }
8093
8094 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
8095 {
8096 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
8098 }
8099
8100 else if (action_id ==
EActions.ADD_QUANTITY)
8101 {
8102 if (IsMagazine())
8103 {
8104 Magazine mag = Magazine.Cast(this);
8105 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
8106 }
8107 else
8108 {
8110 }
8111
8112 if (m_EM)
8113 {
8114 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
8115 }
8116
8117 }
8118
8119 else if (action_id ==
EActions.REMOVE_QUANTITY)
8120 {
8121 if (IsMagazine())
8122 {
8123 Magazine mag2 = Magazine.Cast(this);
8124 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
8125 }
8126 else
8127 {
8129 }
8130 if (m_EM)
8131 {
8132 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
8133 }
8134
8135 }
8136
8137 else if (action_id ==
EActions.SET_QUANTITY_0)
8138 {
8140
8141 if (m_EM)
8142 {
8143 m_EM.SetEnergy(0);
8144 }
8145 }
8146
8147 else if (action_id ==
EActions.SET_MAX_QUANTITY)
8148 {
8150
8151 if (m_EM)
8152 {
8153 m_EM.SetEnergy(m_EM.GetEnergyMax());
8154 }
8155 }
8156
8157 else if (action_id ==
EActions.ADD_HEALTH)
8158 {
8159 AddHealth("","",GetMaxHealth("","Health")/5);
8160 }
8161 else if (action_id ==
EActions.REMOVE_HEALTH)
8162 {
8163 AddHealth("","",-GetMaxHealth("","Health")/5);
8164 }
8165 else if (action_id ==
EActions.DESTROY_HEALTH)
8166 {
8167 SetHealth01("","",0);
8168 }
8169 else if (action_id ==
EActions.WATCH_ITEM)
8170 {
8172 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
8173 #ifdef DEVELOPER
8174 SetDebugDeveloper_item(this);
8175 #endif
8176 }
8177
8178 else if (action_id ==
EActions.ADD_TEMPERATURE)
8179 {
8180 AddTemperature(20);
8181
8182 }
8183
8184 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
8185 {
8186 AddTemperature(-20);
8187
8188 }
8189
8190 else if (action_id ==
EActions.FLIP_FROZEN)
8191 {
8192 SetFrozen(!GetIsFrozen());
8193
8194 }
8195
8196 else if (action_id ==
EActions.ADD_WETNESS)
8197 {
8199
8200 }
8201
8202 else if (action_id ==
EActions.REMOVE_WETNESS)
8203 {
8205
8206 }
8207
8208 else if (action_id ==
EActions.LIQUIDTYPE_UP)
8209 {
8212
8213
8214 }
8215
8216 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
8217 {
8220 }
8221
8222 else if (action_id ==
EActions.MAKE_SPECIAL)
8223 {
8224 auto debugParams = DebugSpawnParams.WithPlayer(player);
8225 OnDebugSpawnEx(debugParams);
8226 }
8227
8228 }
8229
8230
8231 return false;
8232 }
8233
8234
8235
8236
8240
8243
8244
8245
8247 {
8248 return false;
8249 }
8250
8251
8253 {
8254 return true;
8255 }
8256
8257
8259 {
8260 return true;
8261 }
8262
8263
8264
8266 {
8267 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
8269 }
8270
8273 {
8274 return null;
8275 }
8276
8278 {
8279 return false;
8280 }
8281
8283 {
8284 return false;
8285 }
8286
8290
8291
8293 {
8294 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8295 return module_repairing.CanRepair(this, item_repair_kit);
8296 }
8297
8298
8299 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
8300 {
8301 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8302 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
8303 }
8304
8305
8307 {
8308
8309
8310
8311
8312
8313
8314
8315
8316 return 1;
8317 }
8318
8319
8320
8322 {
8324 }
8325
8326
8327
8329 {
8331 }
8332
8333
8342 {
8343 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8344
8345 if (player)
8346 {
8347 player.MessageStatus(text);
8348 }
8349 }
8350
8351
8360 {
8361 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8362
8363 if (player)
8364 {
8365 player.MessageAction(text);
8366 }
8367 }
8368
8369
8378 {
8379 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8380
8381 if (player)
8382 {
8383 player.MessageFriendly(text);
8384 }
8385 }
8386
8387
8396 {
8397 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8398
8399 if (player)
8400 {
8401 player.MessageImportant(text);
8402 }
8403 }
8404
8406 {
8407 return true;
8408 }
8409
8410
8411 override bool KindOf(
string tag)
8412 {
8413 bool found = false;
8414 string item_name = this.
GetType();
8417
8418 int array_size = item_tag_array.Count();
8419 for (int i = 0; i < array_size; i++)
8420 {
8421 if (item_tag_array.Get(i) == tag)
8422 {
8423 found = true;
8424 break;
8425 }
8426 }
8427 return found;
8428 }
8429
8430
8432 {
8433
8434 super.OnRPC(sender, rpc_type,ctx);
8435
8436
8437 switch (rpc_type)
8438 {
8439 #ifndef SERVER
8440 case ERPCs.RPC_SOUND_LOCK_ATTACH:
8441 Param2<bool, string> p = new Param2<bool, string>(false, "");
8442
8444 return;
8445
8446 bool play = p.param1;
8447 string soundSet = p.param2;
8448
8449 if (play)
8450 {
8452 {
8454 {
8456 }
8457 }
8458 else
8459 {
8461 }
8462 }
8463 else
8464 {
8466 }
8467
8468 break;
8469 #endif
8470
8471 }
8472
8474 {
8476 }
8477 }
8478
8479
8480
8481
8483 {
8484 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8485 return plugin.GetID(
name);
8486 }
8487
8489 {
8490 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8491 return plugin.GetName(id);
8492 }
8493
8496 {
8497
8498
8499 int varFlags;
8500 if (!ctx.
Read(varFlags))
8501 return;
8502
8503 if (varFlags & ItemVariableFlags.FLOAT)
8504 {
8506 }
8507 }
8508
8510 {
8511
8512 super.SerializeNumericalVars(floats_out);
8513
8514
8515
8517 {
8519 }
8520
8522 {
8524 }
8525
8527 {
8529 }
8530
8532 {
8537 }
8538
8540 {
8542 }
8543 }
8544
8546 {
8547
8548 super.DeSerializeNumericalVars(floats);
8549
8550
8551 int index = 0;
8552 int mask = Math.Round(floats.Get(index));
8553
8554 index++;
8555
8557 {
8559 {
8561 }
8562 else
8563 {
8564 float quantity = floats.Get(index);
8566 }
8567 index++;
8568 }
8569
8571 {
8572 float wet = floats.Get(index);
8574 index++;
8575 }
8576
8578 {
8579 int liquidtype = Math.Round(floats.Get(index));
8581 index++;
8582 }
8583
8585 {
8587 index++;
8589 index++;
8591 index++;
8593 index++;
8594 }
8595
8597 {
8598 int cleanness = Math.Round(floats.Get(index));
8600 index++;
8601 }
8602 }
8603
8605 {
8606 super.WriteVarsToCTX(ctx);
8607
8608
8610 {
8612 }
8613
8615 {
8617 }
8618
8620 {
8622 }
8623
8625 {
8626 int r,g,b,a;
8632 }
8633
8635 {
8637 }
8638 }
8639
8641 {
8642 if (!super.ReadVarsFromCTX(ctx,version))
8643 return false;
8644
8645 int intValue;
8646 float value;
8647
8648 if (version < 140)
8649 {
8650 if (!ctx.
Read(intValue))
8651 return false;
8652
8653 m_VariablesMask = intValue;
8654 }
8655
8657 {
8658 if (!ctx.
Read(value))
8659 return false;
8660
8662 {
8664 }
8665 else
8666 {
8668 }
8669 }
8670
8671 if (version < 140)
8672 {
8674 {
8675 if (!ctx.
Read(value))
8676 return false;
8677 SetTemperatureDirect(value);
8678 }
8679 }
8680
8682 {
8683 if (!ctx.
Read(value))
8684 return false;
8686 }
8687
8689 {
8690 if (!ctx.
Read(intValue))
8691 return false;
8693 }
8694
8696 {
8697 int r,g,b,a;
8699 return false;
8701 return false;
8703 return false;
8705 return false;
8706
8708 }
8709
8711 {
8712 if (!ctx.
Read(intValue))
8713 return false;
8715 }
8716
8717 if (version >= 138 && version < 140)
8718 {
8720 {
8721 if (!ctx.
Read(intValue))
8722 return false;
8723 SetFrozen(intValue);
8724 }
8725 }
8726
8727 return true;
8728 }
8729
8730
8732 {
8735 {
8737 }
8738
8739 if (!super.OnStoreLoad(ctx, version))
8740 {
8742 return false;
8743 }
8744
8745 if (version >= 114)
8746 {
8747 bool hasQuickBarIndexSaved;
8748
8749 if (!ctx.
Read(hasQuickBarIndexSaved))
8750 {
8752 return false;
8753 }
8754
8755 if (hasQuickBarIndexSaved)
8756 {
8757 int itmQBIndex;
8758
8759
8760 if (!ctx.
Read(itmQBIndex))
8761 {
8763 return false;
8764 }
8765
8766 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
8767 if (itmQBIndex != -1 && parentPlayer)
8768 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
8769 }
8770 }
8771 else
8772 {
8773
8774 PlayerBase player;
8775 int itemQBIndex;
8776 if (version ==
int.
MAX)
8777 {
8778 if (!ctx.
Read(itemQBIndex))
8779 {
8781 return false;
8782 }
8783 }
8784 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
8785 {
8786
8787 if (!ctx.
Read(itemQBIndex))
8788 {
8790 return false;
8791 }
8792 if (itemQBIndex != -1 && player)
8793 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
8794 }
8795 }
8796
8797 if (version < 140)
8798 {
8799
8800 if (!LoadVariables(ctx, version))
8801 {
8803 return false;
8804 }
8805 }
8806
8807
8809 {
8811 return false;
8812 }
8813 if (version >= 132)
8814 {
8816 if (raib)
8817 {
8819 {
8821 return false;
8822 }
8823 }
8824 }
8825
8827 return true;
8828 }
8829
8830
8831
8833 {
8834 super.OnStoreSave(ctx);
8835
8836 PlayerBase player;
8837 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
8838 {
8840
8841 int itemQBIndex = -1;
8842 itemQBIndex = player.FindQuickBarEntityIndex(this);
8843 ctx.
Write(itemQBIndex);
8844 }
8845 else
8846 {
8848 }
8849
8851
8853 if (raib)
8854 {
8856 }
8857 }
8858
8859
8861 {
8862 super.AfterStoreLoad();
8863
8865 {
8867 }
8868
8870 {
8873 }
8874 }
8875
8877 {
8878 super.EEOnAfterLoad();
8879
8881 {
8883 }
8884
8887 }
8888
8890 {
8891 return false;
8892 }
8893
8894
8895
8897 {
8899 {
8900 #ifdef PLATFORM_CONSOLE
8901
8903 {
8905 if (menu)
8906 {
8908 }
8909 }
8910 #endif
8911 }
8912
8914 {
8917 }
8918
8920 {
8921 SetWeightDirty();
8923 }
8925 {
8928 }
8929
8931 {
8934 }
8936 {
8939 }
8940
8941 super.OnVariablesSynchronized();
8942 }
8943
8944
8945
8947 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
8948 {
8949 if (!IsServerCheck(allow_client))
8950 return false;
8951
8953 return false;
8954
8957
8958 if (value <= (min + 0.001))
8959 value = min;
8960
8961 if (value == min)
8962 {
8963 if (destroy_config)
8964 {
8965 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
8966 if (dstr)
8967 {
8969 this.Delete();
8970 return true;
8971 }
8972 }
8973 else if (destroy_forced)
8974 {
8976 this.Delete();
8977 return true;
8978 }
8979
8981 }
8982
8985
8987 {
8989
8990 if (delta)
8992 }
8993
8995
8996 return false;
8997 }
8998
8999
9001 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9002 {
9004 }
9005
9007 {
9010 }
9011
9013 {
9016 }
9017
9019 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9020 {
9021 float value_clamped = Math.Clamp(value, 0, 1);
9023 SetQuantity(result, destroy_config, destroy_forced);
9024 }
9025
9026
9029 {
9031 }
9032
9034 {
9036 }
9037
9038
9039
9040
9041
9042
9043
9044
9045
9046
9048 {
9049 int slot = -1;
9050 if (GetInventory())
9051 {
9052 InventoryLocation il = new InventoryLocation;
9053 GetInventory().GetCurrentInventoryLocation(il);
9055 }
9056
9058 }
9059
9061 {
9062 float quantity_max = 0;
9063
9065 {
9066 if (attSlotID != -1)
9067 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
9068
9069 if (quantity_max <= 0)
9071 }
9072
9073 if (quantity_max <= 0)
9075
9076 return quantity_max;
9077 }
9078
9080 {
9082 }
9083
9085 {
9087 }
9088
9089
9091 {
9093 }
9094
9096 {
9098 }
9099
9101 {
9103 }
9104
9105
9107 {
9108
9109 float weightEx = GetWeightEx();
9110 float special = GetInventoryAndCargoWeight();
9111 return weightEx - special;
9112 }
9113
9114
9116 {
9118 }
9119
9121 {
9123 {
9124 #ifdef DEVELOPER
9125 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9126 {
9127 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
9129 }
9130 #endif
9131
9133 }
9134 else if (HasEnergyManager())
9135 {
9136 #ifdef DEVELOPER
9137 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9138 {
9139 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
9140 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
9141 }
9142 #endif
9143 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
9144 }
9145 else
9146 {
9147 #ifdef DEVELOPER
9148 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9149 {
9150 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
9151 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
9152 }
9153 #endif
9154 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
9155 }
9156 }
9157
9160 {
9161 int item_count = 0;
9163
9164 if (GetInventory().GetCargo() != NULL)
9165 {
9166 item_count = GetInventory().GetCargo().GetItemCount();
9167 }
9168
9169 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
9170 {
9171 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
9172 if (item)
9173 item_count += item.GetNumberOfItems();
9174 }
9175 return item_count;
9176 }
9177
9180 {
9181 float weight = 0;
9182 float wetness = 1;
9183 if (include_wetness)
9186 {
9187 weight = wetness * m_ConfigWeight;
9188 }
9190 {
9191 weight = 1;
9192 }
9193 return weight;
9194 }
9195
9196
9197
9199 {
9200 if ((
GetGame().IsServer() || !
GetGame().IsMultiplayer()) && GetInventory())
9201 {
9202 GameInventory inv = GetInventory();
9203 array<EntityAI> items = new array<EntityAI>;
9205 for (int i = 0; i < items.Count(); i++)
9206 {
9208 if (item)
9209 {
9211 }
9212 }
9213 }
9214 }
9215
9216
9217
9218
9220 {
9221 float energy = 0;
9222 if (HasEnergyManager())
9223 {
9224 energy = GetCompEM().GetEnergy();
9225 }
9226 return energy;
9227 }
9228
9229
9231 {
9232 super.OnEnergyConsumed();
9233
9235 }
9236
9238 {
9239 super.OnEnergyAdded();
9240
9242 }
9243
9244
9246 {
9247 if (
GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
9248 {
9250 {
9251 float energy_0to1 = GetCompEM().GetEnergy0To1();
9253 }
9254 }
9255 }
9256
9257
9259 {
9260 return ConfigGetFloat("heatIsolation");
9261 }
9262
9264 {
9266 }
9267
9269 {
9270 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
9271 if (
GetGame().ConfigIsExisting(paramPath))
9273
9274 return 0.0;
9275 }
9276
9278 {
9279 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
9280 if (
GetGame().ConfigIsExisting(paramPath))
9282
9283 return 0.0;
9284 }
9285
9286 override void SetWet(
float value,
bool allow_client =
false)
9287 {
9288 if (!IsServerCheck(allow_client))
9289 return;
9290
9293
9295
9296 m_VarWet = Math.Clamp(value, min, max);
9297
9299 {
9302 }
9303 }
9304
9305 override void AddWet(
float value)
9306 {
9308 }
9309
9311 {
9313 }
9314
9316 {
9318 }
9319
9321 {
9323 }
9324
9326 {
9328 }
9329
9331 {
9333 }
9334
9336 {
9339 if (newLevel != oldLevel)
9340 {
9342 }
9343 }
9344
9346 {
9347 SetWeightDirty();
9348 }
9349
9351 {
9352 return GetWetLevelInternal(
m_VarWet);
9353 }
9354
9355
9356
9358 {
9360 }
9361
9363 {
9365 }
9366
9368 {
9370 }
9371
9373 {
9375 }
9376
9377
9378
9380 {
9381 if (ConfigIsExisting("itemModelLength"))
9382 {
9383 return ConfigGetFloat("itemModelLength");
9384 }
9385 return 0;
9386 }
9387
9389 {
9390 if (ConfigIsExisting("itemAttachOffset"))
9391 {
9392 return ConfigGetFloat("itemAttachOffset");
9393 }
9394 return 0;
9395 }
9396
9397 override void SetCleanness(
int value,
bool allow_client =
false)
9398 {
9399 if (!IsServerCheck(allow_client))
9400 return;
9401
9403
9405
9408 }
9409
9411 {
9413 }
9414
9416 {
9417 return true;
9418 }
9419
9420
9421
9422
9424 {
9426 }
9427
9429 {
9431 }
9432
9433
9434
9435
9436 override void SetColor(
int r,
int g,
int b,
int a)
9437 {
9443 }
9445 override void GetColor(out
int r,out
int g,out
int b,out
int a)
9446 {
9451 }
9452
9454 {
9456 }
9457
9460 {
9461 int r,g,b,a;
9463 r = r/255;
9464 g = g/255;
9465 b = b/255;
9466 a = a/255;
9467 return MiscGameplayFunctions.GetColorString(r, g, b, a);
9468 }
9469
9470
9471
9472 override void SetLiquidType(
int value,
bool allow_client =
false)
9473 {
9474 if (!IsServerCheck(allow_client))
9475 return;
9476
9481 }
9482
9484 {
9485 return ConfigGetInt("varLiquidTypeInit");
9486 }
9487
9489 {
9491 }
9492
9494 {
9496 SetFrozen(false);
9497 }
9498
9501 {
9502 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9503 }
9504
9505
9508 {
9509 PlayerBase nplayer;
9510 if (PlayerBase.CastTo(nplayer, player))
9511 {
9513
9514 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9515 }
9516 }
9517
9518
9521 {
9522 PlayerBase nplayer;
9523 if (PlayerBase.CastTo(nplayer,player))
9524 {
9525
9526 nplayer.SetEnableQuickBarEntityShortcut(this,false);
9527
9528 }
9529
9530
9531 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
9532
9533
9534 if (HasEnergyManager())
9535 {
9536 GetCompEM().UpdatePlugState();
9537 }
9538 }
9539
9540
9542 {
9543 super.OnPlacementStarted(player);
9544
9546 }
9547
9548 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
9549 {
9551 {
9552 m_AdminLog.OnPlacementComplete(player,
this);
9553 }
9554
9555 super.OnPlacementComplete(player, position, orientation);
9556 }
9557
9558
9559
9560
9561
9563 {
9565 {
9566 return true;
9567 }
9568 else
9569 {
9570 return false;
9571 }
9572 }
9573
9574
9576 {
9578 {
9580 }
9581 }
9582
9583
9585 {
9587 }
9588
9590 {
9592 }
9593
9594 override void InsertAgent(
int agent,
float count = 1)
9595 {
9596 if (count < 1)
9597 return;
9598
9600 }
9601
9604 {
9606 }
9607
9608
9610 {
9612 }
9613
9614
9615
9616
9617
9618
9619
9620
9621
9622
9623
9624
9625
9626
9627
9628
9629
9630
9631
9632
9633
9634
9635
9636
9637
9638
9639
9640
9641
9642
9643
9644
9645
9646
9647
9648
9649
9650
9651
9652
9653
9654
9656 {
9658 return false;
9659 return true;
9660 }
9661
9663 {
9664
9666 }
9667
9668
9671 {
9672 super.CheckForRoofLimited(timeTresholdMS);
9673
9675 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
9676 {
9677 m_PreviousRoofTestTime = time;
9678 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
9679 }
9680 }
9681
9682
9684 {
9686 {
9687 return 0;
9688 }
9689
9690 if (GetInventory().GetAttachmentSlotsCount() != 0)
9691 {
9692 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
9693 if (filter)
9694 return filter.GetProtectionLevel(type, false, system);
9695 else
9696 return 0;
9697 }
9698
9699 string subclassPath, entryName;
9700
9701 switch (type)
9702 {
9704 entryName = "biological";
9705 break;
9707 entryName = "chemical";
9708 break;
9709 default:
9710 entryName = "biological";
9711 break;
9712 }
9713
9714 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
9715
9717 }
9718
9719
9720
9723 {
9724 if (!IsMagazine())
9726
9728 }
9729
9730
9731
9732
9733
9738 {
9739 return true;
9740 }
9741
9743 {
9745 }
9746
9747
9748
9749
9750
9752 {
9753 if (parent)
9754 {
9755 if (parent.IsInherited(DayZInfected))
9756 return true;
9757
9758 if (!parent.IsRuined())
9759 return true;
9760 }
9761
9762 return true;
9763 }
9764
9766 {
9767 if (!super.CanPutAsAttachment(parent))
9768 {
9769 return false;
9770 }
9771
9772 if (!IsRuined() && !parent.IsRuined())
9773 {
9774 return true;
9775 }
9776
9777 return false;
9778 }
9779
9781 {
9782
9783
9784
9785
9786 return super.CanReceiveItemIntoCargo(item);
9787 }
9788
9790 {
9791
9792
9793
9794
9795 GameInventory attachmentInv = attachment.GetInventory();
9797 {
9798 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
9799 return false;
9800 }
9801
9802 InventoryLocation loc = new InventoryLocation();
9803 attachment.GetInventory().GetCurrentInventoryLocation(loc);
9804 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
9805 return false;
9806
9807 return super.CanReceiveAttachment(attachment, slotId);
9808 }
9809
9811 {
9812 if (!super.CanReleaseAttachment(attachment))
9813 return false;
9814
9815 return GetInventory().AreChildrenAccessible();
9816 }
9817
9818
9819
9820
9821
9822
9823
9824
9825
9826
9827
9828
9829
9830
9831
9832
9833
9834
9835
9836
9837
9839 {
9840 int id = muzzle_owner.GetMuzzleID();
9841 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
9842
9843 if (WPOF_array)
9844 {
9845 for (int i = 0; i < WPOF_array.Count(); i++)
9846 {
9847 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
9848
9849 if (WPOF)
9850 {
9851 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
9852 }
9853 }
9854 }
9855 }
9856
9857
9859 {
9860 int id = muzzle_owner.GetMuzzleID();
9862
9863 if (WPOBE_array)
9864 {
9865 for (int i = 0; i < WPOBE_array.Count(); i++)
9866 {
9867 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
9868
9869 if (WPOBE)
9870 {
9871 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
9872 }
9873 }
9874 }
9875 }
9876
9877
9879 {
9880 int id = muzzle_owner.GetMuzzleID();
9881 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9882
9883 if (WPOOH_array)
9884 {
9885 for (int i = 0; i < WPOOH_array.Count(); i++)
9886 {
9887 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9888
9889 if (WPOOH)
9890 {
9891 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
9892 }
9893 }
9894 }
9895 }
9896
9897
9899 {
9900 int id = muzzle_owner.GetMuzzleID();
9901 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9902
9903 if (WPOOH_array)
9904 {
9905 for (int i = 0; i < WPOOH_array.Count(); i++)
9906 {
9907 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9908
9909 if (WPOOH)
9910 {
9911 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9912 }
9913 }
9914 }
9915 }
9916
9917
9919 {
9920 int id = muzzle_owner.GetMuzzleID();
9921 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9922
9923 if (WPOOH_array)
9924 {
9925 for (int i = 0; i < WPOOH_array.Count(); i++)
9926 {
9927 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9928
9929 if (WPOOH)
9930 {
9931 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9932 }
9933 }
9934 }
9935 }
9936
9937
9938
9940 {
9942 {
9943 return true;
9944 }
9945
9946 return false;
9947 }
9948
9950 {
9952 {
9953 return true;
9954 }
9955
9956 return false;
9957 }
9958
9960 {
9962 {
9963 return true;
9964 }
9965
9966 return false;
9967 }
9968
9970 {
9971 return false;
9972 }
9973
9976 {
9977 return UATimeSpent.DEFAULT_DEPLOY;
9978 }
9979
9980
9981
9982
9984 {
9986 SetSynchDirty();
9987 }
9988
9990 {
9992 }
9993
9994
9996 {
9997 return false;
9998 }
9999
10002 {
10003 string att_type = "None";
10004
10005 if (ConfigIsExisting("soundAttType"))
10006 {
10007 att_type = ConfigGetString("soundAttType");
10008 }
10009
10011 }
10012
10014 {
10016 }
10017
10018
10019
10020
10021
10027
10029 {
10032
10034 }
10035
10036
10038 {
10040 return;
10041
10043
10046
10049
10050 SoundParameters params = new SoundParameters();
10054 }
10055
10056
10058 {
10060 return;
10061
10063 SetSynchDirty();
10064
10067 }
10068
10069
10071 {
10073 return;
10074
10076 SetSynchDirty();
10077
10080 }
10081
10083 {
10085 }
10086
10088 {
10090 }
10091
10094 {
10095 if (!
GetGame().IsDedicatedServer())
10096 {
10097 if (ConfigIsExisting("attachSoundSet"))
10098 {
10099 string cfg_path = "";
10100 string soundset = "";
10101 string type_name =
GetType();
10102
10105 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
10106 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
10107
10108 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
10109 {
10110 for (int i = 0; i < cfg_soundset_array.Count(); i++)
10111 {
10112 if (cfg_slot_array[i] == slot_type)
10113 {
10114 soundset = cfg_soundset_array[i];
10115 break;
10116 }
10117 }
10118 }
10119
10120 if (soundset != "")
10121 {
10122 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
10124 }
10125 }
10126 }
10127 }
10128
10130 {
10131
10132 }
10133
10134 void OnApply(PlayerBase player);
10135
10137 {
10138 return 1.0;
10139 };
10140
10142 {
10144 }
10145
10147 {
10149 }
10150
10152
10154 {
10155 SetDynamicPhysicsLifeTime(0.01);
10157 }
10158
10160 {
10161 array<string> zone_names = new array<string>;
10162 GetDamageZones(zone_names);
10163 for (int i = 0; i < zone_names.Count(); i++)
10164 {
10165 SetHealthMax(zone_names.Get(i),"Health");
10166 }
10167 SetHealthMax("","Health");
10168 }
10169
10172 {
10173 float global_health = GetHealth01("","Health");
10174 array<string> zones = new array<string>;
10175 GetDamageZones(zones);
10176
10177 for (int i = 0; i < zones.Count(); i++)
10178 {
10179 SetHealth01(zones.Get(i),"Health",global_health);
10180 }
10181 }
10182
10185 {
10186 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
10187 }
10188
10190 {
10191 if (!hasRootAsPlayer)
10192 {
10193 if (refParentIB)
10194 {
10195
10196 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
10197 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
10198
10199 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
10200 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
10201
10204 }
10205 else
10206 {
10207
10210 }
10211 }
10212 }
10213
10215 {
10217 {
10218 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
10219 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
10220 {
10221 float heatPermCoef = 1.0;
10223 while (ent)
10224 {
10225 heatPermCoef *= ent.GetHeatPermeabilityCoef();
10226 ent = ent.GetHierarchyParent();
10227 }
10228
10229 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
10230 }
10231 }
10232 }
10233
10235 {
10236
10237 EntityAI parent = GetHierarchyParent();
10238 if (!parent)
10239 {
10240 hasParent = false;
10241 hasRootAsPlayer = false;
10242 }
10243 else
10244 {
10245 hasParent = true;
10246 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
10247 refParentIB =
ItemBase.Cast(parent);
10248 }
10249 }
10250
10251 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
10252 {
10253
10254 }
10255
10257 {
10258
10259 return false;
10260 }
10261
10263 {
10264
10265
10266 return false;
10267 }
10268
10270 {
10271
10272 return false;
10273 }
10274
10277 {
10278 return !GetIsFrozen() &&
IsOpen();
10279 }
10280
10282 {
10283 bool hasParent = false, hasRootAsPlayer = false;
10285
10286 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
10287 bool foodDecay =
g_Game.IsFoodDecayEnabled();
10288
10289 if (wwtu || foodDecay)
10290 {
10294
10295 if (processWetness || processTemperature || processDecay)
10296 {
10298
10299 if (processWetness)
10300 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
10301
10302 if (processTemperature)
10304
10305 if (processDecay)
10306 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
10307 }
10308 }
10309 }
10310
10313 {
10315 }
10316
10318 {
10321
10322 return super.GetTemperatureFreezeThreshold();
10323 }
10324
10326 {
10329
10330 return super.GetTemperatureThawThreshold();
10331 }
10332
10334 {
10337
10338 return super.GetItemOverheatThreshold();
10339 }
10340
10342 {
10344 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
10345
10346 return super.GetTemperatureFreezeTime();
10347 }
10348
10350 {
10352 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
10353
10354 return super.GetTemperatureThawTime();
10355 }
10356
10361
10363 {
10364 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
10365 }
10366
10368 {
10369 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
10370 }
10371
10374 {
10376 }
10377
10379 {
10381 }
10382
10384 {
10386 }
10387
10390 {
10391 return null;
10392 }
10393
10396 {
10397 return false;
10398 }
10399
10401 {
10403 {
10406 if (!trg)
10407 {
10409 explosive = this;
10410 }
10411
10412 explosive.PairRemote(trg);
10414
10415 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
10416 trg.SetPersistentPairID(persistentID);
10417 explosive.SetPersistentPairID(persistentID);
10418
10419 return true;
10420 }
10421 return false;
10422 }
10423
10426 {
10427 float ret = 1.0;
10430 ret *= GetHealth01();
10431
10432 return ret;
10433 }
10434
10435 #ifdef DEVELOPER
10436 override void SetDebugItem()
10437 {
10438 super.SetDebugItem();
10439 _itemBase = this;
10440 }
10441
10443 {
10444 string text = super.GetDebugText();
10445
10447 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
10448
10449 return text;
10450 }
10451 #endif
10452
10454 {
10455 return true;
10456 }
10457
10459
10461
10463 {
10466 }
10467
10468
10476
10492}
10493
10495{
10497 if (entity)
10498 {
10499 bool is_item = entity.IsInherited(
ItemBase);
10500 if (is_item && full_quantity)
10501 {
10504 }
10505 }
10506 else
10507 {
10509 return NULL;
10510 }
10511 return entity;
10512}
10513
10515{
10516 if (item)
10517 {
10518 if (health > 0)
10519 item.SetHealth("", "", health);
10520
10521 if (item.CanHaveTemperature())
10522 {
10524 if (item.CanFreeze())
10525 item.SetFrozen(false);
10526 }
10527
10528 if (item.HasEnergyManager())
10529 {
10530 if (quantity >= 0)
10531 {
10532 item.GetCompEM().SetEnergy0To1(quantity);
10533 }
10534 else
10535 {
10537 }
10538 }
10539 else if (item.IsMagazine())
10540 {
10541 Magazine mag = Magazine.Cast(item);
10542 if (quantity >= 0)
10543 {
10544 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
10545 }
10546 else
10547 {
10549 }
10550
10551 }
10552 else
10553 {
10554 if (quantity >= 0)
10555 {
10556 item.SetQuantityNormalized(quantity, false);
10557 }
10558 else
10559 {
10561 }
10562
10563 }
10564 }
10565}
10566
10567#ifdef DEVELOPER
10569#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.