5560{
5562 {
5563 return true;
5564 }
5565};
5566
5568{
5569
5570};
5571
5572
5573
5575{
5579
5581
5584
5585
5586
5587
5588
5597
5603
5608
5613
5634 protected bool m_IsResultOfSplit
5635
5637
5642
5643
5644
5646
5650
5651
5652
5654
5657
5658
5659
5665
5666
5674
5677
5678
5680
5681
5683
5684
5689
5690
5695
5697
5698
5700
5701
5703 {
5708
5709 if (!
g_Game.IsDedicatedServer())
5710 {
5712 {
5714
5716 {
5718 }
5719 }
5720
5723 }
5724
5725 m_OldLocation = null;
5726
5728 {
5730 }
5731
5732 if (ConfigIsExisting("headSelectionsToHide"))
5733 {
5736 }
5737
5739 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
5740 {
5742 }
5743
5745
5746 m_IsResultOfSplit = false;
5747
5749 }
5750
5752 {
5753 super.InitItemVariables();
5754
5760 m_Count = ConfigGetInt(
"count");
5761
5764
5769
5772
5777
5789
5793
5794
5797 if (ConfigIsExisting("canBeSplit"))
5798 {
5801 }
5802
5804 if (ConfigIsExisting("itemBehaviour"))
5806
5807
5810 RegisterNetSyncVariableInt("m_VarLiquidType");
5811 RegisterNetSyncVariableInt("m_Cleanness",0,1);
5812
5813 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
5814 RegisterNetSyncVariableFloat("m_ImpactSpeed");
5815 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
5816
5817 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
5818 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
5819 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
5820 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
5821
5822 RegisterNetSyncVariableBool("m_IsBeingPlaced");
5823 RegisterNetSyncVariableBool("m_IsTakeable");
5824 RegisterNetSyncVariableBool("m_IsHologram");
5825
5828 {
5831 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
5832 }
5833
5835
5837 if (ConfigIsExisting("temperaturePerQuantityWeight"))
5839
5841 }
5842
5844 {
5846 }
5847
5849 {
5852 {
5857 }
5858 }
5859
5860 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
5861 {
5863 {
5866 }
5867
5869 }
5870
5872 {
5878 }
5879
5881
5883 {
5885
5886 if (!action)
5887 {
5888 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
5889 return;
5890 }
5891
5893 if (!ai)
5894 {
5896 return;
5897 }
5898
5900 if (!action_array)
5901 {
5902 action_array = new array<ActionBase_Basic>;
5904 }
5905 if (LogManager.IsActionLogEnable())
5906 {
5907 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
5908 }
5909
5910 if (action_array.Find(action) != -1)
5911 {
5912 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
5913 }
5914 else
5915 {
5916 action_array.Insert(action);
5917 }
5918 }
5919
5921 {
5922 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
5923 ActionBase action = player.GetActionManager().GetAction(actionName);
5926
5927 if (action_array)
5928 {
5929 action_array.RemoveItem(action);
5930 }
5931 }
5932
5933
5934
5936 {
5937 ActionOverrideData overrideData = new ActionOverrideData();
5941
5943 if (!actionMap)
5944 {
5947 }
5948
5949 actionMap.Insert(this.
Type(), overrideData);
5950
5951 }
5952
5954
5956
5957
5959 {
5962
5965
5966 string config_to_search = "CfgVehicles";
5967 string muzzle_owner_config;
5968
5970 {
5971 if (IsInherited(Weapon))
5972 config_to_search = "CfgWeapons";
5973
5974 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
5975
5976 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
5977
5978 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
5979
5980 if (config_OnFire_subclass_count > 0)
5981 {
5982 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
5983
5984 for (int i = 0; i < config_OnFire_subclass_count; i++)
5985 {
5986 string particle_class = "";
5987 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
5988 string config_OnFire_entry = config_OnFire_class + particle_class;
5989 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
5990 WPOF_array.Insert(WPOF);
5991 }
5992
5993
5995 }
5996 }
5997
5999 {
6000 config_to_search = "CfgWeapons";
6001 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6002
6003 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
6004
6005 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
6006
6007 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
6008 {
6009 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
6010
6011 for (i = 0; i < config_OnBulletCasingEject_count; i++)
6012 {
6013 string particle_class2 = "";
6014 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
6015 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
6016 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
6017 WPOBE_array.Insert(WPOBE);
6018 }
6019
6020
6022 }
6023 }
6024 }
6025
6026
6028 {
6031
6033 {
6034 string config_to_search = "CfgVehicles";
6035
6036 if (IsInherited(Weapon))
6037 config_to_search = "CfgWeapons";
6038
6039 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6040 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
6041
6042 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
6043 {
6044
6046
6048 {
6050 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
6052 return;
6053 }
6054
6057
6058
6059
6060 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
6061 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
6062
6063 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
6064 {
6065 string particle_class = "";
6066 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
6067 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
6068 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
6069
6070 if (entry_type == CT_CLASS)
6071 {
6072 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
6073 WPOOH_array.Insert(WPOF);
6074 }
6075 }
6076
6077
6079 }
6080 }
6081 }
6082
6084 {
6086 }
6087
6089 {
6091 {
6093
6096
6099
6100 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6101 }
6102 }
6103
6105 {
6107 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6108
6110 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6111
6113 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6114
6116 {
6118 }
6119 }
6120
6122 {
6124 }
6125
6127 {
6130 else
6132
6134 {
6137 }
6138 else
6139 {
6142
6145 }
6146
6148 }
6149
6151 {
6153 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6154 }
6155
6157 {
6159 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6161 }
6162
6164 {
6166 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6167 }
6168
6170 {
6173
6174 OverheatingParticle OP = new OverheatingParticle();
6179
6181 }
6182
6184 {
6187
6188 return -1;
6189 }
6190
6192 {
6194 {
6197
6198 for (int i = count; i > 0; --i)
6199 {
6200 int id = i - 1;
6203
6206
6207 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
6208 {
6209 if (p)
6210 {
6213 }
6214 }
6215 }
6216 }
6217 }
6218
6220 {
6222 {
6224 {
6225 int id = i - 1;
6227
6228 if (OP)
6229 {
6231
6232 if (p)
6233 {
6235 }
6236
6237 delete OP;
6238 }
6239 }
6240
6243 }
6244 }
6245
6248 {
6249 return 0.0;
6250 }
6251
6252
6254 {
6255 return 250;
6256 }
6257
6259 {
6260 return 0;
6261 }
6262
6265 {
6267 return true;
6268
6269 return false;
6270 }
6271
6274 {
6277
6279 {
6281 }
6282 else
6283 {
6284
6286 }
6287
6289 }
6290
6297 {
6298 return -1;
6299 }
6300
6301
6302
6303
6305 {
6307 {
6308 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6309 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6310
6311 if (r_index >= 0)
6312 {
6313 InventoryLocation r_il = new InventoryLocation;
6314 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6315
6316 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6319 {
6320 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6321 }
6323 {
6324 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6325 }
6326
6327 }
6328
6329 player.GetHumanInventory().ClearUserReservedLocation(this);
6330 }
6331
6334 }
6335
6336
6337
6338
6340 {
6341 return ItemBase.m_DebugActionsMask;
6342 }
6343
6345 {
6346 return ItemBase.m_DebugActionsMask & mask;
6347 }
6348
6350 {
6351 ItemBase.m_DebugActionsMask = mask;
6352 }
6353
6355 {
6356 ItemBase.m_DebugActionsMask |= mask;
6357 }
6358
6360 {
6361 ItemBase.m_DebugActionsMask &= ~mask;
6362 }
6363
6365 {
6367 {
6369 }
6370 else
6371 {
6373 }
6374 }
6375
6376
6378 {
6379 if (GetEconomyProfile())
6380 {
6381 float q_max = GetEconomyProfile().GetQuantityMax();
6382 if (q_max > 0)
6383 {
6384 float q_min = GetEconomyProfile().GetQuantityMin();
6385 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
6386
6388 {
6389 ComponentEnergyManager comp = GetCompEM();
6391 {
6393 }
6394 }
6396 {
6398
6399 }
6400
6401 }
6402 }
6403 }
6404
6407 {
6408 EntityAI parent = GetHierarchyParent();
6409
6410 if (parent)
6411 {
6412 InventoryLocation inventory_location_to_lock = new InventoryLocation;
6413 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
6414 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
6415 }
6416 }
6417
6420 {
6421 EntityAI parent = GetHierarchyParent();
6422
6423 if (parent)
6424 {
6425 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
6426 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
6427 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
6428 }
6429 }
6430
6432 {
6433
6434
6435
6436
6438
6440 {
6441 if (ScriptInputUserData.CanStoreInputUserData())
6442 {
6443 ScriptInputUserData ctx = new ScriptInputUserData;
6449 ctx.
Write(use_stack_max);
6452
6454 {
6455 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
6456 }
6457 }
6458 }
6459 else if (!
g_Game.IsMultiplayer())
6460 {
6462 }
6463 }
6464
6466 {
6468 }
6469
6471 {
6473 }
6474
6476 {
6478 }
6479
6481 {
6482
6483 return false;
6484 }
6485
6487 {
6488 return false;
6489 }
6490
6494 {
6495 return false;
6496 }
6497
6499 {
6500 return "";
6501 }
6502
6504
6506 {
6507 return false;
6508 }
6509
6511 {
6512 return true;
6513 }
6514
6515
6516
6518 {
6519 return true;
6520 }
6521
6523 {
6524 return true;
6525 }
6526
6528 {
6529 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6531 }
6532
6534 {
6536 }
6537
6539 {
6541 if (!is_being_placed)
6543 SetSynchDirty();
6544 }
6545
6546
6548
6550 {
6552 }
6553
6555 {
6557 }
6558
6560 {
6561 return 1;
6562 }
6563
6565 {
6566 return false;
6567 }
6568
6570 {
6572 SetSynchDirty();
6573 }
6574
6575
6576
6577
6578
6579
6580
6581
6582
6583
6584
6585
6586
6587
6588
6589
6590
6591
6592
6593
6594
6595
6596
6597
6598
6599
6600
6601
6602
6603
6604
6605
6606
6607
6608
6610 {
6611 super.OnMovedInsideCargo(container);
6612
6613 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6614 }
6615
6616 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
6617 {
6618 super.EEItemLocationChanged(oldLoc, newLoc);
6619
6620 PlayerBase newPlayer = null;
6621 PlayerBase oldPlayer = null;
6622
6623 if (newLoc.GetParent())
6624 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
6625
6626 if (oldLoc.GetParent())
6627 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
6628
6630 {
6631 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
6632
6633 if (rIndex >= 0)
6634 {
6635 InventoryLocation rIl = new InventoryLocation;
6636 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
6637
6638 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
6641 {
6642 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
6643 }
6645 {
6647 }
6648
6649 }
6650 }
6651
6653 {
6654 if (newPlayer)
6655 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
6656
6657 if (newPlayer == oldPlayer)
6658 {
6659 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
6660 {
6662 {
6663 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
6664 {
6665 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6666 }
6667 }
6668 else
6669 {
6670 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6671 }
6672 }
6673
6674 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
6675 {
6676 int type = oldLoc.GetType();
6678 {
6679 oldLoc.GetParent().GetOnSetLock().Invoke(this);
6680 }
6682 {
6683 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
6684 }
6685 }
6686 if (!m_OldLocation)
6687 {
6688 m_OldLocation = new InventoryLocation;
6689 }
6690 m_OldLocation.Copy(oldLoc);
6691 }
6692 else
6693 {
6694 if (m_OldLocation)
6695 {
6696 m_OldLocation.Reset();
6697 }
6698 }
6699
6700 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
6701 }
6702 else
6703 {
6704 if (newPlayer)
6705 {
6706 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
6707 if (resIndex >= 0)
6708 {
6709 InventoryLocation il = new InventoryLocation;
6710 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
6712 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
6715 {
6716 il.
GetParent().GetOnReleaseLock().Invoke(it);
6717 }
6719 {
6721 }
6722
6723 }
6724 }
6726 {
6727
6729 }
6730
6731 if (m_OldLocation)
6732 {
6733 m_OldLocation.Reset();
6734 }
6735 }
6736
6738 {
6739 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
6740 }
6741
6743 {
6744 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
6745 }
6746 }
6747
6748 override void EOnContact(IEntity other, Contact extra)
6749 {
6751 {
6752 int liquidType = -1;
6754 if (impactSpeed > 0.0)
6755 {
6757 #ifndef SERVER
6759 #else
6761 SetSynchDirty();
6762 #endif
6764 }
6765 }
6766
6767 #ifdef SERVER
6768 if (GetCompEM() && GetCompEM().IsPlugged())
6769 {
6770 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
6771 GetCompEM().UnplugThis();
6772 }
6773 #endif
6774 }
6775
6777
6779 {
6781 }
6782
6784 {
6785
6786 }
6787
6789 {
6790 super.OnItemLocationChanged(old_owner, new_owner);
6791
6792 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
6793 PlayerBase playerNew = PlayerBase.Cast(new_owner);
6794
6795 if (!relatedPlayer && playerNew)
6796 relatedPlayer = playerNew;
6797
6798 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
6799 {
6801 if (actionMgr)
6802 {
6803 ActionBase currentAction = actionMgr.GetRunningAction();
6804 if (currentAction)
6806 }
6807 }
6808
6809 Man ownerPlayerOld = null;
6810 Man ownerPlayerNew = null;
6811
6812 if (old_owner)
6813 {
6814 if (old_owner.
IsMan())
6815 {
6816 ownerPlayerOld = Man.Cast(old_owner);
6817 }
6818 else
6819 {
6820 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
6821 }
6822 }
6823 else
6824 {
6826 {
6828
6829 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
6830 {
6831 GetCompEM().UnplugThis();
6832 }
6833 }
6834 }
6835
6836 if (new_owner)
6837 {
6838 if (new_owner.
IsMan())
6839 {
6840 ownerPlayerNew = Man.Cast(new_owner);
6841 }
6842 else
6843 {
6844 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
6845 }
6846 }
6847
6848 if (ownerPlayerOld != ownerPlayerNew)
6849 {
6850 if (ownerPlayerOld)
6851 {
6852 array<EntityAI> subItemsExit = new array<EntityAI>;
6854 for (int i = 0; i < subItemsExit.Count(); i++)
6855 {
6858 }
6859 }
6860
6861 if (ownerPlayerNew)
6862 {
6863 array<EntityAI> subItemsEnter = new array<EntityAI>;
6865 for (int j = 0; j < subItemsEnter.Count(); j++)
6866 {
6869 }
6870 }
6871 }
6872 else if (ownerPlayerNew != null)
6873 {
6874 PlayerBase nplayer;
6875 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
6876 {
6877 array<EntityAI> subItemsUpdate = new array<EntityAI>;
6879 for (int k = 0; k < subItemsUpdate.Count(); k++)
6880 {
6882 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
6883 }
6884 }
6885 }
6886
6887 if (old_owner)
6888 old_owner.OnChildItemRemoved(this);
6889 if (new_owner)
6890 new_owner.OnChildItemReceived(this);
6891 }
6892
6893
6895 {
6896 super.EEDelete(parent);
6897 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
6898 if (player)
6899 {
6901
6902 if (player.IsAlive())
6903 {
6904 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6905 if (r_index >= 0)
6906 {
6907 InventoryLocation r_il = new InventoryLocation;
6908 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6909
6910 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6913 {
6914 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6915 }
6917 {
6918 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6919 }
6920
6921 }
6922
6923 player.RemoveQuickBarEntityShortcut(this);
6924 }
6925 }
6926 }
6927
6929 {
6930 super.EEKilled(killer);
6931
6934 {
6935 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
6936 {
6937 if (IsMagazine())
6938 {
6939 if (Magazine.Cast(this).GetAmmoCount() > 0)
6940 {
6942 }
6943 }
6944 else
6945 {
6947 }
6948 }
6949 }
6950 }
6951
6953 {
6954 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6955
6956 super.OnWasAttached(parent, slot_id);
6957
6960
6963 }
6964
6966 {
6967 super.OnWasDetached(parent, slot_id);
6968
6971
6974 }
6975
6977 {
6978 int idx;
6981
6982 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
6983 if (inventory_slots.Count() < 1)
6984 {
6985 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
6986 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
6987 }
6988 else
6989 {
6990 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
6991 }
6992
6993 idx = inventory_slots.Find(slot);
6994 if (idx < 0)
6995 return "";
6996
6997 return attach_types.Get(idx);
6998 }
6999
7001 {
7002 int idx = -1;
7003 string slot;
7004
7007
7008 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7009 if (inventory_slots.Count() < 1)
7010 {
7011 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
7012 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7013 }
7014 else
7015 {
7016 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
7017 if (detach_types.Count() < 1)
7018 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7019 }
7020
7021 for (int i = 0; i < inventory_slots.Count(); i++)
7022 {
7023 slot = inventory_slots.Get(i);
7024 }
7025
7026 if (slot != "")
7027 {
7028 if (detach_types.Count() == 1)
7029 idx = 0;
7030 else
7031 idx = inventory_slots.Find(slot);
7032 }
7033 if (idx < 0)
7034 return "";
7035
7036 return detach_types.Get(idx);
7037 }
7038
7040 {
7041
7043
7044
7045 float min_time = 1;
7046 float max_time = 3;
7047 float delay = Math.RandomFloat(min_time, max_time);
7048
7049 explode_timer.Run(delay, this, "DoAmmoExplosion");
7050 }
7051
7053 {
7054 Magazine magazine = Magazine.Cast(this);
7055 int pop_sounds_count = 6;
7056 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
7057
7058
7059 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
7060 string sound_name = pop_sounds[ sound_idx ];
7061 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
7062
7063
7064 magazine.ServerAddAmmoCount(-1);
7065
7066
7067 float min_temp_to_explode = 100;
7068
7069 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
7070 {
7072 }
7073 }
7074
7075
7076 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
7077 {
7078 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
7079
7080 const int CHANCE_DAMAGE_CARGO = 4;
7081 const int CHANCE_DAMAGE_ATTACHMENT = 1;
7082 const int CHANCE_DAMAGE_NOTHING = 2;
7083
7085 {
7086 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
7087 int chances;
7088 int rnd;
7089
7090 if (GetInventory().GetCargo())
7091 {
7092 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7093 rnd = Math.RandomInt(0,chances);
7094
7095 if (rnd < CHANCE_DAMAGE_CARGO)
7096 {
7098 }
7099 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
7100 {
7102 }
7103 }
7104 else
7105 {
7106 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7107 rnd = Math.RandomInt(0,chances);
7108
7109 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
7110 {
7112 }
7113 }
7114 }
7115 }
7116
7118 {
7119 CargoBase cargo = GetInventory().GetCargo();
7120 if (cargo)
7121 {
7123 if (item_count > 0)
7124 {
7125 int random_pick = Math.RandomInt(0, item_count);
7127 if (!item.IsExplosive())
7128 {
7129 item.AddHealth("","",damage);
7130 return true;
7131 }
7132 }
7133 }
7134 return false;
7135 }
7136
7138 {
7139 GameInventory inventory = GetInventory();
7141 if (attachment_count > 0)
7142 {
7143 int random_pick = Math.RandomInt(0, attachment_count);
7145 if (!attachment.IsExplosive())
7146 {
7147 attachment.AddHealth("","",damage);
7148 return true;
7149 }
7150 }
7151 return false;
7152 }
7153
7155 {
7157 }
7158
7160 {
7162 return GetInventory().CanRemoveEntity();
7163
7164 return false;
7165 }
7166
7168 {
7169
7171 return false;
7172
7173
7175 return false;
7176
7177
7178
7180 if (delta == 0)
7181 return false;
7182
7183
7184 return true;
7185 }
7186
7188 {
7190 {
7191 if (ScriptInputUserData.CanStoreInputUserData())
7192 {
7193 ScriptInputUserData ctx = new ScriptInputUserData;
7198 ctx.
Write(destination_entity);
7202 }
7203 }
7204 else if (!
g_Game.IsMultiplayer())
7205 {
7207 }
7208 }
7209
7211 {
7212 float split_quantity_new;
7216 InventoryLocation loc = new InventoryLocation;
7217
7218 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7219 {
7221 split_quantity_new = stack_max;
7222 else
7224
7226 {
7227 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7228 if (new_item)
7229 {
7230 new_item.SetResultOfSplit(true);
7231 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7233 new_item.
SetQuantity(split_quantity_new,
false,
true);
7234 }
7235 }
7236 }
7237 else if (destination_entity && slot_id == -1)
7238 {
7239 if (quantity > stack_max)
7240 split_quantity_new = stack_max;
7241 else
7242 split_quantity_new = quantity;
7243
7245 {
7246 GameInventory destinationInventory = destination_entity.GetInventory();
7248 {
7251 }
7252
7253 if (new_item)
7254 {
7255 new_item.SetResultOfSplit(true);
7256 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7258 new_item.
SetQuantity(split_quantity_new,
false,
true);
7259 }
7260 }
7261 }
7262 else
7263 {
7264 if (stack_max != 0)
7265 {
7267 {
7269 }
7270
7271 if (split_quantity_new == 0)
7272 {
7273 if (!
g_Game.IsMultiplayer())
7274 player.PhysicalPredictiveDropItem(this);
7275 else
7276 player.ServerDropEntity(this);
7277 return;
7278 }
7279
7281 {
7283
7284 if (new_item)
7285 {
7286 new_item.SetResultOfSplit(true);
7287 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7290 new_item.PlaceOnSurface();
7291 }
7292 }
7293 }
7294 }
7295 }
7296
7298 {
7299 float split_quantity_new;
7303 InventoryLocation loc = new InventoryLocation;
7304
7305 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7306 {
7308 split_quantity_new = stack_max;
7309 else
7311
7313 {
7314 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7315 if (new_item)
7316 {
7317 new_item.SetResultOfSplit(true);
7318 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7320 new_item.
SetQuantity(split_quantity_new,
false,
true);
7321 }
7322 }
7323 }
7324 else if (destination_entity && slot_id == -1)
7325 {
7326 if (quantity > stack_max)
7327 split_quantity_new = stack_max;
7328 else
7329 split_quantity_new = quantity;
7330
7332 {
7333 GameInventory destinationInventory = destination_entity.GetInventory();
7335 {
7338 }
7339
7340 if (new_item)
7341 {
7342 new_item.SetResultOfSplit(true);
7343 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7345 new_item.
SetQuantity(split_quantity_new,
false,
true);
7346 }
7347 }
7348 }
7349 else
7350 {
7351 if (stack_max != 0)
7352 {
7354 {
7356 }
7357
7359 {
7361
7362 if (new_item)
7363 {
7364 new_item.SetResultOfSplit(true);
7365 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7368 new_item.PlaceOnSurface();
7369 }
7370 }
7371 }
7372 }
7373 }
7374
7376 {
7378 {
7379 if (ScriptInputUserData.CanStoreInputUserData())
7380 {
7381 ScriptInputUserData ctx = new ScriptInputUserData;
7386 dst.WriteToContext(ctx);
7388 }
7389 }
7390 else if (!
g_Game.IsMultiplayer())
7391 {
7393 }
7394 }
7395
7397 {
7399 {
7400 if (ScriptInputUserData.CanStoreInputUserData())
7401 {
7402 ScriptInputUserData ctx = new ScriptInputUserData;
7407 ctx.
Write(destination_entity);
7413 }
7414 }
7415 else if (!
g_Game.IsMultiplayer())
7416 {
7418 }
7419 }
7420
7422 {
7424 }
7425
7427 {
7429 float split_quantity_new;
7431 if (dst.IsValid())
7432 {
7433 int slot_id = dst.GetSlot();
7435
7436 if (quantity > stack_max)
7437 split_quantity_new = stack_max;
7438 else
7439 split_quantity_new = quantity;
7440
7442 {
7444
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 return new_item;
7454 }
7455 }
7456
7457 return null;
7458 }
7459
7461 {
7463 float split_quantity_new;
7465 if (destination_entity)
7466 {
7468 if (quantity > stackable)
7469 split_quantity_new = stackable;
7470 else
7471 split_quantity_new = quantity;
7472
7474 {
7475 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
7476 if (new_item)
7477 {
7478 new_item.SetResultOfSplit(true);
7479 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7481 new_item.
SetQuantity(split_quantity_new,
false,
true);
7482 }
7483 }
7484 }
7485 }
7486
7488 {
7490 {
7491 if (ScriptInputUserData.CanStoreInputUserData())
7492 {
7493 ScriptInputUserData ctx = new ScriptInputUserData;
7498 ItemBase destination_entity =
this;
7499 ctx.
Write(destination_entity);
7503 }
7504 }
7505 else if (!
g_Game.IsMultiplayer())
7506 {
7508 }
7509 }
7510
7512 {
7514 float split_quantity_new;
7516 if (player)
7517 {
7519 if (quantity > stackable)
7520 split_quantity_new = stackable;
7521 else
7522 split_quantity_new = quantity;
7523
7525 {
7526 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
7527 new_item =
ItemBase.Cast(in_hands);
7528 if (new_item)
7529 {
7530 new_item.SetResultOfSplit(true);
7531 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7533 new_item.SetQuantity(split_quantity_new, false, true);
7534 }
7535 }
7536 }
7537 }
7538
7540 {
7542 float split_quantity_new = Math.Floor(quantity * 0.5);
7543
7545 return;
7546
7548
7549 if (new_item)
7550 {
7551 if (new_item.GetQuantityMax() < split_quantity_new)
7552 {
7553 split_quantity_new = new_item.GetQuantityMax();
7554 }
7555
7556 new_item.SetResultOfSplit(true);
7557 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7558
7560 {
7563 }
7564 else
7565 {
7567 new_item.
SetQuantity(split_quantity_new,
false,
true);
7568 }
7569 }
7570 }
7571
7573 {
7575 float split_quantity_new = Math.Floor(quantity / 2);
7576
7578 return;
7579
7580 InventoryLocation invloc = new InventoryLocation;
7582
7584 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
7585
7586 if (new_item)
7587 {
7588 if (new_item.GetQuantityMax() < split_quantity_new)
7589 {
7590 split_quantity_new = new_item.GetQuantityMax();
7591 }
7593 {
7596 }
7597 else if (split_quantity_new > 1)
7598 {
7600 new_item.
SetQuantity(split_quantity_new,
false,
true);
7601 }
7602 }
7603 }
7604
7607 {
7608 SetWeightDirty();
7610
7611 if (parent)
7612 parent.OnAttachmentQuantityChangedEx(this, delta);
7613
7615 {
7617 {
7619 }
7621 {
7622 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
7624 }
7625 }
7626 }
7627
7630 {
7631
7632 }
7633
7636 {
7638 }
7639
7641 {
7642 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
7643
7645 {
7646 if (newLevel == GameConstants.STATE_RUINED)
7647 {
7649 EntityAI parent = GetHierarchyParent();
7650 if (parent && parent.IsFireplace())
7651 {
7652 CargoBase cargo = GetInventory().GetCargo();
7653 if (cargo)
7654 {
7656 {
7658 }
7659 }
7660 }
7661 }
7662
7664 {
7665
7667 return;
7668 }
7669
7670 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
7671 {
7673 }
7674 }
7675 }
7676
7677
7679 {
7680 super.OnRightClick();
7681
7683 {
7685 {
7686 if (ScriptInputUserData.CanStoreInputUserData())
7687 {
7688 EntityAI root = GetHierarchyRoot();
7689 Man playerOwner = GetHierarchyRootPlayer();
7690 InventoryLocation dst = new InventoryLocation;
7691
7692
7693 if (!playerOwner && root && root == this)
7694 {
7696 }
7697 else
7698 {
7699
7700 GetInventory().GetCurrentInventoryLocation(dst);
7702 {
7703 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7705 {
7707 }
7708 else
7709 {
7711
7712
7713 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
7714 {
7716 }
7717 else
7718 {
7719 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
7720 }
7721 }
7722 }
7723 }
7724
7725 ScriptInputUserData ctx = new ScriptInputUserData;
7733 }
7734 }
7735 else if (!
g_Game.IsMultiplayer())
7736 {
7738 }
7739 }
7740 }
7741
7743 {
7744 if (root)
7745 {
7746 vector m4[4];
7747 root.GetTransform(m4);
7748 dst.SetGround(this, m4);
7749 }
7750 else
7751 {
7752 GetInventory().GetCurrentInventoryLocation(dst);
7753 }
7754 }
7755
7756 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
7757 {
7758
7759 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
7760 return false;
7761
7762 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
7763 return false;
7764
7765
7767 return false;
7768
7769
7770 Magazine mag = Magazine.Cast(this);
7771 if (mag)
7772 {
7773 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
7774 return false;
7775
7776 if (stack_max_limit)
7777 {
7778 Magazine other_mag = Magazine.Cast(other_item);
7779 if (other_item)
7780 {
7781 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
7782 return false;
7783 }
7784
7785 }
7786 }
7787 else
7788 {
7789
7791 return false;
7792
7794 return false;
7795 }
7796
7797 PlayerBase player = null;
7798 if (CastTo(player, GetHierarchyRootPlayer()))
7799 {
7800 if (player.GetInventory().HasAttachment(this))
7801 return false;
7802
7803 if (player.IsItemsToDelete())
7804 return false;
7805 }
7806
7807 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
7808 return false;
7809
7810 int slotID;
7812 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
7813 return false;
7814
7815 return true;
7816 }
7817
7819 {
7821 }
7822
7824 {
7825 return m_IsResultOfSplit;
7826 }
7827
7829 {
7830 m_IsResultOfSplit = value;
7831 }
7832
7834 {
7836 }
7837
7839 {
7840 float other_item_quantity = other_item.GetQuantity();
7841 float this_free_space;
7842
7844
7846
7847 if (other_item_quantity > this_free_space)
7848 {
7849 return this_free_space;
7850 }
7851 else
7852 {
7853 return other_item_quantity;
7854 }
7855 }
7856
7858 {
7860 }
7861
7863 {
7865 return;
7866
7867 if (!IsMagazine() && other_item)
7868 {
7870 if (quantity_used != 0)
7871 {
7872 float hp1 = GetHealth01("","");
7873 float hp2 = other_item.GetHealth01("","");
7874 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
7875 hpResult = hpResult / (
GetQuantity() + quantity_used);
7876
7877 hpResult *= GetMaxHealth();
7878 Math.Round(hpResult);
7879 SetHealth("", "Health", hpResult);
7880
7882 other_item.AddQuantity(-quantity_used);
7883 }
7884 }
7886 }
7887
7889 {
7890 #ifdef SERVER
7891 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
7892 GetHierarchyParent().IncreaseLifetimeUp();
7893 #endif
7894 };
7895
7897 {
7898 PlayerBase p = PlayerBase.Cast(player);
7899
7900 array<int> recipesIds = p.m_Recipes;
7901 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
7902 if (moduleRecipesManager)
7903 {
7904 EntityAI itemInHands = player.GetEntityInHands();
7905 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
7906 }
7907
7908 for (int i = 0;i < recipesIds.Count(); i++)
7909 {
7910 int key = recipesIds.Get(i);
7911 string recipeName = moduleRecipesManager.GetRecipeName(key);
7913 }
7914 }
7915
7916
7917 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
7918 {
7919 super.GetDebugActions(outputList);
7920
7921
7927
7928
7933
7938
7939
7943
7944
7946 {
7950 }
7951
7954
7955
7959
7961
7962 InventoryLocation loc = new InventoryLocation();
7963 GetInventory().GetCurrentInventoryLocation(loc);
7965 {
7966 if (Gizmo_IsSupported())
7969 }
7970
7972 }
7973
7974
7975
7976
7978 {
7979 super.OnAction(action_id, player, ctx);
7980
7982 {
7983 switch (action_id)
7984 {
7988 return true;
7992 return true;
7993 }
7994 }
7995
7997 {
7998 switch (action_id)
7999 {
8001 Delete();
8002 return true;
8003 }
8004 }
8005
8006 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
8007 {
8008 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8009 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
8010 PlayerBase p = PlayerBase.Cast(player);
8011 if (
EActions.RECIPES_RANGE_START < 1000)
8012 {
8013 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
8014 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
8015 }
8016 }
8017 #ifndef SERVER
8018 else if (action_id ==
EActions.WATCH_PLAYER)
8019 {
8020 PluginDeveloper.SetDeveloperItemClientEx(player);
8021 }
8022 #endif
8024 {
8025 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
8026 {
8027 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
8028 OnDebugButtonPressServer(id + 1);
8029 }
8030
8031 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
8032 {
8033 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
8035 }
8036
8037 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
8038 {
8039 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
8041 }
8042
8043 else if (action_id ==
EActions.ADD_QUANTITY)
8044 {
8045 if (IsMagazine())
8046 {
8047 Magazine mag = Magazine.Cast(this);
8048 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
8049 }
8050 else
8051 {
8053 }
8054
8055 if (m_EM)
8056 {
8057 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
8058 }
8059
8060 }
8061
8062 else if (action_id ==
EActions.REMOVE_QUANTITY)
8063 {
8064 if (IsMagazine())
8065 {
8066 Magazine mag2 = Magazine.Cast(this);
8067 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
8068 }
8069 else
8070 {
8072 }
8073 if (m_EM)
8074 {
8075 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
8076 }
8077
8078 }
8079
8080 else if (action_id ==
EActions.SET_QUANTITY_0)
8081 {
8083
8084 if (m_EM)
8085 {
8086 m_EM.SetEnergy(0);
8087 }
8088 }
8089
8090 else if (action_id ==
EActions.SET_MAX_QUANTITY)
8091 {
8093
8094 if (m_EM)
8095 {
8096 m_EM.SetEnergy(m_EM.GetEnergyMax());
8097 }
8098 }
8099
8100 else if (action_id ==
EActions.ADD_HEALTH)
8101 {
8102 AddHealth("","",GetMaxHealth("","Health")/5);
8103 }
8104 else if (action_id ==
EActions.REMOVE_HEALTH)
8105 {
8106 AddHealth("","",-GetMaxHealth("","Health")/5);
8107 }
8108 else if (action_id ==
EActions.DESTROY_HEALTH)
8109 {
8110 SetHealth01("","",0);
8111 }
8112 else if (action_id ==
EActions.WATCH_ITEM)
8113 {
8115 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
8116 #ifdef DEVELOPER
8117 SetDebugDeveloper_item(this);
8118 #endif
8119 }
8120
8121 else if (action_id ==
EActions.ADD_TEMPERATURE)
8122 {
8123 AddTemperature(20);
8124
8125 }
8126
8127 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
8128 {
8129 AddTemperature(-20);
8130
8131 }
8132
8133 else if (action_id ==
EActions.FLIP_FROZEN)
8134 {
8135 SetFrozen(!GetIsFrozen());
8136
8137 }
8138
8139 else if (action_id ==
EActions.ADD_WETNESS)
8140 {
8142
8143 }
8144
8145 else if (action_id ==
EActions.REMOVE_WETNESS)
8146 {
8148
8149 }
8150
8151 else if (action_id ==
EActions.LIQUIDTYPE_UP)
8152 {
8155
8156
8157 }
8158
8159 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
8160 {
8163 }
8164
8165 else if (action_id ==
EActions.MAKE_SPECIAL)
8166 {
8167 auto debugParams = DebugSpawnParams.WithPlayer(player);
8168 OnDebugSpawnEx(debugParams);
8169 }
8170
8171 }
8172
8173
8174 return false;
8175 }
8176
8177
8178
8179
8183
8186
8187
8188
8190 {
8191 return false;
8192 }
8193
8194
8196 {
8197 return true;
8198 }
8199
8200
8202 {
8203 return true;
8204 }
8205
8206
8207
8209 {
8210 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
8211 return g_Game.ConfigIsExisting(config_path);
8212 }
8213
8216 {
8217 return null;
8218 }
8219
8221 {
8222 return false;
8223 }
8224
8226 {
8227 return false;
8228 }
8229
8233
8234
8236 {
8237 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8238 return module_repairing.CanRepair(this, item_repair_kit);
8239 }
8240
8241
8242 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
8243 {
8244 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8245 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
8246 }
8247
8248
8250 {
8251
8252
8253
8254
8255
8256
8257
8258
8259 return 1;
8260 }
8261
8262
8263
8265 {
8267 }
8268
8269
8270
8272 {
8274 }
8275
8276
8285 {
8286 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8287
8288 if (player)
8289 {
8290 player.MessageStatus(text);
8291 }
8292 }
8293
8294
8303 {
8304 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8305
8306 if (player)
8307 {
8308 player.MessageAction(text);
8309 }
8310 }
8311
8312
8321 {
8322 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8323
8324 if (player)
8325 {
8326 player.MessageFriendly(text);
8327 }
8328 }
8329
8330
8339 {
8340 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8341
8342 if (player)
8343 {
8344 player.MessageImportant(text);
8345 }
8346 }
8347
8349 {
8350 return true;
8351 }
8352
8353
8354 override bool KindOf(
string tag)
8355 {
8356 bool found = false;
8357 string item_name = this.
GetType();
8359 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
8360
8361 int array_size = item_tag_array.Count();
8362 for (int i = 0; i < array_size; i++)
8363 {
8364 if (item_tag_array.Get(i) == tag)
8365 {
8366 found = true;
8367 break;
8368 }
8369 }
8370 return found;
8371 }
8372
8373
8375 {
8376
8377 super.OnRPC(sender, rpc_type,ctx);
8378
8379
8380 switch (rpc_type)
8381 {
8382 #ifndef SERVER
8383 case ERPCs.RPC_SOUND_LOCK_ATTACH:
8384 Param2<bool, string> p = new Param2<bool, string>(false, "");
8385
8387 return;
8388
8389 bool play = p.param1;
8390 string soundSet = p.param2;
8391
8392 if (play)
8393 {
8395 {
8397 {
8399 }
8400 }
8401 else
8402 {
8404 }
8405 }
8406 else
8407 {
8409 }
8410
8411 break;
8412 #endif
8413
8414 }
8415
8417 {
8419 }
8420 }
8421
8422
8423
8424
8426 {
8427 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8428 return plugin.GetID(
name);
8429 }
8430
8432 {
8433 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8434 return plugin.GetName(id);
8435 }
8436
8439 {
8440
8441
8442 int varFlags;
8443 if (!ctx.
Read(varFlags))
8444 return;
8445
8446 if (varFlags & ItemVariableFlags.FLOAT)
8447 {
8449 }
8450 }
8451
8453 {
8454
8455 super.SerializeNumericalVars(floats_out);
8456
8457
8458
8460 {
8462 }
8463
8465 {
8467 }
8468
8470 {
8472 }
8473
8475 {
8480 }
8481
8483 {
8485 }
8486 }
8487
8489 {
8490
8491 super.DeSerializeNumericalVars(floats);
8492
8493
8494 int index = 0;
8495 int mask = Math.Round(floats.Get(index));
8496
8497 index++;
8498
8500 {
8502 {
8504 }
8505 else
8506 {
8507 float quantity = floats.Get(index);
8509 }
8510 index++;
8511 }
8512
8514 {
8515 float wet = floats.Get(index);
8517 index++;
8518 }
8519
8521 {
8522 int liquidtype = Math.Round(floats.Get(index));
8524 index++;
8525 }
8526
8528 {
8530 index++;
8532 index++;
8534 index++;
8536 index++;
8537 }
8538
8540 {
8541 int cleanness = Math.Round(floats.Get(index));
8543 index++;
8544 }
8545 }
8546
8548 {
8549 super.WriteVarsToCTX(ctx);
8550
8551
8553 {
8555 }
8556
8558 {
8560 }
8561
8563 {
8565 }
8566
8568 {
8569 int r,g,b,a;
8575 }
8576
8578 {
8580 }
8581 }
8582
8584 {
8585 if (!super.ReadVarsFromCTX(ctx,version))
8586 return false;
8587
8588 int intValue;
8589 float value;
8590
8591 if (version < 140)
8592 {
8593 if (!ctx.
Read(intValue))
8594 return false;
8595
8596 m_VariablesMask = intValue;
8597 }
8598
8600 {
8601 if (!ctx.
Read(value))
8602 return false;
8603
8605 {
8607 }
8608 else
8609 {
8611 }
8612 }
8613
8614 if (version < 140)
8615 {
8617 {
8618 if (!ctx.
Read(value))
8619 return false;
8620 SetTemperatureDirect(value);
8621 }
8622 }
8623
8625 {
8626 if (!ctx.
Read(value))
8627 return false;
8629 }
8630
8632 {
8633 if (!ctx.
Read(intValue))
8634 return false;
8636 }
8637
8639 {
8640 int r,g,b,a;
8642 return false;
8644 return false;
8646 return false;
8648 return false;
8649
8651 }
8652
8654 {
8655 if (!ctx.
Read(intValue))
8656 return false;
8658 }
8659
8660 if (version >= 138 && version < 140)
8661 {
8663 {
8664 if (!ctx.
Read(intValue))
8665 return false;
8666 SetFrozen(intValue);
8667 }
8668 }
8669
8670 return true;
8671 }
8672
8673
8675 {
8678 {
8680 }
8681
8682 if (!super.OnStoreLoad(ctx, version))
8683 {
8685 return false;
8686 }
8687
8688 if (version >= 114)
8689 {
8690 bool hasQuickBarIndexSaved;
8691
8692 if (!ctx.
Read(hasQuickBarIndexSaved))
8693 {
8695 return false;
8696 }
8697
8698 if (hasQuickBarIndexSaved)
8699 {
8700 int itmQBIndex;
8701
8702
8703 if (!ctx.
Read(itmQBIndex))
8704 {
8706 return false;
8707 }
8708
8709 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
8710 if (itmQBIndex != -1 && parentPlayer)
8711 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
8712 }
8713 }
8714 else
8715 {
8716
8717 PlayerBase player;
8718 int itemQBIndex;
8719 if (version ==
int.
MAX)
8720 {
8721 if (!ctx.
Read(itemQBIndex))
8722 {
8724 return false;
8725 }
8726 }
8727 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
8728 {
8729
8730 if (!ctx.
Read(itemQBIndex))
8731 {
8733 return false;
8734 }
8735 if (itemQBIndex != -1 && player)
8736 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
8737 }
8738 }
8739
8740 if (version < 140)
8741 {
8742
8743 if (!LoadVariables(ctx, version))
8744 {
8746 return false;
8747 }
8748 }
8749
8750
8752 {
8754 return false;
8755 }
8756 if (version >= 132)
8757 {
8759 if (raib)
8760 {
8762 {
8764 return false;
8765 }
8766 }
8767 }
8768
8770 return true;
8771 }
8772
8773
8774
8776 {
8777 super.OnStoreSave(ctx);
8778
8779 PlayerBase player;
8780 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
8781 {
8783
8784 int itemQBIndex = -1;
8785 itemQBIndex = player.FindQuickBarEntityIndex(this);
8786 ctx.
Write(itemQBIndex);
8787 }
8788 else
8789 {
8791 }
8792
8794
8796 if (raib)
8797 {
8799 }
8800 }
8801
8802
8804 {
8805 super.AfterStoreLoad();
8806
8808 {
8810 }
8811
8813 {
8816 }
8817 }
8818
8820 {
8821 super.EEOnAfterLoad();
8822
8824 {
8826 }
8827
8830 }
8831
8833 {
8834 return false;
8835 }
8836
8837
8838
8840 {
8842 {
8843 #ifdef PLATFORM_CONSOLE
8844
8846 {
8848 if (menu)
8849 {
8851 }
8852 }
8853 #endif
8854 }
8855
8857 {
8860 }
8861
8863 {
8864 SetWeightDirty();
8866 }
8868 {
8871 }
8872
8874 {
8877
8880 }
8882 {
8886 }
8887
8888 super.OnVariablesSynchronized();
8889 }
8890
8891
8892
8894 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
8895 {
8896 if (!IsServerCheck(allow_client))
8897 return false;
8898
8900 return false;
8901
8904
8905 if (value <= (min + 0.001))
8906 value = min;
8907
8908 if (value == min)
8909 {
8910 if (destroy_config)
8911 {
8912 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
8913 if (dstr)
8914 {
8916 this.Delete();
8917 return true;
8918 }
8919 }
8920 else if (destroy_forced)
8921 {
8923 this.Delete();
8924 return true;
8925 }
8926
8928 }
8929
8932
8934 {
8935 EntityAI parent = GetHierarchyRoot();
8936 InventoryLocation iLoc = new InventoryLocation();
8937 GetInventory().GetCurrentInventoryLocation(iLoc);
8939 {
8940 int iLocSlot = iLoc.
GetSlot();
8942 {
8944 }
8946 {
8948 }
8949 }
8950 }
8951
8953 {
8955
8956 if (delta)
8958 }
8959
8961
8962 return false;
8963 }
8964
8965
8967 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
8968 {
8970 }
8971
8973 {
8976 }
8977
8979 {
8982 }
8983
8985 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
8986 {
8987 float value_clamped = Math.Clamp(value, 0, 1);
8989 SetQuantity(result, destroy_config, destroy_forced);
8990 }
8991
8992
8995 {
8997 }
8998
9000 {
9002 }
9003
9004
9005
9006
9007
9008
9009
9010
9011
9012
9014 {
9015 int slot = -1;
9016 GameInventory inventory = GetInventory();
9017 if (inventory)
9018 {
9019 InventoryLocation il = new InventoryLocation;
9022 }
9023
9025 }
9026
9028 {
9029 float quantity_max = 0;
9030
9032 {
9033 if (attSlotID != -1)
9034 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
9035
9036 if (quantity_max <= 0)
9038 }
9039
9040 if (quantity_max <= 0)
9042
9043 return quantity_max;
9044 }
9045
9047 {
9049 }
9050
9052 {
9054 }
9055
9056
9058 {
9060 }
9061
9063 {
9065 }
9066
9068 {
9070 }
9071
9072
9074 {
9075
9076 float weightEx = GetWeightEx();
9077 float special = GetInventoryAndCargoWeight();
9078 return weightEx - special;
9079 }
9080
9081
9083 {
9085 }
9086
9088 {
9090 {
9091 #ifdef DEVELOPER
9092 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9093 {
9094 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
9096 }
9097 #endif
9098
9100 }
9101 else if (HasEnergyManager())
9102 {
9103 #ifdef DEVELOPER
9104 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9105 {
9106 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
9107 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
9108 }
9109 #endif
9110 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
9111 }
9112 else
9113 {
9114 #ifdef DEVELOPER
9115 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9116 {
9117 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
9118 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
9119 }
9120 #endif
9121 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
9122 }
9123 }
9124
9127 {
9128 int item_count = 0;
9130
9131 GameInventory inventory = GetInventory();
9132 CargoBase cargo = inventory.
GetCargo();
9133 if (cargo != NULL)
9134 {
9136 }
9137
9139 for (int i = 0; i < nAttachments; ++i)
9140 {
9142 if (item)
9143 item_count += item.GetNumberOfItems();
9144 }
9145 return item_count;
9146 }
9147
9150 {
9151 float weight = 0;
9152 float wetness = 1;
9153 if (include_wetness)
9156 {
9157 weight = wetness * m_ConfigWeight;
9158 }
9160 {
9161 weight = 1;
9162 }
9163 return weight;
9164 }
9165
9166
9167
9169 {
9170 GameInventory inventory = GetInventory();
9171 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
9172 {
9173 array<EntityAI> items = new array<EntityAI>;
9175 for (int i = 0; i < items.Count(); ++i)
9176 {
9178 if (item)
9179 {
9180 g_Game.ObjectDelete(item);
9181 }
9182 }
9183 }
9184 }
9185
9186
9187
9188
9190 {
9191 float energy = 0;
9192 if (HasEnergyManager())
9193 {
9194 energy = GetCompEM().GetEnergy();
9195 }
9196 return energy;
9197 }
9198
9199
9201 {
9202 super.OnEnergyConsumed();
9203
9205 }
9206
9208 {
9209 super.OnEnergyAdded();
9210
9212 }
9213
9214
9216 {
9217 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
9218 {
9220 {
9221 float energy_0to1 = GetCompEM().GetEnergy0To1();
9223 }
9224 }
9225 }
9226
9227
9229 {
9230 return ConfigGetFloat("heatIsolation");
9231 }
9232
9234 {
9236 }
9237
9239 {
9240 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
9241 if (
g_Game.ConfigIsExisting(paramPath))
9242 return g_Game.ConfigGetFloat(paramPath);
9243
9244 return 0.0;
9245 }
9246
9248 {
9249 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
9250 if (
g_Game.ConfigIsExisting(paramPath))
9251 return g_Game.ConfigGetFloat(paramPath);
9252
9253 return 0.0;
9254 }
9255
9256 override void SetWet(
float value,
bool allow_client =
false)
9257 {
9258 if (!IsServerCheck(allow_client))
9259 return;
9260
9263
9265
9266 m_VarWet = Math.Clamp(value, min, max);
9267
9269 {
9272 }
9273 }
9274
9275 override void AddWet(
float value)
9276 {
9278 }
9279
9281 {
9283 }
9284
9286 {
9288 }
9289
9291 {
9293 }
9294
9296 {
9298 }
9299
9301 {
9303 }
9304
9306 {
9309 if (newLevel != oldLevel)
9310 {
9312 }
9313 }
9314
9316 {
9317 SetWeightDirty();
9318 }
9319
9321 {
9322 return GetWetLevelInternal(
m_VarWet);
9323 }
9324
9325
9326
9328 {
9330 }
9331
9333 {
9335 }
9336
9338 {
9340 }
9341
9343 {
9345 }
9346
9347
9348
9350 {
9351 if (ConfigIsExisting("itemModelLength"))
9352 {
9353 return ConfigGetFloat("itemModelLength");
9354 }
9355 return 0;
9356 }
9357
9359 {
9360 if (ConfigIsExisting("itemAttachOffset"))
9361 {
9362 return ConfigGetFloat("itemAttachOffset");
9363 }
9364 return 0;
9365 }
9366
9367 override void SetCleanness(
int value,
bool allow_client =
false)
9368 {
9369 if (!IsServerCheck(allow_client))
9370 return;
9371
9373
9375
9378 }
9379
9381 {
9383 }
9384
9386 {
9387 return true;
9388 }
9389
9390
9391
9392
9394 {
9396 }
9397
9399 {
9401 }
9402
9403
9404
9405
9406 override void SetColor(
int r,
int g,
int b,
int a)
9407 {
9413 }
9415 override void GetColor(out
int r,out
int g,out
int b,out
int a)
9416 {
9421 }
9422
9424 {
9426 }
9427
9430 {
9431 int r,g,b,a;
9433 r = r/255;
9434 g = g/255;
9435 b = b/255;
9436 a = a/255;
9437 return MiscGameplayFunctions.GetColorString(r, g, b, a);
9438 }
9439
9440
9441
9442 override void SetLiquidType(
int value,
bool allow_client =
false)
9443 {
9444 if (!IsServerCheck(allow_client))
9445 return;
9446
9451 }
9452
9454 {
9455 return ConfigGetInt("varLiquidTypeInit");
9456 }
9457
9459 {
9461 }
9462
9464 {
9466 SetFrozen(false);
9467 }
9468
9471 {
9472 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9473 }
9474
9475
9478 {
9479 PlayerBase nplayer;
9480 if (PlayerBase.CastTo(nplayer, player))
9481 {
9483 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9484 }
9485 }
9486
9487
9490 {
9491 PlayerBase nplayer;
9492 if (PlayerBase.CastTo(nplayer,player))
9493 {
9494 nplayer.SetEnableQuickBarEntityShortcut(this, false);
9495 }
9496
9497 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
9498
9499 if (HasEnergyManager())
9500 {
9501 GetCompEM().UpdatePlugState();
9502 }
9503 }
9504
9505
9507 {
9508 super.OnPlacementStarted(player);
9509
9511 }
9512
9513 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
9514 {
9516 {
9517 m_AdminLog.OnPlacementComplete(player,
this);
9518 }
9519
9520 super.OnPlacementComplete(player, position, orientation);
9521 }
9522
9523
9524
9525
9526
9528 {
9530 {
9531 return true;
9532 }
9533 else
9534 {
9535 return false;
9536 }
9537 }
9538
9539
9541 {
9543 {
9545 }
9546 }
9547
9548
9550 {
9552 }
9553
9555 {
9557 }
9558
9559 override void InsertAgent(
int agent,
float count = 1)
9560 {
9561 if (count < 1)
9562 return;
9563
9565 }
9566
9569 {
9571 }
9572
9573
9575 {
9577 }
9578
9579
9580
9581
9582
9583
9584
9585
9586
9587
9588
9589
9590
9591
9592
9593
9594
9595
9596
9597
9598
9599
9600
9601
9602
9603
9604
9605
9606
9607
9608
9609
9610
9611
9612
9613
9614
9615
9616
9617
9618
9619
9621 {
9623 return false;
9624 return true;
9625 }
9626
9628 {
9629
9631 }
9632
9633
9636 {
9637 super.CheckForRoofLimited(timeTresholdMS);
9638
9639 float time =
g_Game.GetTime();
9640 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
9641 {
9642 m_PreviousRoofTestTime = time;
9643 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
9644 }
9645 }
9646
9647
9649 {
9651 {
9652 return 0;
9653 }
9654
9655 if (GetInventory().GetAttachmentSlotsCount() != 0)
9656 {
9657 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
9658 if (filter)
9659 return filter.GetProtectionLevel(type, false, system);
9660 else
9661 return 0;
9662 }
9663
9664 string subclassPath, entryName;
9665
9666 switch (type)
9667 {
9669 entryName = "biological";
9670 break;
9672 entryName = "chemical";
9673 break;
9674 default:
9675 entryName = "biological";
9676 break;
9677 }
9678
9679 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
9680
9681 return g_Game.ConfigGetFloat(subclassPath + entryName);
9682 }
9683
9684
9685
9688 {
9689 if (!IsMagazine())
9691
9693 }
9694
9695
9696
9697
9698
9703 {
9704 return true;
9705 }
9706
9708 {
9710 }
9711
9712
9713
9714
9715
9717 {
9718 if (parent)
9719 {
9720 if (parent.IsInherited(DayZInfected))
9721 return true;
9722
9723 if (!parent.IsRuined())
9724 return true;
9725 }
9726
9727 return true;
9728 }
9729
9731 {
9732 if (!super.CanPutAsAttachment(parent))
9733 {
9734 return false;
9735 }
9736
9737 if (!IsRuined() && !parent.IsRuined())
9738 {
9739 return true;
9740 }
9741
9742 return false;
9743 }
9744
9746 {
9747
9748
9749
9750
9751 return super.CanReceiveItemIntoCargo(item);
9752 }
9753
9755 {
9756
9757
9758
9759
9760 GameInventory attachmentInv = attachment.GetInventory();
9762 {
9763 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
9764 return false;
9765 }
9766
9767 InventoryLocation loc = new InventoryLocation();
9768 attachment.GetInventory().GetCurrentInventoryLocation(loc);
9769 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
9770 return false;
9771
9772 return super.CanReceiveAttachment(attachment, slotId);
9773 }
9774
9776 {
9777 if (!super.CanReleaseAttachment(attachment))
9778 return false;
9779
9780 return GetInventory().AreChildrenAccessible();
9781 }
9782
9783
9784
9785
9786
9787
9788
9789
9790
9791
9792
9793
9794
9795
9796
9797
9798
9799
9800
9801
9802
9804 {
9805 int id = muzzle_owner.GetMuzzleID();
9806 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
9807
9808 if (WPOF_array)
9809 {
9810 for (int i = 0; i < WPOF_array.Count(); i++)
9811 {
9812 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
9813
9814 if (WPOF)
9815 {
9816 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
9817 }
9818 }
9819 }
9820 }
9821
9822
9824 {
9825 int id = muzzle_owner.GetMuzzleID();
9827
9828 if (WPOBE_array)
9829 {
9830 for (int i = 0; i < WPOBE_array.Count(); i++)
9831 {
9832 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
9833
9834 if (WPOBE)
9835 {
9836 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
9837 }
9838 }
9839 }
9840 }
9841
9842
9844 {
9845 int id = muzzle_owner.GetMuzzleID();
9846 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9847
9848 if (WPOOH_array)
9849 {
9850 for (int i = 0; i < WPOOH_array.Count(); i++)
9851 {
9852 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9853
9854 if (WPOOH)
9855 {
9856 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
9857 }
9858 }
9859 }
9860 }
9861
9862
9864 {
9865 int id = muzzle_owner.GetMuzzleID();
9866 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9867
9868 if (WPOOH_array)
9869 {
9870 for (int i = 0; i < WPOOH_array.Count(); i++)
9871 {
9872 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9873
9874 if (WPOOH)
9875 {
9876 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9877 }
9878 }
9879 }
9880 }
9881
9882
9884 {
9885 int id = muzzle_owner.GetMuzzleID();
9886 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9887
9888 if (WPOOH_array)
9889 {
9890 for (int i = 0; i < WPOOH_array.Count(); i++)
9891 {
9892 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9893
9894 if (WPOOH)
9895 {
9896 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9897 }
9898 }
9899 }
9900 }
9901
9902
9903
9905 {
9907 {
9908 return true;
9909 }
9910
9911 return false;
9912 }
9913
9915 {
9917 {
9918 return true;
9919 }
9920
9921 return false;
9922 }
9923
9925 {
9927 {
9928 return true;
9929 }
9930
9931 return false;
9932 }
9933
9935 {
9936 return false;
9937 }
9938
9941 {
9942 return UATimeSpent.DEFAULT_DEPLOY;
9943 }
9944
9945
9946
9947
9949 {
9951 SetSynchDirty();
9952 }
9953
9955 {
9957 }
9958
9959
9961 {
9962 return false;
9963 }
9964
9967 {
9968 string att_type = "None";
9969
9970 if (ConfigIsExisting("soundAttType"))
9971 {
9972 att_type = ConfigGetString("soundAttType");
9973 }
9974
9976 }
9977
9979 {
9981 }
9982
9983
9984
9985
9986
9992
9994 {
9997
9999 }
10000
10001
10003 {
10005 return;
10006
10008
10011
10014
10015 SoundParameters params = new SoundParameters();
10019 }
10020
10021
10023 {
10025 {
10028
10029 SetSynchDirty();
10030
10033 }
10034 }
10035
10037 {
10039 }
10040
10041
10043 {
10045 return;
10046
10048 SetSynchDirty();
10049
10052 }
10053
10055 {
10058 }
10059
10061 {
10063 }
10064
10065 void OnApply(PlayerBase player);
10066
10068 {
10069 return 1.0;
10070 };
10071
10073 {
10075 }
10076
10078 {
10080 }
10081
10083
10085 {
10086 SetDynamicPhysicsLifeTime(0.01);
10088 }
10089
10091 {
10092 array<string> zone_names = new array<string>;
10093 GetDamageZones(zone_names);
10094 for (int i = 0; i < zone_names.Count(); i++)
10095 {
10096 SetHealthMax(zone_names.Get(i),"Health");
10097 }
10098 SetHealthMax("","Health");
10099 }
10100
10103 {
10104 float global_health = GetHealth01("","Health");
10105 array<string> zones = new array<string>;
10106 GetDamageZones(zones);
10107
10108 for (int i = 0; i < zones.Count(); i++)
10109 {
10110 SetHealth01(zones.Get(i),"Health",global_health);
10111 }
10112 }
10113
10116 {
10117 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
10118 }
10119
10121 {
10122 if (!hasRootAsPlayer)
10123 {
10124 if (refParentIB)
10125 {
10126
10127 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
10128 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
10129
10130 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
10131 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
10132
10135 }
10136 else
10137 {
10138
10141 }
10142 }
10143 }
10144
10146 {
10148 {
10149 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
10150 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
10151 {
10152 float heatPermCoef = 1.0;
10154 while (ent)
10155 {
10156 heatPermCoef *= ent.GetHeatPermeabilityCoef();
10157 ent = ent.GetHierarchyParent();
10158 }
10159
10160 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
10161 }
10162 }
10163 }
10164
10166 {
10167
10168 EntityAI parent = GetHierarchyParent();
10169 if (!parent)
10170 {
10171 hasParent = false;
10172 hasRootAsPlayer = false;
10173 }
10174 else
10175 {
10176 hasParent = true;
10177 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
10178 refParentIB =
ItemBase.Cast(parent);
10179 }
10180 }
10181
10182 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
10183 {
10184
10185 }
10186
10188 {
10189
10190 return false;
10191 }
10192
10194 {
10195
10196
10197 return false;
10198 }
10199
10201 {
10202
10203 return false;
10204 }
10205
10208 {
10209 return !GetIsFrozen() &&
IsOpen();
10210 }
10211
10213 {
10214 bool hasParent = false, hasRootAsPlayer = false;
10216
10217 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
10218 bool foodDecay =
g_Game.IsFoodDecayEnabled();
10219
10220 if (wwtu || foodDecay)
10221 {
10225
10226 if (processWetness || processTemperature || processDecay)
10227 {
10229
10230 if (processWetness)
10231 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
10232
10233 if (processTemperature)
10235
10236 if (processDecay)
10237 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
10238 }
10239 }
10240 }
10241
10244 {
10246 }
10247
10249 {
10252
10253 return super.GetTemperatureFreezeThreshold();
10254 }
10255
10257 {
10260
10261 return super.GetTemperatureThawThreshold();
10262 }
10263
10265 {
10268
10269 return super.GetItemOverheatThreshold();
10270 }
10271
10273 {
10275 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
10276
10277 return super.GetTemperatureFreezeTime();
10278 }
10279
10281 {
10283 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
10284
10285 return super.GetTemperatureThawTime();
10286 }
10287
10292
10294 {
10295 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
10296 }
10297
10299 {
10300 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
10301 }
10302
10305 {
10307 }
10308
10310 {
10312 }
10313
10315 {
10317 }
10318
10321 {
10322 return null;
10323 }
10324
10327 {
10328 return false;
10329 }
10330
10332 {
10334 {
10337 if (!trg)
10338 {
10340 explosive = this;
10341 }
10342
10343 explosive.PairRemote(trg);
10345
10346 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
10347 trg.SetPersistentPairID(persistentID);
10348 explosive.SetPersistentPairID(persistentID);
10349
10350 return true;
10351 }
10352 return false;
10353 }
10354
10357 {
10358 float ret = 1.0;
10361 ret *= GetHealth01();
10362
10363 return ret;
10364 }
10365
10366 #ifdef DEVELOPER
10367 override void SetDebugItem()
10368 {
10369 super.SetDebugItem();
10370 _itemBase = this;
10371 }
10372
10374 {
10375 string text = super.GetDebugText();
10376
10378 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
10379
10380 return text;
10381 }
10382 #endif
10383
10385 {
10386 return true;
10387 }
10388
10390
10392
10394 {
10397 }
10398
10399
10407
10423
10424 [
Obsolete(
"Use ItemSoundHandler instead")]
10427 {
10428 if (!
g_Game.IsDedicatedServer())
10429 {
10430 if (ConfigIsExisting("attachSoundSet"))
10431 {
10432 string cfg_path = "";
10433 string soundset = "";
10434 string type_name =
GetType();
10435
10438 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
10439 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
10440
10441 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
10442 {
10443 for (int i = 0; i < cfg_soundset_array.Count(); i++)
10444 {
10445 if (cfg_slot_array[i] == slot_type)
10446 {
10447 soundset = cfg_soundset_array[i];
10448 break;
10449 }
10450 }
10451 }
10452
10453 if (soundset != "")
10454 {
10455 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
10457 }
10458 }
10459 }
10460 }
10461
10463}
10464
10466{
10468 if (entity)
10469 {
10470 bool is_item = entity.IsInherited(
ItemBase);
10471 if (is_item && full_quantity)
10472 {
10475 }
10476 }
10477 else
10478 {
10480 return NULL;
10481 }
10482 return entity;
10483}
10484
10486{
10487 if (item)
10488 {
10489 if (health > 0)
10490 item.SetHealth("", "", health);
10491
10492 if (item.CanHaveTemperature())
10493 {
10495 if (item.CanFreeze())
10496 item.SetFrozen(false);
10497 }
10498
10499 if (item.HasEnergyManager())
10500 {
10501 if (quantity >= 0)
10502 {
10503 item.GetCompEM().SetEnergy0To1(quantity);
10504 }
10505 else
10506 {
10508 }
10509 }
10510 else if (item.IsMagazine())
10511 {
10512 Magazine mag = Magazine.Cast(item);
10513 if (quantity >= 0)
10514 {
10515 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
10516 }
10517 else
10518 {
10520 }
10521
10522 }
10523 else
10524 {
10525 if (quantity >= 0)
10526 {
10527 item.SetQuantityNormalized(quantity, false);
10528 }
10529 else
10530 {
10532 }
10533
10534 }
10535 }
10536}
10537
10538#ifdef DEVELOPER
10540#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.