5605{
5607 {
5608 return true;
5609 }
5610};
5611
5613{
5614
5615};
5616
5617
5618
5620{
5624
5626
5629
5630
5631
5632
5633
5642
5648
5653
5658
5679 protected bool m_IsResultOfSplit
5680
5682
5687
5688
5689
5691
5695
5696
5697
5699
5702
5703
5704
5710
5711
5719
5722
5723
5725
5726
5728
5729
5734
5735
5740
5742
5743
5745
5746
5748 {
5753
5754 if (!
g_Game.IsDedicatedServer())
5755 {
5757 {
5759
5761 {
5763 }
5764 }
5765
5768 }
5769
5770 m_OldLocation = null;
5771
5773 {
5775 }
5776
5777 if (ConfigIsExisting("headSelectionsToHide"))
5778 {
5781 }
5782
5784 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
5785 {
5787 }
5788
5790
5791 m_IsResultOfSplit = false;
5792
5794 }
5795
5797 {
5798 super.InitItemVariables();
5799
5805 m_Count = ConfigGetInt(
"count");
5806
5809
5814
5817
5822
5834
5838
5839
5842 if (ConfigIsExisting("canBeSplit"))
5843 {
5846 }
5847
5849 if (ConfigIsExisting("itemBehaviour"))
5851
5852
5855 RegisterNetSyncVariableInt("m_VarLiquidType");
5856 RegisterNetSyncVariableInt("m_Cleanness",0,1);
5857
5858 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
5859 RegisterNetSyncVariableFloat("m_ImpactSpeed");
5860 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
5861
5862 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
5863 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
5864 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
5865 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
5866
5867 RegisterNetSyncVariableBool("m_IsBeingPlaced");
5868 RegisterNetSyncVariableBool("m_IsTakeable");
5869 RegisterNetSyncVariableBool("m_IsHologram");
5870
5873 {
5876 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
5877 }
5878
5880
5882 if (ConfigIsExisting("temperaturePerQuantityWeight"))
5884
5886 }
5887
5889 {
5891 }
5892
5894 {
5897 {
5902 }
5903 }
5904
5905 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
5906 {
5908 {
5911 }
5912
5914 }
5915
5917 {
5923 }
5924
5926
5928 {
5930
5931 if (!action)
5932 {
5933 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
5934 return;
5935 }
5936
5938 if (!ai)
5939 {
5941 return;
5942 }
5943
5945 if (!action_array)
5946 {
5947 action_array = new array<ActionBase_Basic>;
5949 }
5950 if (LogManager.IsActionLogEnable())
5951 {
5952 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
5953 }
5954
5955 if (action_array.Find(action) != -1)
5956 {
5957 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
5958 }
5959 else
5960 {
5961 action_array.Insert(action);
5962 }
5963 }
5964
5966 {
5967 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
5968 ActionBase action = player.GetActionManager().GetAction(actionName);
5971
5972 if (action_array)
5973 {
5974 action_array.RemoveItem(action);
5975 }
5976 }
5977
5978
5979
5981 {
5982 ActionOverrideData overrideData = new ActionOverrideData();
5986
5988 if (!actionMap)
5989 {
5992 }
5993
5994 actionMap.Insert(this.
Type(), overrideData);
5995
5996 }
5997
5999
6001
6002
6004 {
6007
6010
6011 string config_to_search = "CfgVehicles";
6012 string muzzle_owner_config;
6013
6015 {
6016 if (IsInherited(Weapon))
6017 config_to_search = "CfgWeapons";
6018
6019 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6020
6021 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
6022
6023 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
6024
6025 if (config_OnFire_subclass_count > 0)
6026 {
6027 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
6028
6029 for (int i = 0; i < config_OnFire_subclass_count; i++)
6030 {
6031 string particle_class = "";
6032 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
6033 string config_OnFire_entry = config_OnFire_class + particle_class;
6034 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
6035 WPOF_array.Insert(WPOF);
6036 }
6037
6038
6040 }
6041 }
6042
6044 {
6045 config_to_search = "CfgWeapons";
6046 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6047
6048 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
6049
6050 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
6051
6052 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
6053 {
6054 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
6055
6056 for (i = 0; i < config_OnBulletCasingEject_count; i++)
6057 {
6058 string particle_class2 = "";
6059 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
6060 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
6061 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
6062 WPOBE_array.Insert(WPOBE);
6063 }
6064
6065
6067 }
6068 }
6069 }
6070
6071
6073 {
6076
6078 {
6079 string config_to_search = "CfgVehicles";
6080
6081 if (IsInherited(Weapon))
6082 config_to_search = "CfgWeapons";
6083
6084 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6085 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
6086
6087 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
6088 {
6089
6091
6093 {
6095 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
6097 return;
6098 }
6099
6102
6103
6104
6105 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
6106 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
6107
6108 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
6109 {
6110 string particle_class = "";
6111 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
6112 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
6113 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
6114
6115 if (entry_type == CT_CLASS)
6116 {
6117 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
6118 WPOOH_array.Insert(WPOF);
6119 }
6120 }
6121
6122
6124 }
6125 }
6126 }
6127
6129 {
6131 }
6132
6134 {
6136 {
6138
6141
6144
6145 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6146 }
6147 }
6148
6150 {
6152 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6153
6155 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6156
6158 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6159
6161 {
6163 }
6164 }
6165
6167 {
6169 }
6170
6172 {
6175 else
6177
6179 {
6182 }
6183 else
6184 {
6187
6190 }
6191
6193 }
6194
6196 {
6198 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6199 }
6200
6202 {
6204 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6206 }
6207
6209 {
6211 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6212 }
6213
6215 {
6218
6219 OverheatingParticle OP = new OverheatingParticle();
6224
6226 }
6227
6229 {
6232
6233 return -1;
6234 }
6235
6237 {
6239 {
6242
6243 for (int i = count; i > 0; --i)
6244 {
6245 int id = i - 1;
6248
6251
6252 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
6253 {
6254 if (p)
6255 {
6258 }
6259 }
6260 }
6261 }
6262 }
6263
6265 {
6267 {
6269 {
6270 int id = i - 1;
6272
6273 if (OP)
6274 {
6276
6277 if (p)
6278 {
6280 }
6281
6282 delete OP;
6283 }
6284 }
6285
6288 }
6289 }
6290
6293 {
6294 return 0.0;
6295 }
6296
6297
6299 {
6300 return 250;
6301 }
6302
6304 {
6305 return 0;
6306 }
6307
6310 {
6312 return true;
6313
6314 return false;
6315 }
6316
6319 {
6322
6324 {
6326 }
6327 else
6328 {
6329
6331 }
6332
6334 }
6335
6342 {
6343 return -1;
6344 }
6345
6346
6347
6348
6350 {
6352 {
6353 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6354 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6355
6356 if (r_index >= 0)
6357 {
6358 InventoryLocation r_il = new InventoryLocation;
6359 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6360
6361 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6364 {
6365 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6366 }
6368 {
6369 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6370 }
6371
6372 }
6373
6374 player.GetHumanInventory().ClearUserReservedLocation(this);
6375 }
6376
6379 }
6380
6381
6382
6383
6385 {
6386 return ItemBase.m_DebugActionsMask;
6387 }
6388
6390 {
6391 return ItemBase.m_DebugActionsMask & mask;
6392 }
6393
6395 {
6396 ItemBase.m_DebugActionsMask = mask;
6397 }
6398
6400 {
6401 ItemBase.m_DebugActionsMask |= mask;
6402 }
6403
6405 {
6406 ItemBase.m_DebugActionsMask &= ~mask;
6407 }
6408
6410 {
6412 {
6414 }
6415 else
6416 {
6418 }
6419 }
6420
6421
6423 {
6424 if (GetEconomyProfile())
6425 {
6426 float q_max = GetEconomyProfile().GetQuantityMax();
6427 if (q_max > 0)
6428 {
6429 float q_min = GetEconomyProfile().GetQuantityMin();
6430 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
6431
6433 {
6434 ComponentEnergyManager comp = GetCompEM();
6436 {
6438 }
6439 }
6441 {
6443
6444 }
6445
6446 }
6447 }
6448 }
6449
6452 {
6453 EntityAI parent = GetHierarchyParent();
6454
6455 if (parent)
6456 {
6457 InventoryLocation inventory_location_to_lock = new InventoryLocation;
6458 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
6459 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
6460 }
6461 }
6462
6465 {
6466 EntityAI parent = GetHierarchyParent();
6467
6468 if (parent)
6469 {
6470 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
6471 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
6472 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
6473 }
6474 }
6475
6477 {
6478
6479
6480
6481
6483
6485 {
6486 if (ScriptInputUserData.CanStoreInputUserData())
6487 {
6488 ScriptInputUserData ctx = new ScriptInputUserData;
6494 ctx.
Write(use_stack_max);
6497
6499 {
6500 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
6501 }
6502 }
6503 }
6504 else if (!
g_Game.IsMultiplayer())
6505 {
6507 }
6508 }
6509
6511 {
6513 }
6514
6516 {
6518 }
6519
6521 {
6523 }
6524
6526 {
6527
6528 return false;
6529 }
6530
6532 {
6533 return false;
6534 }
6535
6539 {
6540 return false;
6541 }
6542
6544 {
6545 return "";
6546 }
6547
6549
6551 {
6552 return false;
6553 }
6554
6556 {
6557 return true;
6558 }
6559
6560
6561
6563 {
6564 return true;
6565 }
6566
6568 {
6569 return true;
6570 }
6571
6573 {
6574 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6576 }
6577
6579 {
6581 }
6582
6584 {
6586 if (!is_being_placed)
6588 SetSynchDirty();
6589 }
6590
6591
6593
6595 {
6597 }
6598
6600 {
6602 }
6603
6605 {
6606 return 1;
6607 }
6608
6610 {
6611 return false;
6612 }
6613
6615 {
6617 SetSynchDirty();
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
6648
6649
6650
6651
6652
6653
6655 {
6656 super.OnMovedInsideCargo(container);
6657
6658 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6659 }
6660
6661 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
6662 {
6663 super.EEItemLocationChanged(oldLoc, newLoc);
6664
6665 PlayerBase newPlayer = null;
6666 PlayerBase oldPlayer = null;
6667
6668 if (newLoc.GetParent())
6669 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
6670
6671 if (oldLoc.GetParent())
6672 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
6673
6675 {
6676 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
6677
6678 if (rIndex >= 0)
6679 {
6680 InventoryLocation rIl = new InventoryLocation;
6681 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
6682
6683 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
6686 {
6687 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
6688 }
6690 {
6692 }
6693
6694 }
6695 }
6696
6698 {
6699 if (newPlayer)
6700 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
6701
6702 if (newPlayer == oldPlayer)
6703 {
6704 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
6705 {
6707 {
6708 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
6709 {
6710 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6711 }
6712 }
6713 else
6714 {
6715 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6716 }
6717 }
6718
6719 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
6720 {
6721 int type = oldLoc.GetType();
6723 {
6724 oldLoc.GetParent().GetOnSetLock().Invoke(this);
6725 }
6727 {
6728 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
6729 }
6730 }
6731 if (!m_OldLocation)
6732 {
6733 m_OldLocation = new InventoryLocation;
6734 }
6735 m_OldLocation.Copy(oldLoc);
6736 }
6737 else
6738 {
6739 if (m_OldLocation)
6740 {
6741 m_OldLocation.Reset();
6742 }
6743 }
6744
6745 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
6746 }
6747 else
6748 {
6749 if (newPlayer)
6750 {
6751 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
6752 if (resIndex >= 0)
6753 {
6754 InventoryLocation il = new InventoryLocation;
6755 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
6757 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
6760 {
6761 il.
GetParent().GetOnReleaseLock().Invoke(it);
6762 }
6764 {
6766 }
6767
6768 }
6769 }
6771 {
6772
6774 }
6775
6776 if (m_OldLocation)
6777 {
6778 m_OldLocation.Reset();
6779 }
6780 }
6781
6783 {
6784 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
6785 }
6786
6788 {
6789 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
6790 }
6791 }
6792
6793 override void EOnContact(IEntity other, Contact extra)
6794 {
6796 {
6797 int liquidType = -1;
6799 if (impactSpeed > 0.0)
6800 {
6802 #ifndef SERVER
6804 #else
6806 SetSynchDirty();
6807 #endif
6809 }
6810 }
6811
6812 #ifdef SERVER
6813 if (GetCompEM() && GetCompEM().IsPlugged())
6814 {
6815 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
6816 GetCompEM().UnplugThis();
6817 }
6818 #endif
6819 }
6820
6822
6824 {
6826 }
6827
6829 {
6830
6831 }
6832
6834 {
6835 super.OnItemLocationChanged(old_owner, new_owner);
6836
6837 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
6838 PlayerBase playerNew = PlayerBase.Cast(new_owner);
6839
6840 if (!relatedPlayer && playerNew)
6841 relatedPlayer = playerNew;
6842
6843 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
6844 {
6846 if (actionMgr)
6847 {
6848 ActionBase currentAction = actionMgr.GetRunningAction();
6849 if (currentAction)
6851 }
6852 }
6853
6854 Man ownerPlayerOld = null;
6855 Man ownerPlayerNew = null;
6856
6857 if (old_owner)
6858 {
6859 if (old_owner.
IsMan())
6860 {
6861 ownerPlayerOld = Man.Cast(old_owner);
6862 }
6863 else
6864 {
6865 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
6866 }
6867 }
6868 else
6869 {
6871 {
6873
6874 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
6875 {
6876 GetCompEM().UnplugThis();
6877 }
6878 }
6879 }
6880
6881 if (new_owner)
6882 {
6883 if (new_owner.
IsMan())
6884 {
6885 ownerPlayerNew = Man.Cast(new_owner);
6886 }
6887 else
6888 {
6889 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
6890 }
6891 }
6892
6893 if (ownerPlayerOld != ownerPlayerNew)
6894 {
6895 if (ownerPlayerOld)
6896 {
6897 array<EntityAI> subItemsExit = new array<EntityAI>;
6899 for (int i = 0; i < subItemsExit.Count(); i++)
6900 {
6903 }
6904 }
6905
6906 if (ownerPlayerNew)
6907 {
6908 array<EntityAI> subItemsEnter = new array<EntityAI>;
6910 for (int j = 0; j < subItemsEnter.Count(); j++)
6911 {
6914 }
6915 }
6916 }
6917 else if (ownerPlayerNew != null)
6918 {
6919 PlayerBase nplayer;
6920 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
6921 {
6922 array<EntityAI> subItemsUpdate = new array<EntityAI>;
6924 for (int k = 0; k < subItemsUpdate.Count(); k++)
6925 {
6927 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
6928 }
6929 }
6930 }
6931
6932 if (old_owner)
6933 old_owner.OnChildItemRemoved(this);
6934 if (new_owner)
6935 new_owner.OnChildItemReceived(this);
6936 }
6937
6938
6940 {
6941 super.EEDelete(parent);
6942 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
6943 if (player)
6944 {
6946
6947 if (player.IsAlive())
6948 {
6949 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6950 if (r_index >= 0)
6951 {
6952 InventoryLocation r_il = new InventoryLocation;
6953 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6954
6955 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6958 {
6959 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6960 }
6962 {
6963 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6964 }
6965
6966 }
6967
6968 player.RemoveQuickBarEntityShortcut(this);
6969 }
6970 }
6971 }
6972
6974 {
6975 super.EEKilled(killer);
6976
6979 {
6980 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
6981 {
6982 if (IsMagazine())
6983 {
6984 if (Magazine.Cast(this).GetAmmoCount() > 0)
6985 {
6987 }
6988 }
6989 else
6990 {
6992 }
6993 }
6994 }
6995 }
6996
6998 {
6999 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7000
7001 super.OnWasAttached(parent, slot_id);
7002
7005
7008 }
7009
7011 {
7012 super.OnWasDetached(parent, slot_id);
7013
7016
7019 }
7020
7022 {
7023 int idx;
7026
7027 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7028 if (inventory_slots.Count() < 1)
7029 {
7030 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
7031 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
7032 }
7033 else
7034 {
7035 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
7036 }
7037
7038 idx = inventory_slots.Find(slot);
7039 if (idx < 0)
7040 return "";
7041
7042 return attach_types.Get(idx);
7043 }
7044
7046 {
7047 int idx = -1;
7048 string slot;
7049
7052
7053 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7054 if (inventory_slots.Count() < 1)
7055 {
7056 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
7057 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7058 }
7059 else
7060 {
7061 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
7062 if (detach_types.Count() < 1)
7063 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7064 }
7065
7066 for (int i = 0; i < inventory_slots.Count(); i++)
7067 {
7068 slot = inventory_slots.Get(i);
7069 }
7070
7071 if (slot != "")
7072 {
7073 if (detach_types.Count() == 1)
7074 idx = 0;
7075 else
7076 idx = inventory_slots.Find(slot);
7077 }
7078 if (idx < 0)
7079 return "";
7080
7081 return detach_types.Get(idx);
7082 }
7083
7085 {
7086
7088
7089
7090 float min_time = 1;
7091 float max_time = 3;
7092 float delay = Math.RandomFloat(min_time, max_time);
7093
7094 explode_timer.Run(delay, this, "DoAmmoExplosion");
7095 }
7096
7098 {
7099 Magazine magazine = Magazine.Cast(this);
7100 int pop_sounds_count = 6;
7101 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
7102
7103
7104 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
7105 string sound_name = pop_sounds[ sound_idx ];
7106 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
7107
7108
7109 magazine.ServerAddAmmoCount(-1);
7110
7111
7112 float min_temp_to_explode = 100;
7113
7114 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
7115 {
7117 }
7118 }
7119
7120
7121 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
7122 {
7123 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
7124
7125 const int CHANCE_DAMAGE_CARGO = 4;
7126 const int CHANCE_DAMAGE_ATTACHMENT = 1;
7127 const int CHANCE_DAMAGE_NOTHING = 2;
7128
7130 {
7131 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
7132 int chances;
7133 int rnd;
7134
7135 if (GetInventory().GetCargo())
7136 {
7137 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7138 rnd = Math.RandomInt(0,chances);
7139
7140 if (rnd < CHANCE_DAMAGE_CARGO)
7141 {
7143 }
7144 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
7145 {
7147 }
7148 }
7149 else
7150 {
7151 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7152 rnd = Math.RandomInt(0,chances);
7153
7154 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
7155 {
7157 }
7158 }
7159 }
7160 }
7161
7163 {
7164 CargoBase cargo = GetInventory().GetCargo();
7165 if (cargo)
7166 {
7168 if (item_count > 0)
7169 {
7170 int random_pick = Math.RandomInt(0, item_count);
7172 if (!item.IsExplosive())
7173 {
7174 item.AddHealth("","",damage);
7175 return true;
7176 }
7177 }
7178 }
7179 return false;
7180 }
7181
7183 {
7184 GameInventory inventory = GetInventory();
7186 if (attachment_count > 0)
7187 {
7188 int random_pick = Math.RandomInt(0, attachment_count);
7190 if (!attachment.IsExplosive())
7191 {
7192 attachment.AddHealth("","",damage);
7193 return true;
7194 }
7195 }
7196 return false;
7197 }
7198
7200 {
7202 }
7203
7205 {
7207 return GetInventory().CanRemoveEntity();
7208
7209 return false;
7210 }
7211
7213 {
7214
7216 return false;
7217
7218
7220 return false;
7221
7222
7223
7225 if (delta == 0)
7226 return false;
7227
7228
7229 return true;
7230 }
7231
7233 {
7235 {
7236 if (ScriptInputUserData.CanStoreInputUserData())
7237 {
7238 ScriptInputUserData ctx = new ScriptInputUserData;
7243 ctx.
Write(destination_entity);
7247 }
7248 }
7249 else if (!
g_Game.IsMultiplayer())
7250 {
7252 }
7253 }
7254
7256 {
7257 float split_quantity_new;
7261 InventoryLocation loc = new InventoryLocation;
7262
7263 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7264 {
7266 split_quantity_new = stack_max;
7267 else
7269
7271 {
7272 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7273 if (new_item)
7274 {
7275 new_item.SetResultOfSplit(true);
7276 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7278 new_item.
SetQuantity(split_quantity_new,
false,
true);
7279 }
7280 }
7281 }
7282 else if (destination_entity && slot_id == -1)
7283 {
7284 if (quantity > stack_max)
7285 split_quantity_new = stack_max;
7286 else
7287 split_quantity_new = quantity;
7288
7290 {
7291 GameInventory destinationInventory = destination_entity.GetInventory();
7293 {
7296 }
7297
7298 if (new_item)
7299 {
7300 new_item.SetResultOfSplit(true);
7301 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7303 new_item.
SetQuantity(split_quantity_new,
false,
true);
7304 }
7305 }
7306 }
7307 else
7308 {
7309 if (stack_max != 0)
7310 {
7312 {
7314 }
7315
7316 if (split_quantity_new == 0)
7317 {
7318 if (!
g_Game.IsMultiplayer())
7319 player.PhysicalPredictiveDropItem(this);
7320 else
7321 player.ServerDropEntity(this);
7322 return;
7323 }
7324
7326 {
7328
7329 if (new_item)
7330 {
7331 new_item.SetResultOfSplit(true);
7332 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7335 new_item.PlaceOnSurface();
7336 }
7337 }
7338 }
7339 }
7340 }
7341
7343 {
7344 float split_quantity_new;
7348 InventoryLocation loc = new InventoryLocation;
7349
7350 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7351 {
7353 split_quantity_new = stack_max;
7354 else
7356
7358 {
7359 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7360 if (new_item)
7361 {
7362 new_item.SetResultOfSplit(true);
7363 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7365 new_item.
SetQuantity(split_quantity_new,
false,
true);
7366 }
7367 }
7368 }
7369 else if (destination_entity && slot_id == -1)
7370 {
7371 if (quantity > stack_max)
7372 split_quantity_new = stack_max;
7373 else
7374 split_quantity_new = quantity;
7375
7377 {
7378 GameInventory destinationInventory = destination_entity.GetInventory();
7380 {
7383 }
7384
7385 if (new_item)
7386 {
7387 new_item.SetResultOfSplit(true);
7388 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7390 new_item.
SetQuantity(split_quantity_new,
false,
true);
7391 }
7392 }
7393 }
7394 else
7395 {
7396 if (stack_max != 0)
7397 {
7399 {
7401 }
7402
7404 {
7406
7407 if (new_item)
7408 {
7409 new_item.SetResultOfSplit(true);
7410 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7413 new_item.PlaceOnSurface();
7414 }
7415 }
7416 }
7417 }
7418 }
7419
7421 {
7423 {
7424 if (ScriptInputUserData.CanStoreInputUserData())
7425 {
7426 ScriptInputUserData ctx = new ScriptInputUserData;
7431 dst.WriteToContext(ctx);
7433 }
7434 }
7435 else if (!
g_Game.IsMultiplayer())
7436 {
7438 }
7439 }
7440
7442 {
7444 {
7445 if (ScriptInputUserData.CanStoreInputUserData())
7446 {
7447 ScriptInputUserData ctx = new ScriptInputUserData;
7452 ctx.
Write(destination_entity);
7458 }
7459 }
7460 else if (!
g_Game.IsMultiplayer())
7461 {
7463 }
7464 }
7465
7467 {
7469 }
7470
7472 {
7474 float split_quantity_new;
7476 if (dst.IsValid())
7477 {
7478 int slot_id = dst.GetSlot();
7480
7481 if (quantity > stack_max)
7482 split_quantity_new = stack_max;
7483 else
7484 split_quantity_new = quantity;
7485
7487 {
7489
7490 if (new_item)
7491 {
7492 new_item.SetResultOfSplit(true);
7493 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7495 new_item.
SetQuantity(split_quantity_new,
false,
true);
7496 }
7497
7498 return new_item;
7499 }
7500 }
7501
7502 return null;
7503 }
7504
7506 {
7508 float split_quantity_new;
7510 if (destination_entity)
7511 {
7513 if (quantity > stackable)
7514 split_quantity_new = stackable;
7515 else
7516 split_quantity_new = quantity;
7517
7519 {
7520 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
7521 if (new_item)
7522 {
7523 new_item.SetResultOfSplit(true);
7524 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7526 new_item.
SetQuantity(split_quantity_new,
false,
true);
7527 }
7528 }
7529 }
7530 }
7531
7533 {
7535 {
7536 if (ScriptInputUserData.CanStoreInputUserData())
7537 {
7538 ScriptInputUserData ctx = new ScriptInputUserData;
7543 ItemBase destination_entity =
this;
7544 ctx.
Write(destination_entity);
7548 }
7549 }
7550 else if (!
g_Game.IsMultiplayer())
7551 {
7553 }
7554 }
7555
7557 {
7559 float split_quantity_new;
7561 if (player)
7562 {
7564 if (quantity > stackable)
7565 split_quantity_new = stackable;
7566 else
7567 split_quantity_new = quantity;
7568
7570 {
7571 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
7572 new_item =
ItemBase.Cast(in_hands);
7573 if (new_item)
7574 {
7575 new_item.SetResultOfSplit(true);
7576 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7578 new_item.SetQuantity(split_quantity_new, false, true);
7579 }
7580 }
7581 }
7582 }
7583
7585 {
7587 float split_quantity_new = Math.Floor(quantity * 0.5);
7588
7590 return;
7591
7593
7594 if (new_item)
7595 {
7596 if (new_item.GetQuantityMax() < split_quantity_new)
7597 {
7598 split_quantity_new = new_item.GetQuantityMax();
7599 }
7600
7601 new_item.SetResultOfSplit(true);
7602 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7603
7605 {
7608 }
7609 else
7610 {
7612 new_item.
SetQuantity(split_quantity_new,
false,
true);
7613 }
7614 }
7615 }
7616
7618 {
7620 float split_quantity_new = Math.Floor(quantity / 2);
7621
7623 return;
7624
7625 InventoryLocation invloc = new InventoryLocation;
7627
7629 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
7630
7631 if (new_item)
7632 {
7633 if (new_item.GetQuantityMax() < split_quantity_new)
7634 {
7635 split_quantity_new = new_item.GetQuantityMax();
7636 }
7638 {
7641 }
7642 else if (split_quantity_new > 1)
7643 {
7645 new_item.
SetQuantity(split_quantity_new,
false,
true);
7646 }
7647 }
7648 }
7649
7652 {
7653 SetWeightDirty();
7655
7656 if (parent)
7657 parent.OnAttachmentQuantityChangedEx(this, delta);
7658
7660 {
7662 {
7664 }
7666 {
7667 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
7669 }
7670 }
7671 }
7672
7675 {
7676
7677 }
7678
7681 {
7683 }
7684
7686 {
7687 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
7688
7690 {
7691 if (newLevel == GameConstants.STATE_RUINED)
7692 {
7694 EntityAI parent = GetHierarchyParent();
7695 if (parent && parent.IsFireplace())
7696 {
7697 CargoBase cargo = GetInventory().GetCargo();
7698 if (cargo)
7699 {
7701 {
7703 }
7704 }
7705 }
7706 }
7707
7709 {
7710
7712 return;
7713 }
7714
7715 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
7716 {
7718 }
7719 }
7720 }
7721
7722
7724 {
7725 super.OnRightClick();
7726
7728 {
7730 {
7731 if (ScriptInputUserData.CanStoreInputUserData())
7732 {
7733 EntityAI root = GetHierarchyRoot();
7734 Man playerOwner = GetHierarchyRootPlayer();
7735 InventoryLocation dst = new InventoryLocation;
7736
7737
7738 if (!playerOwner && root && root == this)
7739 {
7741 }
7742 else
7743 {
7744
7745 GetInventory().GetCurrentInventoryLocation(dst);
7747 {
7748 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7750 {
7752 }
7753 else
7754 {
7756
7757
7758 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
7759 {
7761 }
7762 else
7763 {
7764 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
7765 }
7766 }
7767 }
7768 }
7769
7770 ScriptInputUserData ctx = new ScriptInputUserData;
7778 }
7779 }
7780 else if (!
g_Game.IsMultiplayer())
7781 {
7783 }
7784 }
7785 }
7786
7788 {
7789 if (root)
7790 {
7791 vector m4[4];
7792 root.GetTransform(m4);
7793 dst.SetGround(this, m4);
7794 }
7795 else
7796 {
7797 GetInventory().GetCurrentInventoryLocation(dst);
7798 }
7799 }
7800
7801 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
7802 {
7803
7804 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
7805 return false;
7806
7807 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
7808 return false;
7809
7810
7812 return false;
7813
7814
7815 Magazine mag = Magazine.Cast(this);
7816 if (mag)
7817 {
7818 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
7819 return false;
7820
7821 if (stack_max_limit)
7822 {
7823 Magazine other_mag = Magazine.Cast(other_item);
7824 if (other_item)
7825 {
7826 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
7827 return false;
7828 }
7829
7830 }
7831 }
7832 else
7833 {
7834
7836 return false;
7837
7839 return false;
7840 }
7841
7842 PlayerBase player = null;
7843 if (CastTo(player, GetHierarchyRootPlayer()))
7844 {
7845 if (player.GetInventory().HasAttachment(this))
7846 return false;
7847
7848 if (player.IsItemsToDelete())
7849 return false;
7850 }
7851
7852 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
7853 return false;
7854
7855 int slotID;
7857 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
7858 return false;
7859
7860 return true;
7861 }
7862
7864 {
7866 }
7867
7869 {
7870 return m_IsResultOfSplit;
7871 }
7872
7874 {
7875 m_IsResultOfSplit = value;
7876 }
7877
7879 {
7881 }
7882
7884 {
7885 float other_item_quantity = other_item.GetQuantity();
7886 float this_free_space;
7887
7889
7891
7892 if (other_item_quantity > this_free_space)
7893 {
7894 return this_free_space;
7895 }
7896 else
7897 {
7898 return other_item_quantity;
7899 }
7900 }
7901
7903 {
7905 }
7906
7908 {
7910 return;
7911
7912 if (!IsMagazine() && other_item)
7913 {
7915 if (quantity_used != 0)
7916 {
7917 float hp1 = GetHealth01("","");
7918 float hp2 = other_item.GetHealth01("","");
7919 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
7920 hpResult = hpResult / (
GetQuantity() + quantity_used);
7921
7922 hpResult *= GetMaxHealth();
7923 Math.Round(hpResult);
7924 SetHealth("", "Health", hpResult);
7925
7927 other_item.AddQuantity(-quantity_used);
7928 }
7929 }
7931 }
7932
7934 {
7935 #ifdef SERVER
7936 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
7937 GetHierarchyParent().IncreaseLifetimeUp();
7938 #endif
7939 };
7940
7942 {
7943 PlayerBase p = PlayerBase.Cast(player);
7944
7945 array<int> recipesIds = p.m_Recipes;
7946 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
7947 if (moduleRecipesManager)
7948 {
7949 EntityAI itemInHands = player.GetEntityInHands();
7950 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
7951 }
7952
7953 for (int i = 0;i < recipesIds.Count(); i++)
7954 {
7955 int key = recipesIds.Get(i);
7956 string recipeName = moduleRecipesManager.GetRecipeName(key);
7958 }
7959 }
7960
7961
7962 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
7963 {
7964 super.GetDebugActions(outputList);
7965
7966
7972
7973
7978
7983
7984
7988
7989
7991 {
7995 }
7996
7999
8000
8004
8006
8007 InventoryLocation loc = new InventoryLocation();
8008 GetInventory().GetCurrentInventoryLocation(loc);
8010 {
8011 if (Gizmo_IsSupported())
8014 }
8015
8017 }
8018
8019
8020
8021
8023 {
8024 super.OnAction(action_id, player, ctx);
8025
8027 {
8028 switch (action_id)
8029 {
8033 return true;
8037 return true;
8038 }
8039 }
8040
8042 {
8043 switch (action_id)
8044 {
8046 Delete();
8047 return true;
8048 }
8049 }
8050
8051 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
8052 {
8053 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8054 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
8055 PlayerBase p = PlayerBase.Cast(player);
8056 if (
EActions.RECIPES_RANGE_START < 1000)
8057 {
8058 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
8059 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
8060 }
8061 }
8062 #ifndef SERVER
8063 else if (action_id ==
EActions.WATCH_PLAYER)
8064 {
8065 PluginDeveloper.SetDeveloperItemClientEx(player);
8066 }
8067 #endif
8069 {
8070 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
8071 {
8072 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
8073 OnDebugButtonPressServer(id + 1);
8074 }
8075
8076 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
8077 {
8078 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
8080 }
8081
8082 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
8083 {
8084 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
8086 }
8087
8088 else if (action_id ==
EActions.ADD_QUANTITY)
8089 {
8090 if (IsMagazine())
8091 {
8092 Magazine mag = Magazine.Cast(this);
8093 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
8094 }
8095 else
8096 {
8098 }
8099
8100 if (m_EM)
8101 {
8102 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
8103 }
8104
8105 }
8106
8107 else if (action_id ==
EActions.REMOVE_QUANTITY)
8108 {
8109 if (IsMagazine())
8110 {
8111 Magazine mag2 = Magazine.Cast(this);
8112 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
8113 }
8114 else
8115 {
8117 }
8118 if (m_EM)
8119 {
8120 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
8121 }
8122
8123 }
8124
8125 else if (action_id ==
EActions.SET_QUANTITY_0)
8126 {
8128
8129 if (m_EM)
8130 {
8131 m_EM.SetEnergy(0);
8132 }
8133 }
8134
8135 else if (action_id ==
EActions.SET_MAX_QUANTITY)
8136 {
8138
8139 if (m_EM)
8140 {
8141 m_EM.SetEnergy(m_EM.GetEnergyMax());
8142 }
8143 }
8144
8145 else if (action_id ==
EActions.ADD_HEALTH)
8146 {
8147 AddHealth("","",GetMaxHealth("","Health")/5);
8148 }
8149 else if (action_id ==
EActions.REMOVE_HEALTH)
8150 {
8151 AddHealth("","",-GetMaxHealth("","Health")/5);
8152 }
8153 else if (action_id ==
EActions.DESTROY_HEALTH)
8154 {
8155 SetHealth01("","",0);
8156 }
8157 else if (action_id ==
EActions.WATCH_ITEM)
8158 {
8160 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
8161 #ifdef DEVELOPER
8162 SetDebugDeveloper_item(this);
8163 #endif
8164 }
8165
8166 else if (action_id ==
EActions.ADD_TEMPERATURE)
8167 {
8168 AddTemperature(20);
8169
8170 }
8171
8172 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
8173 {
8174 AddTemperature(-20);
8175
8176 }
8177
8178 else if (action_id ==
EActions.FLIP_FROZEN)
8179 {
8180 SetFrozen(!GetIsFrozen());
8181
8182 }
8183
8184 else if (action_id ==
EActions.ADD_WETNESS)
8185 {
8187
8188 }
8189
8190 else if (action_id ==
EActions.REMOVE_WETNESS)
8191 {
8193
8194 }
8195
8196 else if (action_id ==
EActions.LIQUIDTYPE_UP)
8197 {
8200
8201
8202 }
8203
8204 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
8205 {
8208 }
8209
8210 else if (action_id ==
EActions.MAKE_SPECIAL)
8211 {
8212 auto debugParams = DebugSpawnParams.WithPlayer(player);
8213 OnDebugSpawnEx(debugParams);
8214 }
8215
8216 }
8217
8218
8219 return false;
8220 }
8221
8222
8223
8224
8228
8231
8232
8233
8235 {
8236 return false;
8237 }
8238
8239
8241 {
8242 return true;
8243 }
8244
8245
8247 {
8248 return true;
8249 }
8250
8251
8252
8254 {
8255 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
8256 return g_Game.ConfigIsExisting(config_path);
8257 }
8258
8261 {
8262 return null;
8263 }
8264
8266 {
8267 return false;
8268 }
8269
8271 {
8272 return false;
8273 }
8274
8278
8279
8281 {
8282 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8283 return module_repairing.CanRepair(this, item_repair_kit);
8284 }
8285
8286
8287 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
8288 {
8289 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8290 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
8291 }
8292
8293
8295 {
8296
8297
8298
8299
8300
8301
8302
8303
8304 return 1;
8305 }
8306
8307
8308
8310 {
8312 }
8313
8314
8315
8317 {
8319 }
8320
8321
8330 {
8331 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8332
8333 if (player)
8334 {
8335 player.MessageStatus(text);
8336 }
8337 }
8338
8339
8348 {
8349 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8350
8351 if (player)
8352 {
8353 player.MessageAction(text);
8354 }
8355 }
8356
8357
8366 {
8367 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8368
8369 if (player)
8370 {
8371 player.MessageFriendly(text);
8372 }
8373 }
8374
8375
8384 {
8385 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8386
8387 if (player)
8388 {
8389 player.MessageImportant(text);
8390 }
8391 }
8392
8394 {
8395 return true;
8396 }
8397
8398
8399 override bool KindOf(
string tag)
8400 {
8401 bool found = false;
8402 string item_name = this.
GetType();
8404 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
8405
8406 int array_size = item_tag_array.Count();
8407 for (int i = 0; i < array_size; i++)
8408 {
8409 if (item_tag_array.Get(i) == tag)
8410 {
8411 found = true;
8412 break;
8413 }
8414 }
8415 return found;
8416 }
8417
8418
8420 {
8421
8422 super.OnRPC(sender, rpc_type,ctx);
8423
8424
8425 switch (rpc_type)
8426 {
8427 #ifndef SERVER
8428 case ERPCs.RPC_SOUND_LOCK_ATTACH:
8429 Param2<bool, string> p = new Param2<bool, string>(false, "");
8430
8432 return;
8433
8434 bool play = p.param1;
8435 string soundSet = p.param2;
8436
8437 if (play)
8438 {
8440 {
8442 {
8444 }
8445 }
8446 else
8447 {
8449 }
8450 }
8451 else
8452 {
8454 }
8455
8456 break;
8457 #endif
8458
8459 }
8460
8462 {
8464 }
8465 }
8466
8467
8468
8469
8471 {
8472 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8473 return plugin.GetID(
name);
8474 }
8475
8477 {
8478 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8479 return plugin.GetName(id);
8480 }
8481
8484 {
8485
8486
8487 int varFlags;
8488 if (!ctx.
Read(varFlags))
8489 return;
8490
8491 if (varFlags & ItemVariableFlags.FLOAT)
8492 {
8494 }
8495 }
8496
8498 {
8499
8500 super.SerializeNumericalVars(floats_out);
8501
8502
8503
8505 {
8507 }
8508
8510 {
8512 }
8513
8515 {
8517 }
8518
8520 {
8525 }
8526
8528 {
8530 }
8531 }
8532
8534 {
8535
8536 super.DeSerializeNumericalVars(floats);
8537
8538
8539 int index = 0;
8540 int mask = Math.Round(floats.Get(index));
8541
8542 index++;
8543
8545 {
8547 {
8549 }
8550 else
8551 {
8552 float quantity = floats.Get(index);
8554 }
8555 index++;
8556 }
8557
8559 {
8560 float wet = floats.Get(index);
8562 index++;
8563 }
8564
8566 {
8567 int liquidtype = Math.Round(floats.Get(index));
8569 index++;
8570 }
8571
8573 {
8575 index++;
8577 index++;
8579 index++;
8581 index++;
8582 }
8583
8585 {
8586 int cleanness = Math.Round(floats.Get(index));
8588 index++;
8589 }
8590 }
8591
8593 {
8594 super.WriteVarsToCTX(ctx);
8595
8596
8598 {
8600 }
8601
8603 {
8605 }
8606
8608 {
8610 }
8611
8613 {
8614 int r,g,b,a;
8620 }
8621
8623 {
8625 }
8626 }
8627
8629 {
8630 if (!super.ReadVarsFromCTX(ctx,version))
8631 return false;
8632
8633 int intValue;
8634 float value;
8635
8636 if (version < 140)
8637 {
8638 if (!ctx.
Read(intValue))
8639 return false;
8640
8641 m_VariablesMask = intValue;
8642 }
8643
8645 {
8646 if (!ctx.
Read(value))
8647 return false;
8648
8650 {
8652 }
8653 else
8654 {
8656 }
8657 }
8658
8659 if (version < 140)
8660 {
8662 {
8663 if (!ctx.
Read(value))
8664 return false;
8665 SetTemperatureDirect(value);
8666 }
8667 }
8668
8670 {
8671 if (!ctx.
Read(value))
8672 return false;
8674 }
8675
8677 {
8678 if (!ctx.
Read(intValue))
8679 return false;
8681 }
8682
8684 {
8685 int r,g,b,a;
8687 return false;
8689 return false;
8691 return false;
8693 return false;
8694
8696 }
8697
8699 {
8700 if (!ctx.
Read(intValue))
8701 return false;
8703 }
8704
8705 if (version >= 138 && version < 140)
8706 {
8708 {
8709 if (!ctx.
Read(intValue))
8710 return false;
8711 SetFrozen(intValue);
8712 }
8713 }
8714
8715 return true;
8716 }
8717
8718
8720 {
8723 {
8725 }
8726
8727 if (!super.OnStoreLoad(ctx, version))
8728 {
8730 return false;
8731 }
8732
8733 if (version >= 114)
8734 {
8735 bool hasQuickBarIndexSaved;
8736
8737 if (!ctx.
Read(hasQuickBarIndexSaved))
8738 {
8740 return false;
8741 }
8742
8743 if (hasQuickBarIndexSaved)
8744 {
8745 int itmQBIndex;
8746
8747
8748 if (!ctx.
Read(itmQBIndex))
8749 {
8751 return false;
8752 }
8753
8754 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
8755 if (itmQBIndex != -1 && parentPlayer)
8756 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
8757 }
8758 }
8759 else
8760 {
8761
8762 PlayerBase player;
8763 int itemQBIndex;
8764 if (version ==
int.
MAX)
8765 {
8766 if (!ctx.
Read(itemQBIndex))
8767 {
8769 return false;
8770 }
8771 }
8772 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
8773 {
8774
8775 if (!ctx.
Read(itemQBIndex))
8776 {
8778 return false;
8779 }
8780 if (itemQBIndex != -1 && player)
8781 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
8782 }
8783 }
8784
8785 if (version < 140)
8786 {
8787
8788 if (!LoadVariables(ctx, version))
8789 {
8791 return false;
8792 }
8793 }
8794
8795
8797 {
8799 return false;
8800 }
8801 if (version >= 132)
8802 {
8804 if (raib)
8805 {
8807 {
8809 return false;
8810 }
8811 }
8812 }
8813
8815 return true;
8816 }
8817
8818
8819
8821 {
8822 super.OnStoreSave(ctx);
8823
8824 PlayerBase player;
8825 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
8826 {
8828
8829 int itemQBIndex = -1;
8830 itemQBIndex = player.FindQuickBarEntityIndex(this);
8831 ctx.
Write(itemQBIndex);
8832 }
8833 else
8834 {
8836 }
8837
8839
8841 if (raib)
8842 {
8844 }
8845 }
8846
8847
8849 {
8850 super.AfterStoreLoad();
8851
8853 {
8855 }
8856
8858 {
8861 }
8862 }
8863
8865 {
8866 super.EEOnAfterLoad();
8867
8869 {
8871 }
8872
8875 }
8876
8878 {
8879 return false;
8880 }
8881
8882
8883
8885 {
8887 {
8888 #ifdef PLATFORM_CONSOLE
8889
8891 {
8893 if (menu)
8894 {
8896 }
8897 }
8898 #endif
8899 }
8900
8902 {
8905 }
8906
8908 {
8909 SetWeightDirty();
8911 }
8913 {
8916 }
8917
8919 {
8922
8925 }
8927 {
8931 }
8932
8933 super.OnVariablesSynchronized();
8934 }
8935
8936
8937
8939 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
8940 {
8941 if (!IsServerCheck(allow_client))
8942 return false;
8943
8945 return false;
8946
8949
8950 if (value <= (min + 0.001))
8951 value = min;
8952
8953 if (value == min)
8954 {
8955 if (destroy_config)
8956 {
8957 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
8958 if (dstr)
8959 {
8961 this.Delete();
8962 return true;
8963 }
8964 }
8965 else if (destroy_forced)
8966 {
8968 this.Delete();
8969 return true;
8970 }
8971
8973 }
8974
8977
8979 {
8980 EntityAI parent = GetHierarchyRoot();
8981 InventoryLocation iLoc = new InventoryLocation();
8982 GetInventory().GetCurrentInventoryLocation(iLoc);
8984 {
8985 int iLocSlot = iLoc.
GetSlot();
8987 {
8989 }
8991 {
8993 }
8994 }
8995 }
8996
8998 {
9000
9001 if (delta)
9003 }
9004
9006
9007 return false;
9008 }
9009
9010
9012 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9013 {
9015 }
9016
9018 {
9021 }
9022
9024 {
9027 }
9028
9030 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9031 {
9032 float value_clamped = Math.Clamp(value, 0, 1);
9034 SetQuantity(result, destroy_config, destroy_forced);
9035 }
9036
9037
9040 {
9042 }
9043
9045 {
9047 }
9048
9049
9050
9051
9052
9053
9054
9055
9056
9057
9059 {
9060 int slot = -1;
9061 GameInventory inventory = GetInventory();
9062 if (inventory)
9063 {
9064 InventoryLocation il = new InventoryLocation;
9067 }
9068
9070 }
9071
9073 {
9074 float quantity_max = 0;
9075
9077 {
9078 if (attSlotID != -1)
9079 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
9080
9081 if (quantity_max <= 0)
9083 }
9084
9085 if (quantity_max <= 0)
9087
9088 return quantity_max;
9089 }
9090
9092 {
9094 }
9095
9097 {
9099 }
9100
9101
9103 {
9105 }
9106
9108 {
9110 }
9111
9113 {
9115 }
9116
9117
9119 {
9120
9121 float weightEx = GetWeightEx();
9122 float special = GetInventoryAndCargoWeight();
9123 return weightEx - special;
9124 }
9125
9126
9128 {
9130 }
9131
9133 {
9135 {
9136 #ifdef DEVELOPER
9137 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9138 {
9139 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
9141 }
9142 #endif
9143
9145 }
9146 else if (HasEnergyManager())
9147 {
9148 #ifdef DEVELOPER
9149 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9150 {
9151 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
9152 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
9153 }
9154 #endif
9155 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
9156 }
9157 else
9158 {
9159 #ifdef DEVELOPER
9160 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9161 {
9162 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
9163 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
9164 }
9165 #endif
9166 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
9167 }
9168 }
9169
9172 {
9173 int item_count = 0;
9175
9176 GameInventory inventory = GetInventory();
9177 CargoBase cargo = inventory.
GetCargo();
9178 if (cargo != NULL)
9179 {
9181 }
9182
9184 for (int i = 0; i < nAttachments; ++i)
9185 {
9187 if (item)
9188 item_count += item.GetNumberOfItems();
9189 }
9190 return item_count;
9191 }
9192
9195 {
9196 float weight = 0;
9197 float wetness = 1;
9198 if (include_wetness)
9201 {
9202 weight = wetness * m_ConfigWeight;
9203 }
9205 {
9206 weight = 1;
9207 }
9208 return weight;
9209 }
9210
9211
9212
9214 {
9215 GameInventory inventory = GetInventory();
9216 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
9217 {
9218 array<EntityAI> items = new array<EntityAI>;
9220 for (int i = 0; i < items.Count(); ++i)
9221 {
9223 if (item)
9224 {
9225 g_Game.ObjectDelete(item);
9226 }
9227 }
9228 }
9229 }
9230
9231
9232
9233
9235 {
9236 float energy = 0;
9237 if (HasEnergyManager())
9238 {
9239 energy = GetCompEM().GetEnergy();
9240 }
9241 return energy;
9242 }
9243
9244
9246 {
9247 super.OnEnergyConsumed();
9248
9250 }
9251
9253 {
9254 super.OnEnergyAdded();
9255
9257 }
9258
9259
9261 {
9262 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
9263 {
9265 {
9266 float energy_0to1 = GetCompEM().GetEnergy0To1();
9268 }
9269 }
9270 }
9271
9272
9274 {
9275 return ConfigGetFloat("heatIsolation");
9276 }
9277
9279 {
9281 }
9282
9284 {
9285 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
9286 if (
g_Game.ConfigIsExisting(paramPath))
9287 return g_Game.ConfigGetFloat(paramPath);
9288
9289 return 0.0;
9290 }
9291
9293 {
9294 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
9295 if (
g_Game.ConfigIsExisting(paramPath))
9296 return g_Game.ConfigGetFloat(paramPath);
9297
9298 return 0.0;
9299 }
9300
9301 override void SetWet(
float value,
bool allow_client =
false)
9302 {
9303 if (!IsServerCheck(allow_client))
9304 return;
9305
9308
9310
9311 m_VarWet = Math.Clamp(value, min, max);
9312
9314 {
9317 }
9318 }
9319
9320 override void AddWet(
float value)
9321 {
9323 }
9324
9326 {
9328 }
9329
9331 {
9333 }
9334
9336 {
9338 }
9339
9341 {
9343 }
9344
9346 {
9348 }
9349
9351 {
9354 if (newLevel != oldLevel)
9355 {
9357 }
9358 }
9359
9361 {
9362 SetWeightDirty();
9363 }
9364
9366 {
9367 return GetWetLevelInternal(
m_VarWet);
9368 }
9369
9370
9371
9373 {
9375 }
9376
9378 {
9380 }
9381
9383 {
9385 }
9386
9388 {
9390 }
9391
9392
9393
9395 {
9396 if (ConfigIsExisting("itemModelLength"))
9397 {
9398 return ConfigGetFloat("itemModelLength");
9399 }
9400 return 0;
9401 }
9402
9404 {
9405 if (ConfigIsExisting("itemAttachOffset"))
9406 {
9407 return ConfigGetFloat("itemAttachOffset");
9408 }
9409 return 0;
9410 }
9411
9412 override void SetCleanness(
int value,
bool allow_client =
false)
9413 {
9414 if (!IsServerCheck(allow_client))
9415 return;
9416
9418
9420
9423 }
9424
9426 {
9428 }
9429
9431 {
9432 return true;
9433 }
9434
9435
9436
9437
9439 {
9441 }
9442
9444 {
9446 }
9447
9448
9449
9450
9451 override void SetColor(
int r,
int g,
int b,
int a)
9452 {
9458 }
9460 override void GetColor(out
int r,out
int g,out
int b,out
int a)
9461 {
9466 }
9467
9469 {
9471 }
9472
9475 {
9476 int r,g,b,a;
9478 r = r/255;
9479 g = g/255;
9480 b = b/255;
9481 a = a/255;
9482 return MiscGameplayFunctions.GetColorString(r, g, b, a);
9483 }
9484
9485
9486
9487 override void SetLiquidType(
int value,
bool allow_client =
false)
9488 {
9489 if (!IsServerCheck(allow_client))
9490 return;
9491
9496 }
9497
9499 {
9500 return ConfigGetInt("varLiquidTypeInit");
9501 }
9502
9504 {
9506 }
9507
9509 {
9511 SetFrozen(false);
9512 }
9513
9516 {
9517 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9518 }
9519
9520
9523 {
9524 PlayerBase nplayer;
9525 if (PlayerBase.CastTo(nplayer, player))
9526 {
9528 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9529 }
9530 }
9531
9532
9535 {
9536 PlayerBase nplayer;
9537 if (PlayerBase.CastTo(nplayer,player))
9538 {
9539 nplayer.SetEnableQuickBarEntityShortcut(this, false);
9540 }
9541
9542 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
9543
9544 if (HasEnergyManager())
9545 {
9546 GetCompEM().UpdatePlugState();
9547 }
9548 }
9549
9550
9552 {
9553 super.OnPlacementStarted(player);
9554
9556 }
9557
9558 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
9559 {
9561 {
9562 m_AdminLog.OnPlacementComplete(player,
this);
9563 }
9564
9565 super.OnPlacementComplete(player, position, orientation);
9566 }
9567
9568
9569
9570
9571
9573 {
9575 {
9576 return true;
9577 }
9578 else
9579 {
9580 return false;
9581 }
9582 }
9583
9584
9586 {
9588 {
9590 }
9591 }
9592
9593
9595 {
9597 }
9598
9600 {
9602 }
9603
9604 override void InsertAgent(
int agent,
float count = 1)
9605 {
9606 if (count < 1)
9607 return;
9608
9610 }
9611
9614 {
9616 }
9617
9618
9620 {
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
9659
9660
9661
9662
9663
9664
9666 {
9668 return false;
9669 return true;
9670 }
9671
9673 {
9674
9676 }
9677
9678
9681 {
9682 super.CheckForRoofLimited(timeTresholdMS);
9683
9684 float time =
g_Game.GetTime();
9685 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
9686 {
9687 m_PreviousRoofTestTime = time;
9688 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
9689 }
9690 }
9691
9692
9694 {
9696 {
9697 return 0;
9698 }
9699
9700 if (GetInventory().GetAttachmentSlotsCount() != 0)
9701 {
9702 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
9703 if (filter)
9704 return filter.GetProtectionLevel(type, false, system);
9705 else
9706 return 0;
9707 }
9708
9709 string subclassPath, entryName;
9710
9711 switch (type)
9712 {
9714 entryName = "biological";
9715 break;
9717 entryName = "chemical";
9718 break;
9719 default:
9720 entryName = "biological";
9721 break;
9722 }
9723
9724 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
9725
9726 return g_Game.ConfigGetFloat(subclassPath + entryName);
9727 }
9728
9729
9730
9733 {
9734 if (!IsMagazine())
9736
9738 }
9739
9740
9741
9742
9743
9748 {
9749 return true;
9750 }
9751
9753 {
9755 }
9756
9757
9758
9759
9760
9762 {
9763 if (parent)
9764 {
9765 if (parent.IsInherited(DayZInfected))
9766 return true;
9767
9768 if (!parent.IsRuined())
9769 return true;
9770 }
9771
9772 return true;
9773 }
9774
9776 {
9777 if (!super.CanPutAsAttachment(parent))
9778 {
9779 return false;
9780 }
9781
9782 if (!IsRuined() && !parent.IsRuined())
9783 {
9784 return true;
9785 }
9786
9787 return false;
9788 }
9789
9791 {
9792
9793
9794
9795
9796 return super.CanReceiveItemIntoCargo(item);
9797 }
9798
9800 {
9801
9802
9803
9804
9805 GameInventory attachmentInv = attachment.GetInventory();
9807 {
9808 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
9809 return false;
9810 }
9811
9812 InventoryLocation loc = new InventoryLocation();
9813 attachment.GetInventory().GetCurrentInventoryLocation(loc);
9814 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
9815 return false;
9816
9817 return super.CanReceiveAttachment(attachment, slotId);
9818 }
9819
9821 {
9822 if (!super.CanReleaseAttachment(attachment))
9823 return false;
9824
9825 return GetInventory().AreChildrenAccessible();
9826 }
9827
9828
9829
9830
9831
9832
9833
9834
9835
9836
9837
9838
9839
9840
9841
9842
9843
9844
9845
9846
9847
9849 {
9850 int id = muzzle_owner.GetMuzzleID();
9851 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
9852
9853 if (WPOF_array)
9854 {
9855 for (int i = 0; i < WPOF_array.Count(); i++)
9856 {
9857 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
9858
9859 if (WPOF)
9860 {
9861 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
9862 }
9863 }
9864 }
9865 }
9866
9867
9869 {
9870 int id = muzzle_owner.GetMuzzleID();
9872
9873 if (WPOBE_array)
9874 {
9875 for (int i = 0; i < WPOBE_array.Count(); i++)
9876 {
9877 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
9878
9879 if (WPOBE)
9880 {
9881 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
9882 }
9883 }
9884 }
9885 }
9886
9887
9889 {
9890 int id = muzzle_owner.GetMuzzleID();
9891 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9892
9893 if (WPOOH_array)
9894 {
9895 for (int i = 0; i < WPOOH_array.Count(); i++)
9896 {
9897 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9898
9899 if (WPOOH)
9900 {
9901 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
9902 }
9903 }
9904 }
9905 }
9906
9907
9909 {
9910 int id = muzzle_owner.GetMuzzleID();
9911 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9912
9913 if (WPOOH_array)
9914 {
9915 for (int i = 0; i < WPOOH_array.Count(); i++)
9916 {
9917 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9918
9919 if (WPOOH)
9920 {
9921 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9922 }
9923 }
9924 }
9925 }
9926
9927
9929 {
9930 int id = muzzle_owner.GetMuzzleID();
9931 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9932
9933 if (WPOOH_array)
9934 {
9935 for (int i = 0; i < WPOOH_array.Count(); i++)
9936 {
9937 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9938
9939 if (WPOOH)
9940 {
9941 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9942 }
9943 }
9944 }
9945 }
9946
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 {
9972 {
9973 return true;
9974 }
9975
9976 return false;
9977 }
9978
9980 {
9981 return false;
9982 }
9983
9986 {
9987 return UATimeSpent.DEFAULT_DEPLOY;
9988 }
9989
9990
9991
9992
9994 {
9996 SetSynchDirty();
9997 }
9998
10000 {
10002 }
10003
10004
10006 {
10007 return false;
10008 }
10009
10012 {
10013 string att_type = "None";
10014
10015 if (ConfigIsExisting("soundAttType"))
10016 {
10017 att_type = ConfigGetString("soundAttType");
10018 }
10019
10021 }
10022
10024 {
10026 }
10027
10028
10029
10030
10031
10037
10039 {
10042
10044 }
10045
10046
10048 {
10050 return;
10051
10053
10056
10059
10060 SoundParameters params = new SoundParameters();
10064 }
10065
10066
10068 {
10070 {
10073
10074 SetSynchDirty();
10075
10078 }
10079 }
10080
10082 {
10084 }
10085
10086
10088 {
10090 return;
10091
10093 SetSynchDirty();
10094
10097 }
10098
10100 {
10103 }
10104
10106 {
10108 }
10109
10110 void OnApply(PlayerBase player);
10111
10113 {
10114 return 1.0;
10115 };
10116
10118 {
10120 }
10121
10123 {
10125 }
10126
10128
10130 {
10131 SetDynamicPhysicsLifeTime(0.01);
10133 }
10134
10136 {
10137 array<string> zone_names = new array<string>;
10138 GetDamageZones(zone_names);
10139 for (int i = 0; i < zone_names.Count(); i++)
10140 {
10141 SetHealthMax(zone_names.Get(i),"Health");
10142 }
10143 SetHealthMax("","Health");
10144 }
10145
10148 {
10149 float global_health = GetHealth01("","Health");
10150 array<string> zones = new array<string>;
10151 GetDamageZones(zones);
10152
10153 for (int i = 0; i < zones.Count(); i++)
10154 {
10155 SetHealth01(zones.Get(i),"Health",global_health);
10156 }
10157 }
10158
10161 {
10162 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
10163 }
10164
10166 {
10167 if (!hasRootAsPlayer)
10168 {
10169 if (refParentIB)
10170 {
10171
10172 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
10173 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
10174
10175 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
10176 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
10177
10180 }
10181 else
10182 {
10183
10186 }
10187 }
10188 }
10189
10191 {
10193 {
10194 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
10195 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
10196 {
10197 float heatPermCoef = 1.0;
10199 while (ent)
10200 {
10201 heatPermCoef *= ent.GetHeatPermeabilityCoef();
10202 ent = ent.GetHierarchyParent();
10203 }
10204
10205 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
10206 }
10207 }
10208 }
10209
10211 {
10212
10213 EntityAI parent = GetHierarchyParent();
10214 if (!parent)
10215 {
10216 hasParent = false;
10217 hasRootAsPlayer = false;
10218 }
10219 else
10220 {
10221 hasParent = true;
10222 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
10223 refParentIB =
ItemBase.Cast(parent);
10224 }
10225 }
10226
10227 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
10228 {
10229
10230 }
10231
10233 {
10234
10235 return false;
10236 }
10237
10239 {
10240
10241
10242 return false;
10243 }
10244
10246 {
10247
10248 return false;
10249 }
10250
10253 {
10254 return !GetIsFrozen() &&
IsOpen();
10255 }
10256
10258 {
10259 bool hasParent = false, hasRootAsPlayer = false;
10261
10262 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
10263 bool foodDecay =
g_Game.IsFoodDecayEnabled();
10264
10265 if (wwtu || foodDecay)
10266 {
10270
10271 if (processWetness || processTemperature || processDecay)
10272 {
10274
10275 if (processWetness)
10276 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
10277
10278 if (processTemperature)
10280
10281 if (processDecay)
10282 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
10283 }
10284 }
10285 }
10286
10289 {
10291 }
10292
10294 {
10297
10298 return super.GetTemperatureFreezeThreshold();
10299 }
10300
10302 {
10305
10306 return super.GetTemperatureThawThreshold();
10307 }
10308
10310 {
10313
10314 return super.GetItemOverheatThreshold();
10315 }
10316
10318 {
10320 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
10321
10322 return super.GetTemperatureFreezeTime();
10323 }
10324
10326 {
10328 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
10329
10330 return super.GetTemperatureThawTime();
10331 }
10332
10337
10339 {
10340 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
10341 }
10342
10344 {
10345 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
10346 }
10347
10350 {
10352 }
10353
10355 {
10357 }
10358
10360 {
10362 }
10363
10366 {
10367 return null;
10368 }
10369
10372 {
10373 return false;
10374 }
10375
10377 {
10379 {
10382 if (!trg)
10383 {
10385 explosive = this;
10386 }
10387
10388 explosive.PairRemote(trg);
10390
10391 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
10392 trg.SetPersistentPairID(persistentID);
10393 explosive.SetPersistentPairID(persistentID);
10394
10395 return true;
10396 }
10397 return false;
10398 }
10399
10402 {
10403 float ret = 1.0;
10406 ret *= GetHealth01();
10407
10408 return ret;
10409 }
10410
10411 #ifdef DEVELOPER
10412 override void SetDebugItem()
10413 {
10414 super.SetDebugItem();
10415 _itemBase = this;
10416 }
10417
10419 {
10420 string text = super.GetDebugText();
10421
10423 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
10424
10425 return text;
10426 }
10427 #endif
10428
10430 {
10431 return true;
10432 }
10433
10435
10437
10439 {
10442 }
10443
10444
10452
10468
10469 [
Obsolete(
"Use ItemSoundHandler instead")]
10472 {
10473 if (!
g_Game.IsDedicatedServer())
10474 {
10475 if (ConfigIsExisting("attachSoundSet"))
10476 {
10477 string cfg_path = "";
10478 string soundset = "";
10479 string type_name =
GetType();
10480
10483 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
10484 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
10485
10486 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
10487 {
10488 for (int i = 0; i < cfg_soundset_array.Count(); i++)
10489 {
10490 if (cfg_slot_array[i] == slot_type)
10491 {
10492 soundset = cfg_soundset_array[i];
10493 break;
10494 }
10495 }
10496 }
10497
10498 if (soundset != "")
10499 {
10500 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
10502 }
10503 }
10504 }
10505 }
10506
10508}
10509
10511{
10513 if (entity)
10514 {
10515 bool is_item = entity.IsInherited(
ItemBase);
10516 if (is_item && full_quantity)
10517 {
10520 }
10521 }
10522 else
10523 {
10525 return NULL;
10526 }
10527 return entity;
10528}
10529
10531{
10532 if (item)
10533 {
10534 if (health > 0)
10535 item.SetHealth("", "", health);
10536
10537 if (item.CanHaveTemperature())
10538 {
10540 if (item.CanFreeze())
10541 item.SetFrozen(false);
10542 }
10543
10544 if (item.HasEnergyManager())
10545 {
10546 if (quantity >= 0)
10547 {
10548 item.GetCompEM().SetEnergy0To1(quantity);
10549 }
10550 else
10551 {
10553 }
10554 }
10555 else if (item.IsMagazine())
10556 {
10557 Magazine mag = Magazine.Cast(item);
10558 if (quantity >= 0)
10559 {
10560 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
10561 }
10562 else
10563 {
10565 }
10566
10567 }
10568 else
10569 {
10570 if (quantity >= 0)
10571 {
10572 item.SetQuantityNormalized(quantity, false);
10573 }
10574 else
10575 {
10577 }
10578
10579 }
10580 }
10581}
10582
10583#ifdef DEVELOPER
10585#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.