5685{
5687 {
5688 return true;
5689 }
5690};
5691
5693{
5694
5695};
5696
5697
5698
5700{
5704
5706
5709
5710
5711
5712
5713
5722
5728
5733
5738
5759 protected bool m_IsResultOfSplit
5760
5762
5767
5768
5769
5771
5775
5776
5777
5779
5782
5783
5784
5790
5791
5799
5802
5803
5805
5806
5808
5809
5814
5815
5820
5822
5823
5825
5826
5828 {
5833
5834 if (!
g_Game.IsDedicatedServer())
5835 {
5837 {
5839
5841 {
5843 }
5844 }
5845
5848 }
5849
5850 m_OldLocation = null;
5851
5853 {
5855 }
5856
5857 if (ConfigIsExisting("headSelectionsToHide"))
5858 {
5861 }
5862
5864 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
5865 {
5867 }
5868
5870
5871 m_IsResultOfSplit = false;
5872
5874 }
5875
5877 {
5878 super.InitItemVariables();
5879
5885 m_Count = ConfigGetInt(
"count");
5886
5889
5894
5897
5902
5914
5918
5919
5922 if (ConfigIsExisting("canBeSplit"))
5923 {
5926 }
5927
5929 if (ConfigIsExisting("itemBehaviour"))
5931
5932
5935 RegisterNetSyncVariableInt("m_VarLiquidType");
5936 RegisterNetSyncVariableInt("m_Cleanness",0,1);
5937
5938 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
5939 RegisterNetSyncVariableFloat("m_ImpactSpeed");
5940 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
5941
5942 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
5943 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
5944 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
5945 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
5946
5947 RegisterNetSyncVariableBool("m_IsBeingPlaced");
5948 RegisterNetSyncVariableBool("m_IsTakeable");
5949 RegisterNetSyncVariableBool("m_IsHologram");
5950
5953 {
5956 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
5957 }
5958
5960
5962 if (ConfigIsExisting("temperaturePerQuantityWeight"))
5964
5966 }
5967
5969 {
5971 }
5972
5974 {
5977 {
5982 }
5983 }
5984
5985 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
5986 {
5988 {
5991 }
5992
5994 }
5995
5997 {
6003 }
6004
6006
6008 {
6010
6011 if (!action)
6012 {
6013 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
6014 return;
6015 }
6016
6018 if (!ai)
6019 {
6021 return;
6022 }
6023
6025 if (!action_array)
6026 {
6027 action_array = new array<ActionBase_Basic>;
6029 }
6030 if (LogManager.IsActionLogEnable())
6031 {
6032 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
6033 }
6034
6035 if (action_array.Find(action) != -1)
6036 {
6037 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
6038 }
6039 else
6040 {
6041 action_array.Insert(action);
6042 }
6043 }
6044
6046 {
6047 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6048 ActionBase action = player.GetActionManager().GetAction(actionName);
6051
6052 if (action_array)
6053 {
6054 action_array.RemoveItem(action);
6055 }
6056 }
6057
6058
6059
6061 {
6062 ActionOverrideData overrideData = new ActionOverrideData();
6066
6068 if (!actionMap)
6069 {
6072 }
6073
6074 actionMap.Insert(this.
Type(), overrideData);
6075
6076 }
6077
6079
6081
6082
6084 {
6087
6090
6091 string config_to_search = "CfgVehicles";
6092 string muzzle_owner_config;
6093
6095 {
6096 if (IsInherited(Weapon))
6097 config_to_search = "CfgWeapons";
6098
6099 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6100
6101 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
6102
6103 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
6104
6105 if (config_OnFire_subclass_count > 0)
6106 {
6107 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
6108
6109 for (int i = 0; i < config_OnFire_subclass_count; i++)
6110 {
6111 string particle_class = "";
6112 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
6113 string config_OnFire_entry = config_OnFire_class + particle_class;
6114 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
6115 WPOF_array.Insert(WPOF);
6116 }
6117
6118
6120 }
6121 }
6122
6124 {
6125 config_to_search = "CfgWeapons";
6126 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6127
6128 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
6129
6130 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
6131
6132 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
6133 {
6134 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
6135
6136 for (i = 0; i < config_OnBulletCasingEject_count; i++)
6137 {
6138 string particle_class2 = "";
6139 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
6140 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
6141 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
6142 WPOBE_array.Insert(WPOBE);
6143 }
6144
6145
6147 }
6148 }
6149 }
6150
6151
6153 {
6156
6158 {
6159 string config_to_search = "CfgVehicles";
6160
6161 if (IsInherited(Weapon))
6162 config_to_search = "CfgWeapons";
6163
6164 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6165 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
6166
6167 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
6168 {
6169
6171
6173 {
6175 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
6177 return;
6178 }
6179
6182
6183
6184
6185 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
6186 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
6187
6188 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
6189 {
6190 string particle_class = "";
6191 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
6192 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
6193 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
6194
6195 if (entry_type == CT_CLASS)
6196 {
6197 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
6198 WPOOH_array.Insert(WPOF);
6199 }
6200 }
6201
6202
6204 }
6205 }
6206 }
6207
6209 {
6211 }
6212
6214 {
6216 {
6218
6221
6224
6225 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6226 }
6227 }
6228
6230 {
6232 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6233
6235 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6236
6238 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6239
6241 {
6243 }
6244 }
6245
6247 {
6249 }
6250
6252 {
6255 else
6257
6259 {
6262 }
6263 else
6264 {
6267
6270 }
6271
6273 }
6274
6276 {
6278 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6279 }
6280
6282 {
6284 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6286 }
6287
6289 {
6291 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6292 }
6293
6295 {
6298
6299 OverheatingParticle OP = new OverheatingParticle();
6304
6306 }
6307
6309 {
6312
6313 return -1;
6314 }
6315
6317 {
6319 {
6322
6323 for (int i = count; i > 0; --i)
6324 {
6325 int id = i - 1;
6328
6331
6332 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
6333 {
6334 if (p)
6335 {
6338 }
6339 }
6340 }
6341 }
6342 }
6343
6345 {
6347 {
6349 {
6350 int id = i - 1;
6352
6353 if (OP)
6354 {
6356
6357 if (p)
6358 {
6360 }
6361
6362 delete OP;
6363 }
6364 }
6365
6368 }
6369 }
6370
6373 {
6374 return 0.0;
6375 }
6376
6377
6379 {
6380 return 250;
6381 }
6382
6384 {
6385 return 0;
6386 }
6387
6390 {
6392 return true;
6393
6394 return false;
6395 }
6396
6399 {
6402
6404 {
6406 }
6407 else
6408 {
6409
6411 }
6412
6414 }
6415
6422 {
6423 return -1;
6424 }
6425
6426
6427
6428
6430 {
6432 {
6433 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6434 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6435
6436 if (r_index >= 0)
6437 {
6438 InventoryLocation r_il = new InventoryLocation;
6439 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6440
6441 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6444 {
6445 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6446 }
6448 {
6449 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6450 }
6451
6452 }
6453
6454 player.GetHumanInventory().ClearUserReservedLocation(this);
6455 }
6456
6459 }
6460
6461
6462
6463
6465 {
6466 return ItemBase.m_DebugActionsMask;
6467 }
6468
6470 {
6471 return ItemBase.m_DebugActionsMask & mask;
6472 }
6473
6475 {
6476 ItemBase.m_DebugActionsMask = mask;
6477 }
6478
6480 {
6481 ItemBase.m_DebugActionsMask |= mask;
6482 }
6483
6485 {
6486 ItemBase.m_DebugActionsMask &= ~mask;
6487 }
6488
6490 {
6492 {
6494 }
6495 else
6496 {
6498 }
6499 }
6500
6501
6503 {
6504 if (GetEconomyProfile())
6505 {
6506 float q_max = GetEconomyProfile().GetQuantityMax();
6507 if (q_max > 0)
6508 {
6509 float q_min = GetEconomyProfile().GetQuantityMin();
6510 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
6511
6513 {
6514 ComponentEnergyManager comp = GetCompEM();
6516 {
6518 }
6519 }
6521 {
6523
6524 }
6525
6526 }
6527 }
6528 }
6529
6532 {
6533 EntityAI parent = GetHierarchyParent();
6534
6535 if (parent)
6536 {
6537 InventoryLocation inventory_location_to_lock = new InventoryLocation;
6538 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
6539 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
6540 }
6541 }
6542
6545 {
6546 EntityAI parent = GetHierarchyParent();
6547
6548 if (parent)
6549 {
6550 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
6551 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
6552 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
6553 }
6554 }
6555
6557 {
6558
6559
6560
6561
6563
6565 {
6566 if (ScriptInputUserData.CanStoreInputUserData())
6567 {
6568 ScriptInputUserData ctx = new ScriptInputUserData;
6574 ctx.
Write(use_stack_max);
6577
6579 {
6580 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
6581 }
6582 }
6583 }
6584 else if (!
g_Game.IsMultiplayer())
6585 {
6587 }
6588 }
6589
6591 {
6593 }
6594
6596 {
6598 }
6599
6601 {
6603 }
6604
6606 {
6607
6608 return false;
6609 }
6610
6612 {
6613 return false;
6614 }
6615
6619 {
6620 return false;
6621 }
6622
6624 {
6625 return "";
6626 }
6627
6629
6631 {
6632 return false;
6633 }
6634
6636 {
6637 return true;
6638 }
6639
6640
6641
6643 {
6644 return true;
6645 }
6646
6648 {
6649 return true;
6650 }
6651
6653 {
6654 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6656 }
6657
6659 {
6661 }
6662
6664 {
6666 if (!is_being_placed)
6668 SetSynchDirty();
6669 }
6670
6671
6673
6675 {
6677 }
6678
6680 {
6682 }
6683
6685 {
6686 return 1;
6687 }
6688
6690 {
6691 return false;
6692 }
6693
6695 {
6697 SetSynchDirty();
6698 }
6699
6700
6701
6702
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
6735 {
6736 super.OnMovedInsideCargo(container);
6737
6738 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6739 }
6740
6741 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
6742 {
6743 super.EEItemLocationChanged(oldLoc, newLoc);
6744
6745 PlayerBase newPlayer = null;
6746 PlayerBase oldPlayer = null;
6747
6748 if (newLoc.GetParent())
6749 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
6750
6751 if (oldLoc.GetParent())
6752 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
6753
6755 {
6756 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
6757
6758 if (rIndex >= 0)
6759 {
6760 InventoryLocation rIl = new InventoryLocation;
6761 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
6762
6763 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
6766 {
6767 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
6768 }
6770 {
6772 }
6773
6774 }
6775 }
6776
6778 {
6779 if (newPlayer)
6780 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
6781
6782 if (newPlayer == oldPlayer)
6783 {
6784 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
6785 {
6787 {
6788 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
6789 {
6790 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6791 }
6792 }
6793 else
6794 {
6795 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6796 }
6797 }
6798
6799 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
6800 {
6801 int type = oldLoc.GetType();
6803 {
6804 oldLoc.GetParent().GetOnSetLock().Invoke(this);
6805 }
6807 {
6808 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
6809 }
6810 }
6811 if (!m_OldLocation)
6812 {
6813 m_OldLocation = new InventoryLocation;
6814 }
6815 m_OldLocation.Copy(oldLoc);
6816 }
6817 else
6818 {
6819 if (m_OldLocation)
6820 {
6821 m_OldLocation.Reset();
6822 }
6823 }
6824
6825 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
6826 }
6827 else
6828 {
6829 if (newPlayer)
6830 {
6831 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
6832 if (resIndex >= 0)
6833 {
6834 InventoryLocation il = new InventoryLocation;
6835 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
6837 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
6840 {
6841 il.
GetParent().GetOnReleaseLock().Invoke(it);
6842 }
6844 {
6846 }
6847
6848 }
6849 }
6851 {
6852
6854 }
6855
6856 if (m_OldLocation)
6857 {
6858 m_OldLocation.Reset();
6859 }
6860 }
6861
6863 {
6864 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
6865 }
6866
6868 {
6869 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
6870 }
6871 }
6872
6873 override void EOnContact(IEntity other, Contact extra)
6874 {
6876 {
6877 int liquidType = -1;
6879 if (impactSpeed > 0.0)
6880 {
6882 #ifndef SERVER
6884 #else
6886 SetSynchDirty();
6887 #endif
6889 }
6890 }
6891
6892 #ifdef SERVER
6893 if (GetCompEM() && GetCompEM().IsPlugged())
6894 {
6895 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
6896 GetCompEM().UnplugThis();
6897 }
6898 #endif
6899 }
6900
6902
6904 {
6906 }
6907
6909 {
6910
6911 }
6912
6914 {
6915 super.OnItemLocationChanged(old_owner, new_owner);
6916
6917 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
6918 PlayerBase playerNew = PlayerBase.Cast(new_owner);
6919
6920 if (!relatedPlayer && playerNew)
6921 relatedPlayer = playerNew;
6922
6923 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
6924 {
6926 if (actionMgr)
6927 {
6928 ActionBase currentAction = actionMgr.GetRunningAction();
6929 if (currentAction)
6931 }
6932 }
6933
6934 Man ownerPlayerOld = null;
6935 Man ownerPlayerNew = null;
6936
6937 if (old_owner)
6938 {
6939 if (old_owner.
IsMan())
6940 {
6941 ownerPlayerOld = Man.Cast(old_owner);
6942 }
6943 else
6944 {
6945 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
6946 }
6947 }
6948 else
6949 {
6951 {
6953
6954 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
6955 {
6956 GetCompEM().UnplugThis();
6957 }
6958 }
6959 }
6960
6961 if (new_owner)
6962 {
6963 if (new_owner.
IsMan())
6964 {
6965 ownerPlayerNew = Man.Cast(new_owner);
6966 }
6967 else
6968 {
6969 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
6970 }
6971 }
6972
6973 if (ownerPlayerOld != ownerPlayerNew)
6974 {
6975 if (ownerPlayerOld)
6976 {
6977 array<EntityAI> subItemsExit = new array<EntityAI>;
6979 for (int i = 0; i < subItemsExit.Count(); i++)
6980 {
6983 }
6984 }
6985
6986 if (ownerPlayerNew)
6987 {
6988 array<EntityAI> subItemsEnter = new array<EntityAI>;
6990 for (int j = 0; j < subItemsEnter.Count(); j++)
6991 {
6994 }
6995 }
6996 }
6997 else if (ownerPlayerNew != null)
6998 {
6999 PlayerBase nplayer;
7000 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
7001 {
7002 array<EntityAI> subItemsUpdate = new array<EntityAI>;
7004 for (int k = 0; k < subItemsUpdate.Count(); k++)
7005 {
7007 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
7008 }
7009 }
7010 }
7011
7012 if (old_owner)
7013 old_owner.OnChildItemRemoved(this);
7014 if (new_owner)
7015 new_owner.OnChildItemReceived(this);
7016 }
7017
7018
7020 {
7021 super.EEDelete(parent);
7022 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
7023 if (player)
7024 {
7026
7027 if (player.IsAlive())
7028 {
7029 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7030 if (r_index >= 0)
7031 {
7032 InventoryLocation r_il = new InventoryLocation;
7033 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7034
7035 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7038 {
7039 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7040 }
7042 {
7043 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7044 }
7045
7046 }
7047
7048 player.RemoveQuickBarEntityShortcut(this);
7049 }
7050 }
7051 }
7052
7054 {
7055 super.EEKilled(killer);
7056
7059 {
7060 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
7061 {
7062 if (IsMagazine())
7063 {
7064 if (Magazine.Cast(this).GetAmmoCount() > 0)
7065 {
7067 }
7068 }
7069 else
7070 {
7072 }
7073 }
7074 }
7075 }
7076
7078 {
7079 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7080
7081 super.OnWasAttached(parent, slot_id);
7082
7085
7088 }
7089
7091 {
7092 super.OnWasDetached(parent, slot_id);
7093
7096
7099 }
7100
7102 {
7103 int idx;
7106
7107 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7108 if (inventory_slots.Count() < 1)
7109 {
7110 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
7111 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
7112 }
7113 else
7114 {
7115 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
7116 }
7117
7118 idx = inventory_slots.Find(slot);
7119 if (idx < 0)
7120 return "";
7121
7122 return attach_types.Get(idx);
7123 }
7124
7126 {
7127 int idx = -1;
7128 string slot;
7129
7132
7133 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7134 if (inventory_slots.Count() < 1)
7135 {
7136 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
7137 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7138 }
7139 else
7140 {
7141 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
7142 if (detach_types.Count() < 1)
7143 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7144 }
7145
7146 for (int i = 0; i < inventory_slots.Count(); i++)
7147 {
7148 slot = inventory_slots.Get(i);
7149 }
7150
7151 if (slot != "")
7152 {
7153 if (detach_types.Count() == 1)
7154 idx = 0;
7155 else
7156 idx = inventory_slots.Find(slot);
7157 }
7158 if (idx < 0)
7159 return "";
7160
7161 return detach_types.Get(idx);
7162 }
7163
7165 {
7166
7168
7169
7170 float min_time = 1;
7171 float max_time = 3;
7172 float delay = Math.RandomFloat(min_time, max_time);
7173
7174 explode_timer.Run(delay, this, "DoAmmoExplosion");
7175 }
7176
7178 {
7179 Magazine magazine = Magazine.Cast(this);
7180 int pop_sounds_count = 6;
7181 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
7182
7183
7184 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
7185 string sound_name = pop_sounds[ sound_idx ];
7186 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
7187
7188
7189 magazine.ServerAddAmmoCount(-1);
7190
7191
7192 float min_temp_to_explode = 100;
7193
7194 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
7195 {
7197 }
7198 }
7199
7200
7201 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
7202 {
7203 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
7204
7205 const int CHANCE_DAMAGE_CARGO = 4;
7206 const int CHANCE_DAMAGE_ATTACHMENT = 1;
7207 const int CHANCE_DAMAGE_NOTHING = 2;
7208
7210 {
7211 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
7212 int chances;
7213 int rnd;
7214
7215 if (GetInventory().GetCargo())
7216 {
7217 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7218 rnd = Math.RandomInt(0,chances);
7219
7220 if (rnd < CHANCE_DAMAGE_CARGO)
7221 {
7223 }
7224 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
7225 {
7227 }
7228 }
7229 else
7230 {
7231 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7232 rnd = Math.RandomInt(0,chances);
7233
7234 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
7235 {
7237 }
7238 }
7239 }
7240 }
7241
7243 {
7244 CargoBase cargo = GetInventory().GetCargo();
7245 if (cargo)
7246 {
7248 if (item_count > 0)
7249 {
7250 int random_pick = Math.RandomInt(0, item_count);
7252 if (!item.IsExplosive())
7253 {
7254 item.AddHealth("","",damage);
7255 return true;
7256 }
7257 }
7258 }
7259 return false;
7260 }
7261
7263 {
7264 GameInventory inventory = GetInventory();
7266 if (attachment_count > 0)
7267 {
7268 int random_pick = Math.RandomInt(0, attachment_count);
7270 if (!attachment.IsExplosive())
7271 {
7272 attachment.AddHealth("","",damage);
7273 return true;
7274 }
7275 }
7276 return false;
7277 }
7278
7280 {
7282 }
7283
7285 {
7287 return GetInventory().CanRemoveEntity();
7288
7289 return false;
7290 }
7291
7293 {
7294
7296 return false;
7297
7298
7300 return false;
7301
7302
7303
7305 if (delta == 0)
7306 return false;
7307
7308
7309 return true;
7310 }
7311
7313 {
7315 {
7316 if (ScriptInputUserData.CanStoreInputUserData())
7317 {
7318 ScriptInputUserData ctx = new ScriptInputUserData;
7323 ctx.
Write(destination_entity);
7327 }
7328 }
7329 else if (!
g_Game.IsMultiplayer())
7330 {
7332 }
7333 }
7334
7336 {
7337 float split_quantity_new;
7341 InventoryLocation loc = new InventoryLocation;
7342
7343 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7344 {
7346 split_quantity_new = stack_max;
7347 else
7349
7351 {
7352 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7353 if (new_item)
7354 {
7355 new_item.SetResultOfSplit(true);
7356 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7358 new_item.
SetQuantity(split_quantity_new,
false,
true);
7359 }
7360 }
7361 }
7362 else if (destination_entity && slot_id == -1)
7363 {
7364 if (quantity > stack_max)
7365 split_quantity_new = stack_max;
7366 else
7367 split_quantity_new = quantity;
7368
7370 {
7371 GameInventory destinationInventory = destination_entity.GetInventory();
7373 {
7376 }
7377
7378 if (new_item)
7379 {
7380 new_item.SetResultOfSplit(true);
7381 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7383 new_item.
SetQuantity(split_quantity_new,
false,
true);
7384 }
7385 }
7386 }
7387 else
7388 {
7389 if (stack_max != 0)
7390 {
7392 {
7394 }
7395
7396 if (split_quantity_new == 0)
7397 {
7398 if (!
g_Game.IsMultiplayer())
7399 player.PhysicalPredictiveDropItem(this);
7400 else
7401 player.ServerDropEntity(this);
7402 return;
7403 }
7404
7406 {
7408
7409 if (new_item)
7410 {
7411 new_item.SetResultOfSplit(true);
7412 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7415 new_item.PlaceOnSurface();
7416 }
7417 }
7418 }
7419 }
7420 }
7421
7423 {
7424 float split_quantity_new;
7428 InventoryLocation loc = new InventoryLocation;
7429
7430 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7431 {
7433 split_quantity_new = stack_max;
7434 else
7436
7438 {
7439 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7440 if (new_item)
7441 {
7442 new_item.SetResultOfSplit(true);
7443 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7445 new_item.
SetQuantity(split_quantity_new,
false,
true);
7446 }
7447 }
7448 }
7449 else if (destination_entity && slot_id == -1)
7450 {
7451 if (quantity > stack_max)
7452 split_quantity_new = stack_max;
7453 else
7454 split_quantity_new = quantity;
7455
7457 {
7458 GameInventory destinationInventory = destination_entity.GetInventory();
7460 {
7463 }
7464
7465 if (new_item)
7466 {
7467 new_item.SetResultOfSplit(true);
7468 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7470 new_item.
SetQuantity(split_quantity_new,
false,
true);
7471 }
7472 }
7473 }
7474 else
7475 {
7476 if (stack_max != 0)
7477 {
7479 {
7481 }
7482
7484 {
7486
7487 if (new_item)
7488 {
7489 new_item.SetResultOfSplit(true);
7490 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7493 new_item.PlaceOnSurface();
7494 }
7495 }
7496 }
7497 }
7498 }
7499
7501 {
7503 {
7504 if (ScriptInputUserData.CanStoreInputUserData())
7505 {
7506 ScriptInputUserData ctx = new ScriptInputUserData;
7511 dst.WriteToContext(ctx);
7513 }
7514 }
7515 else if (!
g_Game.IsMultiplayer())
7516 {
7518 }
7519 }
7520
7522 {
7524 {
7525 if (ScriptInputUserData.CanStoreInputUserData())
7526 {
7527 ScriptInputUserData ctx = new ScriptInputUserData;
7532 ctx.
Write(destination_entity);
7538 }
7539 }
7540 else if (!
g_Game.IsMultiplayer())
7541 {
7543 }
7544 }
7545
7547 {
7549 }
7550
7552 {
7554 float split_quantity_new;
7556 if (dst.IsValid())
7557 {
7558 int slot_id = dst.GetSlot();
7560
7561 if (quantity > stack_max)
7562 split_quantity_new = stack_max;
7563 else
7564 split_quantity_new = quantity;
7565
7567 {
7569
7570 if (new_item)
7571 {
7572 new_item.SetResultOfSplit(true);
7573 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7575 new_item.
SetQuantity(split_quantity_new,
false,
true);
7576 }
7577
7578 return new_item;
7579 }
7580 }
7581
7582 return null;
7583 }
7584
7586 {
7588 float split_quantity_new;
7590 if (destination_entity)
7591 {
7593 if (quantity > stackable)
7594 split_quantity_new = stackable;
7595 else
7596 split_quantity_new = quantity;
7597
7599 {
7600 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
7601 if (new_item)
7602 {
7603 new_item.SetResultOfSplit(true);
7604 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7606 new_item.
SetQuantity(split_quantity_new,
false,
true);
7607 }
7608 }
7609 }
7610 }
7611
7613 {
7615 {
7616 if (ScriptInputUserData.CanStoreInputUserData())
7617 {
7618 ScriptInputUserData ctx = new ScriptInputUserData;
7623 ItemBase destination_entity =
this;
7624 ctx.
Write(destination_entity);
7628 }
7629 }
7630 else if (!
g_Game.IsMultiplayer())
7631 {
7633 }
7634 }
7635
7637 {
7639 float split_quantity_new;
7641 if (player)
7642 {
7644 if (quantity > stackable)
7645 split_quantity_new = stackable;
7646 else
7647 split_quantity_new = quantity;
7648
7650 {
7651 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
7652 new_item =
ItemBase.Cast(in_hands);
7653 if (new_item)
7654 {
7655 new_item.SetResultOfSplit(true);
7656 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7658 new_item.SetQuantity(split_quantity_new, false, true);
7659 }
7660 }
7661 }
7662 }
7663
7665 {
7667 float split_quantity_new = Math.Floor(quantity * 0.5);
7668
7670 return;
7671
7673
7674 if (new_item)
7675 {
7676 if (new_item.GetQuantityMax() < split_quantity_new)
7677 {
7678 split_quantity_new = new_item.GetQuantityMax();
7679 }
7680
7681 new_item.SetResultOfSplit(true);
7682 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7683
7685 {
7688 }
7689 else
7690 {
7692 new_item.
SetQuantity(split_quantity_new,
false,
true);
7693 }
7694 }
7695 }
7696
7698 {
7700 float split_quantity_new = Math.Floor(quantity / 2);
7701
7703 return;
7704
7705 InventoryLocation invloc = new InventoryLocation;
7707
7709 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
7710
7711 if (new_item)
7712 {
7713 if (new_item.GetQuantityMax() < split_quantity_new)
7714 {
7715 split_quantity_new = new_item.GetQuantityMax();
7716 }
7718 {
7721 }
7722 else if (split_quantity_new > 1)
7723 {
7725 new_item.
SetQuantity(split_quantity_new,
false,
true);
7726 }
7727 }
7728 }
7729
7732 {
7733 SetWeightDirty();
7735
7736 if (parent)
7737 parent.OnAttachmentQuantityChangedEx(this, delta);
7738
7740 {
7742 {
7744 }
7746 {
7747 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
7749 }
7750 }
7751 }
7752
7755 {
7756
7757 }
7758
7761 {
7763 }
7764
7766 {
7767 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
7768
7770 {
7771 if (newLevel == GameConstants.STATE_RUINED)
7772 {
7774 EntityAI parent = GetHierarchyParent();
7775 if (parent && parent.IsFireplace())
7776 {
7777 CargoBase cargo = GetInventory().GetCargo();
7778 if (cargo)
7779 {
7781 {
7783 }
7784 }
7785 }
7786 }
7787
7789 {
7790
7792 return;
7793 }
7794
7795 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
7796 {
7798 }
7799 }
7800 }
7801
7802
7804 {
7805 super.OnRightClick();
7806
7808 {
7810 {
7811 if (ScriptInputUserData.CanStoreInputUserData())
7812 {
7813 EntityAI root = GetHierarchyRoot();
7814 Man playerOwner = GetHierarchyRootPlayer();
7815 InventoryLocation dst = new InventoryLocation;
7816
7817
7818 if (!playerOwner && root && root == this)
7819 {
7821 }
7822 else
7823 {
7824
7825 GetInventory().GetCurrentInventoryLocation(dst);
7827 {
7828 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7830 {
7832 }
7833 else
7834 {
7836
7837
7838 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
7839 {
7841 }
7842 else
7843 {
7844 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
7845 }
7846 }
7847 }
7848 }
7849
7850 ScriptInputUserData ctx = new ScriptInputUserData;
7858 }
7859 }
7860 else if (!
g_Game.IsMultiplayer())
7861 {
7863 }
7864 }
7865 }
7866
7868 {
7869 if (root)
7870 {
7871 vector m4[4];
7872 root.GetTransform(m4);
7873 dst.SetGround(this, m4);
7874 }
7875 else
7876 {
7877 GetInventory().GetCurrentInventoryLocation(dst);
7878 }
7879 }
7880
7881 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
7882 {
7883
7884 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
7885 return false;
7886
7887 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
7888 return false;
7889
7890
7892 return false;
7893
7894
7895 Magazine mag = Magazine.Cast(this);
7896 if (mag)
7897 {
7898 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
7899 return false;
7900
7901 if (stack_max_limit)
7902 {
7903 Magazine other_mag = Magazine.Cast(other_item);
7904 if (other_item)
7905 {
7906 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
7907 return false;
7908 }
7909
7910 }
7911 }
7912 else
7913 {
7914
7916 return false;
7917
7919 return false;
7920 }
7921
7922 PlayerBase player = null;
7923 if (CastTo(player, GetHierarchyRootPlayer()))
7924 {
7925 if (player.GetInventory().HasAttachment(this))
7926 return false;
7927
7928 if (player.IsItemsToDelete())
7929 return false;
7930 }
7931
7932 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
7933 return false;
7934
7935 int slotID;
7937 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
7938 return false;
7939
7940 return true;
7941 }
7942
7944 {
7946 }
7947
7949 {
7950 return m_IsResultOfSplit;
7951 }
7952
7954 {
7955 m_IsResultOfSplit = value;
7956 }
7957
7959 {
7961 }
7962
7964 {
7965 float other_item_quantity = other_item.GetQuantity();
7966 float this_free_space;
7967
7969
7971
7972 if (other_item_quantity > this_free_space)
7973 {
7974 return this_free_space;
7975 }
7976 else
7977 {
7978 return other_item_quantity;
7979 }
7980 }
7981
7983 {
7985 }
7986
7988 {
7990 return;
7991
7992 if (!IsMagazine() && other_item)
7993 {
7995 if (quantity_used != 0)
7996 {
7997 float hp1 = GetHealth01("","");
7998 float hp2 = other_item.GetHealth01("","");
7999 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
8000 hpResult = hpResult / (
GetQuantity() + quantity_used);
8001
8002 hpResult *= GetMaxHealth();
8003 Math.Round(hpResult);
8004 SetHealth("", "Health", hpResult);
8005
8007 other_item.AddQuantity(-quantity_used);
8008 }
8009 }
8011 }
8012
8014 {
8015 #ifdef SERVER
8016 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
8017 GetHierarchyParent().IncreaseLifetimeUp();
8018 #endif
8019 };
8020
8022 {
8023 PlayerBase p = PlayerBase.Cast(player);
8024
8025 array<int> recipesIds = p.m_Recipes;
8026 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8027 if (moduleRecipesManager)
8028 {
8029 EntityAI itemInHands = player.GetEntityInHands();
8030 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
8031 }
8032
8033 for (int i = 0;i < recipesIds.Count(); i++)
8034 {
8035 int key = recipesIds.Get(i);
8036 string recipeName = moduleRecipesManager.GetRecipeName(key);
8038 }
8039 }
8040
8041
8042 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
8043 {
8044 super.GetDebugActions(outputList);
8045
8046
8052
8053
8058
8063
8064
8068
8069
8071 {
8075 }
8076
8079
8080
8084
8086
8087 InventoryLocation loc = new InventoryLocation();
8088 GetInventory().GetCurrentInventoryLocation(loc);
8090 {
8091 if (Gizmo_IsSupported())
8094 }
8095
8097 }
8098
8099
8100
8101
8103 {
8104 super.OnAction(action_id, player, ctx);
8105
8107 {
8108 switch (action_id)
8109 {
8113 return true;
8117 return true;
8118 }
8119 }
8120
8122 {
8123 switch (action_id)
8124 {
8126 Delete();
8127 return true;
8128 }
8129 }
8130
8131 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
8132 {
8133 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8134 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
8135 PlayerBase p = PlayerBase.Cast(player);
8136 if (
EActions.RECIPES_RANGE_START < 1000)
8137 {
8138 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
8139 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
8140 }
8141 }
8142 #ifndef SERVER
8143 else if (action_id ==
EActions.WATCH_PLAYER)
8144 {
8145 PluginDeveloper.SetDeveloperItemClientEx(player);
8146 }
8147 #endif
8149 {
8150 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
8151 {
8152 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
8153 OnDebugButtonPressServer(id + 1);
8154 }
8155
8156 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
8157 {
8158 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
8160 }
8161
8162 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
8163 {
8164 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
8166 }
8167
8168 else if (action_id ==
EActions.ADD_QUANTITY)
8169 {
8170 if (IsMagazine())
8171 {
8172 Magazine mag = Magazine.Cast(this);
8173 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
8174 }
8175 else
8176 {
8178 }
8179
8180 if (m_EM)
8181 {
8182 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
8183 }
8184
8185 }
8186
8187 else if (action_id ==
EActions.REMOVE_QUANTITY)
8188 {
8189 if (IsMagazine())
8190 {
8191 Magazine mag2 = Magazine.Cast(this);
8192 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
8193 }
8194 else
8195 {
8197 }
8198 if (m_EM)
8199 {
8200 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
8201 }
8202
8203 }
8204
8205 else if (action_id ==
EActions.SET_QUANTITY_0)
8206 {
8208
8209 if (m_EM)
8210 {
8211 m_EM.SetEnergy(0);
8212 }
8213 }
8214
8215 else if (action_id ==
EActions.SET_MAX_QUANTITY)
8216 {
8218
8219 if (m_EM)
8220 {
8221 m_EM.SetEnergy(m_EM.GetEnergyMax());
8222 }
8223 }
8224
8225 else if (action_id ==
EActions.ADD_HEALTH)
8226 {
8227 AddHealth("","",GetMaxHealth("","Health")/5);
8228 }
8229 else if (action_id ==
EActions.REMOVE_HEALTH)
8230 {
8231 AddHealth("","",-GetMaxHealth("","Health")/5);
8232 }
8233 else if (action_id ==
EActions.DESTROY_HEALTH)
8234 {
8235 SetHealth01("","",0);
8236 }
8237 else if (action_id ==
EActions.WATCH_ITEM)
8238 {
8240 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
8241 #ifdef DEVELOPER
8242 SetDebugDeveloper_item(this);
8243 #endif
8244 }
8245
8246 else if (action_id ==
EActions.ADD_TEMPERATURE)
8247 {
8248 AddTemperature(20);
8249
8250 }
8251
8252 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
8253 {
8254 AddTemperature(-20);
8255
8256 }
8257
8258 else if (action_id ==
EActions.FLIP_FROZEN)
8259 {
8260 SetFrozen(!GetIsFrozen());
8261
8262 }
8263
8264 else if (action_id ==
EActions.ADD_WETNESS)
8265 {
8267
8268 }
8269
8270 else if (action_id ==
EActions.REMOVE_WETNESS)
8271 {
8273
8274 }
8275
8276 else if (action_id ==
EActions.LIQUIDTYPE_UP)
8277 {
8280
8281
8282 }
8283
8284 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
8285 {
8288 }
8289
8290 else if (action_id ==
EActions.MAKE_SPECIAL)
8291 {
8292 auto debugParams = DebugSpawnParams.WithPlayer(player);
8293 OnDebugSpawnEx(debugParams);
8294 }
8295
8296 }
8297
8298
8299 return false;
8300 }
8301
8302
8303
8304
8308
8311
8312
8313
8315 {
8316 return false;
8317 }
8318
8319
8321 {
8322 return true;
8323 }
8324
8325
8327 {
8328 return true;
8329 }
8330
8331
8332
8334 {
8335 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
8336 return g_Game.ConfigIsExisting(config_path);
8337 }
8338
8341 {
8342 return null;
8343 }
8344
8346 {
8347 return false;
8348 }
8349
8351 {
8352 return false;
8353 }
8354
8358
8359
8361 {
8362 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8363 return module_repairing.CanRepair(this, item_repair_kit);
8364 }
8365
8366
8367 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
8368 {
8369 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8370 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
8371 }
8372
8373
8375 {
8376
8377
8378
8379
8380
8381
8382
8383
8384 return 1;
8385 }
8386
8387
8388
8390 {
8392 }
8393
8394
8395
8397 {
8399 }
8400
8401
8410 {
8411 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8412
8413 if (player)
8414 {
8415 player.MessageStatus(text);
8416 }
8417 }
8418
8419
8428 {
8429 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8430
8431 if (player)
8432 {
8433 player.MessageAction(text);
8434 }
8435 }
8436
8437
8446 {
8447 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8448
8449 if (player)
8450 {
8451 player.MessageFriendly(text);
8452 }
8453 }
8454
8455
8464 {
8465 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8466
8467 if (player)
8468 {
8469 player.MessageImportant(text);
8470 }
8471 }
8472
8474 {
8475 return true;
8476 }
8477
8478
8479 override bool KindOf(
string tag)
8480 {
8481 bool found = false;
8482 string item_name = this.
GetType();
8484 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
8485
8486 int array_size = item_tag_array.Count();
8487 for (int i = 0; i < array_size; i++)
8488 {
8489 if (item_tag_array.Get(i) == tag)
8490 {
8491 found = true;
8492 break;
8493 }
8494 }
8495 return found;
8496 }
8497
8498
8500 {
8501
8502 super.OnRPC(sender, rpc_type,ctx);
8503
8504
8505 switch (rpc_type)
8506 {
8507 #ifndef SERVER
8508 case ERPCs.RPC_SOUND_LOCK_ATTACH:
8509 Param2<bool, string> p = new Param2<bool, string>(false, "");
8510
8512 return;
8513
8514 bool play = p.param1;
8515 string soundSet = p.param2;
8516
8517 if (play)
8518 {
8520 {
8522 {
8524 }
8525 }
8526 else
8527 {
8529 }
8530 }
8531 else
8532 {
8534 }
8535
8536 break;
8537 #endif
8538
8539 }
8540
8542 {
8544 }
8545 }
8546
8547
8548
8549
8551 {
8552 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8553 return plugin.GetID(
name);
8554 }
8555
8557 {
8558 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8559 return plugin.GetName(id);
8560 }
8561
8564 {
8565
8566
8567 int varFlags;
8568 if (!ctx.
Read(varFlags))
8569 return;
8570
8571 if (varFlags & ItemVariableFlags.FLOAT)
8572 {
8574 }
8575 }
8576
8578 {
8579
8580 super.SerializeNumericalVars(floats_out);
8581
8582
8583
8585 {
8587 }
8588
8590 {
8592 }
8593
8595 {
8597 }
8598
8600 {
8605 }
8606
8608 {
8610 }
8611 }
8612
8614 {
8615
8616 super.DeSerializeNumericalVars(floats);
8617
8618
8619 int index = 0;
8620 int mask = Math.Round(floats.Get(index));
8621
8622 index++;
8623
8625 {
8627 {
8629 }
8630 else
8631 {
8632 float quantity = floats.Get(index);
8634 }
8635 index++;
8636 }
8637
8639 {
8640 float wet = floats.Get(index);
8642 index++;
8643 }
8644
8646 {
8647 int liquidtype = Math.Round(floats.Get(index));
8649 index++;
8650 }
8651
8653 {
8655 index++;
8657 index++;
8659 index++;
8661 index++;
8662 }
8663
8665 {
8666 int cleanness = Math.Round(floats.Get(index));
8668 index++;
8669 }
8670 }
8671
8673 {
8674 super.WriteVarsToCTX(ctx);
8675
8676
8678 {
8680 }
8681
8683 {
8685 }
8686
8688 {
8690 }
8691
8693 {
8694 int r,g,b,a;
8700 }
8701
8703 {
8705 }
8706 }
8707
8709 {
8710 if (!super.ReadVarsFromCTX(ctx,version))
8711 return false;
8712
8713 int intValue;
8714 float value;
8715
8716 if (version < 140)
8717 {
8718 if (!ctx.
Read(intValue))
8719 return false;
8720
8721 m_VariablesMask = intValue;
8722 }
8723
8725 {
8726 if (!ctx.
Read(value))
8727 return false;
8728
8730 {
8732 }
8733 else
8734 {
8736 }
8737 }
8738
8739 if (version < 140)
8740 {
8742 {
8743 if (!ctx.
Read(value))
8744 return false;
8745 SetTemperatureDirect(value);
8746 }
8747 }
8748
8750 {
8751 if (!ctx.
Read(value))
8752 return false;
8754 }
8755
8757 {
8758 if (!ctx.
Read(intValue))
8759 return false;
8761 }
8762
8764 {
8765 int r,g,b,a;
8767 return false;
8769 return false;
8771 return false;
8773 return false;
8774
8776 }
8777
8779 {
8780 if (!ctx.
Read(intValue))
8781 return false;
8783 }
8784
8785 if (version >= 138 && version < 140)
8786 {
8788 {
8789 if (!ctx.
Read(intValue))
8790 return false;
8791 SetFrozen(intValue);
8792 }
8793 }
8794
8795 return true;
8796 }
8797
8798
8800 {
8803 {
8805 }
8806
8807 if (!super.OnStoreLoad(ctx, version))
8808 {
8810 return false;
8811 }
8812
8813 if (version >= 114)
8814 {
8815 bool hasQuickBarIndexSaved;
8816
8817 if (!ctx.
Read(hasQuickBarIndexSaved))
8818 {
8820 return false;
8821 }
8822
8823 if (hasQuickBarIndexSaved)
8824 {
8825 int itmQBIndex;
8826
8827
8828 if (!ctx.
Read(itmQBIndex))
8829 {
8831 return false;
8832 }
8833
8834 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
8835 if (itmQBIndex != -1 && parentPlayer)
8836 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
8837 }
8838 }
8839 else
8840 {
8841
8842 PlayerBase player;
8843 int itemQBIndex;
8844 if (version ==
int.
MAX)
8845 {
8846 if (!ctx.
Read(itemQBIndex))
8847 {
8849 return false;
8850 }
8851 }
8852 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
8853 {
8854
8855 if (!ctx.
Read(itemQBIndex))
8856 {
8858 return false;
8859 }
8860 if (itemQBIndex != -1 && player)
8861 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
8862 }
8863 }
8864
8865 if (version < 140)
8866 {
8867
8868 if (!LoadVariables(ctx, version))
8869 {
8871 return false;
8872 }
8873 }
8874
8875
8877 {
8879 return false;
8880 }
8881 if (version >= 132)
8882 {
8884 if (raib)
8885 {
8887 {
8889 return false;
8890 }
8891 }
8892 }
8893
8895 return true;
8896 }
8897
8898
8899
8901 {
8902 super.OnStoreSave(ctx);
8903
8904 PlayerBase player;
8905 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
8906 {
8908
8909 int itemQBIndex = -1;
8910 itemQBIndex = player.FindQuickBarEntityIndex(this);
8911 ctx.
Write(itemQBIndex);
8912 }
8913 else
8914 {
8916 }
8917
8919
8921 if (raib)
8922 {
8924 }
8925 }
8926
8927
8929 {
8930 super.AfterStoreLoad();
8931
8933 {
8935 }
8936
8938 {
8941 }
8942 }
8943
8945 {
8946 super.EEOnAfterLoad();
8947
8949 {
8951 }
8952
8955 }
8956
8958 {
8959 return false;
8960 }
8961
8962
8963
8965 {
8967 {
8968 #ifdef PLATFORM_CONSOLE
8969
8971 {
8973 if (menu)
8974 {
8976 }
8977 }
8978 #endif
8979 }
8980
8982 {
8985 }
8986
8988 {
8989 SetWeightDirty();
8991 }
8993 {
8996 }
8997
8999 {
9002
9005 }
9007 {
9011 }
9012
9013 super.OnVariablesSynchronized();
9014 }
9015
9016
9017
9019 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
9020 {
9021 if (!IsServerCheck(allow_client))
9022 return false;
9023
9025 return false;
9026
9029
9030 if (value <= (min + 0.001))
9031 value = min;
9032
9033 if (value == min)
9034 {
9035 if (destroy_config)
9036 {
9037 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
9038 if (dstr)
9039 {
9041 this.Delete();
9042 return true;
9043 }
9044 }
9045 else if (destroy_forced)
9046 {
9048 this.Delete();
9049 return true;
9050 }
9051
9053 }
9054
9057
9059 {
9060 EntityAI parent = GetHierarchyRoot();
9061 InventoryLocation iLoc = new InventoryLocation();
9062 GetInventory().GetCurrentInventoryLocation(iLoc);
9064 {
9065 int iLocSlot = iLoc.
GetSlot();
9067 {
9069 }
9071 {
9073 }
9074 }
9075 }
9076
9078 {
9080
9081 if (delta)
9083 }
9084
9086
9087 return false;
9088 }
9089
9090
9092 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9093 {
9095 }
9096
9098 {
9101 }
9102
9104 {
9107 }
9108
9110 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9111 {
9112 float value_clamped = Math.Clamp(value, 0, 1);
9114 SetQuantity(result, destroy_config, destroy_forced);
9115 }
9116
9117
9120 {
9122 }
9123
9125 {
9127 }
9128
9129
9130
9131
9132
9133
9134
9135
9136
9137
9139 {
9140 int slot = -1;
9141 GameInventory inventory = GetInventory();
9142 if (inventory)
9143 {
9144 InventoryLocation il = new InventoryLocation;
9147 }
9148
9150 }
9151
9153 {
9154 float quantity_max = 0;
9155
9157 {
9158 if (attSlotID != -1)
9159 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
9160
9161 if (quantity_max <= 0)
9163 }
9164
9165 if (quantity_max <= 0)
9167
9168 return quantity_max;
9169 }
9170
9172 {
9174 }
9175
9177 {
9179 }
9180
9181
9183 {
9185 }
9186
9188 {
9190 }
9191
9193 {
9195 }
9196
9197
9199 {
9200
9201 float weightEx = GetWeightEx();
9202 float special = GetInventoryAndCargoWeight();
9203 return weightEx - special;
9204 }
9205
9206
9208 {
9210 }
9211
9213 {
9215 {
9216 #ifdef DEVELOPER
9217 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9218 {
9219 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
9221 }
9222 #endif
9223
9225 }
9226 else if (HasEnergyManager())
9227 {
9228 #ifdef DEVELOPER
9229 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9230 {
9231 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
9232 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
9233 }
9234 #endif
9235 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
9236 }
9237 else
9238 {
9239 #ifdef DEVELOPER
9240 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9241 {
9242 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
9243 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
9244 }
9245 #endif
9246 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
9247 }
9248 }
9249
9252 {
9253 int item_count = 0;
9255
9256 GameInventory inventory = GetInventory();
9257 CargoBase cargo = inventory.
GetCargo();
9258 if (cargo != NULL)
9259 {
9261 }
9262
9264 for (int i = 0; i < nAttachments; ++i)
9265 {
9267 if (item)
9268 item_count += item.GetNumberOfItems();
9269 }
9270 return item_count;
9271 }
9272
9275 {
9276 float weight = 0;
9277 float wetness = 1;
9278 if (include_wetness)
9281 {
9282 weight = wetness * m_ConfigWeight;
9283 }
9285 {
9286 weight = 1;
9287 }
9288 return weight;
9289 }
9290
9291
9292
9294 {
9295 GameInventory inventory = GetInventory();
9296 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
9297 {
9298 array<EntityAI> items = new array<EntityAI>;
9300 for (int i = 0; i < items.Count(); ++i)
9301 {
9303 if (item)
9304 {
9305 g_Game.ObjectDelete(item);
9306 }
9307 }
9308 }
9309 }
9310
9311
9312
9313
9315 {
9316 float energy = 0;
9317 if (HasEnergyManager())
9318 {
9319 energy = GetCompEM().GetEnergy();
9320 }
9321 return energy;
9322 }
9323
9324
9326 {
9327 super.OnEnergyConsumed();
9328
9330 }
9331
9333 {
9334 super.OnEnergyAdded();
9335
9337 }
9338
9339
9341 {
9342 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
9343 {
9345 {
9346 float energy_0to1 = GetCompEM().GetEnergy0To1();
9348 }
9349 }
9350 }
9351
9352
9354 {
9355 return ConfigGetFloat("heatIsolation");
9356 }
9357
9359 {
9361 }
9362
9364 {
9365 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
9366 if (
g_Game.ConfigIsExisting(paramPath))
9367 return g_Game.ConfigGetFloat(paramPath);
9368
9369 return 0.0;
9370 }
9371
9373 {
9374 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
9375 if (
g_Game.ConfigIsExisting(paramPath))
9376 return g_Game.ConfigGetFloat(paramPath);
9377
9378 return 0.0;
9379 }
9380
9381 override void SetWet(
float value,
bool allow_client =
false)
9382 {
9383 if (!IsServerCheck(allow_client))
9384 return;
9385
9388
9390
9391 m_VarWet = Math.Clamp(value, min, max);
9392
9394 {
9397 }
9398 }
9399
9400 override void AddWet(
float value)
9401 {
9403 }
9404
9406 {
9408 }
9409
9411 {
9413 }
9414
9416 {
9418 }
9419
9421 {
9423 }
9424
9426 {
9428 }
9429
9431 {
9434 if (newLevel != oldLevel)
9435 {
9437 }
9438 }
9439
9441 {
9442 SetWeightDirty();
9443 }
9444
9446 {
9447 return GetWetLevelInternal(
m_VarWet);
9448 }
9449
9450
9451
9453 {
9455 }
9456
9458 {
9460 }
9461
9463 {
9465 }
9466
9468 {
9470 }
9471
9472
9473
9475 {
9476 if (ConfigIsExisting("itemModelLength"))
9477 {
9478 return ConfigGetFloat("itemModelLength");
9479 }
9480 return 0;
9481 }
9482
9484 {
9485 if (ConfigIsExisting("itemAttachOffset"))
9486 {
9487 return ConfigGetFloat("itemAttachOffset");
9488 }
9489 return 0;
9490 }
9491
9492 override void SetCleanness(
int value,
bool allow_client =
false)
9493 {
9494 if (!IsServerCheck(allow_client))
9495 return;
9496
9498
9500
9503 }
9504
9506 {
9508 }
9509
9511 {
9512 return true;
9513 }
9514
9515
9516
9517
9519 {
9521 }
9522
9524 {
9526 }
9527
9528
9529
9530
9531 override void SetColor(
int r,
int g,
int b,
int a)
9532 {
9538 }
9540 override void GetColor(out
int r,out
int g,out
int b,out
int a)
9541 {
9546 }
9547
9549 {
9551 }
9552
9555 {
9556 int r,g,b,a;
9558 r = r/255;
9559 g = g/255;
9560 b = b/255;
9561 a = a/255;
9562 return MiscGameplayFunctions.GetColorString(r, g, b, a);
9563 }
9564
9565
9566
9567 override void SetLiquidType(
int value,
bool allow_client =
false)
9568 {
9569 if (!IsServerCheck(allow_client))
9570 return;
9571
9576 }
9577
9579 {
9580 return ConfigGetInt("varLiquidTypeInit");
9581 }
9582
9584 {
9586 }
9587
9589 {
9591 SetFrozen(false);
9592 }
9593
9596 {
9597 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9598 }
9599
9600
9603 {
9604 PlayerBase nplayer;
9605 if (PlayerBase.CastTo(nplayer, player))
9606 {
9608 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9609 }
9610 }
9611
9612
9615 {
9616 PlayerBase nplayer;
9617 if (PlayerBase.CastTo(nplayer,player))
9618 {
9619 nplayer.SetEnableQuickBarEntityShortcut(this, false);
9620 }
9621
9622 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
9623
9624 if (HasEnergyManager())
9625 {
9626 GetCompEM().UpdatePlugState();
9627 }
9628 }
9629
9630
9632 {
9633 super.OnPlacementStarted(player);
9634
9636 }
9637
9638 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
9639 {
9641 {
9642 m_AdminLog.OnPlacementComplete(player,
this);
9643 }
9644
9645 super.OnPlacementComplete(player, position, orientation);
9646 }
9647
9648
9649
9650
9651
9653 {
9655 {
9656 return true;
9657 }
9658 else
9659 {
9660 return false;
9661 }
9662 }
9663
9664
9666 {
9668 {
9670 }
9671 }
9672
9673
9675 {
9677 }
9678
9680 {
9682 }
9683
9684 override void InsertAgent(
int agent,
float count = 1)
9685 {
9686 if (count < 1)
9687 return;
9688
9690 }
9691
9694 {
9696 }
9697
9698
9700 {
9702 }
9703
9704
9705
9706
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
9746 {
9748 return false;
9749 return true;
9750 }
9751
9753 {
9754
9756 }
9757
9758
9761 {
9762 super.CheckForRoofLimited(timeTresholdMS);
9763
9764 float time =
g_Game.GetTime();
9765 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
9766 {
9767 m_PreviousRoofTestTime = time;
9768 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
9769 }
9770 }
9771
9772
9774 {
9776 {
9777 return 0;
9778 }
9779
9780 if (GetInventory().GetAttachmentSlotsCount() != 0)
9781 {
9782 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
9783 if (filter)
9784 return filter.GetProtectionLevel(type, false, system);
9785 else
9786 return 0;
9787 }
9788
9789 string subclassPath, entryName;
9790
9791 switch (type)
9792 {
9794 entryName = "biological";
9795 break;
9797 entryName = "chemical";
9798 break;
9799 default:
9800 entryName = "biological";
9801 break;
9802 }
9803
9804 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
9805
9806 return g_Game.ConfigGetFloat(subclassPath + entryName);
9807 }
9808
9809
9810
9813 {
9814 if (!IsMagazine())
9816
9818 }
9819
9820
9821
9822
9823
9828 {
9829 return true;
9830 }
9831
9833 {
9835 }
9836
9837
9838
9839
9840
9842 {
9843 if (parent)
9844 {
9845 if (parent.IsInherited(DayZInfected))
9846 return true;
9847
9848 if (!parent.IsRuined())
9849 return true;
9850 }
9851
9852 return true;
9853 }
9854
9856 {
9857 if (!super.CanPutAsAttachment(parent))
9858 {
9859 return false;
9860 }
9861
9862 if (!IsRuined() && !parent.IsRuined())
9863 {
9864 return true;
9865 }
9866
9867 return false;
9868 }
9869
9871 {
9872
9873
9874
9875
9876 return super.CanReceiveItemIntoCargo(item);
9877 }
9878
9880 {
9881
9882
9883
9884
9885 GameInventory attachmentInv = attachment.GetInventory();
9887 {
9888 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
9889 return false;
9890 }
9891
9892 InventoryLocation loc = new InventoryLocation();
9893 attachment.GetInventory().GetCurrentInventoryLocation(loc);
9894 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
9895 return false;
9896
9897 return super.CanReceiveAttachment(attachment, slotId);
9898 }
9899
9901 {
9902 if (!super.CanReleaseAttachment(attachment))
9903 return false;
9904
9905 return GetInventory().AreChildrenAccessible();
9906 }
9907
9908
9909
9910
9911
9912
9913
9914
9915
9916
9917
9918
9919
9920
9921
9922
9923
9924
9925
9926
9927
9929 {
9930 int id = muzzle_owner.GetMuzzleID();
9931 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
9932
9933 if (WPOF_array)
9934 {
9935 for (int i = 0; i < WPOF_array.Count(); i++)
9936 {
9937 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
9938
9939 if (WPOF)
9940 {
9941 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
9942 }
9943 }
9944 }
9945 }
9946
9947
9949 {
9950 int id = muzzle_owner.GetMuzzleID();
9952
9953 if (WPOBE_array)
9954 {
9955 for (int i = 0; i < WPOBE_array.Count(); i++)
9956 {
9957 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
9958
9959 if (WPOBE)
9960 {
9961 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
9962 }
9963 }
9964 }
9965 }
9966
9967
9969 {
9970 int id = muzzle_owner.GetMuzzleID();
9971 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9972
9973 if (WPOOH_array)
9974 {
9975 for (int i = 0; i < WPOOH_array.Count(); i++)
9976 {
9977 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9978
9979 if (WPOOH)
9980 {
9981 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
9982 }
9983 }
9984 }
9985 }
9986
9987
9989 {
9990 int id = muzzle_owner.GetMuzzleID();
9991 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9992
9993 if (WPOOH_array)
9994 {
9995 for (int i = 0; i < WPOOH_array.Count(); i++)
9996 {
9997 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9998
9999 if (WPOOH)
10000 {
10001 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10002 }
10003 }
10004 }
10005 }
10006
10007
10009 {
10010 int id = muzzle_owner.GetMuzzleID();
10011 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10012
10013 if (WPOOH_array)
10014 {
10015 for (int i = 0; i < WPOOH_array.Count(); i++)
10016 {
10017 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10018
10019 if (WPOOH)
10020 {
10021 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10022 }
10023 }
10024 }
10025 }
10026
10027
10028
10030 {
10032 {
10033 return true;
10034 }
10035
10036 return false;
10037 }
10038
10040 {
10042 {
10043 return true;
10044 }
10045
10046 return false;
10047 }
10048
10050 {
10052 {
10053 return true;
10054 }
10055
10056 return false;
10057 }
10058
10060 {
10061 return false;
10062 }
10063
10066 {
10067 return UATimeSpent.DEFAULT_DEPLOY;
10068 }
10069
10070
10071
10072
10074 {
10076 SetSynchDirty();
10077 }
10078
10080 {
10082 }
10083
10084
10086 {
10087 return false;
10088 }
10089
10092 {
10093 string att_type = "None";
10094
10095 if (ConfigIsExisting("soundAttType"))
10096 {
10097 att_type = ConfigGetString("soundAttType");
10098 }
10099
10101 }
10102
10104 {
10106 }
10107
10108
10109
10110
10111
10117
10119 {
10122
10124 }
10125
10126
10128 {
10130 return;
10131
10133
10136
10139
10140 SoundParameters params = new SoundParameters();
10144 }
10145
10146
10148 {
10150 {
10153
10154 SetSynchDirty();
10155
10158 }
10159 }
10160
10162 {
10164 }
10165
10166
10168 {
10170 return;
10171
10173 SetSynchDirty();
10174
10177 }
10178
10180 {
10183 }
10184
10186 {
10188 }
10189
10190 void OnApply(PlayerBase player);
10191
10193 {
10194 return 1.0;
10195 };
10196
10198 {
10200 }
10201
10203 {
10205 }
10206
10208
10210 {
10211 SetDynamicPhysicsLifeTime(0.01);
10213 }
10214
10216 {
10217 array<string> zone_names = new array<string>;
10218 GetDamageZones(zone_names);
10219 for (int i = 0; i < zone_names.Count(); i++)
10220 {
10221 SetHealthMax(zone_names.Get(i),"Health");
10222 }
10223 SetHealthMax("","Health");
10224 }
10225
10228 {
10229 float global_health = GetHealth01("","Health");
10230 array<string> zones = new array<string>;
10231 GetDamageZones(zones);
10232
10233 for (int i = 0; i < zones.Count(); i++)
10234 {
10235 SetHealth01(zones.Get(i),"Health",global_health);
10236 }
10237 }
10238
10241 {
10242 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
10243 }
10244
10246 {
10247 if (!hasRootAsPlayer)
10248 {
10249 if (refParentIB)
10250 {
10251
10252 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
10253 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
10254
10255 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
10256 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
10257
10260 }
10261 else
10262 {
10263
10266 }
10267 }
10268 }
10269
10271 {
10273 {
10274 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
10275 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
10276 {
10277 float heatPermCoef = 1.0;
10279 while (ent)
10280 {
10281 heatPermCoef *= ent.GetHeatPermeabilityCoef();
10282 ent = ent.GetHierarchyParent();
10283 }
10284
10285 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
10286 }
10287 }
10288 }
10289
10291 {
10292
10293 EntityAI parent = GetHierarchyParent();
10294 if (!parent)
10295 {
10296 hasParent = false;
10297 hasRootAsPlayer = false;
10298 }
10299 else
10300 {
10301 hasParent = true;
10302 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
10303 refParentIB =
ItemBase.Cast(parent);
10304 }
10305 }
10306
10307 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
10308 {
10309
10310 }
10311
10313 {
10314
10315 return false;
10316 }
10317
10319 {
10320
10321
10322 return false;
10323 }
10324
10326 {
10327
10328 return false;
10329 }
10330
10333 {
10334 return !GetIsFrozen() &&
IsOpen();
10335 }
10336
10338 {
10339 bool hasParent = false, hasRootAsPlayer = false;
10341
10342 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
10343 bool foodDecay =
g_Game.IsFoodDecayEnabled();
10344
10345 if (wwtu || foodDecay)
10346 {
10350
10351 if (processWetness || processTemperature || processDecay)
10352 {
10354
10355 if (processWetness)
10356 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
10357
10358 if (processTemperature)
10360
10361 if (processDecay)
10362 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
10363 }
10364 }
10365 }
10366
10369 {
10371 }
10372
10374 {
10377
10378 return super.GetTemperatureFreezeThreshold();
10379 }
10380
10382 {
10385
10386 return super.GetTemperatureThawThreshold();
10387 }
10388
10390 {
10393
10394 return super.GetItemOverheatThreshold();
10395 }
10396
10398 {
10400 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
10401
10402 return super.GetTemperatureFreezeTime();
10403 }
10404
10406 {
10408 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
10409
10410 return super.GetTemperatureThawTime();
10411 }
10412
10417
10419 {
10420 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
10421 }
10422
10424 {
10425 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
10426 }
10427
10430 {
10432 }
10433
10435 {
10437 }
10438
10440 {
10442 }
10443
10446 {
10447 return null;
10448 }
10449
10452 {
10453 return false;
10454 }
10455
10457 {
10459 {
10462 if (!trg)
10463 {
10465 explosive = this;
10466 }
10467
10468 explosive.PairRemote(trg);
10470
10471 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
10472 trg.SetPersistentPairID(persistentID);
10473 explosive.SetPersistentPairID(persistentID);
10474
10475 return true;
10476 }
10477 return false;
10478 }
10479
10482 {
10483 float ret = 1.0;
10486 ret *= GetHealth01();
10487
10488 return ret;
10489 }
10490
10491 #ifdef DEVELOPER
10492 override void SetDebugItem()
10493 {
10494 super.SetDebugItem();
10495 _itemBase = this;
10496 }
10497
10499 {
10500 string text = super.GetDebugText();
10501
10503 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
10504
10505 return text;
10506 }
10507 #endif
10508
10510 {
10511 return true;
10512 }
10513
10515
10517
10519 {
10522 }
10523
10524
10532
10548
10549 [
Obsolete(
"Use ItemSoundHandler instead")]
10552 {
10553 if (!
g_Game.IsDedicatedServer())
10554 {
10555 if (ConfigIsExisting("attachSoundSet"))
10556 {
10557 string cfg_path = "";
10558 string soundset = "";
10559 string type_name =
GetType();
10560
10563 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
10564 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
10565
10566 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
10567 {
10568 for (int i = 0; i < cfg_soundset_array.Count(); i++)
10569 {
10570 if (cfg_slot_array[i] == slot_type)
10571 {
10572 soundset = cfg_soundset_array[i];
10573 break;
10574 }
10575 }
10576 }
10577
10578 if (soundset != "")
10579 {
10580 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
10582 }
10583 }
10584 }
10585 }
10586
10588}
10589
10591{
10593 if (entity)
10594 {
10595 bool is_item = entity.IsInherited(
ItemBase);
10596 if (is_item && full_quantity)
10597 {
10600 }
10601 }
10602 else
10603 {
10605 return NULL;
10606 }
10607 return entity;
10608}
10609
10611{
10612 if (item)
10613 {
10614 if (health > 0)
10615 item.SetHealth("", "", health);
10616
10617 if (item.CanHaveTemperature())
10618 {
10620 if (item.CanFreeze())
10621 item.SetFrozen(false);
10622 }
10623
10624 if (item.HasEnergyManager())
10625 {
10626 if (quantity >= 0)
10627 {
10628 item.GetCompEM().SetEnergy0To1(quantity);
10629 }
10630 else
10631 {
10633 }
10634 }
10635 else if (item.IsMagazine())
10636 {
10637 Magazine mag = Magazine.Cast(item);
10638 if (quantity >= 0)
10639 {
10640 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
10641 }
10642 else
10643 {
10645 }
10646
10647 }
10648 else
10649 {
10650 if (quantity >= 0)
10651 {
10652 item.SetQuantityNormalized(quantity, false);
10653 }
10654 else
10655 {
10657 }
10658
10659 }
10660 }
10661}
10662
10663#ifdef DEVELOPER
10665#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.