5690{
5692 {
5693 return true;
5694 }
5695};
5696
5698{
5699
5700};
5701
5702
5703
5705{
5709
5711
5714
5715
5716
5717
5718
5727
5733
5738
5743
5764 protected bool m_IsResultOfSplit
5765
5767
5772
5773
5774
5776
5780
5781
5782
5784
5787
5788
5789
5795
5796
5804
5807
5808
5810
5811
5813
5814
5819
5820
5825
5827
5828
5830
5831
5833 {
5838
5839 if (!
g_Game.IsDedicatedServer())
5840 {
5842 {
5844
5846 {
5848 }
5849 }
5850
5853 }
5854
5855 m_OldLocation = null;
5856
5858 {
5860 }
5861
5862 if (ConfigIsExisting("headSelectionsToHide"))
5863 {
5866 }
5867
5869 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
5870 {
5872 }
5873
5875
5876 m_IsResultOfSplit = false;
5877
5879 }
5880
5882 {
5883 super.InitItemVariables();
5884
5890 m_Count = ConfigGetInt(
"count");
5891
5894
5899
5902
5907
5919
5923
5924
5927 if (ConfigIsExisting("canBeSplit"))
5928 {
5931 }
5932
5934 if (ConfigIsExisting("itemBehaviour"))
5936
5937
5940 RegisterNetSyncVariableInt("m_VarLiquidType");
5941 RegisterNetSyncVariableInt("m_Cleanness",0,1);
5942
5943 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
5944 RegisterNetSyncVariableFloat("m_ImpactSpeed");
5945 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
5946
5947 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
5948 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
5949 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
5950 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
5951
5952 RegisterNetSyncVariableBool("m_IsBeingPlaced");
5953 RegisterNetSyncVariableBool("m_IsTakeable");
5954 RegisterNetSyncVariableBool("m_IsHologram");
5955
5958 {
5961 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
5962 }
5963
5965
5967 if (ConfigIsExisting("temperaturePerQuantityWeight"))
5969
5971 }
5972
5974 {
5976 }
5977
5979 {
5982 {
5987 }
5988 }
5989
5990 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
5991 {
5993 {
5996 }
5997
5999 }
6000
6002 {
6008 }
6009
6011
6013 {
6015
6016 if (!action)
6017 {
6018 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
6019 return;
6020 }
6021
6023 if (!ai)
6024 {
6026 return;
6027 }
6028
6030 if (!action_array)
6031 {
6032 action_array = new array<ActionBase_Basic>;
6034 }
6035 if (LogManager.IsActionLogEnable())
6036 {
6037 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
6038 }
6039
6040 if (action_array.Find(action) != -1)
6041 {
6042 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
6043 }
6044 else
6045 {
6046 action_array.Insert(action);
6047 }
6048 }
6049
6051 {
6052 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6053 ActionBase action = player.GetActionManager().GetAction(actionName);
6056
6057 if (action_array)
6058 {
6059 action_array.RemoveItem(action);
6060 }
6061 }
6062
6063
6064
6066 {
6067 ActionOverrideData overrideData = new ActionOverrideData();
6071
6073 if (!actionMap)
6074 {
6077 }
6078
6079 actionMap.Insert(this.
Type(), overrideData);
6080
6081 }
6082
6084
6086
6087
6089 {
6092
6095
6096 string config_to_search = "CfgVehicles";
6097 string muzzle_owner_config;
6098
6100 {
6101 if (IsInherited(Weapon))
6102 config_to_search = "CfgWeapons";
6103
6104 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6105
6106 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
6107
6108 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
6109
6110 if (config_OnFire_subclass_count > 0)
6111 {
6112 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
6113
6114 for (int i = 0; i < config_OnFire_subclass_count; i++)
6115 {
6116 string particle_class = "";
6117 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
6118 string config_OnFire_entry = config_OnFire_class + particle_class;
6119 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
6120 WPOF_array.Insert(WPOF);
6121 }
6122
6123
6125 }
6126 }
6127
6129 {
6130 config_to_search = "CfgWeapons";
6131 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6132
6133 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
6134
6135 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
6136
6137 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
6138 {
6139 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
6140
6141 for (i = 0; i < config_OnBulletCasingEject_count; i++)
6142 {
6143 string particle_class2 = "";
6144 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
6145 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
6146 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
6147 WPOBE_array.Insert(WPOBE);
6148 }
6149
6150
6152 }
6153 }
6154 }
6155
6156
6158 {
6161
6163 {
6164 string config_to_search = "CfgVehicles";
6165
6166 if (IsInherited(Weapon))
6167 config_to_search = "CfgWeapons";
6168
6169 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6170 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
6171
6172 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
6173 {
6174
6176
6178 {
6180 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
6182 return;
6183 }
6184
6187
6188
6189
6190 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
6191 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
6192
6193 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
6194 {
6195 string particle_class = "";
6196 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
6197 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
6198 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
6199
6200 if (entry_type == CT_CLASS)
6201 {
6202 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
6203 WPOOH_array.Insert(WPOF);
6204 }
6205 }
6206
6207
6209 }
6210 }
6211 }
6212
6214 {
6216 }
6217
6219 {
6221 {
6223
6226
6229
6230 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6231 }
6232 }
6233
6235 {
6237 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6238
6240 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6241
6243 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6244
6246 {
6248 }
6249 }
6250
6252 {
6254 }
6255
6257 {
6260 else
6262
6264 {
6267 }
6268 else
6269 {
6272
6275 }
6276
6278 }
6279
6281 {
6283 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6284 }
6285
6287 {
6289 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6291 }
6292
6294 {
6296 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6297 }
6298
6300 {
6303
6304 OverheatingParticle OP = new OverheatingParticle();
6309
6311 }
6312
6314 {
6317
6318 return -1;
6319 }
6320
6322 {
6324 {
6327
6328 for (int i = count; i > 0; --i)
6329 {
6330 int id = i - 1;
6333
6336
6337 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
6338 {
6339 if (p)
6340 {
6343 }
6344 }
6345 }
6346 }
6347 }
6348
6350 {
6352 {
6354 {
6355 int id = i - 1;
6357
6358 if (OP)
6359 {
6361
6362 if (p)
6363 {
6365 }
6366
6367 delete OP;
6368 }
6369 }
6370
6373 }
6374 }
6375
6378 {
6379 return 0.0;
6380 }
6381
6382
6384 {
6385 return 250;
6386 }
6387
6389 {
6390 return 0;
6391 }
6392
6395 {
6397 return true;
6398
6399 return false;
6400 }
6401
6404 {
6407
6409 {
6411 }
6412 else
6413 {
6414
6416 }
6417
6419 }
6420
6427 {
6428 return -1;
6429 }
6430
6431
6432
6433
6435 {
6437 {
6438 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6439 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6440
6441 if (r_index >= 0)
6442 {
6443 InventoryLocation r_il = new InventoryLocation;
6444 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6445
6446 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6449 {
6450 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6451 }
6453 {
6454 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6455 }
6456
6457 }
6458
6459 player.GetHumanInventory().ClearUserReservedLocation(this);
6460 }
6461
6464 }
6465
6466
6467
6468
6470 {
6471 return ItemBase.m_DebugActionsMask;
6472 }
6473
6475 {
6476 return ItemBase.m_DebugActionsMask & mask;
6477 }
6478
6480 {
6481 ItemBase.m_DebugActionsMask = mask;
6482 }
6483
6485 {
6486 ItemBase.m_DebugActionsMask |= mask;
6487 }
6488
6490 {
6491 ItemBase.m_DebugActionsMask &= ~mask;
6492 }
6493
6495 {
6497 {
6499 }
6500 else
6501 {
6503 }
6504 }
6505
6506
6508 {
6509 if (GetEconomyProfile())
6510 {
6511 float q_max = GetEconomyProfile().GetQuantityMax();
6512 if (q_max > 0)
6513 {
6514 float q_min = GetEconomyProfile().GetQuantityMin();
6515 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
6516
6518 {
6519 ComponentEnergyManager comp = GetCompEM();
6521 {
6523 }
6524 }
6526 {
6528
6529 }
6530
6531 }
6532 }
6533 }
6534
6537 {
6538 EntityAI parent = GetHierarchyParent();
6539
6540 if (parent)
6541 {
6542 InventoryLocation inventory_location_to_lock = new InventoryLocation;
6543 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
6544 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
6545 }
6546 }
6547
6550 {
6551 EntityAI parent = GetHierarchyParent();
6552
6553 if (parent)
6554 {
6555 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
6556 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
6557 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
6558 }
6559 }
6560
6562 {
6563
6564
6565
6566
6568
6570 {
6571 if (ScriptInputUserData.CanStoreInputUserData())
6572 {
6573 ScriptInputUserData ctx = new ScriptInputUserData;
6579 ctx.
Write(use_stack_max);
6582
6584 {
6585 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
6586 }
6587 }
6588 }
6589 else if (!
g_Game.IsMultiplayer())
6590 {
6592 }
6593 }
6594
6596 {
6598 }
6599
6601 {
6603 }
6604
6606 {
6608 }
6609
6611 {
6612
6613 return false;
6614 }
6615
6617 {
6618 return false;
6619 }
6620
6624 {
6625 return false;
6626 }
6627
6629 {
6630 return "";
6631 }
6632
6634
6636 {
6637 return false;
6638 }
6639
6641 {
6642 return true;
6643 }
6644
6645
6646
6648 {
6649 return true;
6650 }
6651
6653 {
6654 return true;
6655 }
6656
6658 {
6659 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6661 }
6662
6664 {
6666 }
6667
6669 {
6671 if (!is_being_placed)
6673 SetSynchDirty();
6674 }
6675
6676
6678
6680 {
6682 }
6683
6685 {
6687 }
6688
6690 {
6691 return 1;
6692 }
6693
6695 {
6696 return false;
6697 }
6698
6700 {
6702 SetSynchDirty();
6703 }
6704
6705
6706
6707
6708
6709
6710
6711
6712
6713
6714
6715
6716
6717
6718
6719
6720
6721
6722
6723
6724
6725
6726
6727
6728
6729
6730
6731
6732
6733
6734
6735
6736
6737
6738
6740 {
6741 super.OnMovedInsideCargo(container);
6742
6743 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6744 }
6745
6746 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
6747 {
6748 super.EEItemLocationChanged(oldLoc, newLoc);
6749
6750 PlayerBase newPlayer = null;
6751 PlayerBase oldPlayer = null;
6752
6753 if (newLoc.GetParent())
6754 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
6755
6756 if (oldLoc.GetParent())
6757 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
6758
6760 {
6761 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
6762
6763 if (rIndex >= 0)
6764 {
6765 InventoryLocation rIl = new InventoryLocation;
6766 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
6767
6768 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
6771 {
6772 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
6773 }
6775 {
6777 }
6778
6779 }
6780 }
6781
6783 {
6784 if (newPlayer)
6785 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
6786
6787 if (newPlayer == oldPlayer)
6788 {
6789 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
6790 {
6792 {
6793 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
6794 {
6795 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6796 }
6797 }
6798 else
6799 {
6800 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6801 }
6802 }
6803
6804 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
6805 {
6806 int type = oldLoc.GetType();
6808 {
6809 oldLoc.GetParent().GetOnSetLock().Invoke(this);
6810 }
6812 {
6813 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
6814 }
6815 }
6816 if (!m_OldLocation)
6817 {
6818 m_OldLocation = new InventoryLocation;
6819 }
6820 m_OldLocation.Copy(oldLoc);
6821 }
6822 else
6823 {
6824 if (m_OldLocation)
6825 {
6826 m_OldLocation.Reset();
6827 }
6828 }
6829
6830 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
6831 }
6832 else
6833 {
6834 if (newPlayer)
6835 {
6836 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
6837 if (resIndex >= 0)
6838 {
6839 InventoryLocation il = new InventoryLocation;
6840 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
6842 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
6845 {
6846 il.
GetParent().GetOnReleaseLock().Invoke(it);
6847 }
6849 {
6851 }
6852
6853 }
6854 }
6856 {
6857
6859 }
6860
6861 if (m_OldLocation)
6862 {
6863 m_OldLocation.Reset();
6864 }
6865 }
6866
6868 {
6869 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
6870 }
6871
6873 {
6874 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
6875 }
6876 }
6877
6878 override void EOnContact(IEntity other, Contact extra)
6879 {
6881 {
6882 int liquidType = -1;
6884 if (impactSpeed > 0.0)
6885 {
6887 #ifndef SERVER
6889 #else
6891 SetSynchDirty();
6892 #endif
6894 }
6895 }
6896
6897 #ifdef SERVER
6898 if (GetCompEM() && GetCompEM().IsPlugged())
6899 {
6900 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
6901 GetCompEM().UnplugThis();
6902 }
6903 #endif
6904 }
6905
6907
6909 {
6911 }
6912
6914 {
6915
6916 }
6917
6919 {
6920 super.OnItemLocationChanged(old_owner, new_owner);
6921
6922 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
6923 PlayerBase playerNew = PlayerBase.Cast(new_owner);
6924
6925 if (!relatedPlayer && playerNew)
6926 relatedPlayer = playerNew;
6927
6928 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
6929 {
6931 if (actionMgr)
6932 {
6933 ActionBase currentAction = actionMgr.GetRunningAction();
6934 if (currentAction)
6936 }
6937 }
6938
6939 Man ownerPlayerOld = null;
6940 Man ownerPlayerNew = null;
6941
6942 if (old_owner)
6943 {
6944 if (old_owner.
IsMan())
6945 {
6946 ownerPlayerOld = Man.Cast(old_owner);
6947 }
6948 else
6949 {
6950 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
6951 }
6952 }
6953 else
6954 {
6956 {
6958
6959 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
6960 {
6961 GetCompEM().UnplugThis();
6962 }
6963 }
6964 }
6965
6966 if (new_owner)
6967 {
6968 if (new_owner.
IsMan())
6969 {
6970 ownerPlayerNew = Man.Cast(new_owner);
6971 }
6972 else
6973 {
6974 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
6975 }
6976 }
6977
6978 if (ownerPlayerOld != ownerPlayerNew)
6979 {
6980 if (ownerPlayerOld)
6981 {
6982 array<EntityAI> subItemsExit = new array<EntityAI>;
6984 for (int i = 0; i < subItemsExit.Count(); i++)
6985 {
6988 }
6989 }
6990
6991 if (ownerPlayerNew)
6992 {
6993 array<EntityAI> subItemsEnter = new array<EntityAI>;
6995 for (int j = 0; j < subItemsEnter.Count(); j++)
6996 {
6999 }
7000 }
7001 }
7002 else if (ownerPlayerNew != null)
7003 {
7004 PlayerBase nplayer;
7005 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
7006 {
7007 array<EntityAI> subItemsUpdate = new array<EntityAI>;
7009 for (int k = 0; k < subItemsUpdate.Count(); k++)
7010 {
7012 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
7013 }
7014 }
7015 }
7016
7017 if (old_owner)
7018 old_owner.OnChildItemRemoved(this);
7019 if (new_owner)
7020 new_owner.OnChildItemReceived(this);
7021 }
7022
7023
7025 {
7026 super.EEDelete(parent);
7027 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
7028 if (player)
7029 {
7031
7032 if (player.IsAlive())
7033 {
7034 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7035 if (r_index >= 0)
7036 {
7037 InventoryLocation r_il = new InventoryLocation;
7038 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7039
7040 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7043 {
7044 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7045 }
7047 {
7048 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7049 }
7050
7051 }
7052
7053 player.RemoveQuickBarEntityShortcut(this);
7054 }
7055 }
7056 }
7057
7059 {
7060 super.EEKilled(killer);
7061
7064 {
7065 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
7066 {
7067 if (IsMagazine())
7068 {
7069 if (Magazine.Cast(this).GetAmmoCount() > 0)
7070 {
7072 }
7073 }
7074 else
7075 {
7077 }
7078 }
7079 }
7080 }
7081
7083 {
7084 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7085
7086 super.OnWasAttached(parent, slot_id);
7087
7090
7093 }
7094
7096 {
7097 super.OnWasDetached(parent, slot_id);
7098
7101
7104 }
7105
7107 {
7108 int idx;
7111
7112 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7113 if (inventory_slots.Count() < 1)
7114 {
7115 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
7116 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
7117 }
7118 else
7119 {
7120 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
7121 }
7122
7123 idx = inventory_slots.Find(slot);
7124 if (idx < 0)
7125 return "";
7126
7127 return attach_types.Get(idx);
7128 }
7129
7131 {
7132 int idx = -1;
7133 string slot;
7134
7137
7138 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7139 if (inventory_slots.Count() < 1)
7140 {
7141 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
7142 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7143 }
7144 else
7145 {
7146 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
7147 if (detach_types.Count() < 1)
7148 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7149 }
7150
7151 for (int i = 0; i < inventory_slots.Count(); i++)
7152 {
7153 slot = inventory_slots.Get(i);
7154 }
7155
7156 if (slot != "")
7157 {
7158 if (detach_types.Count() == 1)
7159 idx = 0;
7160 else
7161 idx = inventory_slots.Find(slot);
7162 }
7163 if (idx < 0)
7164 return "";
7165
7166 return detach_types.Get(idx);
7167 }
7168
7170 {
7171
7173
7174
7175 float min_time = 1;
7176 float max_time = 3;
7177 float delay = Math.RandomFloat(min_time, max_time);
7178
7179 explode_timer.Run(delay, this, "DoAmmoExplosion");
7180 }
7181
7183 {
7184 Magazine magazine = Magazine.Cast(this);
7185 int pop_sounds_count = 6;
7186 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
7187
7188
7189 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
7190 string sound_name = pop_sounds[ sound_idx ];
7191 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
7192
7193
7194 magazine.ServerAddAmmoCount(-1);
7195
7196
7197 float min_temp_to_explode = 100;
7198
7199 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
7200 {
7202 }
7203 }
7204
7205
7206 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
7207 {
7208 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
7209
7210 const int CHANCE_DAMAGE_CARGO = 4;
7211 const int CHANCE_DAMAGE_ATTACHMENT = 1;
7212 const int CHANCE_DAMAGE_NOTHING = 2;
7213
7215 {
7216 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
7217 int chances;
7218 int rnd;
7219
7220 if (GetInventory().GetCargo())
7221 {
7222 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7223 rnd = Math.RandomInt(0,chances);
7224
7225 if (rnd < CHANCE_DAMAGE_CARGO)
7226 {
7228 }
7229 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
7230 {
7232 }
7233 }
7234 else
7235 {
7236 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7237 rnd = Math.RandomInt(0,chances);
7238
7239 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
7240 {
7242 }
7243 }
7244 }
7245 }
7246
7248 {
7249 CargoBase cargo = GetInventory().GetCargo();
7250 if (cargo)
7251 {
7253 if (item_count > 0)
7254 {
7255 int random_pick = Math.RandomInt(0, item_count);
7257 if (!item.IsExplosive())
7258 {
7259 item.AddHealth("","",damage);
7260 return true;
7261 }
7262 }
7263 }
7264 return false;
7265 }
7266
7268 {
7269 GameInventory inventory = GetInventory();
7271 if (attachment_count > 0)
7272 {
7273 int random_pick = Math.RandomInt(0, attachment_count);
7275 if (!attachment.IsExplosive())
7276 {
7277 attachment.AddHealth("","",damage);
7278 return true;
7279 }
7280 }
7281 return false;
7282 }
7283
7285 {
7287 }
7288
7290 {
7292 return GetInventory().CanRemoveEntity();
7293
7294 return false;
7295 }
7296
7298 {
7299
7301 return false;
7302
7303
7305 return false;
7306
7307
7308
7310 if (delta == 0)
7311 return false;
7312
7313
7314 return true;
7315 }
7316
7318 {
7320 {
7321 if (ScriptInputUserData.CanStoreInputUserData())
7322 {
7323 ScriptInputUserData ctx = new ScriptInputUserData;
7328 ctx.
Write(destination_entity);
7332 }
7333 }
7334 else if (!
g_Game.IsMultiplayer())
7335 {
7337 }
7338 }
7339
7341 {
7342 float split_quantity_new;
7346 InventoryLocation loc = new InventoryLocation;
7347
7348 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7349 {
7351 split_quantity_new = stack_max;
7352 else
7354
7356 {
7357 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7358 if (new_item)
7359 {
7360 new_item.SetResultOfSplit(true);
7361 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7363 new_item.
SetQuantity(split_quantity_new,
false,
true);
7364 }
7365 }
7366 }
7367 else if (destination_entity && slot_id == -1)
7368 {
7369 if (quantity > stack_max)
7370 split_quantity_new = stack_max;
7371 else
7372 split_quantity_new = quantity;
7373
7375 {
7376 GameInventory destinationInventory = destination_entity.GetInventory();
7378 {
7381 }
7382
7383 if (new_item)
7384 {
7385 new_item.SetResultOfSplit(true);
7386 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7388 new_item.
SetQuantity(split_quantity_new,
false,
true);
7389 }
7390 }
7391 }
7392 else
7393 {
7394 if (stack_max != 0)
7395 {
7397 {
7399 }
7400
7401 if (split_quantity_new == 0)
7402 {
7403 if (!
g_Game.IsMultiplayer())
7404 player.PhysicalPredictiveDropItem(this);
7405 else
7406 player.ServerDropEntity(this);
7407 return;
7408 }
7409
7411 {
7413
7414 if (new_item)
7415 {
7416 new_item.SetResultOfSplit(true);
7417 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7420 new_item.PlaceOnSurface();
7421 }
7422 }
7423 }
7424 }
7425 }
7426
7428 {
7429 float split_quantity_new;
7433 InventoryLocation loc = new InventoryLocation;
7434
7435 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7436 {
7438 split_quantity_new = stack_max;
7439 else
7441
7443 {
7444 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7445 if (new_item)
7446 {
7447 new_item.SetResultOfSplit(true);
7448 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7450 new_item.
SetQuantity(split_quantity_new,
false,
true);
7451 }
7452 }
7453 }
7454 else if (destination_entity && slot_id == -1)
7455 {
7456 if (quantity > stack_max)
7457 split_quantity_new = stack_max;
7458 else
7459 split_quantity_new = quantity;
7460
7462 {
7463 GameInventory destinationInventory = destination_entity.GetInventory();
7465 {
7468 }
7469
7470 if (new_item)
7471 {
7472 new_item.SetResultOfSplit(true);
7473 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7475 new_item.
SetQuantity(split_quantity_new,
false,
true);
7476 }
7477 }
7478 }
7479 else
7480 {
7481 if (stack_max != 0)
7482 {
7484 {
7486 }
7487
7489 {
7491
7492 if (new_item)
7493 {
7494 new_item.SetResultOfSplit(true);
7495 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7498 new_item.PlaceOnSurface();
7499 }
7500 }
7501 }
7502 }
7503 }
7504
7506 {
7508 {
7509 if (ScriptInputUserData.CanStoreInputUserData())
7510 {
7511 ScriptInputUserData ctx = new ScriptInputUserData;
7516 dst.WriteToContext(ctx);
7518 }
7519 }
7520 else if (!
g_Game.IsMultiplayer())
7521 {
7523 }
7524 }
7525
7527 {
7529 {
7530 if (ScriptInputUserData.CanStoreInputUserData())
7531 {
7532 ScriptInputUserData ctx = new ScriptInputUserData;
7537 ctx.
Write(destination_entity);
7543 }
7544 }
7545 else if (!
g_Game.IsMultiplayer())
7546 {
7548 }
7549 }
7550
7552 {
7554 }
7555
7557 {
7559 float split_quantity_new;
7561 if (dst.IsValid())
7562 {
7563 int slot_id = dst.GetSlot();
7565
7566 if (quantity > stack_max)
7567 split_quantity_new = stack_max;
7568 else
7569 split_quantity_new = quantity;
7570
7572 {
7574
7575 if (new_item)
7576 {
7577 new_item.SetResultOfSplit(true);
7578 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7580 new_item.
SetQuantity(split_quantity_new,
false,
true);
7581 }
7582
7583 return new_item;
7584 }
7585 }
7586
7587 return null;
7588 }
7589
7591 {
7593 float split_quantity_new;
7595 if (destination_entity)
7596 {
7598 if (quantity > stackable)
7599 split_quantity_new = stackable;
7600 else
7601 split_quantity_new = quantity;
7602
7604 {
7605 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
7606 if (new_item)
7607 {
7608 new_item.SetResultOfSplit(true);
7609 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7611 new_item.
SetQuantity(split_quantity_new,
false,
true);
7612 }
7613 }
7614 }
7615 }
7616
7618 {
7620 {
7621 if (ScriptInputUserData.CanStoreInputUserData())
7622 {
7623 ScriptInputUserData ctx = new ScriptInputUserData;
7628 ItemBase destination_entity =
this;
7629 ctx.
Write(destination_entity);
7633 }
7634 }
7635 else if (!
g_Game.IsMultiplayer())
7636 {
7638 }
7639 }
7640
7642 {
7644 float split_quantity_new;
7646 if (player)
7647 {
7649 if (quantity > stackable)
7650 split_quantity_new = stackable;
7651 else
7652 split_quantity_new = quantity;
7653
7655 {
7656 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
7657 new_item =
ItemBase.Cast(in_hands);
7658 if (new_item)
7659 {
7660 new_item.SetResultOfSplit(true);
7661 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7663 new_item.SetQuantity(split_quantity_new, false, true);
7664 }
7665 }
7666 }
7667 }
7668
7670 {
7672 float split_quantity_new = Math.Floor(quantity * 0.5);
7673
7675 return;
7676
7678
7679 if (new_item)
7680 {
7681 if (new_item.GetQuantityMax() < split_quantity_new)
7682 {
7683 split_quantity_new = new_item.GetQuantityMax();
7684 }
7685
7686 new_item.SetResultOfSplit(true);
7687 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7688
7690 {
7693 }
7694 else
7695 {
7697 new_item.
SetQuantity(split_quantity_new,
false,
true);
7698 }
7699 }
7700 }
7701
7703 {
7705 float split_quantity_new = Math.Floor(quantity / 2);
7706
7708 return;
7709
7710 InventoryLocation invloc = new InventoryLocation;
7712
7714 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
7715
7716 if (new_item)
7717 {
7718 if (new_item.GetQuantityMax() < split_quantity_new)
7719 {
7720 split_quantity_new = new_item.GetQuantityMax();
7721 }
7723 {
7726 }
7727 else if (split_quantity_new > 1)
7728 {
7730 new_item.
SetQuantity(split_quantity_new,
false,
true);
7731 }
7732 }
7733 }
7734
7737 {
7738 SetWeightDirty();
7740
7741 if (parent)
7742 parent.OnAttachmentQuantityChangedEx(this, delta);
7743
7745 {
7747 {
7749 }
7751 {
7752 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
7754 }
7755 }
7756 }
7757
7760 {
7761
7762 }
7763
7766 {
7768 }
7769
7771 {
7772 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
7773
7775 {
7776 if (newLevel == GameConstants.STATE_RUINED)
7777 {
7779 EntityAI parent = GetHierarchyParent();
7780 if (parent && parent.IsFireplace())
7781 {
7782 CargoBase cargo = GetInventory().GetCargo();
7783 if (cargo)
7784 {
7786 {
7788 }
7789 }
7790 }
7791 }
7792
7794 {
7795
7797 return;
7798 }
7799
7800 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
7801 {
7803 }
7804 }
7805 }
7806
7807
7809 {
7810 super.OnRightClick();
7811
7813 {
7815 {
7816 if (ScriptInputUserData.CanStoreInputUserData())
7817 {
7818 EntityAI root = GetHierarchyRoot();
7819 Man playerOwner = GetHierarchyRootPlayer();
7820 InventoryLocation dst = new InventoryLocation;
7821
7822
7823 if (!playerOwner && root && root == this)
7824 {
7826 }
7827 else
7828 {
7829
7830 GetInventory().GetCurrentInventoryLocation(dst);
7832 {
7833 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7835 {
7837 }
7838 else
7839 {
7841
7842
7843 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
7844 {
7846 }
7847 else
7848 {
7849 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
7850 }
7851 }
7852 }
7853 }
7854
7855 ScriptInputUserData ctx = new ScriptInputUserData;
7863 }
7864 }
7865 else if (!
g_Game.IsMultiplayer())
7866 {
7868 }
7869 }
7870 }
7871
7873 {
7874 if (root)
7875 {
7876 vector m4[4];
7877 root.GetTransform(m4);
7878 dst.SetGround(this, m4);
7879 }
7880 else
7881 {
7882 GetInventory().GetCurrentInventoryLocation(dst);
7883 }
7884 }
7885
7886 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
7887 {
7888
7889 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
7890 return false;
7891
7892 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
7893 return false;
7894
7895
7897 return false;
7898
7899
7900 Magazine mag = Magazine.Cast(this);
7901 if (mag)
7902 {
7903 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
7904 return false;
7905
7906 if (stack_max_limit)
7907 {
7908 Magazine other_mag = Magazine.Cast(other_item);
7909 if (other_item)
7910 {
7911 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
7912 return false;
7913 }
7914
7915 }
7916 }
7917 else
7918 {
7919
7921 return false;
7922
7924 return false;
7925 }
7926
7927 PlayerBase player = null;
7928 if (CastTo(player, GetHierarchyRootPlayer()))
7929 {
7930 if (player.GetInventory().HasAttachment(this))
7931 return false;
7932
7933 if (player.IsItemsToDelete())
7934 return false;
7935 }
7936
7937 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
7938 return false;
7939
7940 int slotID;
7942 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
7943 return false;
7944
7945 return true;
7946 }
7947
7949 {
7951 }
7952
7954 {
7955 return m_IsResultOfSplit;
7956 }
7957
7959 {
7960 m_IsResultOfSplit = value;
7961 }
7962
7964 {
7966 }
7967
7969 {
7970 float other_item_quantity = other_item.GetQuantity();
7971 float this_free_space;
7972
7974
7976
7977 if (other_item_quantity > this_free_space)
7978 {
7979 return this_free_space;
7980 }
7981 else
7982 {
7983 return other_item_quantity;
7984 }
7985 }
7986
7988 {
7990 }
7991
7993 {
7995 return;
7996
7997 if (!IsMagazine() && other_item)
7998 {
8000 if (quantity_used != 0)
8001 {
8002 float hp1 = GetHealth01("","");
8003 float hp2 = other_item.GetHealth01("","");
8004 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
8005 hpResult = hpResult / (
GetQuantity() + quantity_used);
8006
8007 hpResult *= GetMaxHealth();
8008 Math.Round(hpResult);
8009 SetHealth("", "Health", hpResult);
8010
8012 other_item.AddQuantity(-quantity_used);
8013 }
8014 }
8016 }
8017
8019 {
8020 #ifdef SERVER
8021 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
8022 GetHierarchyParent().IncreaseLifetimeUp();
8023 #endif
8024 };
8025
8027 {
8028 PlayerBase p = PlayerBase.Cast(player);
8029
8030 array<int> recipesIds = p.m_Recipes;
8031 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8032 if (moduleRecipesManager)
8033 {
8034 EntityAI itemInHands = player.GetEntityInHands();
8035 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
8036 }
8037
8038 for (int i = 0;i < recipesIds.Count(); i++)
8039 {
8040 int key = recipesIds.Get(i);
8041 string recipeName = moduleRecipesManager.GetRecipeName(key);
8043 }
8044 }
8045
8046
8047 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
8048 {
8049 super.GetDebugActions(outputList);
8050
8051
8057
8058
8063
8068
8069
8073
8074
8076 {
8080 }
8081
8084
8085
8089
8091
8092 InventoryLocation loc = new InventoryLocation();
8093 GetInventory().GetCurrentInventoryLocation(loc);
8095 {
8096 if (Gizmo_IsSupported())
8099 }
8100
8102 }
8103
8104
8105
8106
8108 {
8109 super.OnAction(action_id, player, ctx);
8110
8112 {
8113 switch (action_id)
8114 {
8118 return true;
8122 return true;
8123 }
8124 }
8125
8127 {
8128 switch (action_id)
8129 {
8131 Delete();
8132 return true;
8133 }
8134 }
8135
8136 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
8137 {
8138 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8139 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
8140 PlayerBase p = PlayerBase.Cast(player);
8141 if (
EActions.RECIPES_RANGE_START < 1000)
8142 {
8143 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
8144 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
8145 }
8146 }
8147 #ifndef SERVER
8148 else if (action_id ==
EActions.WATCH_PLAYER)
8149 {
8150 PluginDeveloper.SetDeveloperItemClientEx(player);
8151 }
8152 #endif
8154 {
8155 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
8156 {
8157 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
8158 OnDebugButtonPressServer(id + 1);
8159 }
8160
8161 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
8162 {
8163 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
8165 }
8166
8167 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
8168 {
8169 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
8171 }
8172
8173 else if (action_id ==
EActions.ADD_QUANTITY)
8174 {
8175 if (IsMagazine())
8176 {
8177 Magazine mag = Magazine.Cast(this);
8178 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
8179 }
8180 else
8181 {
8183 }
8184
8185 if (m_EM)
8186 {
8187 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
8188 }
8189
8190 }
8191
8192 else if (action_id ==
EActions.REMOVE_QUANTITY)
8193 {
8194 if (IsMagazine())
8195 {
8196 Magazine mag2 = Magazine.Cast(this);
8197 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
8198 }
8199 else
8200 {
8202 }
8203 if (m_EM)
8204 {
8205 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
8206 }
8207
8208 }
8209
8210 else if (action_id ==
EActions.SET_QUANTITY_0)
8211 {
8213
8214 if (m_EM)
8215 {
8216 m_EM.SetEnergy(0);
8217 }
8218 }
8219
8220 else if (action_id ==
EActions.SET_MAX_QUANTITY)
8221 {
8223
8224 if (m_EM)
8225 {
8226 m_EM.SetEnergy(m_EM.GetEnergyMax());
8227 }
8228 }
8229
8230 else if (action_id ==
EActions.ADD_HEALTH)
8231 {
8232 AddHealth("","",GetMaxHealth("","Health")/5);
8233 }
8234 else if (action_id ==
EActions.REMOVE_HEALTH)
8235 {
8236 AddHealth("","",-GetMaxHealth("","Health")/5);
8237 }
8238 else if (action_id ==
EActions.DESTROY_HEALTH)
8239 {
8240 SetHealth01("","",0);
8241 }
8242 else if (action_id ==
EActions.WATCH_ITEM)
8243 {
8245 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
8246 #ifdef DEVELOPER
8247 SetDebugDeveloper_item(this);
8248 #endif
8249 }
8250
8251 else if (action_id ==
EActions.ADD_TEMPERATURE)
8252 {
8253 AddTemperature(20);
8254
8255 }
8256
8257 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
8258 {
8259 AddTemperature(-20);
8260
8261 }
8262
8263 else if (action_id ==
EActions.FLIP_FROZEN)
8264 {
8265 SetFrozen(!GetIsFrozen());
8266
8267 }
8268
8269 else if (action_id ==
EActions.ADD_WETNESS)
8270 {
8272
8273 }
8274
8275 else if (action_id ==
EActions.REMOVE_WETNESS)
8276 {
8278
8279 }
8280
8281 else if (action_id ==
EActions.LIQUIDTYPE_UP)
8282 {
8285
8286
8287 }
8288
8289 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
8290 {
8293 }
8294
8295 else if (action_id ==
EActions.MAKE_SPECIAL)
8296 {
8297 auto debugParams = DebugSpawnParams.WithPlayer(player);
8298 OnDebugSpawnEx(debugParams);
8299 }
8300
8301 }
8302
8303
8304 return false;
8305 }
8306
8307
8308
8309
8313
8316
8317
8318
8320 {
8321 return false;
8322 }
8323
8324
8326 {
8327 return true;
8328 }
8329
8330
8332 {
8333 return true;
8334 }
8335
8336
8337
8339 {
8340 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
8341 return g_Game.ConfigIsExisting(config_path);
8342 }
8343
8346 {
8347 return null;
8348 }
8349
8351 {
8352 return false;
8353 }
8354
8356 {
8357 return false;
8358 }
8359
8363
8364
8366 {
8367 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8368 return module_repairing.CanRepair(this, item_repair_kit);
8369 }
8370
8371
8372 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
8373 {
8374 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8375 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
8376 }
8377
8378
8380 {
8381
8382
8383
8384
8385
8386
8387
8388
8389 return 1;
8390 }
8391
8392
8393
8395 {
8397 }
8398
8399
8400
8402 {
8404 }
8405
8406
8415 {
8416 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8417
8418 if (player)
8419 {
8420 player.MessageStatus(text);
8421 }
8422 }
8423
8424
8433 {
8434 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8435
8436 if (player)
8437 {
8438 player.MessageAction(text);
8439 }
8440 }
8441
8442
8451 {
8452 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8453
8454 if (player)
8455 {
8456 player.MessageFriendly(text);
8457 }
8458 }
8459
8460
8469 {
8470 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8471
8472 if (player)
8473 {
8474 player.MessageImportant(text);
8475 }
8476 }
8477
8479 {
8480 return true;
8481 }
8482
8483
8484 override bool KindOf(
string tag)
8485 {
8486 bool found = false;
8487 string item_name = this.
GetType();
8489 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
8490
8491 int array_size = item_tag_array.Count();
8492 for (int i = 0; i < array_size; i++)
8493 {
8494 if (item_tag_array.Get(i) == tag)
8495 {
8496 found = true;
8497 break;
8498 }
8499 }
8500 return found;
8501 }
8502
8503
8505 {
8506
8507 super.OnRPC(sender, rpc_type,ctx);
8508
8509
8510 switch (rpc_type)
8511 {
8512 #ifndef SERVER
8513 case ERPCs.RPC_SOUND_LOCK_ATTACH:
8514 Param2<bool, string> p = new Param2<bool, string>(false, "");
8515
8517 return;
8518
8519 bool play = p.param1;
8520 string soundSet = p.param2;
8521
8522 if (play)
8523 {
8525 {
8527 {
8529 }
8530 }
8531 else
8532 {
8534 }
8535 }
8536 else
8537 {
8539 }
8540
8541 break;
8542 #endif
8543
8544 }
8545
8547 {
8549 }
8550 }
8551
8552
8553
8554
8556 {
8557 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8558 return plugin.GetID(
name);
8559 }
8560
8562 {
8563 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8564 return plugin.GetName(id);
8565 }
8566
8569 {
8570
8571
8572 int varFlags;
8573 if (!ctx.
Read(varFlags))
8574 return;
8575
8576 if (varFlags & ItemVariableFlags.FLOAT)
8577 {
8579 }
8580 }
8581
8583 {
8584
8585 super.SerializeNumericalVars(floats_out);
8586
8587
8588
8590 {
8592 }
8593
8595 {
8597 }
8598
8600 {
8602 }
8603
8605 {
8610 }
8611
8613 {
8615 }
8616 }
8617
8619 {
8620
8621 super.DeSerializeNumericalVars(floats);
8622
8623
8624 int index = 0;
8625 int mask = Math.Round(floats.Get(index));
8626
8627 index++;
8628
8630 {
8632 {
8634 }
8635 else
8636 {
8637 float quantity = floats.Get(index);
8639 }
8640 index++;
8641 }
8642
8644 {
8645 float wet = floats.Get(index);
8647 index++;
8648 }
8649
8651 {
8652 int liquidtype = Math.Round(floats.Get(index));
8654 index++;
8655 }
8656
8658 {
8660 index++;
8662 index++;
8664 index++;
8666 index++;
8667 }
8668
8670 {
8671 int cleanness = Math.Round(floats.Get(index));
8673 index++;
8674 }
8675 }
8676
8678 {
8679 super.WriteVarsToCTX(ctx);
8680
8681
8683 {
8685 }
8686
8688 {
8690 }
8691
8693 {
8695 }
8696
8698 {
8699 int r,g,b,a;
8705 }
8706
8708 {
8710 }
8711 }
8712
8714 {
8715 if (!super.ReadVarsFromCTX(ctx,version))
8716 return false;
8717
8718 int intValue;
8719 float value;
8720
8721 if (version < 140)
8722 {
8723 if (!ctx.
Read(intValue))
8724 return false;
8725
8726 m_VariablesMask = intValue;
8727 }
8728
8730 {
8731 if (!ctx.
Read(value))
8732 return false;
8733
8735 {
8737 }
8738 else
8739 {
8741 }
8742 }
8743
8744 if (version < 140)
8745 {
8747 {
8748 if (!ctx.
Read(value))
8749 return false;
8750 SetTemperatureDirect(value);
8751 }
8752 }
8753
8755 {
8756 if (!ctx.
Read(value))
8757 return false;
8759 }
8760
8762 {
8763 if (!ctx.
Read(intValue))
8764 return false;
8766 }
8767
8769 {
8770 int r,g,b,a;
8772 return false;
8774 return false;
8776 return false;
8778 return false;
8779
8781 }
8782
8784 {
8785 if (!ctx.
Read(intValue))
8786 return false;
8788 }
8789
8790 if (version >= 138 && version < 140)
8791 {
8793 {
8794 if (!ctx.
Read(intValue))
8795 return false;
8796 SetFrozen(intValue);
8797 }
8798 }
8799
8800 return true;
8801 }
8802
8803
8805 {
8808 {
8810 }
8811
8812 if (!super.OnStoreLoad(ctx, version))
8813 {
8815 return false;
8816 }
8817
8818 if (version >= 114)
8819 {
8820 bool hasQuickBarIndexSaved;
8821
8822 if (!ctx.
Read(hasQuickBarIndexSaved))
8823 {
8825 return false;
8826 }
8827
8828 if (hasQuickBarIndexSaved)
8829 {
8830 int itmQBIndex;
8831
8832
8833 if (!ctx.
Read(itmQBIndex))
8834 {
8836 return false;
8837 }
8838
8839 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
8840 if (itmQBIndex != -1 && parentPlayer)
8841 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
8842 }
8843 }
8844 else
8845 {
8846
8847 PlayerBase player;
8848 int itemQBIndex;
8849 if (version ==
int.
MAX)
8850 {
8851 if (!ctx.
Read(itemQBIndex))
8852 {
8854 return false;
8855 }
8856 }
8857 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
8858 {
8859
8860 if (!ctx.
Read(itemQBIndex))
8861 {
8863 return false;
8864 }
8865 if (itemQBIndex != -1 && player)
8866 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
8867 }
8868 }
8869
8870 if (version < 140)
8871 {
8872
8873 if (!LoadVariables(ctx, version))
8874 {
8876 return false;
8877 }
8878 }
8879
8880
8882 {
8884 return false;
8885 }
8886 if (version >= 132)
8887 {
8889 if (raib)
8890 {
8892 {
8894 return false;
8895 }
8896 }
8897 }
8898
8900 return true;
8901 }
8902
8903
8904
8906 {
8907 super.OnStoreSave(ctx);
8908
8909 PlayerBase player;
8910 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
8911 {
8913
8914 int itemQBIndex = -1;
8915 itemQBIndex = player.FindQuickBarEntityIndex(this);
8916 ctx.
Write(itemQBIndex);
8917 }
8918 else
8919 {
8921 }
8922
8924
8926 if (raib)
8927 {
8929 }
8930 }
8931
8932
8934 {
8935 super.AfterStoreLoad();
8936
8938 {
8940 }
8941
8943 {
8946 }
8947 }
8948
8950 {
8951 super.EEOnAfterLoad();
8952
8954 {
8956 }
8957
8960 }
8961
8963 {
8964 return false;
8965 }
8966
8967
8968
8970 {
8972 {
8973 #ifdef PLATFORM_CONSOLE
8974
8976 {
8978 if (menu)
8979 {
8981 }
8982 }
8983 #endif
8984 }
8985
8987 {
8990 }
8991
8993 {
8994 SetWeightDirty();
8996 }
8998 {
9001 }
9002
9004 {
9007
9010 }
9012 {
9016 }
9017
9018 super.OnVariablesSynchronized();
9019 }
9020
9021
9022
9024 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
9025 {
9026 if (!IsServerCheck(allow_client))
9027 return false;
9028
9030 return false;
9031
9034
9035 if (value <= (min + 0.001))
9036 value = min;
9037
9038 if (value == min)
9039 {
9040 if (destroy_config)
9041 {
9042 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
9043 if (dstr)
9044 {
9046 this.Delete();
9047 return true;
9048 }
9049 }
9050 else if (destroy_forced)
9051 {
9053 this.Delete();
9054 return true;
9055 }
9056
9058 }
9059
9062
9064 {
9065 EntityAI parent = GetHierarchyRoot();
9066 InventoryLocation iLoc = new InventoryLocation();
9067 GetInventory().GetCurrentInventoryLocation(iLoc);
9069 {
9070 int iLocSlot = iLoc.
GetSlot();
9072 {
9074 }
9076 {
9078 }
9079 }
9080 }
9081
9083 {
9085
9086 if (delta)
9088 }
9089
9091
9092 return false;
9093 }
9094
9095
9097 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9098 {
9100 }
9101
9103 {
9106 }
9107
9109 {
9112 }
9113
9115 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9116 {
9117 float value_clamped = Math.Clamp(value, 0, 1);
9119 SetQuantity(result, destroy_config, destroy_forced);
9120 }
9121
9122
9125 {
9127 }
9128
9130 {
9132 }
9133
9134
9135
9136
9137
9138
9139
9140
9141
9142
9144 {
9145 int slot = -1;
9146 GameInventory inventory = GetInventory();
9147 if (inventory)
9148 {
9149 InventoryLocation il = new InventoryLocation;
9152 }
9153
9155 }
9156
9158 {
9159 float quantity_max = 0;
9160
9162 {
9163 if (attSlotID != -1)
9164 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
9165
9166 if (quantity_max <= 0)
9168 }
9169
9170 if (quantity_max <= 0)
9172
9173 return quantity_max;
9174 }
9175
9177 {
9179 }
9180
9182 {
9184 }
9185
9186
9188 {
9190 }
9191
9193 {
9195 }
9196
9198 {
9200 }
9201
9202
9204 {
9205
9206 float weightEx = GetWeightEx();
9207 float special = GetInventoryAndCargoWeight();
9208 return weightEx - special;
9209 }
9210
9211
9213 {
9215 }
9216
9218 {
9220 {
9221 #ifdef DEVELOPER
9222 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9223 {
9224 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
9226 }
9227 #endif
9228
9230 }
9231 else if (HasEnergyManager())
9232 {
9233 #ifdef DEVELOPER
9234 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9235 {
9236 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
9237 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
9238 }
9239 #endif
9240 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
9241 }
9242 else
9243 {
9244 #ifdef DEVELOPER
9245 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9246 {
9247 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
9248 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
9249 }
9250 #endif
9251 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
9252 }
9253 }
9254
9257 {
9258 int item_count = 0;
9260
9261 GameInventory inventory = GetInventory();
9262 CargoBase cargo = inventory.
GetCargo();
9263 if (cargo != NULL)
9264 {
9266 }
9267
9269 for (int i = 0; i < nAttachments; ++i)
9270 {
9272 if (item)
9273 item_count += item.GetNumberOfItems();
9274 }
9275 return item_count;
9276 }
9277
9280 {
9281 float weight = 0;
9282 float wetness = 1;
9283 if (include_wetness)
9286 {
9287 weight = wetness * m_ConfigWeight;
9288 }
9290 {
9291 weight = 1;
9292 }
9293 return weight;
9294 }
9295
9296
9297
9299 {
9300 GameInventory inventory = GetInventory();
9301 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
9302 {
9303 array<EntityAI> items = new array<EntityAI>;
9305 for (int i = 0; i < items.Count(); ++i)
9306 {
9308 if (item)
9309 {
9310 g_Game.ObjectDelete(item);
9311 }
9312 }
9313 }
9314 }
9315
9316
9317
9318
9320 {
9321 float energy = 0;
9322 if (HasEnergyManager())
9323 {
9324 energy = GetCompEM().GetEnergy();
9325 }
9326 return energy;
9327 }
9328
9329
9331 {
9332 super.OnEnergyConsumed();
9333
9335 }
9336
9338 {
9339 super.OnEnergyAdded();
9340
9342 }
9343
9344
9346 {
9347 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
9348 {
9350 {
9351 float energy_0to1 = GetCompEM().GetEnergy0To1();
9353 }
9354 }
9355 }
9356
9357
9359 {
9360 return ConfigGetFloat("heatIsolation");
9361 }
9362
9364 {
9366 }
9367
9369 {
9370 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
9371 if (
g_Game.ConfigIsExisting(paramPath))
9372 return g_Game.ConfigGetFloat(paramPath);
9373
9374 return 0.0;
9375 }
9376
9378 {
9379 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
9380 if (
g_Game.ConfigIsExisting(paramPath))
9381 return g_Game.ConfigGetFloat(paramPath);
9382
9383 return 0.0;
9384 }
9385
9386 override void SetWet(
float value,
bool allow_client =
false)
9387 {
9388 if (!IsServerCheck(allow_client))
9389 return;
9390
9393
9395
9396 m_VarWet = Math.Clamp(value, min, max);
9397
9399 {
9402 }
9403 }
9404
9405 override void AddWet(
float value)
9406 {
9408 }
9409
9411 {
9413 }
9414
9416 {
9418 }
9419
9421 {
9423 }
9424
9426 {
9428 }
9429
9431 {
9433 }
9434
9436 {
9439 if (newLevel != oldLevel)
9440 {
9442 }
9443 }
9444
9446 {
9447 SetWeightDirty();
9448 }
9449
9451 {
9452 return GetWetLevelInternal(
m_VarWet);
9453 }
9454
9455
9456
9458 {
9460 }
9461
9463 {
9465 }
9466
9468 {
9470 }
9471
9473 {
9475 }
9476
9477
9478
9480 {
9481 if (ConfigIsExisting("itemModelLength"))
9482 {
9483 return ConfigGetFloat("itemModelLength");
9484 }
9485 return 0;
9486 }
9487
9489 {
9490 if (ConfigIsExisting("itemAttachOffset"))
9491 {
9492 return ConfigGetFloat("itemAttachOffset");
9493 }
9494 return 0;
9495 }
9496
9497 override void SetCleanness(
int value,
bool allow_client =
false)
9498 {
9499 if (!IsServerCheck(allow_client))
9500 return;
9501
9503
9505
9508 }
9509
9511 {
9513 }
9514
9516 {
9517 return true;
9518 }
9519
9520
9521
9522
9524 {
9526 }
9527
9529 {
9531 }
9532
9533
9534
9535
9536 override void SetColor(
int r,
int g,
int b,
int a)
9537 {
9543 }
9545 override void GetColor(out
int r,out
int g,out
int b,out
int a)
9546 {
9551 }
9552
9554 {
9556 }
9557
9560 {
9561 int r,g,b,a;
9563 r = r/255;
9564 g = g/255;
9565 b = b/255;
9566 a = a/255;
9567 return MiscGameplayFunctions.GetColorString(r, g, b, a);
9568 }
9569
9570
9571
9572 override void SetLiquidType(
int value,
bool allow_client =
false)
9573 {
9574 if (!IsServerCheck(allow_client))
9575 return;
9576
9581 }
9582
9584 {
9585 return ConfigGetInt("varLiquidTypeInit");
9586 }
9587
9589 {
9591 }
9592
9594 {
9596 SetFrozen(false);
9597 }
9598
9601 {
9602 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9603 }
9604
9605
9608 {
9609 PlayerBase nplayer;
9610 if (PlayerBase.CastTo(nplayer, player))
9611 {
9613 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9614 }
9615 }
9616
9617
9620 {
9621 PlayerBase nplayer;
9622 if (PlayerBase.CastTo(nplayer,player))
9623 {
9624 nplayer.SetEnableQuickBarEntityShortcut(this, false);
9625 }
9626
9627 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
9628
9629 if (HasEnergyManager())
9630 {
9631 GetCompEM().UpdatePlugState();
9632 }
9633 }
9634
9635
9637 {
9638 super.OnPlacementStarted(player);
9639
9641 }
9642
9643 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
9644 {
9646 {
9647 m_AdminLog.OnPlacementComplete(player,
this);
9648 }
9649
9650 super.OnPlacementComplete(player, position, orientation);
9651 }
9652
9653
9654
9655
9656
9658 {
9660 {
9661 return true;
9662 }
9663 else
9664 {
9665 return false;
9666 }
9667 }
9668
9669
9671 {
9673 {
9675 }
9676 }
9677
9678
9680 {
9682 }
9683
9685 {
9687 }
9688
9689 override void InsertAgent(
int agent,
float count = 1)
9690 {
9691 if (count < 1)
9692 return;
9693
9695 }
9696
9699 {
9701 }
9702
9703
9705 {
9707 }
9708
9709
9710
9711
9712
9713
9714
9715
9716
9717
9718
9719
9720
9721
9722
9723
9724
9725
9726
9727
9728
9729
9730
9731
9732
9733
9734
9735
9736
9737
9738
9739
9740
9741
9742
9743
9744
9745
9746
9747
9748
9749
9751 {
9753 return false;
9754 return true;
9755 }
9756
9758 {
9759
9761 }
9762
9763
9766 {
9767 super.CheckForRoofLimited(timeTresholdMS);
9768
9769 float time =
g_Game.GetTime();
9770 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
9771 {
9772 m_PreviousRoofTestTime = time;
9773 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
9774 }
9775 }
9776
9777
9779 {
9781 {
9782 return 0;
9783 }
9784
9785 if (GetInventory().GetAttachmentSlotsCount() != 0)
9786 {
9787 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
9788 if (filter)
9789 return filter.GetProtectionLevel(type, false, system);
9790 else
9791 return 0;
9792 }
9793
9794 string subclassPath, entryName;
9795
9796 switch (type)
9797 {
9799 entryName = "biological";
9800 break;
9802 entryName = "chemical";
9803 break;
9804 default:
9805 entryName = "biological";
9806 break;
9807 }
9808
9809 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
9810
9811 return g_Game.ConfigGetFloat(subclassPath + entryName);
9812 }
9813
9814
9815
9818 {
9819 if (!IsMagazine())
9821
9823 }
9824
9825
9826
9827
9828
9833 {
9834 return true;
9835 }
9836
9838 {
9840 }
9841
9842
9843
9844
9845
9847 {
9848 if (parent)
9849 {
9850 if (parent.IsInherited(DayZInfected))
9851 return true;
9852
9853 if (!parent.IsRuined())
9854 return true;
9855 }
9856
9857 return true;
9858 }
9859
9861 {
9862 if (!super.CanPutAsAttachment(parent))
9863 {
9864 return false;
9865 }
9866
9867 if (!IsRuined() && !parent.IsRuined())
9868 {
9869 return true;
9870 }
9871
9872 return false;
9873 }
9874
9876 {
9877
9878
9879
9880
9881 return super.CanReceiveItemIntoCargo(item);
9882 }
9883
9885 {
9886
9887
9888
9889
9890 GameInventory attachmentInv = attachment.GetInventory();
9892 {
9893 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
9894 return false;
9895 }
9896
9897 InventoryLocation loc = new InventoryLocation();
9898 attachment.GetInventory().GetCurrentInventoryLocation(loc);
9899 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
9900 return false;
9901
9902 return super.CanReceiveAttachment(attachment, slotId);
9903 }
9904
9906 {
9907 if (!super.CanReleaseAttachment(attachment))
9908 return false;
9909
9910 return GetInventory().AreChildrenAccessible();
9911 }
9912
9913
9914
9915
9916
9917
9918
9919
9920
9921
9922
9923
9924
9925
9926
9927
9928
9929
9930
9931
9932
9934 {
9935 int id = muzzle_owner.GetMuzzleID();
9936 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
9937
9938 if (WPOF_array)
9939 {
9940 for (int i = 0; i < WPOF_array.Count(); i++)
9941 {
9942 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
9943
9944 if (WPOF)
9945 {
9946 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
9947 }
9948 }
9949 }
9950 }
9951
9952
9954 {
9955 int id = muzzle_owner.GetMuzzleID();
9957
9958 if (WPOBE_array)
9959 {
9960 for (int i = 0; i < WPOBE_array.Count(); i++)
9961 {
9962 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
9963
9964 if (WPOBE)
9965 {
9966 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
9967 }
9968 }
9969 }
9970 }
9971
9972
9974 {
9975 int id = muzzle_owner.GetMuzzleID();
9976 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9977
9978 if (WPOOH_array)
9979 {
9980 for (int i = 0; i < WPOOH_array.Count(); i++)
9981 {
9982 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9983
9984 if (WPOOH)
9985 {
9986 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
9987 }
9988 }
9989 }
9990 }
9991
9992
9994 {
9995 int id = muzzle_owner.GetMuzzleID();
9996 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9997
9998 if (WPOOH_array)
9999 {
10000 for (int i = 0; i < WPOOH_array.Count(); i++)
10001 {
10002 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10003
10004 if (WPOOH)
10005 {
10006 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10007 }
10008 }
10009 }
10010 }
10011
10012
10014 {
10015 int id = muzzle_owner.GetMuzzleID();
10016 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10017
10018 if (WPOOH_array)
10019 {
10020 for (int i = 0; i < WPOOH_array.Count(); i++)
10021 {
10022 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10023
10024 if (WPOOH)
10025 {
10026 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10027 }
10028 }
10029 }
10030 }
10031
10032
10033
10035 {
10037 {
10038 return true;
10039 }
10040
10041 return false;
10042 }
10043
10045 {
10047 {
10048 return true;
10049 }
10050
10051 return false;
10052 }
10053
10055 {
10057 {
10058 return true;
10059 }
10060
10061 return false;
10062 }
10063
10065 {
10066 return false;
10067 }
10068
10071 {
10072 return UATimeSpent.DEFAULT_DEPLOY;
10073 }
10074
10075
10076
10077
10079 {
10081 SetSynchDirty();
10082 }
10083
10085 {
10087 }
10088
10089
10091 {
10092 return false;
10093 }
10094
10097 {
10098 string att_type = "None";
10099
10100 if (ConfigIsExisting("soundAttType"))
10101 {
10102 att_type = ConfigGetString("soundAttType");
10103 }
10104
10106 }
10107
10109 {
10111 }
10112
10113
10114
10115
10116
10122
10124 {
10127
10129 }
10130
10131
10133 {
10135 return;
10136
10138
10141
10144
10145 SoundParameters params = new SoundParameters();
10149 }
10150
10151
10153 {
10155 {
10158
10159 SetSynchDirty();
10160
10163 }
10164 }
10165
10167 {
10169 }
10170
10171
10173 {
10175 return;
10176
10178 SetSynchDirty();
10179
10182 }
10183
10185 {
10188 }
10189
10191 {
10193 }
10194
10195 void OnApply(PlayerBase player);
10196
10198 {
10199 return 1.0;
10200 };
10201
10203 {
10205 }
10206
10208 {
10210 }
10211
10213
10215 {
10216 SetDynamicPhysicsLifeTime(0.01);
10218 }
10219
10221 {
10222 array<string> zone_names = new array<string>;
10223 GetDamageZones(zone_names);
10224 for (int i = 0; i < zone_names.Count(); i++)
10225 {
10226 SetHealthMax(zone_names.Get(i),"Health");
10227 }
10228 SetHealthMax("","Health");
10229 }
10230
10233 {
10234 float global_health = GetHealth01("","Health");
10235 array<string> zones = new array<string>;
10236 GetDamageZones(zones);
10237
10238 for (int i = 0; i < zones.Count(); i++)
10239 {
10240 SetHealth01(zones.Get(i),"Health",global_health);
10241 }
10242 }
10243
10246 {
10247 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
10248 }
10249
10251 {
10252 if (!hasRootAsPlayer)
10253 {
10254 if (refParentIB)
10255 {
10256
10257 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
10258 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
10259
10260 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
10261 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
10262
10265 }
10266 else
10267 {
10268
10271 }
10272 }
10273 }
10274
10276 {
10278 {
10279 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
10280 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
10281 {
10282 float heatPermCoef = 1.0;
10284 while (ent)
10285 {
10286 heatPermCoef *= ent.GetHeatPermeabilityCoef();
10287 ent = ent.GetHierarchyParent();
10288 }
10289
10290 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
10291 }
10292 }
10293 }
10294
10296 {
10297
10298 EntityAI parent = GetHierarchyParent();
10299 if (!parent)
10300 {
10301 hasParent = false;
10302 hasRootAsPlayer = false;
10303 }
10304 else
10305 {
10306 hasParent = true;
10307 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
10308 refParentIB =
ItemBase.Cast(parent);
10309 }
10310 }
10311
10312 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
10313 {
10314
10315 }
10316
10318 {
10319
10320 return false;
10321 }
10322
10324 {
10325
10326
10327 return false;
10328 }
10329
10331 {
10332
10333 return false;
10334 }
10335
10338 {
10339 return !GetIsFrozen() &&
IsOpen();
10340 }
10341
10343 {
10344 bool hasParent = false, hasRootAsPlayer = false;
10346
10347 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
10348 bool foodDecay =
g_Game.IsFoodDecayEnabled();
10349
10350 if (wwtu || foodDecay)
10351 {
10355
10356 if (processWetness || processTemperature || processDecay)
10357 {
10359
10360 if (processWetness)
10361 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
10362
10363 if (processTemperature)
10365
10366 if (processDecay)
10367 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
10368 }
10369 }
10370 }
10371
10374 {
10376 }
10377
10379 {
10382
10383 return super.GetTemperatureFreezeThreshold();
10384 }
10385
10387 {
10390
10391 return super.GetTemperatureThawThreshold();
10392 }
10393
10395 {
10398
10399 return super.GetItemOverheatThreshold();
10400 }
10401
10403 {
10405 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
10406
10407 return super.GetTemperatureFreezeTime();
10408 }
10409
10411 {
10413 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
10414
10415 return super.GetTemperatureThawTime();
10416 }
10417
10422
10424 {
10425 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
10426 }
10427
10429 {
10430 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
10431 }
10432
10435 {
10437 }
10438
10440 {
10442 }
10443
10445 {
10447 }
10448
10451 {
10452 return null;
10453 }
10454
10457 {
10458 return false;
10459 }
10460
10462 {
10464 {
10467 if (!trg)
10468 {
10470 explosive = this;
10471 }
10472
10473 explosive.PairRemote(trg);
10475
10476 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
10477 trg.SetPersistentPairID(persistentID);
10478 explosive.SetPersistentPairID(persistentID);
10479
10480 return true;
10481 }
10482 return false;
10483 }
10484
10487 {
10488 float ret = 1.0;
10491 ret *= GetHealth01();
10492
10493 return ret;
10494 }
10495
10496 #ifdef DEVELOPER
10497 override void SetDebugItem()
10498 {
10499 super.SetDebugItem();
10500 _itemBase = this;
10501 }
10502
10504 {
10505 string text = super.GetDebugText();
10506
10508 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
10509
10510 return text;
10511 }
10512 #endif
10513
10515 {
10516 return true;
10517 }
10518
10520
10522
10524 {
10527 }
10528
10529
10537
10553
10554 [
Obsolete(
"Use ItemSoundHandler instead")]
10557 {
10558 if (!
g_Game.IsDedicatedServer())
10559 {
10560 if (ConfigIsExisting("attachSoundSet"))
10561 {
10562 string cfg_path = "";
10563 string soundset = "";
10564 string type_name =
GetType();
10565
10568 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
10569 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
10570
10571 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
10572 {
10573 for (int i = 0; i < cfg_soundset_array.Count(); i++)
10574 {
10575 if (cfg_slot_array[i] == slot_type)
10576 {
10577 soundset = cfg_soundset_array[i];
10578 break;
10579 }
10580 }
10581 }
10582
10583 if (soundset != "")
10584 {
10585 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
10587 }
10588 }
10589 }
10590 }
10591
10593}
10594
10596{
10598 if (entity)
10599 {
10600 bool is_item = entity.IsInherited(
ItemBase);
10601 if (is_item && full_quantity)
10602 {
10605 }
10606 }
10607 else
10608 {
10610 return NULL;
10611 }
10612 return entity;
10613}
10614
10616{
10617 if (item)
10618 {
10619 if (health > 0)
10620 item.SetHealth("", "", health);
10621
10622 if (item.CanHaveTemperature())
10623 {
10625 if (item.CanFreeze())
10626 item.SetFrozen(false);
10627 }
10628
10629 if (item.HasEnergyManager())
10630 {
10631 if (quantity >= 0)
10632 {
10633 item.GetCompEM().SetEnergy0To1(quantity);
10634 }
10635 else
10636 {
10638 }
10639 }
10640 else if (item.IsMagazine())
10641 {
10642 Magazine mag = Magazine.Cast(item);
10643 if (quantity >= 0)
10644 {
10645 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
10646 }
10647 else
10648 {
10650 }
10651
10652 }
10653 else
10654 {
10655 if (quantity >= 0)
10656 {
10657 item.SetQuantityNormalized(quantity, false);
10658 }
10659 else
10660 {
10662 }
10663
10664 }
10665 }
10666}
10667
10668#ifdef DEVELOPER
10670#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.