Re-sets DamageSystem changes.
5637{
5639 {
5640 return true;
5641 }
5642};
5643
5645{
5646
5647};
5648
5649
5650
5652{
5656
5658
5661
5662
5663
5664
5665
5674
5680
5685
5690
5711 protected bool m_IsResultOfSplit
5712
5714
5719
5720
5721
5723
5727
5728
5729
5731
5734
5735
5736
5742
5743
5751
5754
5755
5757
5758
5760
5761
5766
5767
5772
5774
5775
5777
5778
5780 {
5785
5786 if (!
g_Game.IsDedicatedServer())
5787 {
5789 {
5791
5793 {
5795 }
5796 }
5797
5800 }
5801
5802 m_OldLocation = null;
5803
5805 {
5807 }
5808
5809 if (ConfigIsExisting("headSelectionsToHide"))
5810 {
5813 }
5814
5816 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
5817 {
5819 }
5820
5822
5823 m_IsResultOfSplit = false;
5824
5826 }
5827
5829 {
5830 super.InitItemVariables();
5831
5837 m_Count = ConfigGetInt(
"count");
5838
5841
5846
5849
5854
5866
5870
5871
5874 if (ConfigIsExisting("canBeSplit"))
5875 {
5878 }
5879
5881 if (ConfigIsExisting("itemBehaviour"))
5883
5884
5887 RegisterNetSyncVariableInt("m_VarLiquidType");
5888 RegisterNetSyncVariableInt("m_Cleanness",0,1);
5889
5890 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
5891 RegisterNetSyncVariableFloat("m_ImpactSpeed");
5892 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
5893
5894 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
5895 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
5896 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
5897 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
5898
5899 RegisterNetSyncVariableBool("m_IsBeingPlaced");
5900 RegisterNetSyncVariableBool("m_IsTakeable");
5901 RegisterNetSyncVariableBool("m_IsHologram");
5902
5905 {
5908 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
5909 }
5910
5912
5914 if (ConfigIsExisting("temperaturePerQuantityWeight"))
5916
5918 }
5919
5921 {
5923 }
5924
5926 {
5929 {
5934 }
5935 }
5936
5937 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
5938 {
5940 {
5943 }
5944
5946 }
5947
5949 {
5955 }
5956
5958
5960 {
5962
5963 if (!action)
5964 {
5965 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
5966 return;
5967 }
5968
5970 if (!ai)
5971 {
5973 return;
5974 }
5975
5977 if (!action_array)
5978 {
5979 action_array = new array<ActionBase_Basic>;
5981 }
5982 if (LogManager.IsActionLogEnable())
5983 {
5984 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
5985 }
5986
5987 if (action_array.Find(action) != -1)
5988 {
5989 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
5990 }
5991 else
5992 {
5993 action_array.Insert(action);
5994 }
5995 }
5996
5998 {
5999 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6000 ActionBase action = player.GetActionManager().GetAction(actionName);
6003
6004 if (action_array)
6005 {
6006 action_array.RemoveItem(action);
6007 }
6008 }
6009
6010
6011
6013 {
6014 ActionOverrideData overrideData = new ActionOverrideData();
6018
6020 if (!actionMap)
6021 {
6024 }
6025
6026 actionMap.Insert(this.
Type(), overrideData);
6027
6028 }
6029
6031
6033
6034
6036 {
6039
6042
6043 string config_to_search = "CfgVehicles";
6044 string muzzle_owner_config;
6045
6047 {
6048 if (IsInherited(Weapon))
6049 config_to_search = "CfgWeapons";
6050
6051 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6052
6053 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
6054
6055 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
6056
6057 if (config_OnFire_subclass_count > 0)
6058 {
6059 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
6060
6061 for (int i = 0; i < config_OnFire_subclass_count; i++)
6062 {
6063 string particle_class = "";
6064 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
6065 string config_OnFire_entry = config_OnFire_class + particle_class;
6066 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
6067 WPOF_array.Insert(WPOF);
6068 }
6069
6070
6072 }
6073 }
6074
6076 {
6077 config_to_search = "CfgWeapons";
6078 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6079
6080 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
6081
6082 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
6083
6084 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
6085 {
6086 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
6087
6088 for (i = 0; i < config_OnBulletCasingEject_count; i++)
6089 {
6090 string particle_class2 = "";
6091 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
6092 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
6093 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
6094 WPOBE_array.Insert(WPOBE);
6095 }
6096
6097
6099 }
6100 }
6101 }
6102
6103
6105 {
6108
6110 {
6111 string config_to_search = "CfgVehicles";
6112
6113 if (IsInherited(Weapon))
6114 config_to_search = "CfgWeapons";
6115
6116 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6117 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
6118
6119 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
6120 {
6121
6123
6125 {
6127 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
6129 return;
6130 }
6131
6134
6135
6136
6137 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
6138 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
6139
6140 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
6141 {
6142 string particle_class = "";
6143 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
6144 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
6145 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
6146
6147 if (entry_type == CT_CLASS)
6148 {
6149 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
6150 WPOOH_array.Insert(WPOF);
6151 }
6152 }
6153
6154
6156 }
6157 }
6158 }
6159
6161 {
6163 }
6164
6166 {
6168 {
6170
6173
6176
6177 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6178 }
6179 }
6180
6182 {
6184 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6185
6187 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6188
6190 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6191
6193 {
6195 }
6196 }
6197
6199 {
6201 }
6202
6204 {
6207 else
6209
6211 {
6214 }
6215 else
6216 {
6219
6222 }
6223
6225 }
6226
6228 {
6230 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6231 }
6232
6234 {
6236 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6238 }
6239
6241 {
6243 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6244 }
6245
6247 {
6250
6251 OverheatingParticle OP = new OverheatingParticle();
6256
6258 }
6259
6261 {
6264
6265 return -1;
6266 }
6267
6269 {
6271 {
6274
6275 for (int i = count; i > 0; --i)
6276 {
6277 int id = i - 1;
6280
6283
6284 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
6285 {
6286 if (p)
6287 {
6290 }
6291 }
6292 }
6293 }
6294 }
6295
6297 {
6299 {
6301 {
6302 int id = i - 1;
6304
6305 if (OP)
6306 {
6308
6309 if (p)
6310 {
6312 }
6313
6314 delete OP;
6315 }
6316 }
6317
6320 }
6321 }
6322
6325 {
6326 return 0.0;
6327 }
6328
6329
6331 {
6332 return 250;
6333 }
6334
6336 {
6337 return 0;
6338 }
6339
6342 {
6344 return true;
6345
6346 return false;
6347 }
6348
6351 {
6354
6356 {
6358 }
6359 else
6360 {
6361
6363 }
6364
6366 }
6367
6374 {
6375 return -1;
6376 }
6377
6378
6379
6380
6382 {
6384 {
6385 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6386 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6387
6388 if (r_index >= 0)
6389 {
6390 InventoryLocation r_il = new InventoryLocation;
6391 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6392
6393 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6396 {
6397 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6398 }
6400 {
6401 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6402 }
6403
6404 }
6405
6406 player.GetHumanInventory().ClearUserReservedLocation(this);
6407 }
6408
6411 }
6412
6413
6414
6415
6417 {
6418 return ItemBase.m_DebugActionsMask;
6419 }
6420
6422 {
6423 return ItemBase.m_DebugActionsMask & mask;
6424 }
6425
6427 {
6428 ItemBase.m_DebugActionsMask = mask;
6429 }
6430
6432 {
6433 ItemBase.m_DebugActionsMask |= mask;
6434 }
6435
6437 {
6438 ItemBase.m_DebugActionsMask &= ~mask;
6439 }
6440
6442 {
6444 {
6446 }
6447 else
6448 {
6450 }
6451 }
6452
6453
6455 {
6456 if (GetEconomyProfile())
6457 {
6458 float q_max = GetEconomyProfile().GetQuantityMax();
6459 if (q_max > 0)
6460 {
6461 float q_min = GetEconomyProfile().GetQuantityMin();
6462 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
6463
6465 {
6466 ComponentEnergyManager comp = GetCompEM();
6468 {
6470 }
6471 }
6473 {
6475
6476 }
6477
6478 }
6479 }
6480 }
6481
6484 {
6485 EntityAI parent = GetHierarchyParent();
6486
6487 if (parent)
6488 {
6489 InventoryLocation inventory_location_to_lock = new InventoryLocation;
6490 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
6491 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
6492 }
6493 }
6494
6497 {
6498 EntityAI parent = GetHierarchyParent();
6499
6500 if (parent)
6501 {
6502 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
6503 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
6504 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
6505 }
6506 }
6507
6509 {
6510
6511
6512
6513
6515
6517 {
6518 if (ScriptInputUserData.CanStoreInputUserData())
6519 {
6520 ScriptInputUserData ctx = new ScriptInputUserData;
6526 ctx.
Write(use_stack_max);
6529
6531 {
6532 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
6533 }
6534 }
6535 }
6536 else if (!
g_Game.IsMultiplayer())
6537 {
6539 }
6540 }
6541
6543 {
6545 }
6546
6548 {
6550 }
6551
6553 {
6555 }
6556
6558 {
6559
6560 return false;
6561 }
6562
6564 {
6565 return false;
6566 }
6567
6571 {
6572 return false;
6573 }
6574
6576 {
6577 return "";
6578 }
6579
6581
6583 {
6584 return false;
6585 }
6586
6588 {
6589 return true;
6590 }
6591
6592
6593
6595 {
6596 return true;
6597 }
6598
6600 {
6601 return true;
6602 }
6603
6605 {
6606 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6608 }
6609
6611 {
6613 }
6614
6616 {
6618 if (!is_being_placed)
6620 SetSynchDirty();
6621 }
6622
6623
6625
6627 {
6629 }
6630
6632 {
6634 }
6635
6637 {
6638 return 1;
6639 }
6640
6642 {
6643 return false;
6644 }
6645
6647 {
6649 SetSynchDirty();
6650 }
6651
6652
6653
6654
6655
6656
6657
6658
6659
6660
6661
6662
6663
6664
6665
6666
6667
6668
6669
6670
6671
6672
6673
6674
6675
6676
6677
6678
6679
6680
6681
6682
6683
6684
6685
6687 {
6688 super.OnMovedInsideCargo(container);
6689
6690 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6691 }
6692
6693 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
6694 {
6695 super.EEItemLocationChanged(oldLoc, newLoc);
6696
6697 PlayerBase newPlayer = null;
6698 PlayerBase oldPlayer = null;
6699
6700 if (newLoc.GetParent())
6701 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
6702
6703 if (oldLoc.GetParent())
6704 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
6705
6707 {
6708 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
6709
6710 if (rIndex >= 0)
6711 {
6712 InventoryLocation rIl = new InventoryLocation;
6713 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
6714
6715 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
6718 {
6719 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
6720 }
6722 {
6724 }
6725
6726 }
6727 }
6728
6730 {
6731 if (newPlayer)
6732 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
6733
6734 if (newPlayer == oldPlayer)
6735 {
6736 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
6737 {
6739 {
6740 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
6741 {
6742 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6743 }
6744 }
6745 else
6746 {
6747 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6748 }
6749 }
6750
6751 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
6752 {
6753 int type = oldLoc.GetType();
6755 {
6756 oldLoc.GetParent().GetOnSetLock().Invoke(this);
6757 }
6759 {
6760 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
6761 }
6762 }
6763 if (!m_OldLocation)
6764 {
6765 m_OldLocation = new InventoryLocation;
6766 }
6767 m_OldLocation.Copy(oldLoc);
6768 }
6769 else
6770 {
6771 if (m_OldLocation)
6772 {
6773 m_OldLocation.Reset();
6774 }
6775 }
6776
6777 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
6778 }
6779 else
6780 {
6781 if (newPlayer)
6782 {
6783 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
6784 if (resIndex >= 0)
6785 {
6786 InventoryLocation il = new InventoryLocation;
6787 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
6789 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
6792 {
6793 il.
GetParent().GetOnReleaseLock().Invoke(it);
6794 }
6796 {
6798 }
6799
6800 }
6801 }
6803 {
6804
6806 }
6807
6808 if (m_OldLocation)
6809 {
6810 m_OldLocation.Reset();
6811 }
6812 }
6813
6815 {
6816 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
6817 }
6818
6820 {
6821 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
6822 }
6823 }
6824
6825 override void EOnContact(IEntity other, Contact extra)
6826 {
6828 {
6829 int liquidType = -1;
6831 if (impactSpeed > 0.0)
6832 {
6834 #ifndef SERVER
6836 #else
6838 SetSynchDirty();
6839 #endif
6841 }
6842 }
6843
6844 #ifdef SERVER
6845 if (GetCompEM() && GetCompEM().IsPlugged())
6846 {
6847 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
6848 GetCompEM().UnplugThis();
6849 }
6850 #endif
6851 }
6852
6854
6856 {
6858 }
6859
6861 {
6862
6863 }
6864
6866 {
6867 super.OnItemLocationChanged(old_owner, new_owner);
6868
6869 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
6870 PlayerBase playerNew = PlayerBase.Cast(new_owner);
6871
6872 if (!relatedPlayer && playerNew)
6873 relatedPlayer = playerNew;
6874
6875 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
6876 {
6878 if (actionMgr)
6879 {
6880 ActionBase currentAction = actionMgr.GetRunningAction();
6881 if (currentAction)
6883 }
6884 }
6885
6886 Man ownerPlayerOld = null;
6887 Man ownerPlayerNew = null;
6888
6889 if (old_owner)
6890 {
6891 if (old_owner.
IsMan())
6892 {
6893 ownerPlayerOld = Man.Cast(old_owner);
6894 }
6895 else
6896 {
6897 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
6898 }
6899 }
6900 else
6901 {
6903 {
6905
6906 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
6907 {
6908 GetCompEM().UnplugThis();
6909 }
6910 }
6911 }
6912
6913 if (new_owner)
6914 {
6915 if (new_owner.
IsMan())
6916 {
6917 ownerPlayerNew = Man.Cast(new_owner);
6918 }
6919 else
6920 {
6921 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
6922 }
6923 }
6924
6925 if (ownerPlayerOld != ownerPlayerNew)
6926 {
6927 if (ownerPlayerOld)
6928 {
6929 array<EntityAI> subItemsExit = new array<EntityAI>;
6931 for (int i = 0; i < subItemsExit.Count(); i++)
6932 {
6935 }
6936 }
6937
6938 if (ownerPlayerNew)
6939 {
6940 array<EntityAI> subItemsEnter = new array<EntityAI>;
6942 for (int j = 0; j < subItemsEnter.Count(); j++)
6943 {
6946 }
6947 }
6948 }
6949 else if (ownerPlayerNew != null)
6950 {
6951 PlayerBase nplayer;
6952 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
6953 {
6954 array<EntityAI> subItemsUpdate = new array<EntityAI>;
6956 for (int k = 0; k < subItemsUpdate.Count(); k++)
6957 {
6959 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
6960 }
6961 }
6962 }
6963
6964 if (old_owner)
6965 old_owner.OnChildItemRemoved(this);
6966 if (new_owner)
6967 new_owner.OnChildItemReceived(this);
6968 }
6969
6970
6972 {
6973 super.EEDelete(parent);
6974 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
6975 if (player)
6976 {
6978
6979 if (player.IsAlive())
6980 {
6981 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6982 if (r_index >= 0)
6983 {
6984 InventoryLocation r_il = new InventoryLocation;
6985 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6986
6987 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6990 {
6991 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6992 }
6994 {
6995 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6996 }
6997
6998 }
6999
7000 player.RemoveQuickBarEntityShortcut(this);
7001 }
7002 }
7003 }
7004
7006 {
7007 super.EEKilled(killer);
7008
7011 {
7012 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
7013 {
7014 if (IsMagazine())
7015 {
7016 if (Magazine.Cast(this).GetAmmoCount() > 0)
7017 {
7019 }
7020 }
7021 else
7022 {
7024 }
7025 }
7026 }
7027 }
7028
7030 {
7031 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7032
7033 super.OnWasAttached(parent, slot_id);
7034
7037
7040 }
7041
7043 {
7044 super.OnWasDetached(parent, slot_id);
7045
7048
7051 }
7052
7054 {
7055 int idx;
7058
7059 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7060 if (inventory_slots.Count() < 1)
7061 {
7062 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
7063 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
7064 }
7065 else
7066 {
7067 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
7068 }
7069
7070 idx = inventory_slots.Find(slot);
7071 if (idx < 0)
7072 return "";
7073
7074 return attach_types.Get(idx);
7075 }
7076
7078 {
7079 int idx = -1;
7080 string slot;
7081
7084
7085 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7086 if (inventory_slots.Count() < 1)
7087 {
7088 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
7089 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7090 }
7091 else
7092 {
7093 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
7094 if (detach_types.Count() < 1)
7095 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7096 }
7097
7098 for (int i = 0; i < inventory_slots.Count(); i++)
7099 {
7100 slot = inventory_slots.Get(i);
7101 }
7102
7103 if (slot != "")
7104 {
7105 if (detach_types.Count() == 1)
7106 idx = 0;
7107 else
7108 idx = inventory_slots.Find(slot);
7109 }
7110 if (idx < 0)
7111 return "";
7112
7113 return detach_types.Get(idx);
7114 }
7115
7117 {
7118
7120
7121
7122 float min_time = 1;
7123 float max_time = 3;
7124 float delay = Math.RandomFloat(min_time, max_time);
7125
7126 explode_timer.Run(delay, this, "DoAmmoExplosion");
7127 }
7128
7130 {
7131 Magazine magazine = Magazine.Cast(this);
7132 int pop_sounds_count = 6;
7133 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
7134
7135
7136 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
7137 string sound_name = pop_sounds[ sound_idx ];
7138 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
7139
7140
7141 magazine.ServerAddAmmoCount(-1);
7142
7143
7144 float min_temp_to_explode = 100;
7145
7146 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
7147 {
7149 }
7150 }
7151
7152
7153 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
7154 {
7155 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
7156
7157 const int CHANCE_DAMAGE_CARGO = 4;
7158 const int CHANCE_DAMAGE_ATTACHMENT = 1;
7159 const int CHANCE_DAMAGE_NOTHING = 2;
7160
7162 {
7163 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
7164 int chances;
7165 int rnd;
7166
7167 if (GetInventory().GetCargo())
7168 {
7169 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7170 rnd = Math.RandomInt(0,chances);
7171
7172 if (rnd < CHANCE_DAMAGE_CARGO)
7173 {
7175 }
7176 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
7177 {
7179 }
7180 }
7181 else
7182 {
7183 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7184 rnd = Math.RandomInt(0,chances);
7185
7186 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
7187 {
7189 }
7190 }
7191 }
7192 }
7193
7195 {
7196 CargoBase cargo = GetInventory().GetCargo();
7197 if (cargo)
7198 {
7200 if (item_count > 0)
7201 {
7202 int random_pick = Math.RandomInt(0, item_count);
7204 if (!item.IsExplosive())
7205 {
7206 item.AddHealth("","",damage);
7207 return true;
7208 }
7209 }
7210 }
7211 return false;
7212 }
7213
7215 {
7216 GameInventory inventory = GetInventory();
7218 if (attachment_count > 0)
7219 {
7220 int random_pick = Math.RandomInt(0, attachment_count);
7222 if (!attachment.IsExplosive())
7223 {
7224 attachment.AddHealth("","",damage);
7225 return true;
7226 }
7227 }
7228 return false;
7229 }
7230
7232 {
7234 }
7235
7237 {
7239 return GetInventory().CanRemoveEntity();
7240
7241 return false;
7242 }
7243
7245 {
7246
7248 return false;
7249
7250
7252 return false;
7253
7254
7255
7257 if (delta == 0)
7258 return false;
7259
7260
7261 return true;
7262 }
7263
7265 {
7267 {
7268 if (ScriptInputUserData.CanStoreInputUserData())
7269 {
7270 ScriptInputUserData ctx = new ScriptInputUserData;
7275 ctx.
Write(destination_entity);
7279 }
7280 }
7281 else if (!
g_Game.IsMultiplayer())
7282 {
7284 }
7285 }
7286
7288 {
7289 float split_quantity_new;
7293 InventoryLocation loc = new InventoryLocation;
7294
7295 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7296 {
7298 split_quantity_new = stack_max;
7299 else
7301
7303 {
7304 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7305 if (new_item)
7306 {
7307 new_item.SetResultOfSplit(true);
7308 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7310 new_item.
SetQuantity(split_quantity_new,
false,
true);
7311 }
7312 }
7313 }
7314 else if (destination_entity && slot_id == -1)
7315 {
7316 if (quantity > stack_max)
7317 split_quantity_new = stack_max;
7318 else
7319 split_quantity_new = quantity;
7320
7322 {
7323 GameInventory destinationInventory = destination_entity.GetInventory();
7325 {
7328 }
7329
7330 if (new_item)
7331 {
7332 new_item.SetResultOfSplit(true);
7333 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7335 new_item.
SetQuantity(split_quantity_new,
false,
true);
7336 }
7337 }
7338 }
7339 else
7340 {
7341 if (stack_max != 0)
7342 {
7344 {
7346 }
7347
7348 if (split_quantity_new == 0)
7349 {
7350 if (!
g_Game.IsMultiplayer())
7351 player.PhysicalPredictiveDropItem(this);
7352 else
7353 player.ServerDropEntity(this);
7354 return;
7355 }
7356
7358 {
7360
7361 if (new_item)
7362 {
7363 new_item.SetResultOfSplit(true);
7364 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7367 new_item.PlaceOnSurface();
7368 }
7369 }
7370 }
7371 }
7372 }
7373
7375 {
7376 float split_quantity_new;
7380 InventoryLocation loc = new InventoryLocation;
7381
7382 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7383 {
7385 split_quantity_new = stack_max;
7386 else
7388
7390 {
7391 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7392 if (new_item)
7393 {
7394 new_item.SetResultOfSplit(true);
7395 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7397 new_item.
SetQuantity(split_quantity_new,
false,
true);
7398 }
7399 }
7400 }
7401 else if (destination_entity && slot_id == -1)
7402 {
7403 if (quantity > stack_max)
7404 split_quantity_new = stack_max;
7405 else
7406 split_quantity_new = quantity;
7407
7409 {
7410 GameInventory destinationInventory = destination_entity.GetInventory();
7412 {
7415 }
7416
7417 if (new_item)
7418 {
7419 new_item.SetResultOfSplit(true);
7420 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7422 new_item.
SetQuantity(split_quantity_new,
false,
true);
7423 }
7424 }
7425 }
7426 else
7427 {
7428 if (stack_max != 0)
7429 {
7431 {
7433 }
7434
7436 {
7438
7439 if (new_item)
7440 {
7441 new_item.SetResultOfSplit(true);
7442 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7445 new_item.PlaceOnSurface();
7446 }
7447 }
7448 }
7449 }
7450 }
7451
7453 {
7455 {
7456 if (ScriptInputUserData.CanStoreInputUserData())
7457 {
7458 ScriptInputUserData ctx = new ScriptInputUserData;
7463 dst.WriteToContext(ctx);
7465 }
7466 }
7467 else if (!
g_Game.IsMultiplayer())
7468 {
7470 }
7471 }
7472
7474 {
7476 {
7477 if (ScriptInputUserData.CanStoreInputUserData())
7478 {
7479 ScriptInputUserData ctx = new ScriptInputUserData;
7484 ctx.
Write(destination_entity);
7490 }
7491 }
7492 else if (!
g_Game.IsMultiplayer())
7493 {
7495 }
7496 }
7497
7499 {
7501 }
7502
7504 {
7506 float split_quantity_new;
7508 if (dst.IsValid())
7509 {
7510 int slot_id = dst.GetSlot();
7512
7513 if (quantity > stack_max)
7514 split_quantity_new = stack_max;
7515 else
7516 split_quantity_new = quantity;
7517
7519 {
7521
7522 if (new_item)
7523 {
7524 new_item.SetResultOfSplit(true);
7525 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7527 new_item.
SetQuantity(split_quantity_new,
false,
true);
7528 }
7529
7530 return new_item;
7531 }
7532 }
7533
7534 return null;
7535 }
7536
7538 {
7540 float split_quantity_new;
7542 if (destination_entity)
7543 {
7545 if (quantity > stackable)
7546 split_quantity_new = stackable;
7547 else
7548 split_quantity_new = quantity;
7549
7551 {
7552 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
7553 if (new_item)
7554 {
7555 new_item.SetResultOfSplit(true);
7556 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7558 new_item.
SetQuantity(split_quantity_new,
false,
true);
7559 }
7560 }
7561 }
7562 }
7563
7565 {
7567 {
7568 if (ScriptInputUserData.CanStoreInputUserData())
7569 {
7570 ScriptInputUserData ctx = new ScriptInputUserData;
7575 ItemBase destination_entity =
this;
7576 ctx.
Write(destination_entity);
7580 }
7581 }
7582 else if (!
g_Game.IsMultiplayer())
7583 {
7585 }
7586 }
7587
7589 {
7591 float split_quantity_new;
7593 if (player)
7594 {
7596 if (quantity > stackable)
7597 split_quantity_new = stackable;
7598 else
7599 split_quantity_new = quantity;
7600
7602 {
7603 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
7604 new_item =
ItemBase.Cast(in_hands);
7605 if (new_item)
7606 {
7607 new_item.SetResultOfSplit(true);
7608 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7610 new_item.SetQuantity(split_quantity_new, false, true);
7611 }
7612 }
7613 }
7614 }
7615
7617 {
7619 float split_quantity_new = Math.Floor(quantity * 0.5);
7620
7622 return;
7623
7625
7626 if (new_item)
7627 {
7628 if (new_item.GetQuantityMax() < split_quantity_new)
7629 {
7630 split_quantity_new = new_item.GetQuantityMax();
7631 }
7632
7633 new_item.SetResultOfSplit(true);
7634 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7635
7637 {
7640 }
7641 else
7642 {
7644 new_item.
SetQuantity(split_quantity_new,
false,
true);
7645 }
7646 }
7647 }
7648
7650 {
7652 float split_quantity_new = Math.Floor(quantity / 2);
7653
7655 return;
7656
7657 InventoryLocation invloc = new InventoryLocation;
7659
7661 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
7662
7663 if (new_item)
7664 {
7665 if (new_item.GetQuantityMax() < split_quantity_new)
7666 {
7667 split_quantity_new = new_item.GetQuantityMax();
7668 }
7670 {
7673 }
7674 else if (split_quantity_new > 1)
7675 {
7677 new_item.
SetQuantity(split_quantity_new,
false,
true);
7678 }
7679 }
7680 }
7681
7684 {
7685 SetWeightDirty();
7687
7688 if (parent)
7689 parent.OnAttachmentQuantityChangedEx(this, delta);
7690
7692 {
7694 {
7696 }
7698 {
7699 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
7701 }
7702 }
7703 }
7704
7707 {
7708
7709 }
7710
7713 {
7715 }
7716
7718 {
7719 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
7720
7722 {
7723 if (newLevel == GameConstants.STATE_RUINED)
7724 {
7726 EntityAI parent = GetHierarchyParent();
7727 if (parent && parent.IsFireplace())
7728 {
7729 CargoBase cargo = GetInventory().GetCargo();
7730 if (cargo)
7731 {
7733 {
7735 }
7736 }
7737 }
7738 }
7739
7741 {
7742
7744 return;
7745 }
7746
7747 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
7748 {
7750 }
7751 }
7752 }
7753
7754
7756 {
7757 super.OnRightClick();
7758
7760 {
7762 {
7763 if (ScriptInputUserData.CanStoreInputUserData())
7764 {
7765 EntityAI root = GetHierarchyRoot();
7766 Man playerOwner = GetHierarchyRootPlayer();
7767 InventoryLocation dst = new InventoryLocation;
7768
7769
7770 if (!playerOwner && root && root == this)
7771 {
7773 }
7774 else
7775 {
7776
7777 GetInventory().GetCurrentInventoryLocation(dst);
7779 {
7780 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7782 {
7784 }
7785 else
7786 {
7788
7789
7790 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
7791 {
7793 }
7794 else
7795 {
7796 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
7797 }
7798 }
7799 }
7800 }
7801
7802 ScriptInputUserData ctx = new ScriptInputUserData;
7810 }
7811 }
7812 else if (!
g_Game.IsMultiplayer())
7813 {
7815 }
7816 }
7817 }
7818
7820 {
7821 if (root)
7822 {
7823 vector m4[4];
7824 root.GetTransform(m4);
7825 dst.SetGround(this, m4);
7826 }
7827 else
7828 {
7829 GetInventory().GetCurrentInventoryLocation(dst);
7830 }
7831 }
7832
7833 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
7834 {
7835
7836 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
7837 return false;
7838
7839 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
7840 return false;
7841
7842
7844 return false;
7845
7846
7847 Magazine mag = Magazine.Cast(this);
7848 if (mag)
7849 {
7850 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
7851 return false;
7852
7853 if (stack_max_limit)
7854 {
7855 Magazine other_mag = Magazine.Cast(other_item);
7856 if (other_item)
7857 {
7858 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
7859 return false;
7860 }
7861
7862 }
7863 }
7864 else
7865 {
7866
7868 return false;
7869
7871 return false;
7872 }
7873
7874 PlayerBase player = null;
7875 if (CastTo(player, GetHierarchyRootPlayer()))
7876 {
7877 if (player.GetInventory().HasAttachment(this))
7878 return false;
7879
7880 if (player.IsItemsToDelete())
7881 return false;
7882 }
7883
7884 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
7885 return false;
7886
7887 int slotID;
7889 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
7890 return false;
7891
7892 return true;
7893 }
7894
7896 {
7898 }
7899
7901 {
7902 return m_IsResultOfSplit;
7903 }
7904
7906 {
7907 m_IsResultOfSplit = value;
7908 }
7909
7911 {
7913 }
7914
7916 {
7917 float other_item_quantity = other_item.GetQuantity();
7918 float this_free_space;
7919
7921
7923
7924 if (other_item_quantity > this_free_space)
7925 {
7926 return this_free_space;
7927 }
7928 else
7929 {
7930 return other_item_quantity;
7931 }
7932 }
7933
7935 {
7937 }
7938
7940 {
7942 return;
7943
7944 if (!IsMagazine() && other_item)
7945 {
7947 if (quantity_used != 0)
7948 {
7949 float hp1 = GetHealth01("","");
7950 float hp2 = other_item.GetHealth01("","");
7951 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
7952 hpResult = hpResult / (
GetQuantity() + quantity_used);
7953
7954 hpResult *= GetMaxHealth();
7955 Math.Round(hpResult);
7956 SetHealth("", "Health", hpResult);
7957
7959 other_item.AddQuantity(-quantity_used);
7960 }
7961 }
7963 }
7964
7966 {
7967 #ifdef SERVER
7968 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
7969 GetHierarchyParent().IncreaseLifetimeUp();
7970 #endif
7971 };
7972
7974 {
7975 PlayerBase p = PlayerBase.Cast(player);
7976
7977 array<int> recipesIds = p.m_Recipes;
7978 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
7979 if (moduleRecipesManager)
7980 {
7981 EntityAI itemInHands = player.GetEntityInHands();
7982 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
7983 }
7984
7985 for (int i = 0;i < recipesIds.Count(); i++)
7986 {
7987 int key = recipesIds.Get(i);
7988 string recipeName = moduleRecipesManager.GetRecipeName(key);
7990 }
7991 }
7992
7993
7994 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
7995 {
7996 super.GetDebugActions(outputList);
7997
7998
8004
8005
8010
8015
8016
8020
8021
8023 {
8027 }
8028
8031
8032
8036
8038
8039 InventoryLocation loc = new InventoryLocation();
8040 GetInventory().GetCurrentInventoryLocation(loc);
8042 {
8043 if (Gizmo_IsSupported())
8046 }
8047
8049 }
8050
8051
8052
8053
8055 {
8056 super.OnAction(action_id, player, ctx);
8057
8059 {
8060 switch (action_id)
8061 {
8065 return true;
8069 return true;
8070 }
8071 }
8072
8074 {
8075 switch (action_id)
8076 {
8078 Delete();
8079 return true;
8080 }
8081 }
8082
8083 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
8084 {
8085 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8086 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
8087 PlayerBase p = PlayerBase.Cast(player);
8088 if (
EActions.RECIPES_RANGE_START < 1000)
8089 {
8090 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
8091 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
8092 }
8093 }
8094 #ifndef SERVER
8095 else if (action_id ==
EActions.WATCH_PLAYER)
8096 {
8097 PluginDeveloper.SetDeveloperItemClientEx(player);
8098 }
8099 #endif
8101 {
8102 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
8103 {
8104 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
8105 OnDebugButtonPressServer(id + 1);
8106 }
8107
8108 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
8109 {
8110 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
8112 }
8113
8114 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
8115 {
8116 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
8118 }
8119
8120 else if (action_id ==
EActions.ADD_QUANTITY)
8121 {
8122 if (IsMagazine())
8123 {
8124 Magazine mag = Magazine.Cast(this);
8125 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
8126 }
8127 else
8128 {
8130 }
8131
8132 if (m_EM)
8133 {
8134 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
8135 }
8136
8137 }
8138
8139 else if (action_id ==
EActions.REMOVE_QUANTITY)
8140 {
8141 if (IsMagazine())
8142 {
8143 Magazine mag2 = Magazine.Cast(this);
8144 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
8145 }
8146 else
8147 {
8149 }
8150 if (m_EM)
8151 {
8152 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
8153 }
8154
8155 }
8156
8157 else if (action_id ==
EActions.SET_QUANTITY_0)
8158 {
8160
8161 if (m_EM)
8162 {
8163 m_EM.SetEnergy(0);
8164 }
8165 }
8166
8167 else if (action_id ==
EActions.SET_MAX_QUANTITY)
8168 {
8170
8171 if (m_EM)
8172 {
8173 m_EM.SetEnergy(m_EM.GetEnergyMax());
8174 }
8175 }
8176
8177 else if (action_id ==
EActions.ADD_HEALTH)
8178 {
8179 AddHealth("","",GetMaxHealth("","Health")/5);
8180 }
8181 else if (action_id ==
EActions.REMOVE_HEALTH)
8182 {
8183 AddHealth("","",-GetMaxHealth("","Health")/5);
8184 }
8185 else if (action_id ==
EActions.DESTROY_HEALTH)
8186 {
8187 SetHealth01("","",0);
8188 }
8189 else if (action_id ==
EActions.WATCH_ITEM)
8190 {
8192 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
8193 #ifdef DEVELOPER
8194 SetDebugDeveloper_item(this);
8195 #endif
8196 }
8197
8198 else if (action_id ==
EActions.ADD_TEMPERATURE)
8199 {
8200 AddTemperature(20);
8201
8202 }
8203
8204 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
8205 {
8206 AddTemperature(-20);
8207
8208 }
8209
8210 else if (action_id ==
EActions.FLIP_FROZEN)
8211 {
8212 SetFrozen(!GetIsFrozen());
8213
8214 }
8215
8216 else if (action_id ==
EActions.ADD_WETNESS)
8217 {
8219
8220 }
8221
8222 else if (action_id ==
EActions.REMOVE_WETNESS)
8223 {
8225
8226 }
8227
8228 else if (action_id ==
EActions.LIQUIDTYPE_UP)
8229 {
8232
8233
8234 }
8235
8236 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
8237 {
8240 }
8241
8242 else if (action_id ==
EActions.MAKE_SPECIAL)
8243 {
8244 auto debugParams = DebugSpawnParams.WithPlayer(player);
8245 OnDebugSpawnEx(debugParams);
8246 }
8247
8248 }
8249
8250
8251 return false;
8252 }
8253
8254
8255
8256
8260
8263
8264
8265
8267 {
8268 return false;
8269 }
8270
8271
8273 {
8274 return true;
8275 }
8276
8277
8279 {
8280 return true;
8281 }
8282
8283
8284
8286 {
8287 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
8288 return g_Game.ConfigIsExisting(config_path);
8289 }
8290
8293 {
8294 return null;
8295 }
8296
8298 {
8299 return false;
8300 }
8301
8303 {
8304 return false;
8305 }
8306
8310
8311
8313 {
8314 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8315 return module_repairing.CanRepair(this, item_repair_kit);
8316 }
8317
8318
8319 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
8320 {
8321 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8322 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
8323 }
8324
8325
8327 {
8328
8329
8330
8331
8332
8333
8334
8335
8336 return 1;
8337 }
8338
8339
8340
8342 {
8344 }
8345
8346
8347
8349 {
8351 }
8352
8353
8362 {
8363 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8364
8365 if (player)
8366 {
8367 player.MessageStatus(text);
8368 }
8369 }
8370
8371
8380 {
8381 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8382
8383 if (player)
8384 {
8385 player.MessageAction(text);
8386 }
8387 }
8388
8389
8398 {
8399 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8400
8401 if (player)
8402 {
8403 player.MessageFriendly(text);
8404 }
8405 }
8406
8407
8416 {
8417 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8418
8419 if (player)
8420 {
8421 player.MessageImportant(text);
8422 }
8423 }
8424
8426 {
8427 return true;
8428 }
8429
8430
8431 override bool KindOf(
string tag)
8432 {
8433 bool found = false;
8434 string item_name = this.
GetType();
8436 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
8437
8438 int array_size = item_tag_array.Count();
8439 for (int i = 0; i < array_size; i++)
8440 {
8441 if (item_tag_array.Get(i) == tag)
8442 {
8443 found = true;
8444 break;
8445 }
8446 }
8447 return found;
8448 }
8449
8450
8452 {
8453
8454 super.OnRPC(sender, rpc_type,ctx);
8455
8456
8457 switch (rpc_type)
8458 {
8459 #ifndef SERVER
8460 case ERPCs.RPC_SOUND_LOCK_ATTACH:
8461 Param2<bool, string> p = new Param2<bool, string>(false, "");
8462
8464 return;
8465
8466 bool play = p.param1;
8467 string soundSet = p.param2;
8468
8469 if (play)
8470 {
8472 {
8474 {
8476 }
8477 }
8478 else
8479 {
8481 }
8482 }
8483 else
8484 {
8486 }
8487
8488 break;
8489 #endif
8490
8491 }
8492
8494 {
8496 }
8497 }
8498
8499
8500
8501
8503 {
8504 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8505 return plugin.GetID(
name);
8506 }
8507
8509 {
8510 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8511 return plugin.GetName(id);
8512 }
8513
8516 {
8517
8518
8519 int varFlags;
8520 if (!ctx.
Read(varFlags))
8521 return;
8522
8523 if (varFlags & ItemVariableFlags.FLOAT)
8524 {
8526 }
8527 }
8528
8530 {
8531
8532 super.SerializeNumericalVars(floats_out);
8533
8534
8535
8537 {
8539 }
8540
8542 {
8544 }
8545
8547 {
8549 }
8550
8552 {
8557 }
8558
8560 {
8562 }
8563 }
8564
8566 {
8567
8568 super.DeSerializeNumericalVars(floats);
8569
8570
8571 int index = 0;
8572 int mask = Math.Round(floats.Get(index));
8573
8574 index++;
8575
8577 {
8579 {
8581 }
8582 else
8583 {
8584 float quantity = floats.Get(index);
8586 }
8587 index++;
8588 }
8589
8591 {
8592 float wet = floats.Get(index);
8594 index++;
8595 }
8596
8598 {
8599 int liquidtype = Math.Round(floats.Get(index));
8601 index++;
8602 }
8603
8605 {
8607 index++;
8609 index++;
8611 index++;
8613 index++;
8614 }
8615
8617 {
8618 int cleanness = Math.Round(floats.Get(index));
8620 index++;
8621 }
8622 }
8623
8625 {
8626 super.WriteVarsToCTX(ctx);
8627
8628
8630 {
8632 }
8633
8635 {
8637 }
8638
8640 {
8642 }
8643
8645 {
8646 int r,g,b,a;
8652 }
8653
8655 {
8657 }
8658 }
8659
8661 {
8662 if (!super.ReadVarsFromCTX(ctx,version))
8663 return false;
8664
8665 int intValue;
8666 float value;
8667
8668 if (version < 140)
8669 {
8670 if (!ctx.
Read(intValue))
8671 return false;
8672
8673 m_VariablesMask = intValue;
8674 }
8675
8677 {
8678 if (!ctx.
Read(value))
8679 return false;
8680
8682 {
8684 }
8685 else
8686 {
8688 }
8689 }
8690
8691 if (version < 140)
8692 {
8694 {
8695 if (!ctx.
Read(value))
8696 return false;
8697 SetTemperatureDirect(value);
8698 }
8699 }
8700
8702 {
8703 if (!ctx.
Read(value))
8704 return false;
8706 }
8707
8709 {
8710 if (!ctx.
Read(intValue))
8711 return false;
8713 }
8714
8716 {
8717 int r,g,b,a;
8719 return false;
8721 return false;
8723 return false;
8725 return false;
8726
8728 }
8729
8731 {
8732 if (!ctx.
Read(intValue))
8733 return false;
8735 }
8736
8737 if (version >= 138 && version < 140)
8738 {
8740 {
8741 if (!ctx.
Read(intValue))
8742 return false;
8743 SetFrozen(intValue);
8744 }
8745 }
8746
8747 return true;
8748 }
8749
8750
8752 {
8755 {
8757 }
8758
8759 if (!super.OnStoreLoad(ctx, version))
8760 {
8762 return false;
8763 }
8764
8765 if (version >= 114)
8766 {
8767 bool hasQuickBarIndexSaved;
8768
8769 if (!ctx.
Read(hasQuickBarIndexSaved))
8770 {
8772 return false;
8773 }
8774
8775 if (hasQuickBarIndexSaved)
8776 {
8777 int itmQBIndex;
8778
8779
8780 if (!ctx.
Read(itmQBIndex))
8781 {
8783 return false;
8784 }
8785
8786 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
8787 if (itmQBIndex != -1 && parentPlayer)
8788 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
8789 }
8790 }
8791 else
8792 {
8793
8794 PlayerBase player;
8795 int itemQBIndex;
8796 if (version ==
int.
MAX)
8797 {
8798 if (!ctx.
Read(itemQBIndex))
8799 {
8801 return false;
8802 }
8803 }
8804 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
8805 {
8806
8807 if (!ctx.
Read(itemQBIndex))
8808 {
8810 return false;
8811 }
8812 if (itemQBIndex != -1 && player)
8813 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
8814 }
8815 }
8816
8817 if (version < 140)
8818 {
8819
8820 if (!LoadVariables(ctx, version))
8821 {
8823 return false;
8824 }
8825 }
8826
8827
8829 {
8831 return false;
8832 }
8833 if (version >= 132)
8834 {
8836 if (raib)
8837 {
8839 {
8841 return false;
8842 }
8843 }
8844 }
8845
8847 return true;
8848 }
8849
8850
8851
8853 {
8854 super.OnStoreSave(ctx);
8855
8856 PlayerBase player;
8857 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
8858 {
8860
8861 int itemQBIndex = -1;
8862 itemQBIndex = player.FindQuickBarEntityIndex(this);
8863 ctx.
Write(itemQBIndex);
8864 }
8865 else
8866 {
8868 }
8869
8871
8873 if (raib)
8874 {
8876 }
8877 }
8878
8879
8881 {
8882 super.AfterStoreLoad();
8883
8885 {
8887 }
8888
8890 {
8893 }
8894 }
8895
8897 {
8898 super.EEOnAfterLoad();
8899
8901 {
8903 }
8904
8907 }
8908
8910 {
8911 return false;
8912 }
8913
8914
8915
8917 {
8919 {
8920 #ifdef PLATFORM_CONSOLE
8921
8923 {
8925 if (menu)
8926 {
8928 }
8929 }
8930 #endif
8931 }
8932
8934 {
8937 }
8938
8940 {
8941 SetWeightDirty();
8943 }
8945 {
8948 }
8949
8951 {
8954
8957 }
8959 {
8963 }
8964
8965 super.OnVariablesSynchronized();
8966 }
8967
8968
8969
8971 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
8972 {
8973 if (!IsServerCheck(allow_client))
8974 return false;
8975
8977 return false;
8978
8981
8982 if (value <= (min + 0.001))
8983 value = min;
8984
8985 if (value == min)
8986 {
8987 if (destroy_config)
8988 {
8989 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
8990 if (dstr)
8991 {
8993 this.Delete();
8994 return true;
8995 }
8996 }
8997 else if (destroy_forced)
8998 {
9000 this.Delete();
9001 return true;
9002 }
9003
9005 }
9006
9009
9011 {
9012 EntityAI parent = GetHierarchyRoot();
9013 InventoryLocation iLoc = new InventoryLocation();
9014 GetInventory().GetCurrentInventoryLocation(iLoc);
9016 {
9017 int iLocSlot = iLoc.
GetSlot();
9019 {
9021 }
9023 {
9025 }
9026 }
9027 }
9028
9030 {
9032
9033 if (delta)
9035 }
9036
9038
9039 return false;
9040 }
9041
9042
9044 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9045 {
9047 }
9048
9050 {
9053 }
9054
9056 {
9059 }
9060
9062 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9063 {
9064 float value_clamped = Math.Clamp(value, 0, 1);
9066 SetQuantity(result, destroy_config, destroy_forced);
9067 }
9068
9069
9072 {
9074 }
9075
9077 {
9079 }
9080
9081
9082
9083
9084
9085
9086
9087
9088
9089
9091 {
9092 int slot = -1;
9093 GameInventory inventory = GetInventory();
9094 if (inventory)
9095 {
9096 InventoryLocation il = new InventoryLocation;
9099 }
9100
9102 }
9103
9105 {
9106 float quantity_max = 0;
9107
9109 {
9110 if (attSlotID != -1)
9111 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
9112
9113 if (quantity_max <= 0)
9115 }
9116
9117 if (quantity_max <= 0)
9119
9120 return quantity_max;
9121 }
9122
9124 {
9126 }
9127
9129 {
9131 }
9132
9133
9135 {
9137 }
9138
9140 {
9142 }
9143
9145 {
9147 }
9148
9149
9151 {
9152
9153 float weightEx = GetWeightEx();
9154 float special = GetInventoryAndCargoWeight();
9155 return weightEx - special;
9156 }
9157
9158
9160 {
9162 }
9163
9165 {
9167 {
9168 #ifdef DEVELOPER
9169 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9170 {
9171 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
9173 }
9174 #endif
9175
9177 }
9178 else if (HasEnergyManager())
9179 {
9180 #ifdef DEVELOPER
9181 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9182 {
9183 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
9184 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
9185 }
9186 #endif
9187 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
9188 }
9189 else
9190 {
9191 #ifdef DEVELOPER
9192 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9193 {
9194 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
9195 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
9196 }
9197 #endif
9198 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
9199 }
9200 }
9201
9204 {
9205 int item_count = 0;
9207
9208 GameInventory inventory = GetInventory();
9209 CargoBase cargo = inventory.
GetCargo();
9210 if (cargo != NULL)
9211 {
9213 }
9214
9216 for (int i = 0; i < nAttachments; ++i)
9217 {
9219 if (item)
9220 item_count += item.GetNumberOfItems();
9221 }
9222 return item_count;
9223 }
9224
9227 {
9228 float weight = 0;
9229 float wetness = 1;
9230 if (include_wetness)
9233 {
9234 weight = wetness * m_ConfigWeight;
9235 }
9237 {
9238 weight = 1;
9239 }
9240 return weight;
9241 }
9242
9243
9244
9246 {
9247 GameInventory inventory = GetInventory();
9248 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
9249 {
9250 array<EntityAI> items = new array<EntityAI>;
9252 for (int i = 0; i < items.Count(); ++i)
9253 {
9255 if (item)
9256 {
9257 g_Game.ObjectDelete(item);
9258 }
9259 }
9260 }
9261 }
9262
9263
9264
9265
9267 {
9268 float energy = 0;
9269 if (HasEnergyManager())
9270 {
9271 energy = GetCompEM().GetEnergy();
9272 }
9273 return energy;
9274 }
9275
9276
9278 {
9279 super.OnEnergyConsumed();
9280
9282 }
9283
9285 {
9286 super.OnEnergyAdded();
9287
9289 }
9290
9291
9293 {
9294 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
9295 {
9297 {
9298 float energy_0to1 = GetCompEM().GetEnergy0To1();
9300 }
9301 }
9302 }
9303
9304
9306 {
9307 return ConfigGetFloat("heatIsolation");
9308 }
9309
9311 {
9313 }
9314
9316 {
9317 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
9318 if (
g_Game.ConfigIsExisting(paramPath))
9319 return g_Game.ConfigGetFloat(paramPath);
9320
9321 return 0.0;
9322 }
9323
9325 {
9326 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
9327 if (
g_Game.ConfigIsExisting(paramPath))
9328 return g_Game.ConfigGetFloat(paramPath);
9329
9330 return 0.0;
9331 }
9332
9333 override void SetWet(
float value,
bool allow_client =
false)
9334 {
9335 if (!IsServerCheck(allow_client))
9336 return;
9337
9340
9342
9343 m_VarWet = Math.Clamp(value, min, max);
9344
9346 {
9349 }
9350 }
9351
9352 override void AddWet(
float value)
9353 {
9355 }
9356
9358 {
9360 }
9361
9363 {
9365 }
9366
9368 {
9370 }
9371
9373 {
9375 }
9376
9378 {
9380 }
9381
9383 {
9386 if (newLevel != oldLevel)
9387 {
9389 }
9390 }
9391
9393 {
9394 SetWeightDirty();
9395 }
9396
9398 {
9399 return GetWetLevelInternal(
m_VarWet);
9400 }
9401
9402
9403
9405 {
9407 }
9408
9410 {
9412 }
9413
9415 {
9417 }
9418
9420 {
9422 }
9423
9424
9425
9427 {
9428 if (ConfigIsExisting("itemModelLength"))
9429 {
9430 return ConfigGetFloat("itemModelLength");
9431 }
9432 return 0;
9433 }
9434
9436 {
9437 if (ConfigIsExisting("itemAttachOffset"))
9438 {
9439 return ConfigGetFloat("itemAttachOffset");
9440 }
9441 return 0;
9442 }
9443
9444 override void SetCleanness(
int value,
bool allow_client =
false)
9445 {
9446 if (!IsServerCheck(allow_client))
9447 return;
9448
9450
9452
9455 }
9456
9458 {
9460 }
9461
9463 {
9464 return true;
9465 }
9466
9467
9468
9469
9471 {
9473 }
9474
9476 {
9478 }
9479
9480
9481
9482
9483 override void SetColor(
int r,
int g,
int b,
int a)
9484 {
9490 }
9492 override void GetColor(out
int r,out
int g,out
int b,out
int a)
9493 {
9498 }
9499
9501 {
9503 }
9504
9507 {
9508 int r,g,b,a;
9510 r = r/255;
9511 g = g/255;
9512 b = b/255;
9513 a = a/255;
9514 return MiscGameplayFunctions.GetColorString(r, g, b, a);
9515 }
9516
9517
9518
9519 override void SetLiquidType(
int value,
bool allow_client =
false)
9520 {
9521 if (!IsServerCheck(allow_client))
9522 return;
9523
9528 }
9529
9531 {
9532 return ConfigGetInt("varLiquidTypeInit");
9533 }
9534
9536 {
9538 }
9539
9541 {
9543 SetFrozen(false);
9544 }
9545
9548 {
9549 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9550 }
9551
9552
9555 {
9556 PlayerBase nplayer;
9557 if (PlayerBase.CastTo(nplayer, player))
9558 {
9560 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9561 }
9562 }
9563
9564
9567 {
9568 PlayerBase nplayer;
9569 if (PlayerBase.CastTo(nplayer,player))
9570 {
9571 nplayer.SetEnableQuickBarEntityShortcut(this, false);
9572 }
9573
9574 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
9575
9576 if (HasEnergyManager())
9577 {
9578 GetCompEM().UpdatePlugState();
9579 }
9580 }
9581
9582
9584 {
9585 super.OnPlacementStarted(player);
9586
9588 }
9589
9590 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
9591 {
9593 {
9594 m_AdminLog.OnPlacementComplete(player,
this);
9595 }
9596
9597 super.OnPlacementComplete(player, position, orientation);
9598 }
9599
9600
9601
9602
9603
9605 {
9607 {
9608 return true;
9609 }
9610 else
9611 {
9612 return false;
9613 }
9614 }
9615
9616
9618 {
9620 {
9622 }
9623 }
9624
9625
9627 {
9629 }
9630
9632 {
9634 }
9635
9636 override void InsertAgent(
int agent,
float count = 1)
9637 {
9638 if (count < 1)
9639 return;
9640
9642 }
9643
9646 {
9648 }
9649
9650
9652 {
9654 }
9655
9656
9657
9658
9659
9660
9661
9662
9663
9664
9665
9666
9667
9668
9669
9670
9671
9672
9673
9674
9675
9676
9677
9678
9679
9680
9681
9682
9683
9684
9685
9686
9687
9688
9689
9690
9691
9692
9693
9694
9695
9696
9698 {
9700 return false;
9701 return true;
9702 }
9703
9705 {
9706
9708 }
9709
9710
9713 {
9714 super.CheckForRoofLimited(timeTresholdMS);
9715
9716 float time =
g_Game.GetTime();
9717 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
9718 {
9719 m_PreviousRoofTestTime = time;
9720 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
9721 }
9722 }
9723
9724
9726 {
9728 {
9729 return 0;
9730 }
9731
9732 if (GetInventory().GetAttachmentSlotsCount() != 0)
9733 {
9734 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
9735 if (filter)
9736 return filter.GetProtectionLevel(type, false, system);
9737 else
9738 return 0;
9739 }
9740
9741 string subclassPath, entryName;
9742
9743 switch (type)
9744 {
9746 entryName = "biological";
9747 break;
9749 entryName = "chemical";
9750 break;
9751 default:
9752 entryName = "biological";
9753 break;
9754 }
9755
9756 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
9757
9758 return g_Game.ConfigGetFloat(subclassPath + entryName);
9759 }
9760
9761
9762
9765 {
9766 if (!IsMagazine())
9768
9770 }
9771
9772
9773
9774
9775
9780 {
9781 return true;
9782 }
9783
9785 {
9787 }
9788
9789
9790
9791
9792
9794 {
9795 if (parent)
9796 {
9797 if (parent.IsInherited(DayZInfected))
9798 return true;
9799
9800 if (!parent.IsRuined())
9801 return true;
9802 }
9803
9804 return true;
9805 }
9806
9808 {
9809 if (!super.CanPutAsAttachment(parent))
9810 {
9811 return false;
9812 }
9813
9814 if (!IsRuined() && !parent.IsRuined())
9815 {
9816 return true;
9817 }
9818
9819 return false;
9820 }
9821
9823 {
9824
9825
9826
9827
9828 return super.CanReceiveItemIntoCargo(item);
9829 }
9830
9832 {
9833
9834
9835
9836
9837 GameInventory attachmentInv = attachment.GetInventory();
9839 {
9840 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
9841 return false;
9842 }
9843
9844 InventoryLocation loc = new InventoryLocation();
9845 attachment.GetInventory().GetCurrentInventoryLocation(loc);
9846 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
9847 return false;
9848
9849 return super.CanReceiveAttachment(attachment, slotId);
9850 }
9851
9853 {
9854 if (!super.CanReleaseAttachment(attachment))
9855 return false;
9856
9857 return GetInventory().AreChildrenAccessible();
9858 }
9859
9860
9861
9862
9863
9864
9865
9866
9867
9868
9869
9870
9871
9872
9873
9874
9875
9876
9877
9878
9879
9881 {
9882 int id = muzzle_owner.GetMuzzleID();
9883 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
9884
9885 if (WPOF_array)
9886 {
9887 for (int i = 0; i < WPOF_array.Count(); i++)
9888 {
9889 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
9890
9891 if (WPOF)
9892 {
9893 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
9894 }
9895 }
9896 }
9897 }
9898
9899
9901 {
9902 int id = muzzle_owner.GetMuzzleID();
9904
9905 if (WPOBE_array)
9906 {
9907 for (int i = 0; i < WPOBE_array.Count(); i++)
9908 {
9909 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
9910
9911 if (WPOBE)
9912 {
9913 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
9914 }
9915 }
9916 }
9917 }
9918
9919
9921 {
9922 int id = muzzle_owner.GetMuzzleID();
9923 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9924
9925 if (WPOOH_array)
9926 {
9927 for (int i = 0; i < WPOOH_array.Count(); i++)
9928 {
9929 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9930
9931 if (WPOOH)
9932 {
9933 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
9934 }
9935 }
9936 }
9937 }
9938
9939
9941 {
9942 int id = muzzle_owner.GetMuzzleID();
9943 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9944
9945 if (WPOOH_array)
9946 {
9947 for (int i = 0; i < WPOOH_array.Count(); i++)
9948 {
9949 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9950
9951 if (WPOOH)
9952 {
9953 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9954 }
9955 }
9956 }
9957 }
9958
9959
9961 {
9962 int id = muzzle_owner.GetMuzzleID();
9963 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9964
9965 if (WPOOH_array)
9966 {
9967 for (int i = 0; i < WPOOH_array.Count(); i++)
9968 {
9969 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9970
9971 if (WPOOH)
9972 {
9973 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9974 }
9975 }
9976 }
9977 }
9978
9979
9980
9982 {
9984 {
9985 return true;
9986 }
9987
9988 return false;
9989 }
9990
9992 {
9994 {
9995 return true;
9996 }
9997
9998 return false;
9999 }
10000
10002 {
10004 {
10005 return true;
10006 }
10007
10008 return false;
10009 }
10010
10012 {
10013 return false;
10014 }
10015
10018 {
10019 return UATimeSpent.DEFAULT_DEPLOY;
10020 }
10021
10022
10023
10024
10026 {
10028 SetSynchDirty();
10029 }
10030
10032 {
10034 }
10035
10036
10038 {
10039 return false;
10040 }
10041
10044 {
10045 string att_type = "None";
10046
10047 if (ConfigIsExisting("soundAttType"))
10048 {
10049 att_type = ConfigGetString("soundAttType");
10050 }
10051
10053 }
10054
10056 {
10058 }
10059
10060
10061
10062
10063
10069
10071 {
10074
10076 }
10077
10078
10080 {
10082 return;
10083
10085
10088
10091
10092 SoundParameters params = new SoundParameters();
10096 }
10097
10098
10100 {
10102 {
10105
10106 SetSynchDirty();
10107
10110 }
10111 }
10112
10114 {
10116 }
10117
10118
10120 {
10122 return;
10123
10125 SetSynchDirty();
10126
10129 }
10130
10132 {
10135 }
10136
10138 {
10140 }
10141
10142 void OnApply(PlayerBase player);
10143
10145 {
10146 return 1.0;
10147 };
10148
10150 {
10152 }
10153
10155 {
10157 }
10158
10160
10162 {
10163 SetDynamicPhysicsLifeTime(0.01);
10165 }
10166
10168 {
10169 array<string> zone_names = new array<string>;
10170 GetDamageZones(zone_names);
10171 for (int i = 0; i < zone_names.Count(); i++)
10172 {
10173 SetHealthMax(zone_names.Get(i),"Health");
10174 }
10175 SetHealthMax("","Health");
10176 }
10177
10180 {
10181 float global_health = GetHealth01("","Health");
10182 array<string> zones = new array<string>;
10183 GetDamageZones(zones);
10184
10185 for (int i = 0; i < zones.Count(); i++)
10186 {
10187 SetHealth01(zones.Get(i),"Health",global_health);
10188 }
10189 }
10190
10193 {
10194 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
10195 }
10196
10198 {
10199 if (!hasRootAsPlayer)
10200 {
10201 if (refParentIB)
10202 {
10203
10204 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
10205 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
10206
10207 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
10208 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
10209
10212 }
10213 else
10214 {
10215
10218 }
10219 }
10220 }
10221
10223 {
10225 {
10226 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
10227 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
10228 {
10229 float heatPermCoef = 1.0;
10231 while (ent)
10232 {
10233 heatPermCoef *= ent.GetHeatPermeabilityCoef();
10234 ent = ent.GetHierarchyParent();
10235 }
10236
10237 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
10238 }
10239 }
10240 }
10241
10243 {
10244
10245 EntityAI parent = GetHierarchyParent();
10246 if (!parent)
10247 {
10248 hasParent = false;
10249 hasRootAsPlayer = false;
10250 }
10251 else
10252 {
10253 hasParent = true;
10254 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
10255 refParentIB =
ItemBase.Cast(parent);
10256 }
10257 }
10258
10259 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
10260 {
10261
10262 }
10263
10265 {
10266
10267 return false;
10268 }
10269
10271 {
10272
10273
10274 return false;
10275 }
10276
10278 {
10279
10280 return false;
10281 }
10282
10285 {
10286 return !GetIsFrozen() &&
IsOpen();
10287 }
10288
10290 {
10291 bool hasParent = false, hasRootAsPlayer = false;
10293
10294 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
10295 bool foodDecay =
g_Game.IsFoodDecayEnabled();
10296
10297 if (wwtu || foodDecay)
10298 {
10302
10303 if (processWetness || processTemperature || processDecay)
10304 {
10306
10307 if (processWetness)
10308 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
10309
10310 if (processTemperature)
10312
10313 if (processDecay)
10314 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
10315 }
10316 }
10317 }
10318
10321 {
10323 }
10324
10326 {
10329
10330 return super.GetTemperatureFreezeThreshold();
10331 }
10332
10334 {
10337
10338 return super.GetTemperatureThawThreshold();
10339 }
10340
10342 {
10345
10346 return super.GetItemOverheatThreshold();
10347 }
10348
10350 {
10352 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
10353
10354 return super.GetTemperatureFreezeTime();
10355 }
10356
10358 {
10360 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
10361
10362 return super.GetTemperatureThawTime();
10363 }
10364
10369
10371 {
10372 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
10373 }
10374
10376 {
10377 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
10378 }
10379
10382 {
10384 }
10385
10387 {
10389 }
10390
10392 {
10394 }
10395
10398 {
10399 return null;
10400 }
10401
10404 {
10405 return false;
10406 }
10407
10409 {
10411 {
10414 if (!trg)
10415 {
10417 explosive = this;
10418 }
10419
10420 explosive.PairRemote(trg);
10422
10423 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
10424 trg.SetPersistentPairID(persistentID);
10425 explosive.SetPersistentPairID(persistentID);
10426
10427 return true;
10428 }
10429 return false;
10430 }
10431
10434 {
10435 float ret = 1.0;
10438 ret *= GetHealth01();
10439
10440 return ret;
10441 }
10442
10443 #ifdef DEVELOPER
10444 override void SetDebugItem()
10445 {
10446 super.SetDebugItem();
10447 _itemBase = this;
10448 }
10449
10451 {
10452 string text = super.GetDebugText();
10453
10455 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
10456
10457 return text;
10458 }
10459 #endif
10460
10462 {
10463 return true;
10464 }
10465
10467
10469
10471 {
10474 }
10475
10476
10484
10500
10501 [
Obsolete(
"Use ItemSoundHandler instead")]
10504 {
10505 if (!
g_Game.IsDedicatedServer())
10506 {
10507 if (ConfigIsExisting("attachSoundSet"))
10508 {
10509 string cfg_path = "";
10510 string soundset = "";
10511 string type_name =
GetType();
10512
10515 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
10516 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
10517
10518 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
10519 {
10520 for (int i = 0; i < cfg_soundset_array.Count(); i++)
10521 {
10522 if (cfg_slot_array[i] == slot_type)
10523 {
10524 soundset = cfg_soundset_array[i];
10525 break;
10526 }
10527 }
10528 }
10529
10530 if (soundset != "")
10531 {
10532 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
10534 }
10535 }
10536 }
10537 }
10538
10540}
10541
10543{
10545 if (entity)
10546 {
10547 bool is_item = entity.IsInherited(
ItemBase);
10548 if (is_item && full_quantity)
10549 {
10552 }
10553 }
10554 else
10555 {
10557 return NULL;
10558 }
10559 return entity;
10560}
10561
10563{
10564 if (item)
10565 {
10566 if (health > 0)
10567 item.SetHealth("", "", health);
10568
10569 if (item.CanHaveTemperature())
10570 {
10572 if (item.CanFreeze())
10573 item.SetFrozen(false);
10574 }
10575
10576 if (item.HasEnergyManager())
10577 {
10578 if (quantity >= 0)
10579 {
10580 item.GetCompEM().SetEnergy0To1(quantity);
10581 }
10582 else
10583 {
10585 }
10586 }
10587 else if (item.IsMagazine())
10588 {
10589 Magazine mag = Magazine.Cast(item);
10590 if (quantity >= 0)
10591 {
10592 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
10593 }
10594 else
10595 {
10597 }
10598
10599 }
10600 else
10601 {
10602 if (quantity >= 0)
10603 {
10604 item.SetQuantityNormalized(quantity, false);
10605 }
10606 else
10607 {
10609 }
10610
10611 }
10612 }
10613}
10614
10615#ifdef DEVELOPER
10617#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.