5599{
5601 {
5602 return true;
5603 }
5604};
5605
5607{
5608
5609};
5610
5611
5612
5614{
5618
5620
5623
5624
5625
5626
5627
5636
5642
5647
5652
5673 protected bool m_IsResultOfSplit
5674
5676
5681
5682
5683
5685
5689
5690
5691
5693
5696
5697
5698
5704
5705
5713
5716
5717
5719
5720
5722
5723
5728
5729
5734
5736
5737
5739
5740
5742 {
5747
5748 if (!
g_Game.IsDedicatedServer())
5749 {
5751 {
5753
5755 {
5757 }
5758 }
5759
5762 }
5763
5764 m_OldLocation = null;
5765
5767 {
5769 }
5770
5771 if (ConfigIsExisting("headSelectionsToHide"))
5772 {
5775 }
5776
5778 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
5779 {
5781 }
5782
5784
5785 m_IsResultOfSplit = false;
5786
5788 }
5789
5791 {
5792 super.InitItemVariables();
5793
5799 m_Count = ConfigGetInt(
"count");
5800
5803
5808
5811
5816
5828
5832
5833
5836 if (ConfigIsExisting("canBeSplit"))
5837 {
5840 }
5841
5843 if (ConfigIsExisting("itemBehaviour"))
5845
5846
5849 RegisterNetSyncVariableInt("m_VarLiquidType");
5850 RegisterNetSyncVariableInt("m_Cleanness",0,1);
5851
5852 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
5853 RegisterNetSyncVariableFloat("m_ImpactSpeed");
5854 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
5855
5856 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
5857 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
5858 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
5859 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
5860
5861 RegisterNetSyncVariableBool("m_IsBeingPlaced");
5862 RegisterNetSyncVariableBool("m_IsTakeable");
5863 RegisterNetSyncVariableBool("m_IsHologram");
5864
5867 {
5870 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
5871 }
5872
5874
5876 if (ConfigIsExisting("temperaturePerQuantityWeight"))
5878
5880 }
5881
5883 {
5885 }
5886
5888 {
5891 {
5896 }
5897 }
5898
5899 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
5900 {
5902 {
5905 }
5906
5908 }
5909
5911 {
5917 }
5918
5920
5922 {
5924
5925 if (!action)
5926 {
5927 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
5928 return;
5929 }
5930
5932 if (!ai)
5933 {
5935 return;
5936 }
5937
5939 if (!action_array)
5940 {
5941 action_array = new array<ActionBase_Basic>;
5943 }
5944 if (LogManager.IsActionLogEnable())
5945 {
5946 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
5947 }
5948
5949 if (action_array.Find(action) != -1)
5950 {
5951 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
5952 }
5953 else
5954 {
5955 action_array.Insert(action);
5956 }
5957 }
5958
5960 {
5961 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
5962 ActionBase action = player.GetActionManager().GetAction(actionName);
5965
5966 if (action_array)
5967 {
5968 action_array.RemoveItem(action);
5969 }
5970 }
5971
5972
5973
5975 {
5976 ActionOverrideData overrideData = new ActionOverrideData();
5980
5982 if (!actionMap)
5983 {
5986 }
5987
5988 actionMap.Insert(this.
Type(), overrideData);
5989
5990 }
5991
5993
5995
5996
5998 {
6001
6004
6005 string config_to_search = "CfgVehicles";
6006 string muzzle_owner_config;
6007
6009 {
6010 if (IsInherited(Weapon))
6011 config_to_search = "CfgWeapons";
6012
6013 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6014
6015 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
6016
6017 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
6018
6019 if (config_OnFire_subclass_count > 0)
6020 {
6021 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
6022
6023 for (int i = 0; i < config_OnFire_subclass_count; i++)
6024 {
6025 string particle_class = "";
6026 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
6027 string config_OnFire_entry = config_OnFire_class + particle_class;
6028 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
6029 WPOF_array.Insert(WPOF);
6030 }
6031
6032
6034 }
6035 }
6036
6038 {
6039 config_to_search = "CfgWeapons";
6040 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6041
6042 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
6043
6044 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
6045
6046 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
6047 {
6048 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
6049
6050 for (i = 0; i < config_OnBulletCasingEject_count; i++)
6051 {
6052 string particle_class2 = "";
6053 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
6054 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
6055 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
6056 WPOBE_array.Insert(WPOBE);
6057 }
6058
6059
6061 }
6062 }
6063 }
6064
6065
6067 {
6070
6072 {
6073 string config_to_search = "CfgVehicles";
6074
6075 if (IsInherited(Weapon))
6076 config_to_search = "CfgWeapons";
6077
6078 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6079 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
6080
6081 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
6082 {
6083
6085
6087 {
6089 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
6091 return;
6092 }
6093
6096
6097
6098
6099 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
6100 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
6101
6102 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
6103 {
6104 string particle_class = "";
6105 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
6106 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
6107 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
6108
6109 if (entry_type == CT_CLASS)
6110 {
6111 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
6112 WPOOH_array.Insert(WPOF);
6113 }
6114 }
6115
6116
6118 }
6119 }
6120 }
6121
6123 {
6125 }
6126
6128 {
6130 {
6132
6135
6138
6139 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6140 }
6141 }
6142
6144 {
6146 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6147
6149 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6150
6152 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6153
6155 {
6157 }
6158 }
6159
6161 {
6163 }
6164
6166 {
6169 else
6171
6173 {
6176 }
6177 else
6178 {
6181
6184 }
6185
6187 }
6188
6190 {
6192 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6193 }
6194
6196 {
6198 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6200 }
6201
6203 {
6205 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6206 }
6207
6209 {
6212
6213 OverheatingParticle OP = new OverheatingParticle();
6218
6220 }
6221
6223 {
6226
6227 return -1;
6228 }
6229
6231 {
6233 {
6236
6237 for (int i = count; i > 0; --i)
6238 {
6239 int id = i - 1;
6242
6245
6246 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
6247 {
6248 if (p)
6249 {
6252 }
6253 }
6254 }
6255 }
6256 }
6257
6259 {
6261 {
6263 {
6264 int id = i - 1;
6266
6267 if (OP)
6268 {
6270
6271 if (p)
6272 {
6274 }
6275
6276 delete OP;
6277 }
6278 }
6279
6282 }
6283 }
6284
6287 {
6288 return 0.0;
6289 }
6290
6291
6293 {
6294 return 250;
6295 }
6296
6298 {
6299 return 0;
6300 }
6301
6304 {
6306 return true;
6307
6308 return false;
6309 }
6310
6313 {
6316
6318 {
6320 }
6321 else
6322 {
6323
6325 }
6326
6328 }
6329
6336 {
6337 return -1;
6338 }
6339
6340
6341
6342
6344 {
6346 {
6347 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6348 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6349
6350 if (r_index >= 0)
6351 {
6352 InventoryLocation r_il = new InventoryLocation;
6353 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6354
6355 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6358 {
6359 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6360 }
6362 {
6363 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6364 }
6365
6366 }
6367
6368 player.GetHumanInventory().ClearUserReservedLocation(this);
6369 }
6370
6373 }
6374
6375
6376
6377
6379 {
6380 return ItemBase.m_DebugActionsMask;
6381 }
6382
6384 {
6385 return ItemBase.m_DebugActionsMask & mask;
6386 }
6387
6389 {
6390 ItemBase.m_DebugActionsMask = mask;
6391 }
6392
6394 {
6395 ItemBase.m_DebugActionsMask |= mask;
6396 }
6397
6399 {
6400 ItemBase.m_DebugActionsMask &= ~mask;
6401 }
6402
6404 {
6406 {
6408 }
6409 else
6410 {
6412 }
6413 }
6414
6415
6417 {
6418 if (GetEconomyProfile())
6419 {
6420 float q_max = GetEconomyProfile().GetQuantityMax();
6421 if (q_max > 0)
6422 {
6423 float q_min = GetEconomyProfile().GetQuantityMin();
6424 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
6425
6427 {
6428 ComponentEnergyManager comp = GetCompEM();
6430 {
6432 }
6433 }
6435 {
6437
6438 }
6439
6440 }
6441 }
6442 }
6443
6446 {
6447 EntityAI parent = GetHierarchyParent();
6448
6449 if (parent)
6450 {
6451 InventoryLocation inventory_location_to_lock = new InventoryLocation;
6452 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
6453 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
6454 }
6455 }
6456
6459 {
6460 EntityAI parent = GetHierarchyParent();
6461
6462 if (parent)
6463 {
6464 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
6465 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
6466 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
6467 }
6468 }
6469
6471 {
6472
6473
6474
6475
6477
6479 {
6480 if (ScriptInputUserData.CanStoreInputUserData())
6481 {
6482 ScriptInputUserData ctx = new ScriptInputUserData;
6488 ctx.
Write(use_stack_max);
6491
6493 {
6494 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
6495 }
6496 }
6497 }
6498 else if (!
g_Game.IsMultiplayer())
6499 {
6501 }
6502 }
6503
6505 {
6507 }
6508
6510 {
6512 }
6513
6515 {
6517 }
6518
6520 {
6521
6522 return false;
6523 }
6524
6526 {
6527 return false;
6528 }
6529
6533 {
6534 return false;
6535 }
6536
6538 {
6539 return "";
6540 }
6541
6543
6545 {
6546 return false;
6547 }
6548
6550 {
6551 return true;
6552 }
6553
6554
6555
6557 {
6558 return true;
6559 }
6560
6562 {
6563 return true;
6564 }
6565
6567 {
6568 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6570 }
6571
6573 {
6575 }
6576
6578 {
6580 if (!is_being_placed)
6582 SetSynchDirty();
6583 }
6584
6585
6587
6589 {
6591 }
6592
6594 {
6596 }
6597
6599 {
6600 return 1;
6601 }
6602
6604 {
6605 return false;
6606 }
6607
6609 {
6611 SetSynchDirty();
6612 }
6613
6614
6615
6616
6617
6618
6619
6620
6621
6622
6623
6624
6625
6626
6627
6628
6629
6630
6631
6632
6633
6634
6635
6636
6637
6638
6639
6640
6641
6642
6643
6644
6645
6646
6647
6649 {
6650 super.OnMovedInsideCargo(container);
6651
6652 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6653 }
6654
6655 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
6656 {
6657 super.EEItemLocationChanged(oldLoc, newLoc);
6658
6659 PlayerBase newPlayer = null;
6660 PlayerBase oldPlayer = null;
6661
6662 if (newLoc.GetParent())
6663 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
6664
6665 if (oldLoc.GetParent())
6666 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
6667
6669 {
6670 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
6671
6672 if (rIndex >= 0)
6673 {
6674 InventoryLocation rIl = new InventoryLocation;
6675 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
6676
6677 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
6680 {
6681 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
6682 }
6684 {
6686 }
6687
6688 }
6689 }
6690
6692 {
6693 if (newPlayer)
6694 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
6695
6696 if (newPlayer == oldPlayer)
6697 {
6698 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
6699 {
6701 {
6702 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
6703 {
6704 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6705 }
6706 }
6707 else
6708 {
6709 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6710 }
6711 }
6712
6713 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
6714 {
6715 int type = oldLoc.GetType();
6717 {
6718 oldLoc.GetParent().GetOnSetLock().Invoke(this);
6719 }
6721 {
6722 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
6723 }
6724 }
6725 if (!m_OldLocation)
6726 {
6727 m_OldLocation = new InventoryLocation;
6728 }
6729 m_OldLocation.Copy(oldLoc);
6730 }
6731 else
6732 {
6733 if (m_OldLocation)
6734 {
6735 m_OldLocation.Reset();
6736 }
6737 }
6738
6739 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
6740 }
6741 else
6742 {
6743 if (newPlayer)
6744 {
6745 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
6746 if (resIndex >= 0)
6747 {
6748 InventoryLocation il = new InventoryLocation;
6749 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
6751 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
6754 {
6755 il.
GetParent().GetOnReleaseLock().Invoke(it);
6756 }
6758 {
6760 }
6761
6762 }
6763 }
6765 {
6766
6768 }
6769
6770 if (m_OldLocation)
6771 {
6772 m_OldLocation.Reset();
6773 }
6774 }
6775
6777 {
6778 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
6779 }
6780
6782 {
6783 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
6784 }
6785 }
6786
6787 override void EOnContact(IEntity other, Contact extra)
6788 {
6790 {
6791 int liquidType = -1;
6793 if (impactSpeed > 0.0)
6794 {
6796 #ifndef SERVER
6798 #else
6800 SetSynchDirty();
6801 #endif
6803 }
6804 }
6805
6806 #ifdef SERVER
6807 if (GetCompEM() && GetCompEM().IsPlugged())
6808 {
6809 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
6810 GetCompEM().UnplugThis();
6811 }
6812 #endif
6813 }
6814
6816
6818 {
6820 }
6821
6823 {
6824
6825 }
6826
6828 {
6829 super.OnItemLocationChanged(old_owner, new_owner);
6830
6831 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
6832 PlayerBase playerNew = PlayerBase.Cast(new_owner);
6833
6834 if (!relatedPlayer && playerNew)
6835 relatedPlayer = playerNew;
6836
6837 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
6838 {
6840 if (actionMgr)
6841 {
6842 ActionBase currentAction = actionMgr.GetRunningAction();
6843 if (currentAction)
6845 }
6846 }
6847
6848 Man ownerPlayerOld = null;
6849 Man ownerPlayerNew = null;
6850
6851 if (old_owner)
6852 {
6853 if (old_owner.
IsMan())
6854 {
6855 ownerPlayerOld = Man.Cast(old_owner);
6856 }
6857 else
6858 {
6859 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
6860 }
6861 }
6862 else
6863 {
6865 {
6867
6868 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
6869 {
6870 GetCompEM().UnplugThis();
6871 }
6872 }
6873 }
6874
6875 if (new_owner)
6876 {
6877 if (new_owner.
IsMan())
6878 {
6879 ownerPlayerNew = Man.Cast(new_owner);
6880 }
6881 else
6882 {
6883 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
6884 }
6885 }
6886
6887 if (ownerPlayerOld != ownerPlayerNew)
6888 {
6889 if (ownerPlayerOld)
6890 {
6891 array<EntityAI> subItemsExit = new array<EntityAI>;
6893 for (int i = 0; i < subItemsExit.Count(); i++)
6894 {
6897 }
6898 }
6899
6900 if (ownerPlayerNew)
6901 {
6902 array<EntityAI> subItemsEnter = new array<EntityAI>;
6904 for (int j = 0; j < subItemsEnter.Count(); j++)
6905 {
6908 }
6909 }
6910 }
6911 else if (ownerPlayerNew != null)
6912 {
6913 PlayerBase nplayer;
6914 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
6915 {
6916 array<EntityAI> subItemsUpdate = new array<EntityAI>;
6918 for (int k = 0; k < subItemsUpdate.Count(); k++)
6919 {
6921 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
6922 }
6923 }
6924 }
6925
6926 if (old_owner)
6927 old_owner.OnChildItemRemoved(this);
6928 if (new_owner)
6929 new_owner.OnChildItemReceived(this);
6930 }
6931
6932
6934 {
6935 super.EEDelete(parent);
6936 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
6937 if (player)
6938 {
6940
6941 if (player.IsAlive())
6942 {
6943 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6944 if (r_index >= 0)
6945 {
6946 InventoryLocation r_il = new InventoryLocation;
6947 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6948
6949 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6952 {
6953 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6954 }
6956 {
6957 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6958 }
6959
6960 }
6961
6962 player.RemoveQuickBarEntityShortcut(this);
6963 }
6964 }
6965 }
6966
6968 {
6969 super.EEKilled(killer);
6970
6973 {
6974 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
6975 {
6976 if (IsMagazine())
6977 {
6978 if (Magazine.Cast(this).GetAmmoCount() > 0)
6979 {
6981 }
6982 }
6983 else
6984 {
6986 }
6987 }
6988 }
6989 }
6990
6992 {
6993 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6994
6995 super.OnWasAttached(parent, slot_id);
6996
6999
7002 }
7003
7005 {
7006 super.OnWasDetached(parent, slot_id);
7007
7010
7013 }
7014
7016 {
7017 int idx;
7020
7021 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7022 if (inventory_slots.Count() < 1)
7023 {
7024 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
7025 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
7026 }
7027 else
7028 {
7029 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
7030 }
7031
7032 idx = inventory_slots.Find(slot);
7033 if (idx < 0)
7034 return "";
7035
7036 return attach_types.Get(idx);
7037 }
7038
7040 {
7041 int idx = -1;
7042 string slot;
7043
7046
7047 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7048 if (inventory_slots.Count() < 1)
7049 {
7050 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
7051 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7052 }
7053 else
7054 {
7055 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
7056 if (detach_types.Count() < 1)
7057 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7058 }
7059
7060 for (int i = 0; i < inventory_slots.Count(); i++)
7061 {
7062 slot = inventory_slots.Get(i);
7063 }
7064
7065 if (slot != "")
7066 {
7067 if (detach_types.Count() == 1)
7068 idx = 0;
7069 else
7070 idx = inventory_slots.Find(slot);
7071 }
7072 if (idx < 0)
7073 return "";
7074
7075 return detach_types.Get(idx);
7076 }
7077
7079 {
7080
7082
7083
7084 float min_time = 1;
7085 float max_time = 3;
7086 float delay = Math.RandomFloat(min_time, max_time);
7087
7088 explode_timer.Run(delay, this, "DoAmmoExplosion");
7089 }
7090
7092 {
7093 Magazine magazine = Magazine.Cast(this);
7094 int pop_sounds_count = 6;
7095 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
7096
7097
7098 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
7099 string sound_name = pop_sounds[ sound_idx ];
7100 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
7101
7102
7103 magazine.ServerAddAmmoCount(-1);
7104
7105
7106 float min_temp_to_explode = 100;
7107
7108 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
7109 {
7111 }
7112 }
7113
7114
7115 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
7116 {
7117 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
7118
7119 const int CHANCE_DAMAGE_CARGO = 4;
7120 const int CHANCE_DAMAGE_ATTACHMENT = 1;
7121 const int CHANCE_DAMAGE_NOTHING = 2;
7122
7124 {
7125 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
7126 int chances;
7127 int rnd;
7128
7129 if (GetInventory().GetCargo())
7130 {
7131 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7132 rnd = Math.RandomInt(0,chances);
7133
7134 if (rnd < CHANCE_DAMAGE_CARGO)
7135 {
7137 }
7138 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
7139 {
7141 }
7142 }
7143 else
7144 {
7145 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7146 rnd = Math.RandomInt(0,chances);
7147
7148 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
7149 {
7151 }
7152 }
7153 }
7154 }
7155
7157 {
7158 CargoBase cargo = GetInventory().GetCargo();
7159 if (cargo)
7160 {
7162 if (item_count > 0)
7163 {
7164 int random_pick = Math.RandomInt(0, item_count);
7166 if (!item.IsExplosive())
7167 {
7168 item.AddHealth("","",damage);
7169 return true;
7170 }
7171 }
7172 }
7173 return false;
7174 }
7175
7177 {
7178 GameInventory inventory = GetInventory();
7180 if (attachment_count > 0)
7181 {
7182 int random_pick = Math.RandomInt(0, attachment_count);
7184 if (!attachment.IsExplosive())
7185 {
7186 attachment.AddHealth("","",damage);
7187 return true;
7188 }
7189 }
7190 return false;
7191 }
7192
7194 {
7196 }
7197
7199 {
7201 return GetInventory().CanRemoveEntity();
7202
7203 return false;
7204 }
7205
7207 {
7208
7210 return false;
7211
7212
7214 return false;
7215
7216
7217
7219 if (delta == 0)
7220 return false;
7221
7222
7223 return true;
7224 }
7225
7227 {
7229 {
7230 if (ScriptInputUserData.CanStoreInputUserData())
7231 {
7232 ScriptInputUserData ctx = new ScriptInputUserData;
7237 ctx.
Write(destination_entity);
7241 }
7242 }
7243 else if (!
g_Game.IsMultiplayer())
7244 {
7246 }
7247 }
7248
7250 {
7251 float split_quantity_new;
7255 InventoryLocation loc = new InventoryLocation;
7256
7257 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7258 {
7260 split_quantity_new = stack_max;
7261 else
7263
7265 {
7266 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7267 if (new_item)
7268 {
7269 new_item.SetResultOfSplit(true);
7270 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7272 new_item.
SetQuantity(split_quantity_new,
false,
true);
7273 }
7274 }
7275 }
7276 else if (destination_entity && slot_id == -1)
7277 {
7278 if (quantity > stack_max)
7279 split_quantity_new = stack_max;
7280 else
7281 split_quantity_new = quantity;
7282
7284 {
7285 GameInventory destinationInventory = destination_entity.GetInventory();
7287 {
7290 }
7291
7292 if (new_item)
7293 {
7294 new_item.SetResultOfSplit(true);
7295 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7297 new_item.
SetQuantity(split_quantity_new,
false,
true);
7298 }
7299 }
7300 }
7301 else
7302 {
7303 if (stack_max != 0)
7304 {
7306 {
7308 }
7309
7310 if (split_quantity_new == 0)
7311 {
7312 if (!
g_Game.IsMultiplayer())
7313 player.PhysicalPredictiveDropItem(this);
7314 else
7315 player.ServerDropEntity(this);
7316 return;
7317 }
7318
7320 {
7322
7323 if (new_item)
7324 {
7325 new_item.SetResultOfSplit(true);
7326 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7329 new_item.PlaceOnSurface();
7330 }
7331 }
7332 }
7333 }
7334 }
7335
7337 {
7338 float split_quantity_new;
7342 InventoryLocation loc = new InventoryLocation;
7343
7344 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7345 {
7347 split_quantity_new = stack_max;
7348 else
7350
7352 {
7353 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7354 if (new_item)
7355 {
7356 new_item.SetResultOfSplit(true);
7357 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7359 new_item.
SetQuantity(split_quantity_new,
false,
true);
7360 }
7361 }
7362 }
7363 else if (destination_entity && slot_id == -1)
7364 {
7365 if (quantity > stack_max)
7366 split_quantity_new = stack_max;
7367 else
7368 split_quantity_new = quantity;
7369
7371 {
7372 GameInventory destinationInventory = destination_entity.GetInventory();
7374 {
7377 }
7378
7379 if (new_item)
7380 {
7381 new_item.SetResultOfSplit(true);
7382 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7384 new_item.
SetQuantity(split_quantity_new,
false,
true);
7385 }
7386 }
7387 }
7388 else
7389 {
7390 if (stack_max != 0)
7391 {
7393 {
7395 }
7396
7398 {
7400
7401 if (new_item)
7402 {
7403 new_item.SetResultOfSplit(true);
7404 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7407 new_item.PlaceOnSurface();
7408 }
7409 }
7410 }
7411 }
7412 }
7413
7415 {
7417 {
7418 if (ScriptInputUserData.CanStoreInputUserData())
7419 {
7420 ScriptInputUserData ctx = new ScriptInputUserData;
7425 dst.WriteToContext(ctx);
7427 }
7428 }
7429 else if (!
g_Game.IsMultiplayer())
7430 {
7432 }
7433 }
7434
7436 {
7438 {
7439 if (ScriptInputUserData.CanStoreInputUserData())
7440 {
7441 ScriptInputUserData ctx = new ScriptInputUserData;
7446 ctx.
Write(destination_entity);
7452 }
7453 }
7454 else if (!
g_Game.IsMultiplayer())
7455 {
7457 }
7458 }
7459
7461 {
7463 }
7464
7466 {
7468 float split_quantity_new;
7470 if (dst.IsValid())
7471 {
7472 int slot_id = dst.GetSlot();
7474
7475 if (quantity > stack_max)
7476 split_quantity_new = stack_max;
7477 else
7478 split_quantity_new = quantity;
7479
7481 {
7483
7484 if (new_item)
7485 {
7486 new_item.SetResultOfSplit(true);
7487 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7489 new_item.
SetQuantity(split_quantity_new,
false,
true);
7490 }
7491
7492 return new_item;
7493 }
7494 }
7495
7496 return null;
7497 }
7498
7500 {
7502 float split_quantity_new;
7504 if (destination_entity)
7505 {
7507 if (quantity > stackable)
7508 split_quantity_new = stackable;
7509 else
7510 split_quantity_new = quantity;
7511
7513 {
7514 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
7515 if (new_item)
7516 {
7517 new_item.SetResultOfSplit(true);
7518 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7520 new_item.
SetQuantity(split_quantity_new,
false,
true);
7521 }
7522 }
7523 }
7524 }
7525
7527 {
7529 {
7530 if (ScriptInputUserData.CanStoreInputUserData())
7531 {
7532 ScriptInputUserData ctx = new ScriptInputUserData;
7537 ItemBase destination_entity =
this;
7538 ctx.
Write(destination_entity);
7542 }
7543 }
7544 else if (!
g_Game.IsMultiplayer())
7545 {
7547 }
7548 }
7549
7551 {
7553 float split_quantity_new;
7555 if (player)
7556 {
7558 if (quantity > stackable)
7559 split_quantity_new = stackable;
7560 else
7561 split_quantity_new = quantity;
7562
7564 {
7565 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
7566 new_item =
ItemBase.Cast(in_hands);
7567 if (new_item)
7568 {
7569 new_item.SetResultOfSplit(true);
7570 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7572 new_item.SetQuantity(split_quantity_new, false, true);
7573 }
7574 }
7575 }
7576 }
7577
7579 {
7581 float split_quantity_new = Math.Floor(quantity * 0.5);
7582
7584 return;
7585
7587
7588 if (new_item)
7589 {
7590 if (new_item.GetQuantityMax() < split_quantity_new)
7591 {
7592 split_quantity_new = new_item.GetQuantityMax();
7593 }
7594
7595 new_item.SetResultOfSplit(true);
7596 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7597
7599 {
7602 }
7603 else
7604 {
7606 new_item.
SetQuantity(split_quantity_new,
false,
true);
7607 }
7608 }
7609 }
7610
7612 {
7614 float split_quantity_new = Math.Floor(quantity / 2);
7615
7617 return;
7618
7619 InventoryLocation invloc = new InventoryLocation;
7621
7623 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
7624
7625 if (new_item)
7626 {
7627 if (new_item.GetQuantityMax() < split_quantity_new)
7628 {
7629 split_quantity_new = new_item.GetQuantityMax();
7630 }
7632 {
7635 }
7636 else if (split_quantity_new > 1)
7637 {
7639 new_item.
SetQuantity(split_quantity_new,
false,
true);
7640 }
7641 }
7642 }
7643
7646 {
7647 SetWeightDirty();
7649
7650 if (parent)
7651 parent.OnAttachmentQuantityChangedEx(this, delta);
7652
7654 {
7656 {
7658 }
7660 {
7661 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
7663 }
7664 }
7665 }
7666
7669 {
7670
7671 }
7672
7675 {
7677 }
7678
7680 {
7681 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
7682
7684 {
7685 if (newLevel == GameConstants.STATE_RUINED)
7686 {
7688 EntityAI parent = GetHierarchyParent();
7689 if (parent && parent.IsFireplace())
7690 {
7691 CargoBase cargo = GetInventory().GetCargo();
7692 if (cargo)
7693 {
7695 {
7697 }
7698 }
7699 }
7700 }
7701
7703 {
7704
7706 return;
7707 }
7708
7709 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
7710 {
7712 }
7713 }
7714 }
7715
7716
7718 {
7719 super.OnRightClick();
7720
7722 {
7724 {
7725 if (ScriptInputUserData.CanStoreInputUserData())
7726 {
7727 EntityAI root = GetHierarchyRoot();
7728 Man playerOwner = GetHierarchyRootPlayer();
7729 InventoryLocation dst = new InventoryLocation;
7730
7731
7732 if (!playerOwner && root && root == this)
7733 {
7735 }
7736 else
7737 {
7738
7739 GetInventory().GetCurrentInventoryLocation(dst);
7741 {
7742 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7744 {
7746 }
7747 else
7748 {
7750
7751
7752 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
7753 {
7755 }
7756 else
7757 {
7758 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
7759 }
7760 }
7761 }
7762 }
7763
7764 ScriptInputUserData ctx = new ScriptInputUserData;
7772 }
7773 }
7774 else if (!
g_Game.IsMultiplayer())
7775 {
7777 }
7778 }
7779 }
7780
7782 {
7783 if (root)
7784 {
7785 vector m4[4];
7786 root.GetTransform(m4);
7787 dst.SetGround(this, m4);
7788 }
7789 else
7790 {
7791 GetInventory().GetCurrentInventoryLocation(dst);
7792 }
7793 }
7794
7795 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
7796 {
7797
7798 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
7799 return false;
7800
7801 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
7802 return false;
7803
7804
7806 return false;
7807
7808
7809 Magazine mag = Magazine.Cast(this);
7810 if (mag)
7811 {
7812 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
7813 return false;
7814
7815 if (stack_max_limit)
7816 {
7817 Magazine other_mag = Magazine.Cast(other_item);
7818 if (other_item)
7819 {
7820 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
7821 return false;
7822 }
7823
7824 }
7825 }
7826 else
7827 {
7828
7830 return false;
7831
7833 return false;
7834 }
7835
7836 PlayerBase player = null;
7837 if (CastTo(player, GetHierarchyRootPlayer()))
7838 {
7839 if (player.GetInventory().HasAttachment(this))
7840 return false;
7841
7842 if (player.IsItemsToDelete())
7843 return false;
7844 }
7845
7846 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
7847 return false;
7848
7849 int slotID;
7851 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
7852 return false;
7853
7854 return true;
7855 }
7856
7858 {
7860 }
7861
7863 {
7864 return m_IsResultOfSplit;
7865 }
7866
7868 {
7869 m_IsResultOfSplit = value;
7870 }
7871
7873 {
7875 }
7876
7878 {
7879 float other_item_quantity = other_item.GetQuantity();
7880 float this_free_space;
7881
7883
7885
7886 if (other_item_quantity > this_free_space)
7887 {
7888 return this_free_space;
7889 }
7890 else
7891 {
7892 return other_item_quantity;
7893 }
7894 }
7895
7897 {
7899 }
7900
7902 {
7904 return;
7905
7906 if (!IsMagazine() && other_item)
7907 {
7909 if (quantity_used != 0)
7910 {
7911 float hp1 = GetHealth01("","");
7912 float hp2 = other_item.GetHealth01("","");
7913 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
7914 hpResult = hpResult / (
GetQuantity() + quantity_used);
7915
7916 hpResult *= GetMaxHealth();
7917 Math.Round(hpResult);
7918 SetHealth("", "Health", hpResult);
7919
7921 other_item.AddQuantity(-quantity_used);
7922 }
7923 }
7925 }
7926
7928 {
7929 #ifdef SERVER
7930 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
7931 GetHierarchyParent().IncreaseLifetimeUp();
7932 #endif
7933 };
7934
7936 {
7937 PlayerBase p = PlayerBase.Cast(player);
7938
7939 array<int> recipesIds = p.m_Recipes;
7940 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
7941 if (moduleRecipesManager)
7942 {
7943 EntityAI itemInHands = player.GetEntityInHands();
7944 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
7945 }
7946
7947 for (int i = 0;i < recipesIds.Count(); i++)
7948 {
7949 int key = recipesIds.Get(i);
7950 string recipeName = moduleRecipesManager.GetRecipeName(key);
7952 }
7953 }
7954
7955
7956 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
7957 {
7958 super.GetDebugActions(outputList);
7959
7960
7966
7967
7972
7977
7978
7982
7983
7985 {
7989 }
7990
7993
7994
7998
8000
8001 InventoryLocation loc = new InventoryLocation();
8002 GetInventory().GetCurrentInventoryLocation(loc);
8004 {
8005 if (Gizmo_IsSupported())
8008 }
8009
8011 }
8012
8013
8014
8015
8017 {
8018 super.OnAction(action_id, player, ctx);
8019
8021 {
8022 switch (action_id)
8023 {
8027 return true;
8031 return true;
8032 }
8033 }
8034
8036 {
8037 switch (action_id)
8038 {
8040 Delete();
8041 return true;
8042 }
8043 }
8044
8045 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
8046 {
8047 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8048 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
8049 PlayerBase p = PlayerBase.Cast(player);
8050 if (
EActions.RECIPES_RANGE_START < 1000)
8051 {
8052 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
8053 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
8054 }
8055 }
8056 #ifndef SERVER
8057 else if (action_id ==
EActions.WATCH_PLAYER)
8058 {
8059 PluginDeveloper.SetDeveloperItemClientEx(player);
8060 }
8061 #endif
8063 {
8064 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
8065 {
8066 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
8067 OnDebugButtonPressServer(id + 1);
8068 }
8069
8070 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
8071 {
8072 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
8074 }
8075
8076 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
8077 {
8078 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
8080 }
8081
8082 else if (action_id ==
EActions.ADD_QUANTITY)
8083 {
8084 if (IsMagazine())
8085 {
8086 Magazine mag = Magazine.Cast(this);
8087 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
8088 }
8089 else
8090 {
8092 }
8093
8094 if (m_EM)
8095 {
8096 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
8097 }
8098
8099 }
8100
8101 else if (action_id ==
EActions.REMOVE_QUANTITY)
8102 {
8103 if (IsMagazine())
8104 {
8105 Magazine mag2 = Magazine.Cast(this);
8106 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
8107 }
8108 else
8109 {
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.SET_QUANTITY_0)
8120 {
8122
8123 if (m_EM)
8124 {
8125 m_EM.SetEnergy(0);
8126 }
8127 }
8128
8129 else if (action_id ==
EActions.SET_MAX_QUANTITY)
8130 {
8132
8133 if (m_EM)
8134 {
8135 m_EM.SetEnergy(m_EM.GetEnergyMax());
8136 }
8137 }
8138
8139 else if (action_id ==
EActions.ADD_HEALTH)
8140 {
8141 AddHealth("","",GetMaxHealth("","Health")/5);
8142 }
8143 else if (action_id ==
EActions.REMOVE_HEALTH)
8144 {
8145 AddHealth("","",-GetMaxHealth("","Health")/5);
8146 }
8147 else if (action_id ==
EActions.DESTROY_HEALTH)
8148 {
8149 SetHealth01("","",0);
8150 }
8151 else if (action_id ==
EActions.WATCH_ITEM)
8152 {
8154 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
8155 #ifdef DEVELOPER
8156 SetDebugDeveloper_item(this);
8157 #endif
8158 }
8159
8160 else if (action_id ==
EActions.ADD_TEMPERATURE)
8161 {
8162 AddTemperature(20);
8163
8164 }
8165
8166 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
8167 {
8168 AddTemperature(-20);
8169
8170 }
8171
8172 else if (action_id ==
EActions.FLIP_FROZEN)
8173 {
8174 SetFrozen(!GetIsFrozen());
8175
8176 }
8177
8178 else if (action_id ==
EActions.ADD_WETNESS)
8179 {
8181
8182 }
8183
8184 else if (action_id ==
EActions.REMOVE_WETNESS)
8185 {
8187
8188 }
8189
8190 else if (action_id ==
EActions.LIQUIDTYPE_UP)
8191 {
8194
8195
8196 }
8197
8198 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
8199 {
8202 }
8203
8204 else if (action_id ==
EActions.MAKE_SPECIAL)
8205 {
8206 auto debugParams = DebugSpawnParams.WithPlayer(player);
8207 OnDebugSpawnEx(debugParams);
8208 }
8209
8210 }
8211
8212
8213 return false;
8214 }
8215
8216
8217
8218
8222
8225
8226
8227
8229 {
8230 return false;
8231 }
8232
8233
8235 {
8236 return true;
8237 }
8238
8239
8241 {
8242 return true;
8243 }
8244
8245
8246
8248 {
8249 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
8250 return g_Game.ConfigIsExisting(config_path);
8251 }
8252
8255 {
8256 return null;
8257 }
8258
8260 {
8261 return false;
8262 }
8263
8265 {
8266 return false;
8267 }
8268
8272
8273
8275 {
8276 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8277 return module_repairing.CanRepair(this, item_repair_kit);
8278 }
8279
8280
8281 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
8282 {
8283 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8284 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
8285 }
8286
8287
8289 {
8290
8291
8292
8293
8294
8295
8296
8297
8298 return 1;
8299 }
8300
8301
8302
8304 {
8306 }
8307
8308
8309
8311 {
8313 }
8314
8315
8324 {
8325 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8326
8327 if (player)
8328 {
8329 player.MessageStatus(text);
8330 }
8331 }
8332
8333
8342 {
8343 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8344
8345 if (player)
8346 {
8347 player.MessageAction(text);
8348 }
8349 }
8350
8351
8360 {
8361 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8362
8363 if (player)
8364 {
8365 player.MessageFriendly(text);
8366 }
8367 }
8368
8369
8378 {
8379 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8380
8381 if (player)
8382 {
8383 player.MessageImportant(text);
8384 }
8385 }
8386
8388 {
8389 return true;
8390 }
8391
8392
8393 override bool KindOf(
string tag)
8394 {
8395 bool found = false;
8396 string item_name = this.
GetType();
8398 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
8399
8400 int array_size = item_tag_array.Count();
8401 for (int i = 0; i < array_size; i++)
8402 {
8403 if (item_tag_array.Get(i) == tag)
8404 {
8405 found = true;
8406 break;
8407 }
8408 }
8409 return found;
8410 }
8411
8412
8414 {
8415
8416 super.OnRPC(sender, rpc_type,ctx);
8417
8418
8419 switch (rpc_type)
8420 {
8421 #ifndef SERVER
8422 case ERPCs.RPC_SOUND_LOCK_ATTACH:
8423 Param2<bool, string> p = new Param2<bool, string>(false, "");
8424
8426 return;
8427
8428 bool play = p.param1;
8429 string soundSet = p.param2;
8430
8431 if (play)
8432 {
8434 {
8436 {
8438 }
8439 }
8440 else
8441 {
8443 }
8444 }
8445 else
8446 {
8448 }
8449
8450 break;
8451 #endif
8452
8453 }
8454
8456 {
8458 }
8459 }
8460
8461
8462
8463
8465 {
8466 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8467 return plugin.GetID(
name);
8468 }
8469
8471 {
8472 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8473 return plugin.GetName(id);
8474 }
8475
8478 {
8479
8480
8481 int varFlags;
8482 if (!ctx.
Read(varFlags))
8483 return;
8484
8485 if (varFlags & ItemVariableFlags.FLOAT)
8486 {
8488 }
8489 }
8490
8492 {
8493
8494 super.SerializeNumericalVars(floats_out);
8495
8496
8497
8499 {
8501 }
8502
8504 {
8506 }
8507
8509 {
8511 }
8512
8514 {
8519 }
8520
8522 {
8524 }
8525 }
8526
8528 {
8529
8530 super.DeSerializeNumericalVars(floats);
8531
8532
8533 int index = 0;
8534 int mask = Math.Round(floats.Get(index));
8535
8536 index++;
8537
8539 {
8541 {
8543 }
8544 else
8545 {
8546 float quantity = floats.Get(index);
8548 }
8549 index++;
8550 }
8551
8553 {
8554 float wet = floats.Get(index);
8556 index++;
8557 }
8558
8560 {
8561 int liquidtype = Math.Round(floats.Get(index));
8563 index++;
8564 }
8565
8567 {
8569 index++;
8571 index++;
8573 index++;
8575 index++;
8576 }
8577
8579 {
8580 int cleanness = Math.Round(floats.Get(index));
8582 index++;
8583 }
8584 }
8585
8587 {
8588 super.WriteVarsToCTX(ctx);
8589
8590
8592 {
8594 }
8595
8597 {
8599 }
8600
8602 {
8604 }
8605
8607 {
8608 int r,g,b,a;
8614 }
8615
8617 {
8619 }
8620 }
8621
8623 {
8624 if (!super.ReadVarsFromCTX(ctx,version))
8625 return false;
8626
8627 int intValue;
8628 float value;
8629
8630 if (version < 140)
8631 {
8632 if (!ctx.
Read(intValue))
8633 return false;
8634
8635 m_VariablesMask = intValue;
8636 }
8637
8639 {
8640 if (!ctx.
Read(value))
8641 return false;
8642
8644 {
8646 }
8647 else
8648 {
8650 }
8651 }
8652
8653 if (version < 140)
8654 {
8656 {
8657 if (!ctx.
Read(value))
8658 return false;
8659 SetTemperatureDirect(value);
8660 }
8661 }
8662
8664 {
8665 if (!ctx.
Read(value))
8666 return false;
8668 }
8669
8671 {
8672 if (!ctx.
Read(intValue))
8673 return false;
8675 }
8676
8678 {
8679 int r,g,b,a;
8681 return false;
8683 return false;
8685 return false;
8687 return false;
8688
8690 }
8691
8693 {
8694 if (!ctx.
Read(intValue))
8695 return false;
8697 }
8698
8699 if (version >= 138 && version < 140)
8700 {
8702 {
8703 if (!ctx.
Read(intValue))
8704 return false;
8705 SetFrozen(intValue);
8706 }
8707 }
8708
8709 return true;
8710 }
8711
8712
8714 {
8717 {
8719 }
8720
8721 if (!super.OnStoreLoad(ctx, version))
8722 {
8724 return false;
8725 }
8726
8727 if (version >= 114)
8728 {
8729 bool hasQuickBarIndexSaved;
8730
8731 if (!ctx.
Read(hasQuickBarIndexSaved))
8732 {
8734 return false;
8735 }
8736
8737 if (hasQuickBarIndexSaved)
8738 {
8739 int itmQBIndex;
8740
8741
8742 if (!ctx.
Read(itmQBIndex))
8743 {
8745 return false;
8746 }
8747
8748 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
8749 if (itmQBIndex != -1 && parentPlayer)
8750 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
8751 }
8752 }
8753 else
8754 {
8755
8756 PlayerBase player;
8757 int itemQBIndex;
8758 if (version ==
int.
MAX)
8759 {
8760 if (!ctx.
Read(itemQBIndex))
8761 {
8763 return false;
8764 }
8765 }
8766 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
8767 {
8768
8769 if (!ctx.
Read(itemQBIndex))
8770 {
8772 return false;
8773 }
8774 if (itemQBIndex != -1 && player)
8775 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
8776 }
8777 }
8778
8779 if (version < 140)
8780 {
8781
8782 if (!LoadVariables(ctx, version))
8783 {
8785 return false;
8786 }
8787 }
8788
8789
8791 {
8793 return false;
8794 }
8795 if (version >= 132)
8796 {
8798 if (raib)
8799 {
8801 {
8803 return false;
8804 }
8805 }
8806 }
8807
8809 return true;
8810 }
8811
8812
8813
8815 {
8816 super.OnStoreSave(ctx);
8817
8818 PlayerBase player;
8819 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
8820 {
8822
8823 int itemQBIndex = -1;
8824 itemQBIndex = player.FindQuickBarEntityIndex(this);
8825 ctx.
Write(itemQBIndex);
8826 }
8827 else
8828 {
8830 }
8831
8833
8835 if (raib)
8836 {
8838 }
8839 }
8840
8841
8843 {
8844 super.AfterStoreLoad();
8845
8847 {
8849 }
8850
8852 {
8855 }
8856 }
8857
8859 {
8860 super.EEOnAfterLoad();
8861
8863 {
8865 }
8866
8869 }
8870
8872 {
8873 return false;
8874 }
8875
8876
8877
8879 {
8881 {
8882 #ifdef PLATFORM_CONSOLE
8883
8885 {
8887 if (menu)
8888 {
8890 }
8891 }
8892 #endif
8893 }
8894
8896 {
8899 }
8900
8902 {
8903 SetWeightDirty();
8905 }
8907 {
8910 }
8911
8913 {
8916
8919 }
8921 {
8925 }
8926
8927 super.OnVariablesSynchronized();
8928 }
8929
8930
8931
8933 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
8934 {
8935 if (!IsServerCheck(allow_client))
8936 return false;
8937
8939 return false;
8940
8943
8944 if (value <= (min + 0.001))
8945 value = min;
8946
8947 if (value == min)
8948 {
8949 if (destroy_config)
8950 {
8951 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
8952 if (dstr)
8953 {
8955 this.Delete();
8956 return true;
8957 }
8958 }
8959 else if (destroy_forced)
8960 {
8962 this.Delete();
8963 return true;
8964 }
8965
8967 }
8968
8971
8973 {
8974 EntityAI parent = GetHierarchyRoot();
8975 InventoryLocation iLoc = new InventoryLocation();
8976 GetInventory().GetCurrentInventoryLocation(iLoc);
8978 {
8979 int iLocSlot = iLoc.
GetSlot();
8981 {
8983 }
8985 {
8987 }
8988 }
8989 }
8990
8992 {
8994
8995 if (delta)
8997 }
8998
9000
9001 return false;
9002 }
9003
9004
9006 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9007 {
9009 }
9010
9012 {
9015 }
9016
9018 {
9021 }
9022
9024 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9025 {
9026 float value_clamped = Math.Clamp(value, 0, 1);
9028 SetQuantity(result, destroy_config, destroy_forced);
9029 }
9030
9031
9034 {
9036 }
9037
9039 {
9041 }
9042
9043
9044
9045
9046
9047
9048
9049
9050
9051
9053 {
9054 int slot = -1;
9055 GameInventory inventory = GetInventory();
9056 if (inventory)
9057 {
9058 InventoryLocation il = new InventoryLocation;
9061 }
9062
9064 }
9065
9067 {
9068 float quantity_max = 0;
9069
9071 {
9072 if (attSlotID != -1)
9073 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
9074
9075 if (quantity_max <= 0)
9077 }
9078
9079 if (quantity_max <= 0)
9081
9082 return quantity_max;
9083 }
9084
9086 {
9088 }
9089
9091 {
9093 }
9094
9095
9097 {
9099 }
9100
9102 {
9104 }
9105
9107 {
9109 }
9110
9111
9113 {
9114
9115 float weightEx = GetWeightEx();
9116 float special = GetInventoryAndCargoWeight();
9117 return weightEx - special;
9118 }
9119
9120
9122 {
9124 }
9125
9127 {
9129 {
9130 #ifdef DEVELOPER
9131 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9132 {
9133 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
9135 }
9136 #endif
9137
9139 }
9140 else if (HasEnergyManager())
9141 {
9142 #ifdef DEVELOPER
9143 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9144 {
9145 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
9146 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
9147 }
9148 #endif
9149 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
9150 }
9151 else
9152 {
9153 #ifdef DEVELOPER
9154 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9155 {
9156 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
9157 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
9158 }
9159 #endif
9160 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
9161 }
9162 }
9163
9166 {
9167 int item_count = 0;
9169
9170 GameInventory inventory = GetInventory();
9171 CargoBase cargo = inventory.
GetCargo();
9172 if (cargo != NULL)
9173 {
9175 }
9176
9178 for (int i = 0; i < nAttachments; ++i)
9179 {
9181 if (item)
9182 item_count += item.GetNumberOfItems();
9183 }
9184 return item_count;
9185 }
9186
9189 {
9190 float weight = 0;
9191 float wetness = 1;
9192 if (include_wetness)
9195 {
9196 weight = wetness * m_ConfigWeight;
9197 }
9199 {
9200 weight = 1;
9201 }
9202 return weight;
9203 }
9204
9205
9206
9208 {
9209 GameInventory inventory = GetInventory();
9210 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
9211 {
9212 array<EntityAI> items = new array<EntityAI>;
9214 for (int i = 0; i < items.Count(); ++i)
9215 {
9217 if (item)
9218 {
9219 g_Game.ObjectDelete(item);
9220 }
9221 }
9222 }
9223 }
9224
9225
9226
9227
9229 {
9230 float energy = 0;
9231 if (HasEnergyManager())
9232 {
9233 energy = GetCompEM().GetEnergy();
9234 }
9235 return energy;
9236 }
9237
9238
9240 {
9241 super.OnEnergyConsumed();
9242
9244 }
9245
9247 {
9248 super.OnEnergyAdded();
9249
9251 }
9252
9253
9255 {
9256 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
9257 {
9259 {
9260 float energy_0to1 = GetCompEM().GetEnergy0To1();
9262 }
9263 }
9264 }
9265
9266
9268 {
9269 return ConfigGetFloat("heatIsolation");
9270 }
9271
9273 {
9275 }
9276
9278 {
9279 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
9280 if (
g_Game.ConfigIsExisting(paramPath))
9281 return g_Game.ConfigGetFloat(paramPath);
9282
9283 return 0.0;
9284 }
9285
9287 {
9288 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
9289 if (
g_Game.ConfigIsExisting(paramPath))
9290 return g_Game.ConfigGetFloat(paramPath);
9291
9292 return 0.0;
9293 }
9294
9295 override void SetWet(
float value,
bool allow_client =
false)
9296 {
9297 if (!IsServerCheck(allow_client))
9298 return;
9299
9302
9304
9305 m_VarWet = Math.Clamp(value, min, max);
9306
9308 {
9311 }
9312 }
9313
9314 override void AddWet(
float value)
9315 {
9317 }
9318
9320 {
9322 }
9323
9325 {
9327 }
9328
9330 {
9332 }
9333
9335 {
9337 }
9338
9340 {
9342 }
9343
9345 {
9348 if (newLevel != oldLevel)
9349 {
9351 }
9352 }
9353
9355 {
9356 SetWeightDirty();
9357 }
9358
9360 {
9361 return GetWetLevelInternal(
m_VarWet);
9362 }
9363
9364
9365
9367 {
9369 }
9370
9372 {
9374 }
9375
9377 {
9379 }
9380
9382 {
9384 }
9385
9386
9387
9389 {
9390 if (ConfigIsExisting("itemModelLength"))
9391 {
9392 return ConfigGetFloat("itemModelLength");
9393 }
9394 return 0;
9395 }
9396
9398 {
9399 if (ConfigIsExisting("itemAttachOffset"))
9400 {
9401 return ConfigGetFloat("itemAttachOffset");
9402 }
9403 return 0;
9404 }
9405
9406 override void SetCleanness(
int value,
bool allow_client =
false)
9407 {
9408 if (!IsServerCheck(allow_client))
9409 return;
9410
9412
9414
9417 }
9418
9420 {
9422 }
9423
9425 {
9426 return true;
9427 }
9428
9429
9430
9431
9433 {
9435 }
9436
9438 {
9440 }
9441
9442
9443
9444
9445 override void SetColor(
int r,
int g,
int b,
int a)
9446 {
9452 }
9454 override void GetColor(out
int r,out
int g,out
int b,out
int a)
9455 {
9460 }
9461
9463 {
9465 }
9466
9469 {
9470 int r,g,b,a;
9472 r = r/255;
9473 g = g/255;
9474 b = b/255;
9475 a = a/255;
9476 return MiscGameplayFunctions.GetColorString(r, g, b, a);
9477 }
9478
9479
9480
9481 override void SetLiquidType(
int value,
bool allow_client =
false)
9482 {
9483 if (!IsServerCheck(allow_client))
9484 return;
9485
9490 }
9491
9493 {
9494 return ConfigGetInt("varLiquidTypeInit");
9495 }
9496
9498 {
9500 }
9501
9503 {
9505 SetFrozen(false);
9506 }
9507
9510 {
9511 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9512 }
9513
9514
9517 {
9518 PlayerBase nplayer;
9519 if (PlayerBase.CastTo(nplayer, player))
9520 {
9522 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9523 }
9524 }
9525
9526
9529 {
9530 PlayerBase nplayer;
9531 if (PlayerBase.CastTo(nplayer,player))
9532 {
9533 nplayer.SetEnableQuickBarEntityShortcut(this, false);
9534 }
9535
9536 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
9537
9538 if (HasEnergyManager())
9539 {
9540 GetCompEM().UpdatePlugState();
9541 }
9542 }
9543
9544
9546 {
9547 super.OnPlacementStarted(player);
9548
9550 }
9551
9552 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
9553 {
9555 {
9556 m_AdminLog.OnPlacementComplete(player,
this);
9557 }
9558
9559 super.OnPlacementComplete(player, position, orientation);
9560 }
9561
9562
9563
9564
9565
9567 {
9569 {
9570 return true;
9571 }
9572 else
9573 {
9574 return false;
9575 }
9576 }
9577
9578
9580 {
9582 {
9584 }
9585 }
9586
9587
9589 {
9591 }
9592
9594 {
9596 }
9597
9598 override void InsertAgent(
int agent,
float count = 1)
9599 {
9600 if (count < 1)
9601 return;
9602
9604 }
9605
9608 {
9610 }
9611
9612
9614 {
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
9655
9656
9657
9658
9660 {
9662 return false;
9663 return true;
9664 }
9665
9667 {
9668
9670 }
9671
9672
9675 {
9676 super.CheckForRoofLimited(timeTresholdMS);
9677
9678 float time =
g_Game.GetTime();
9679 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
9680 {
9681 m_PreviousRoofTestTime = time;
9682 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
9683 }
9684 }
9685
9686
9688 {
9690 {
9691 return 0;
9692 }
9693
9694 if (GetInventory().GetAttachmentSlotsCount() != 0)
9695 {
9696 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
9697 if (filter)
9698 return filter.GetProtectionLevel(type, false, system);
9699 else
9700 return 0;
9701 }
9702
9703 string subclassPath, entryName;
9704
9705 switch (type)
9706 {
9708 entryName = "biological";
9709 break;
9711 entryName = "chemical";
9712 break;
9713 default:
9714 entryName = "biological";
9715 break;
9716 }
9717
9718 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
9719
9720 return g_Game.ConfigGetFloat(subclassPath + entryName);
9721 }
9722
9723
9724
9727 {
9728 if (!IsMagazine())
9730
9732 }
9733
9734
9735
9736
9737
9742 {
9743 return true;
9744 }
9745
9747 {
9749 }
9750
9751
9752
9753
9754
9756 {
9757 if (parent)
9758 {
9759 if (parent.IsInherited(DayZInfected))
9760 return true;
9761
9762 if (!parent.IsRuined())
9763 return true;
9764 }
9765
9766 return true;
9767 }
9768
9770 {
9771 if (!super.CanPutAsAttachment(parent))
9772 {
9773 return false;
9774 }
9775
9776 if (!IsRuined() && !parent.IsRuined())
9777 {
9778 return true;
9779 }
9780
9781 return false;
9782 }
9783
9785 {
9786
9787
9788
9789
9790 return super.CanReceiveItemIntoCargo(item);
9791 }
9792
9794 {
9795
9796
9797
9798
9799 GameInventory attachmentInv = attachment.GetInventory();
9801 {
9802 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
9803 return false;
9804 }
9805
9806 InventoryLocation loc = new InventoryLocation();
9807 attachment.GetInventory().GetCurrentInventoryLocation(loc);
9808 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
9809 return false;
9810
9811 return super.CanReceiveAttachment(attachment, slotId);
9812 }
9813
9815 {
9816 if (!super.CanReleaseAttachment(attachment))
9817 return false;
9818
9819 return GetInventory().AreChildrenAccessible();
9820 }
9821
9822
9823
9824
9825
9826
9827
9828
9829
9830
9831
9832
9833
9834
9835
9836
9837
9838
9839
9840
9841
9843 {
9844 int id = muzzle_owner.GetMuzzleID();
9845 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
9846
9847 if (WPOF_array)
9848 {
9849 for (int i = 0; i < WPOF_array.Count(); i++)
9850 {
9851 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
9852
9853 if (WPOF)
9854 {
9855 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
9856 }
9857 }
9858 }
9859 }
9860
9861
9863 {
9864 int id = muzzle_owner.GetMuzzleID();
9866
9867 if (WPOBE_array)
9868 {
9869 for (int i = 0; i < WPOBE_array.Count(); i++)
9870 {
9871 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
9872
9873 if (WPOBE)
9874 {
9875 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
9876 }
9877 }
9878 }
9879 }
9880
9881
9883 {
9884 int id = muzzle_owner.GetMuzzleID();
9885 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9886
9887 if (WPOOH_array)
9888 {
9889 for (int i = 0; i < WPOOH_array.Count(); i++)
9890 {
9891 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9892
9893 if (WPOOH)
9894 {
9895 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
9896 }
9897 }
9898 }
9899 }
9900
9901
9903 {
9904 int id = muzzle_owner.GetMuzzleID();
9905 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9906
9907 if (WPOOH_array)
9908 {
9909 for (int i = 0; i < WPOOH_array.Count(); i++)
9910 {
9911 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9912
9913 if (WPOOH)
9914 {
9915 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9916 }
9917 }
9918 }
9919 }
9920
9921
9923 {
9924 int id = muzzle_owner.GetMuzzleID();
9925 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9926
9927 if (WPOOH_array)
9928 {
9929 for (int i = 0; i < WPOOH_array.Count(); i++)
9930 {
9931 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9932
9933 if (WPOOH)
9934 {
9935 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9936 }
9937 }
9938 }
9939 }
9940
9941
9942
9944 {
9946 {
9947 return true;
9948 }
9949
9950 return false;
9951 }
9952
9954 {
9956 {
9957 return true;
9958 }
9959
9960 return false;
9961 }
9962
9964 {
9966 {
9967 return true;
9968 }
9969
9970 return false;
9971 }
9972
9974 {
9975 return false;
9976 }
9977
9980 {
9981 return UATimeSpent.DEFAULT_DEPLOY;
9982 }
9983
9984
9985
9986
9988 {
9990 SetSynchDirty();
9991 }
9992
9994 {
9996 }
9997
9998
10000 {
10001 return false;
10002 }
10003
10006 {
10007 string att_type = "None";
10008
10009 if (ConfigIsExisting("soundAttType"))
10010 {
10011 att_type = ConfigGetString("soundAttType");
10012 }
10013
10015 }
10016
10018 {
10020 }
10021
10022
10023
10024
10025
10031
10033 {
10036
10038 }
10039
10040
10042 {
10044 return;
10045
10047
10050
10053
10054 SoundParameters params = new SoundParameters();
10058 }
10059
10060
10062 {
10064 {
10067
10068 SetSynchDirty();
10069
10072 }
10073 }
10074
10076 {
10078 }
10079
10080
10082 {
10084 return;
10085
10087 SetSynchDirty();
10088
10091 }
10092
10094 {
10097 }
10098
10100 {
10102 }
10103
10104 void OnApply(PlayerBase player);
10105
10107 {
10108 return 1.0;
10109 };
10110
10112 {
10114 }
10115
10117 {
10119 }
10120
10122
10124 {
10125 SetDynamicPhysicsLifeTime(0.01);
10127 }
10128
10130 {
10131 array<string> zone_names = new array<string>;
10132 GetDamageZones(zone_names);
10133 for (int i = 0; i < zone_names.Count(); i++)
10134 {
10135 SetHealthMax(zone_names.Get(i),"Health");
10136 }
10137 SetHealthMax("","Health");
10138 }
10139
10142 {
10143 float global_health = GetHealth01("","Health");
10144 array<string> zones = new array<string>;
10145 GetDamageZones(zones);
10146
10147 for (int i = 0; i < zones.Count(); i++)
10148 {
10149 SetHealth01(zones.Get(i),"Health",global_health);
10150 }
10151 }
10152
10155 {
10156 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
10157 }
10158
10160 {
10161 if (!hasRootAsPlayer)
10162 {
10163 if (refParentIB)
10164 {
10165
10166 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
10167 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
10168
10169 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
10170 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
10171
10174 }
10175 else
10176 {
10177
10180 }
10181 }
10182 }
10183
10185 {
10187 {
10188 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
10189 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
10190 {
10191 float heatPermCoef = 1.0;
10193 while (ent)
10194 {
10195 heatPermCoef *= ent.GetHeatPermeabilityCoef();
10196 ent = ent.GetHierarchyParent();
10197 }
10198
10199 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
10200 }
10201 }
10202 }
10203
10205 {
10206
10207 EntityAI parent = GetHierarchyParent();
10208 if (!parent)
10209 {
10210 hasParent = false;
10211 hasRootAsPlayer = false;
10212 }
10213 else
10214 {
10215 hasParent = true;
10216 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
10217 refParentIB =
ItemBase.Cast(parent);
10218 }
10219 }
10220
10221 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
10222 {
10223
10224 }
10225
10227 {
10228
10229 return false;
10230 }
10231
10233 {
10234
10235
10236 return false;
10237 }
10238
10240 {
10241
10242 return false;
10243 }
10244
10247 {
10248 return !GetIsFrozen() &&
IsOpen();
10249 }
10250
10252 {
10253 bool hasParent = false, hasRootAsPlayer = false;
10255
10256 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
10257 bool foodDecay =
g_Game.IsFoodDecayEnabled();
10258
10259 if (wwtu || foodDecay)
10260 {
10264
10265 if (processWetness || processTemperature || processDecay)
10266 {
10268
10269 if (processWetness)
10270 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
10271
10272 if (processTemperature)
10274
10275 if (processDecay)
10276 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
10277 }
10278 }
10279 }
10280
10283 {
10285 }
10286
10288 {
10291
10292 return super.GetTemperatureFreezeThreshold();
10293 }
10294
10296 {
10299
10300 return super.GetTemperatureThawThreshold();
10301 }
10302
10304 {
10307
10308 return super.GetItemOverheatThreshold();
10309 }
10310
10312 {
10314 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
10315
10316 return super.GetTemperatureFreezeTime();
10317 }
10318
10320 {
10322 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
10323
10324 return super.GetTemperatureThawTime();
10325 }
10326
10331
10333 {
10334 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
10335 }
10336
10338 {
10339 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
10340 }
10341
10344 {
10346 }
10347
10349 {
10351 }
10352
10354 {
10356 }
10357
10360 {
10361 return null;
10362 }
10363
10366 {
10367 return false;
10368 }
10369
10371 {
10373 {
10376 if (!trg)
10377 {
10379 explosive = this;
10380 }
10381
10382 explosive.PairRemote(trg);
10384
10385 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
10386 trg.SetPersistentPairID(persistentID);
10387 explosive.SetPersistentPairID(persistentID);
10388
10389 return true;
10390 }
10391 return false;
10392 }
10393
10396 {
10397 float ret = 1.0;
10400 ret *= GetHealth01();
10401
10402 return ret;
10403 }
10404
10405 #ifdef DEVELOPER
10406 override void SetDebugItem()
10407 {
10408 super.SetDebugItem();
10409 _itemBase = this;
10410 }
10411
10413 {
10414 string text = super.GetDebugText();
10415
10417 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
10418
10419 return text;
10420 }
10421 #endif
10422
10424 {
10425 return true;
10426 }
10427
10429
10431
10433 {
10436 }
10437
10438
10446
10462
10463 [
Obsolete(
"Use ItemSoundHandler instead")]
10466 {
10467 if (!
g_Game.IsDedicatedServer())
10468 {
10469 if (ConfigIsExisting("attachSoundSet"))
10470 {
10471 string cfg_path = "";
10472 string soundset = "";
10473 string type_name =
GetType();
10474
10477 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
10478 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
10479
10480 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
10481 {
10482 for (int i = 0; i < cfg_soundset_array.Count(); i++)
10483 {
10484 if (cfg_slot_array[i] == slot_type)
10485 {
10486 soundset = cfg_soundset_array[i];
10487 break;
10488 }
10489 }
10490 }
10491
10492 if (soundset != "")
10493 {
10494 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
10496 }
10497 }
10498 }
10499 }
10500
10502}
10503
10505{
10507 if (entity)
10508 {
10509 bool is_item = entity.IsInherited(
ItemBase);
10510 if (is_item && full_quantity)
10511 {
10514 }
10515 }
10516 else
10517 {
10519 return NULL;
10520 }
10521 return entity;
10522}
10523
10525{
10526 if (item)
10527 {
10528 if (health > 0)
10529 item.SetHealth("", "", health);
10530
10531 if (item.CanHaveTemperature())
10532 {
10534 if (item.CanFreeze())
10535 item.SetFrozen(false);
10536 }
10537
10538 if (item.HasEnergyManager())
10539 {
10540 if (quantity >= 0)
10541 {
10542 item.GetCompEM().SetEnergy0To1(quantity);
10543 }
10544 else
10545 {
10547 }
10548 }
10549 else if (item.IsMagazine())
10550 {
10551 Magazine mag = Magazine.Cast(item);
10552 if (quantity >= 0)
10553 {
10554 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
10555 }
10556 else
10557 {
10559 }
10560
10561 }
10562 else
10563 {
10564 if (quantity >= 0)
10565 {
10566 item.SetQuantityNormalized(quantity, false);
10567 }
10568 else
10569 {
10571 }
10572
10573 }
10574 }
10575}
10576
10577#ifdef DEVELOPER
10579#endif
Param4< int, int, string, int > TSelectableActionInfoWithColor
Param3 TSelectableActionInfo
bool SetAttachSoundEvent()
bool SetDetachSoundEvent()
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 IsPrepareToDelete()
override bool CanHaveTemperature()
class GP5GasMask extends MaskBase ItemBase
proto GizmoApi GetGizmoApi()
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
void StartItemSoundServer(int id, int slotId)
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)
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()
override int GetLiquidType()
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)
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 EntityAI GetAttachmentFromIndex(int index)
proto native bool GetCurrentInventoryLocation(out notnull InventoryLocation loc)
returns information about current item location
proto native bool EnumerateInventory(InventoryTraversalType tt, out array< EntityAI > items)
enumerate inventory using traversal type and filling items array
proto native CargoBase GetCargo()
cargo
static proto native EntityAI LocationCreateEntity(notnull InventoryLocation inv_loc, string type, int iSetupFlags, int iRotation)
creates new item directly at location
proto native int AttachmentCount()
Returns count of attachments attached to this item.
proto native bool FindFreeLocationFor(notnull EntityAI item, FindInventoryLocationType flags, out notnull InventoryLocation loc)
FindFreeLocationFor.
proto void SelectObject(Object object)
proto void SelectPhysics(Physics physics)
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 bool Write(void value_out)
proto bool Read(void value_in)
proto native float GetDamage(string zoneName, string healthType)
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
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
void Obsolete(string msg="")
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
vector GetPosition()
Get the world position of the Effect.
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.