5594{
5596 {
5597 return true;
5598 }
5599};
5600
5602{
5603
5604};
5605
5606
5607
5609{
5613
5615
5618
5619
5620
5621
5622
5631
5637
5642
5647
5668 protected bool m_IsResultOfSplit
5669
5671
5676
5677
5678
5680
5684
5685
5686
5688
5691
5692
5693
5699
5700
5708
5711
5712
5714
5715
5717
5718
5723
5724
5729
5731
5732
5734
5735
5737 {
5742
5743 if (!
g_Game.IsDedicatedServer())
5744 {
5746 {
5748
5750 {
5752 }
5753 }
5754
5757 }
5758
5759 m_OldLocation = null;
5760
5762 {
5764 }
5765
5766 if (ConfigIsExisting("headSelectionsToHide"))
5767 {
5770 }
5771
5773 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
5774 {
5776 }
5777
5779
5780 m_IsResultOfSplit = false;
5781
5783 }
5784
5786 {
5787 super.InitItemVariables();
5788
5794 m_Count = ConfigGetInt(
"count");
5795
5798
5803
5806
5811
5823
5827
5828
5831 if (ConfigIsExisting("canBeSplit"))
5832 {
5835 }
5836
5838 if (ConfigIsExisting("itemBehaviour"))
5840
5841
5844 RegisterNetSyncVariableInt("m_VarLiquidType");
5845 RegisterNetSyncVariableInt("m_Cleanness",0,1);
5846
5847 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
5848 RegisterNetSyncVariableFloat("m_ImpactSpeed");
5849 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
5850
5851 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
5852 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
5853 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
5854 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
5855
5856 RegisterNetSyncVariableBool("m_IsBeingPlaced");
5857 RegisterNetSyncVariableBool("m_IsTakeable");
5858 RegisterNetSyncVariableBool("m_IsHologram");
5859
5862 {
5865 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
5866 }
5867
5869
5871 if (ConfigIsExisting("temperaturePerQuantityWeight"))
5873
5875 }
5876
5878 {
5880 }
5881
5883 {
5886 {
5891 }
5892 }
5893
5894 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
5895 {
5897 {
5900 }
5901
5903 }
5904
5906 {
5912 }
5913
5915
5917 {
5919
5920 if (!action)
5921 {
5922 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
5923 return;
5924 }
5925
5927 if (!ai)
5928 {
5930 return;
5931 }
5932
5934 if (!action_array)
5935 {
5936 action_array = new array<ActionBase_Basic>;
5938 }
5939 if (LogManager.IsActionLogEnable())
5940 {
5941 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
5942 }
5943
5944 if (action_array.Find(action) != -1)
5945 {
5946 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
5947 }
5948 else
5949 {
5950 action_array.Insert(action);
5951 }
5952 }
5953
5955 {
5956 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
5957 ActionBase action = player.GetActionManager().GetAction(actionName);
5960
5961 if (action_array)
5962 {
5963 action_array.RemoveItem(action);
5964 }
5965 }
5966
5967
5968
5970 {
5971 ActionOverrideData overrideData = new ActionOverrideData();
5975
5977 if (!actionMap)
5978 {
5981 }
5982
5983 actionMap.Insert(this.
Type(), overrideData);
5984
5985 }
5986
5988
5990
5991
5993 {
5996
5999
6000 string config_to_search = "CfgVehicles";
6001 string muzzle_owner_config;
6002
6004 {
6005 if (IsInherited(Weapon))
6006 config_to_search = "CfgWeapons";
6007
6008 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6009
6010 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
6011
6012 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
6013
6014 if (config_OnFire_subclass_count > 0)
6015 {
6016 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
6017
6018 for (int i = 0; i < config_OnFire_subclass_count; i++)
6019 {
6020 string particle_class = "";
6021 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
6022 string config_OnFire_entry = config_OnFire_class + particle_class;
6023 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
6024 WPOF_array.Insert(WPOF);
6025 }
6026
6027
6029 }
6030 }
6031
6033 {
6034 config_to_search = "CfgWeapons";
6035 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6036
6037 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
6038
6039 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
6040
6041 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
6042 {
6043 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
6044
6045 for (i = 0; i < config_OnBulletCasingEject_count; i++)
6046 {
6047 string particle_class2 = "";
6048 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
6049 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
6050 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
6051 WPOBE_array.Insert(WPOBE);
6052 }
6053
6054
6056 }
6057 }
6058 }
6059
6060
6062 {
6065
6067 {
6068 string config_to_search = "CfgVehicles";
6069
6070 if (IsInherited(Weapon))
6071 config_to_search = "CfgWeapons";
6072
6073 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6074 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
6075
6076 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
6077 {
6078
6080
6082 {
6084 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
6086 return;
6087 }
6088
6091
6092
6093
6094 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
6095 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
6096
6097 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
6098 {
6099 string particle_class = "";
6100 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
6101 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
6102 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
6103
6104 if (entry_type == CT_CLASS)
6105 {
6106 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
6107 WPOOH_array.Insert(WPOF);
6108 }
6109 }
6110
6111
6113 }
6114 }
6115 }
6116
6118 {
6120 }
6121
6123 {
6125 {
6127
6130
6133
6134 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6135 }
6136 }
6137
6139 {
6141 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6142
6144 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6145
6147 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6148
6150 {
6152 }
6153 }
6154
6156 {
6158 }
6159
6161 {
6164 else
6166
6168 {
6171 }
6172 else
6173 {
6176
6179 }
6180
6182 }
6183
6185 {
6187 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6188 }
6189
6191 {
6193 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6195 }
6196
6198 {
6200 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6201 }
6202
6204 {
6207
6208 OverheatingParticle OP = new OverheatingParticle();
6213
6215 }
6216
6218 {
6221
6222 return -1;
6223 }
6224
6226 {
6228 {
6231
6232 for (int i = count; i > 0; --i)
6233 {
6234 int id = i - 1;
6237
6240
6241 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
6242 {
6243 if (p)
6244 {
6247 }
6248 }
6249 }
6250 }
6251 }
6252
6254 {
6256 {
6258 {
6259 int id = i - 1;
6261
6262 if (OP)
6263 {
6265
6266 if (p)
6267 {
6269 }
6270
6271 delete OP;
6272 }
6273 }
6274
6277 }
6278 }
6279
6282 {
6283 return 0.0;
6284 }
6285
6286
6288 {
6289 return 250;
6290 }
6291
6293 {
6294 return 0;
6295 }
6296
6299 {
6301 return true;
6302
6303 return false;
6304 }
6305
6308 {
6311
6313 {
6315 }
6316 else
6317 {
6318
6320 }
6321
6323 }
6324
6331 {
6332 return -1;
6333 }
6334
6335
6336
6337
6339 {
6341 {
6342 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6343 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6344
6345 if (r_index >= 0)
6346 {
6347 InventoryLocation r_il = new InventoryLocation;
6348 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6349
6350 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6353 {
6354 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6355 }
6357 {
6358 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6359 }
6360
6361 }
6362
6363 player.GetHumanInventory().ClearUserReservedLocation(this);
6364 }
6365
6368 }
6369
6370
6371
6372
6374 {
6375 return ItemBase.m_DebugActionsMask;
6376 }
6377
6379 {
6380 return ItemBase.m_DebugActionsMask & mask;
6381 }
6382
6384 {
6385 ItemBase.m_DebugActionsMask = mask;
6386 }
6387
6389 {
6390 ItemBase.m_DebugActionsMask |= mask;
6391 }
6392
6394 {
6395 ItemBase.m_DebugActionsMask &= ~mask;
6396 }
6397
6399 {
6401 {
6403 }
6404 else
6405 {
6407 }
6408 }
6409
6410
6412 {
6413 if (GetEconomyProfile())
6414 {
6415 float q_max = GetEconomyProfile().GetQuantityMax();
6416 if (q_max > 0)
6417 {
6418 float q_min = GetEconomyProfile().GetQuantityMin();
6419 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
6420
6422 {
6423 ComponentEnergyManager comp = GetCompEM();
6425 {
6427 }
6428 }
6430 {
6432
6433 }
6434
6435 }
6436 }
6437 }
6438
6441 {
6442 EntityAI parent = GetHierarchyParent();
6443
6444 if (parent)
6445 {
6446 InventoryLocation inventory_location_to_lock = new InventoryLocation;
6447 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
6448 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
6449 }
6450 }
6451
6454 {
6455 EntityAI parent = GetHierarchyParent();
6456
6457 if (parent)
6458 {
6459 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
6460 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
6461 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
6462 }
6463 }
6464
6466 {
6467
6468
6469
6470
6472
6474 {
6475 if (ScriptInputUserData.CanStoreInputUserData())
6476 {
6477 ScriptInputUserData ctx = new ScriptInputUserData;
6483 ctx.
Write(use_stack_max);
6486
6488 {
6489 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
6490 }
6491 }
6492 }
6493 else if (!
g_Game.IsMultiplayer())
6494 {
6496 }
6497 }
6498
6500 {
6502 }
6503
6505 {
6507 }
6508
6510 {
6512 }
6513
6515 {
6516
6517 return false;
6518 }
6519
6521 {
6522 return false;
6523 }
6524
6528 {
6529 return false;
6530 }
6531
6533 {
6534 return "";
6535 }
6536
6538
6540 {
6541 return false;
6542 }
6543
6545 {
6546 return true;
6547 }
6548
6549
6550
6552 {
6553 return true;
6554 }
6555
6557 {
6558 return true;
6559 }
6560
6562 {
6563 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6565 }
6566
6568 {
6570 }
6571
6573 {
6575 if (!is_being_placed)
6577 SetSynchDirty();
6578 }
6579
6580
6582
6584 {
6586 }
6587
6589 {
6591 }
6592
6594 {
6595 return 1;
6596 }
6597
6599 {
6600 return false;
6601 }
6602
6604 {
6606 SetSynchDirty();
6607 }
6608
6609
6610
6611
6612
6613
6614
6615
6616
6617
6618
6619
6620
6621
6622
6623
6624
6625
6626
6627
6628
6629
6630
6631
6632
6633
6634
6635
6636
6637
6638
6639
6640
6641
6642
6644 {
6645 super.OnMovedInsideCargo(container);
6646
6647 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6648 }
6649
6650 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
6651 {
6652 super.EEItemLocationChanged(oldLoc, newLoc);
6653
6654 PlayerBase newPlayer = null;
6655 PlayerBase oldPlayer = null;
6656
6657 if (newLoc.GetParent())
6658 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
6659
6660 if (oldLoc.GetParent())
6661 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
6662
6664 {
6665 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
6666
6667 if (rIndex >= 0)
6668 {
6669 InventoryLocation rIl = new InventoryLocation;
6670 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
6671
6672 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
6675 {
6676 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
6677 }
6679 {
6681 }
6682
6683 }
6684 }
6685
6687 {
6688 if (newPlayer)
6689 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
6690
6691 if (newPlayer == oldPlayer)
6692 {
6693 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
6694 {
6696 {
6697 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
6698 {
6699 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6700 }
6701 }
6702 else
6703 {
6704 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6705 }
6706 }
6707
6708 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
6709 {
6710 int type = oldLoc.GetType();
6712 {
6713 oldLoc.GetParent().GetOnSetLock().Invoke(this);
6714 }
6716 {
6717 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
6718 }
6719 }
6720 if (!m_OldLocation)
6721 {
6722 m_OldLocation = new InventoryLocation;
6723 }
6724 m_OldLocation.Copy(oldLoc);
6725 }
6726 else
6727 {
6728 if (m_OldLocation)
6729 {
6730 m_OldLocation.Reset();
6731 }
6732 }
6733
6734 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
6735 }
6736 else
6737 {
6738 if (newPlayer)
6739 {
6740 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
6741 if (resIndex >= 0)
6742 {
6743 InventoryLocation il = new InventoryLocation;
6744 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
6746 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
6749 {
6750 il.
GetParent().GetOnReleaseLock().Invoke(it);
6751 }
6753 {
6755 }
6756
6757 }
6758 }
6760 {
6761
6763 }
6764
6765 if (m_OldLocation)
6766 {
6767 m_OldLocation.Reset();
6768 }
6769 }
6770
6772 {
6773 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
6774 }
6775
6777 {
6778 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
6779 }
6780 }
6781
6782 override void EOnContact(IEntity other, Contact extra)
6783 {
6785 {
6786 int liquidType = -1;
6788 if (impactSpeed > 0.0)
6789 {
6791 #ifndef SERVER
6793 #else
6795 SetSynchDirty();
6796 #endif
6798 }
6799 }
6800
6801 #ifdef SERVER
6802 if (GetCompEM() && GetCompEM().IsPlugged())
6803 {
6804 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
6805 GetCompEM().UnplugThis();
6806 }
6807 #endif
6808 }
6809
6811
6813 {
6815 }
6816
6818 {
6819
6820 }
6821
6823 {
6824 super.OnItemLocationChanged(old_owner, new_owner);
6825
6826 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
6827 PlayerBase playerNew = PlayerBase.Cast(new_owner);
6828
6829 if (!relatedPlayer && playerNew)
6830 relatedPlayer = playerNew;
6831
6832 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
6833 {
6835 if (actionMgr)
6836 {
6837 ActionBase currentAction = actionMgr.GetRunningAction();
6838 if (currentAction)
6840 }
6841 }
6842
6843 Man ownerPlayerOld = null;
6844 Man ownerPlayerNew = null;
6845
6846 if (old_owner)
6847 {
6848 if (old_owner.
IsMan())
6849 {
6850 ownerPlayerOld = Man.Cast(old_owner);
6851 }
6852 else
6853 {
6854 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
6855 }
6856 }
6857 else
6858 {
6860 {
6862
6863 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
6864 {
6865 GetCompEM().UnplugThis();
6866 }
6867 }
6868 }
6869
6870 if (new_owner)
6871 {
6872 if (new_owner.
IsMan())
6873 {
6874 ownerPlayerNew = Man.Cast(new_owner);
6875 }
6876 else
6877 {
6878 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
6879 }
6880 }
6881
6882 if (ownerPlayerOld != ownerPlayerNew)
6883 {
6884 if (ownerPlayerOld)
6885 {
6886 array<EntityAI> subItemsExit = new array<EntityAI>;
6888 for (int i = 0; i < subItemsExit.Count(); i++)
6889 {
6892 }
6893 }
6894
6895 if (ownerPlayerNew)
6896 {
6897 array<EntityAI> subItemsEnter = new array<EntityAI>;
6899 for (int j = 0; j < subItemsEnter.Count(); j++)
6900 {
6903 }
6904 }
6905 }
6906 else if (ownerPlayerNew != null)
6907 {
6908 PlayerBase nplayer;
6909 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
6910 {
6911 array<EntityAI> subItemsUpdate = new array<EntityAI>;
6913 for (int k = 0; k < subItemsUpdate.Count(); k++)
6914 {
6916 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
6917 }
6918 }
6919 }
6920
6921 if (old_owner)
6922 old_owner.OnChildItemRemoved(this);
6923 if (new_owner)
6924 new_owner.OnChildItemReceived(this);
6925 }
6926
6927
6929 {
6930 super.EEDelete(parent);
6931 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
6932 if (player)
6933 {
6935
6936 if (player.IsAlive())
6937 {
6938 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6939 if (r_index >= 0)
6940 {
6941 InventoryLocation r_il = new InventoryLocation;
6942 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6943
6944 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6947 {
6948 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6949 }
6951 {
6952 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6953 }
6954
6955 }
6956
6957 player.RemoveQuickBarEntityShortcut(this);
6958 }
6959 }
6960 }
6961
6963 {
6964 super.EEKilled(killer);
6965
6968 {
6969 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
6970 {
6971 if (IsMagazine())
6972 {
6973 if (Magazine.Cast(this).GetAmmoCount() > 0)
6974 {
6976 }
6977 }
6978 else
6979 {
6981 }
6982 }
6983 }
6984 }
6985
6987 {
6988 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6989
6990 super.OnWasAttached(parent, slot_id);
6991
6994
6997 }
6998
7000 {
7001 super.OnWasDetached(parent, slot_id);
7002
7005
7008 }
7009
7011 {
7012 int idx;
7015
7016 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7017 if (inventory_slots.Count() < 1)
7018 {
7019 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
7020 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
7021 }
7022 else
7023 {
7024 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
7025 }
7026
7027 idx = inventory_slots.Find(slot);
7028 if (idx < 0)
7029 return "";
7030
7031 return attach_types.Get(idx);
7032 }
7033
7035 {
7036 int idx = -1;
7037 string slot;
7038
7041
7042 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7043 if (inventory_slots.Count() < 1)
7044 {
7045 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
7046 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7047 }
7048 else
7049 {
7050 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
7051 if (detach_types.Count() < 1)
7052 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7053 }
7054
7055 for (int i = 0; i < inventory_slots.Count(); i++)
7056 {
7057 slot = inventory_slots.Get(i);
7058 }
7059
7060 if (slot != "")
7061 {
7062 if (detach_types.Count() == 1)
7063 idx = 0;
7064 else
7065 idx = inventory_slots.Find(slot);
7066 }
7067 if (idx < 0)
7068 return "";
7069
7070 return detach_types.Get(idx);
7071 }
7072
7074 {
7075
7077
7078
7079 float min_time = 1;
7080 float max_time = 3;
7081 float delay = Math.RandomFloat(min_time, max_time);
7082
7083 explode_timer.Run(delay, this, "DoAmmoExplosion");
7084 }
7085
7087 {
7088 Magazine magazine = Magazine.Cast(this);
7089 int pop_sounds_count = 6;
7090 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
7091
7092
7093 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
7094 string sound_name = pop_sounds[ sound_idx ];
7095 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
7096
7097
7098 magazine.ServerAddAmmoCount(-1);
7099
7100
7101 float min_temp_to_explode = 100;
7102
7103 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
7104 {
7106 }
7107 }
7108
7109
7110 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
7111 {
7112 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
7113
7114 const int CHANCE_DAMAGE_CARGO = 4;
7115 const int CHANCE_DAMAGE_ATTACHMENT = 1;
7116 const int CHANCE_DAMAGE_NOTHING = 2;
7117
7119 {
7120 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
7121 int chances;
7122 int rnd;
7123
7124 if (GetInventory().GetCargo())
7125 {
7126 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7127 rnd = Math.RandomInt(0,chances);
7128
7129 if (rnd < CHANCE_DAMAGE_CARGO)
7130 {
7132 }
7133 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
7134 {
7136 }
7137 }
7138 else
7139 {
7140 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7141 rnd = Math.RandomInt(0,chances);
7142
7143 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
7144 {
7146 }
7147 }
7148 }
7149 }
7150
7152 {
7153 CargoBase cargo = GetInventory().GetCargo();
7154 if (cargo)
7155 {
7157 if (item_count > 0)
7158 {
7159 int random_pick = Math.RandomInt(0, item_count);
7161 if (!item.IsExplosive())
7162 {
7163 item.AddHealth("","",damage);
7164 return true;
7165 }
7166 }
7167 }
7168 return false;
7169 }
7170
7172 {
7173 GameInventory inventory = GetInventory();
7175 if (attachment_count > 0)
7176 {
7177 int random_pick = Math.RandomInt(0, attachment_count);
7179 if (!attachment.IsExplosive())
7180 {
7181 attachment.AddHealth("","",damage);
7182 return true;
7183 }
7184 }
7185 return false;
7186 }
7187
7189 {
7191 }
7192
7194 {
7196 return GetInventory().CanRemoveEntity();
7197
7198 return false;
7199 }
7200
7202 {
7203
7205 return false;
7206
7207
7209 return false;
7210
7211
7212
7214 if (delta == 0)
7215 return false;
7216
7217
7218 return true;
7219 }
7220
7222 {
7224 {
7225 if (ScriptInputUserData.CanStoreInputUserData())
7226 {
7227 ScriptInputUserData ctx = new ScriptInputUserData;
7232 ctx.
Write(destination_entity);
7236 }
7237 }
7238 else if (!
g_Game.IsMultiplayer())
7239 {
7241 }
7242 }
7243
7245 {
7246 float split_quantity_new;
7250 InventoryLocation loc = new InventoryLocation;
7251
7252 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7253 {
7255 split_quantity_new = stack_max;
7256 else
7258
7260 {
7261 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7262 if (new_item)
7263 {
7264 new_item.SetResultOfSplit(true);
7265 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7267 new_item.
SetQuantity(split_quantity_new,
false,
true);
7268 }
7269 }
7270 }
7271 else if (destination_entity && slot_id == -1)
7272 {
7273 if (quantity > stack_max)
7274 split_quantity_new = stack_max;
7275 else
7276 split_quantity_new = quantity;
7277
7279 {
7280 GameInventory destinationInventory = destination_entity.GetInventory();
7282 {
7285 }
7286
7287 if (new_item)
7288 {
7289 new_item.SetResultOfSplit(true);
7290 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7292 new_item.
SetQuantity(split_quantity_new,
false,
true);
7293 }
7294 }
7295 }
7296 else
7297 {
7298 if (stack_max != 0)
7299 {
7301 {
7303 }
7304
7305 if (split_quantity_new == 0)
7306 {
7307 if (!
g_Game.IsMultiplayer())
7308 player.PhysicalPredictiveDropItem(this);
7309 else
7310 player.ServerDropEntity(this);
7311 return;
7312 }
7313
7315 {
7317
7318 if (new_item)
7319 {
7320 new_item.SetResultOfSplit(true);
7321 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7324 new_item.PlaceOnSurface();
7325 }
7326 }
7327 }
7328 }
7329 }
7330
7332 {
7333 float split_quantity_new;
7337 InventoryLocation loc = new InventoryLocation;
7338
7339 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7340 {
7342 split_quantity_new = stack_max;
7343 else
7345
7347 {
7348 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7349 if (new_item)
7350 {
7351 new_item.SetResultOfSplit(true);
7352 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7354 new_item.
SetQuantity(split_quantity_new,
false,
true);
7355 }
7356 }
7357 }
7358 else if (destination_entity && slot_id == -1)
7359 {
7360 if (quantity > stack_max)
7361 split_quantity_new = stack_max;
7362 else
7363 split_quantity_new = quantity;
7364
7366 {
7367 GameInventory destinationInventory = destination_entity.GetInventory();
7369 {
7372 }
7373
7374 if (new_item)
7375 {
7376 new_item.SetResultOfSplit(true);
7377 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7379 new_item.
SetQuantity(split_quantity_new,
false,
true);
7380 }
7381 }
7382 }
7383 else
7384 {
7385 if (stack_max != 0)
7386 {
7388 {
7390 }
7391
7393 {
7395
7396 if (new_item)
7397 {
7398 new_item.SetResultOfSplit(true);
7399 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7402 new_item.PlaceOnSurface();
7403 }
7404 }
7405 }
7406 }
7407 }
7408
7410 {
7412 {
7413 if (ScriptInputUserData.CanStoreInputUserData())
7414 {
7415 ScriptInputUserData ctx = new ScriptInputUserData;
7420 dst.WriteToContext(ctx);
7422 }
7423 }
7424 else if (!
g_Game.IsMultiplayer())
7425 {
7427 }
7428 }
7429
7431 {
7433 {
7434 if (ScriptInputUserData.CanStoreInputUserData())
7435 {
7436 ScriptInputUserData ctx = new ScriptInputUserData;
7441 ctx.
Write(destination_entity);
7447 }
7448 }
7449 else if (!
g_Game.IsMultiplayer())
7450 {
7452 }
7453 }
7454
7456 {
7458 }
7459
7461 {
7463 float split_quantity_new;
7465 if (dst.IsValid())
7466 {
7467 int slot_id = dst.GetSlot();
7469
7470 if (quantity > stack_max)
7471 split_quantity_new = stack_max;
7472 else
7473 split_quantity_new = quantity;
7474
7476 {
7478
7479 if (new_item)
7480 {
7481 new_item.SetResultOfSplit(true);
7482 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7484 new_item.
SetQuantity(split_quantity_new,
false,
true);
7485 }
7486
7487 return new_item;
7488 }
7489 }
7490
7491 return null;
7492 }
7493
7495 {
7497 float split_quantity_new;
7499 if (destination_entity)
7500 {
7502 if (quantity > stackable)
7503 split_quantity_new = stackable;
7504 else
7505 split_quantity_new = quantity;
7506
7508 {
7509 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
7510 if (new_item)
7511 {
7512 new_item.SetResultOfSplit(true);
7513 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7515 new_item.
SetQuantity(split_quantity_new,
false,
true);
7516 }
7517 }
7518 }
7519 }
7520
7522 {
7524 {
7525 if (ScriptInputUserData.CanStoreInputUserData())
7526 {
7527 ScriptInputUserData ctx = new ScriptInputUserData;
7532 ItemBase destination_entity =
this;
7533 ctx.
Write(destination_entity);
7537 }
7538 }
7539 else if (!
g_Game.IsMultiplayer())
7540 {
7542 }
7543 }
7544
7546 {
7548 float split_quantity_new;
7550 if (player)
7551 {
7553 if (quantity > stackable)
7554 split_quantity_new = stackable;
7555 else
7556 split_quantity_new = quantity;
7557
7559 {
7560 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
7561 new_item =
ItemBase.Cast(in_hands);
7562 if (new_item)
7563 {
7564 new_item.SetResultOfSplit(true);
7565 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7567 new_item.SetQuantity(split_quantity_new, false, true);
7568 }
7569 }
7570 }
7571 }
7572
7574 {
7576 float split_quantity_new = Math.Floor(quantity * 0.5);
7577
7579 return;
7580
7582
7583 if (new_item)
7584 {
7585 if (new_item.GetQuantityMax() < split_quantity_new)
7586 {
7587 split_quantity_new = new_item.GetQuantityMax();
7588 }
7589
7590 new_item.SetResultOfSplit(true);
7591 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7592
7594 {
7597 }
7598 else
7599 {
7601 new_item.
SetQuantity(split_quantity_new,
false,
true);
7602 }
7603 }
7604 }
7605
7607 {
7609 float split_quantity_new = Math.Floor(quantity / 2);
7610
7612 return;
7613
7614 InventoryLocation invloc = new InventoryLocation;
7616
7618 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
7619
7620 if (new_item)
7621 {
7622 if (new_item.GetQuantityMax() < split_quantity_new)
7623 {
7624 split_quantity_new = new_item.GetQuantityMax();
7625 }
7627 {
7630 }
7631 else if (split_quantity_new > 1)
7632 {
7634 new_item.
SetQuantity(split_quantity_new,
false,
true);
7635 }
7636 }
7637 }
7638
7641 {
7642 SetWeightDirty();
7644
7645 if (parent)
7646 parent.OnAttachmentQuantityChangedEx(this, delta);
7647
7649 {
7651 {
7653 }
7655 {
7656 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
7658 }
7659 }
7660 }
7661
7664 {
7665
7666 }
7667
7670 {
7672 }
7673
7675 {
7676 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
7677
7679 {
7680 if (newLevel == GameConstants.STATE_RUINED)
7681 {
7683 EntityAI parent = GetHierarchyParent();
7684 if (parent && parent.IsFireplace())
7685 {
7686 CargoBase cargo = GetInventory().GetCargo();
7687 if (cargo)
7688 {
7690 {
7692 }
7693 }
7694 }
7695 }
7696
7698 {
7699
7701 return;
7702 }
7703
7704 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
7705 {
7707 }
7708 }
7709 }
7710
7711
7713 {
7714 super.OnRightClick();
7715
7717 {
7719 {
7720 if (ScriptInputUserData.CanStoreInputUserData())
7721 {
7722 EntityAI root = GetHierarchyRoot();
7723 Man playerOwner = GetHierarchyRootPlayer();
7724 InventoryLocation dst = new InventoryLocation;
7725
7726
7727 if (!playerOwner && root && root == this)
7728 {
7730 }
7731 else
7732 {
7733
7734 GetInventory().GetCurrentInventoryLocation(dst);
7736 {
7737 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7739 {
7741 }
7742 else
7743 {
7745
7746
7747 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
7748 {
7750 }
7751 else
7752 {
7753 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
7754 }
7755 }
7756 }
7757 }
7758
7759 ScriptInputUserData ctx = new ScriptInputUserData;
7767 }
7768 }
7769 else if (!
g_Game.IsMultiplayer())
7770 {
7772 }
7773 }
7774 }
7775
7777 {
7778 if (root)
7779 {
7780 vector m4[4];
7781 root.GetTransform(m4);
7782 dst.SetGround(this, m4);
7783 }
7784 else
7785 {
7786 GetInventory().GetCurrentInventoryLocation(dst);
7787 }
7788 }
7789
7790 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
7791 {
7792
7793 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
7794 return false;
7795
7796 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
7797 return false;
7798
7799
7801 return false;
7802
7803
7804 Magazine mag = Magazine.Cast(this);
7805 if (mag)
7806 {
7807 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
7808 return false;
7809
7810 if (stack_max_limit)
7811 {
7812 Magazine other_mag = Magazine.Cast(other_item);
7813 if (other_item)
7814 {
7815 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
7816 return false;
7817 }
7818
7819 }
7820 }
7821 else
7822 {
7823
7825 return false;
7826
7828 return false;
7829 }
7830
7831 PlayerBase player = null;
7832 if (CastTo(player, GetHierarchyRootPlayer()))
7833 {
7834 if (player.GetInventory().HasAttachment(this))
7835 return false;
7836
7837 if (player.IsItemsToDelete())
7838 return false;
7839 }
7840
7841 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
7842 return false;
7843
7844 int slotID;
7846 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
7847 return false;
7848
7849 return true;
7850 }
7851
7853 {
7855 }
7856
7858 {
7859 return m_IsResultOfSplit;
7860 }
7861
7863 {
7864 m_IsResultOfSplit = value;
7865 }
7866
7868 {
7870 }
7871
7873 {
7874 float other_item_quantity = other_item.GetQuantity();
7875 float this_free_space;
7876
7878
7880
7881 if (other_item_quantity > this_free_space)
7882 {
7883 return this_free_space;
7884 }
7885 else
7886 {
7887 return other_item_quantity;
7888 }
7889 }
7890
7892 {
7894 }
7895
7897 {
7899 return;
7900
7901 if (!IsMagazine() && other_item)
7902 {
7904 if (quantity_used != 0)
7905 {
7906 float hp1 = GetHealth01("","");
7907 float hp2 = other_item.GetHealth01("","");
7908 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
7909 hpResult = hpResult / (
GetQuantity() + quantity_used);
7910
7911 hpResult *= GetMaxHealth();
7912 Math.Round(hpResult);
7913 SetHealth("", "Health", hpResult);
7914
7916 other_item.AddQuantity(-quantity_used);
7917 }
7918 }
7920 }
7921
7923 {
7924 #ifdef SERVER
7925 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
7926 GetHierarchyParent().IncreaseLifetimeUp();
7927 #endif
7928 };
7929
7931 {
7932 PlayerBase p = PlayerBase.Cast(player);
7933
7934 array<int> recipesIds = p.m_Recipes;
7935 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
7936 if (moduleRecipesManager)
7937 {
7938 EntityAI itemInHands = player.GetEntityInHands();
7939 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
7940 }
7941
7942 for (int i = 0;i < recipesIds.Count(); i++)
7943 {
7944 int key = recipesIds.Get(i);
7945 string recipeName = moduleRecipesManager.GetRecipeName(key);
7947 }
7948 }
7949
7950
7951 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
7952 {
7953 super.GetDebugActions(outputList);
7954
7955
7961
7962
7967
7972
7973
7977
7978
7980 {
7984 }
7985
7988
7989
7993
7995
7996 InventoryLocation loc = new InventoryLocation();
7997 GetInventory().GetCurrentInventoryLocation(loc);
7999 {
8000 if (Gizmo_IsSupported())
8003 }
8004
8006 }
8007
8008
8009
8010
8012 {
8013 super.OnAction(action_id, player, ctx);
8014
8016 {
8017 switch (action_id)
8018 {
8022 return true;
8026 return true;
8027 }
8028 }
8029
8031 {
8032 switch (action_id)
8033 {
8035 Delete();
8036 return true;
8037 }
8038 }
8039
8040 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
8041 {
8042 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8043 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
8044 PlayerBase p = PlayerBase.Cast(player);
8045 if (
EActions.RECIPES_RANGE_START < 1000)
8046 {
8047 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
8048 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
8049 }
8050 }
8051 #ifndef SERVER
8052 else if (action_id ==
EActions.WATCH_PLAYER)
8053 {
8054 PluginDeveloper.SetDeveloperItemClientEx(player);
8055 }
8056 #endif
8058 {
8059 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
8060 {
8061 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
8062 OnDebugButtonPressServer(id + 1);
8063 }
8064
8065 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
8066 {
8067 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
8069 }
8070
8071 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
8072 {
8073 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
8075 }
8076
8077 else if (action_id ==
EActions.ADD_QUANTITY)
8078 {
8079 if (IsMagazine())
8080 {
8081 Magazine mag = Magazine.Cast(this);
8082 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
8083 }
8084 else
8085 {
8087 }
8088
8089 if (m_EM)
8090 {
8091 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
8092 }
8093
8094 }
8095
8096 else if (action_id ==
EActions.REMOVE_QUANTITY)
8097 {
8098 if (IsMagazine())
8099 {
8100 Magazine mag2 = Magazine.Cast(this);
8101 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
8102 }
8103 else
8104 {
8106 }
8107 if (m_EM)
8108 {
8109 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
8110 }
8111
8112 }
8113
8114 else if (action_id ==
EActions.SET_QUANTITY_0)
8115 {
8117
8118 if (m_EM)
8119 {
8120 m_EM.SetEnergy(0);
8121 }
8122 }
8123
8124 else if (action_id ==
EActions.SET_MAX_QUANTITY)
8125 {
8127
8128 if (m_EM)
8129 {
8130 m_EM.SetEnergy(m_EM.GetEnergyMax());
8131 }
8132 }
8133
8134 else if (action_id ==
EActions.ADD_HEALTH)
8135 {
8136 AddHealth("","",GetMaxHealth("","Health")/5);
8137 }
8138 else if (action_id ==
EActions.REMOVE_HEALTH)
8139 {
8140 AddHealth("","",-GetMaxHealth("","Health")/5);
8141 }
8142 else if (action_id ==
EActions.DESTROY_HEALTH)
8143 {
8144 SetHealth01("","",0);
8145 }
8146 else if (action_id ==
EActions.WATCH_ITEM)
8147 {
8149 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
8150 #ifdef DEVELOPER
8151 SetDebugDeveloper_item(this);
8152 #endif
8153 }
8154
8155 else if (action_id ==
EActions.ADD_TEMPERATURE)
8156 {
8157 AddTemperature(20);
8158
8159 }
8160
8161 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
8162 {
8163 AddTemperature(-20);
8164
8165 }
8166
8167 else if (action_id ==
EActions.FLIP_FROZEN)
8168 {
8169 SetFrozen(!GetIsFrozen());
8170
8171 }
8172
8173 else if (action_id ==
EActions.ADD_WETNESS)
8174 {
8176
8177 }
8178
8179 else if (action_id ==
EActions.REMOVE_WETNESS)
8180 {
8182
8183 }
8184
8185 else if (action_id ==
EActions.LIQUIDTYPE_UP)
8186 {
8189
8190
8191 }
8192
8193 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
8194 {
8197 }
8198
8199 else if (action_id ==
EActions.MAKE_SPECIAL)
8200 {
8201 auto debugParams = DebugSpawnParams.WithPlayer(player);
8202 OnDebugSpawnEx(debugParams);
8203 }
8204
8205 }
8206
8207
8208 return false;
8209 }
8210
8211
8212
8213
8217
8220
8221
8222
8224 {
8225 return false;
8226 }
8227
8228
8230 {
8231 return true;
8232 }
8233
8234
8236 {
8237 return true;
8238 }
8239
8240
8241
8243 {
8244 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
8245 return g_Game.ConfigIsExisting(config_path);
8246 }
8247
8250 {
8251 return null;
8252 }
8253
8255 {
8256 return false;
8257 }
8258
8260 {
8261 return false;
8262 }
8263
8267
8268
8270 {
8271 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8272 return module_repairing.CanRepair(this, item_repair_kit);
8273 }
8274
8275
8276 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
8277 {
8278 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8279 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
8280 }
8281
8282
8284 {
8285
8286
8287
8288
8289
8290
8291
8292
8293 return 1;
8294 }
8295
8296
8297
8299 {
8301 }
8302
8303
8304
8306 {
8308 }
8309
8310
8319 {
8320 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8321
8322 if (player)
8323 {
8324 player.MessageStatus(text);
8325 }
8326 }
8327
8328
8337 {
8338 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8339
8340 if (player)
8341 {
8342 player.MessageAction(text);
8343 }
8344 }
8345
8346
8355 {
8356 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8357
8358 if (player)
8359 {
8360 player.MessageFriendly(text);
8361 }
8362 }
8363
8364
8373 {
8374 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8375
8376 if (player)
8377 {
8378 player.MessageImportant(text);
8379 }
8380 }
8381
8383 {
8384 return true;
8385 }
8386
8387
8388 override bool KindOf(
string tag)
8389 {
8390 bool found = false;
8391 string item_name = this.
GetType();
8393 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
8394
8395 int array_size = item_tag_array.Count();
8396 for (int i = 0; i < array_size; i++)
8397 {
8398 if (item_tag_array.Get(i) == tag)
8399 {
8400 found = true;
8401 break;
8402 }
8403 }
8404 return found;
8405 }
8406
8407
8409 {
8410
8411 super.OnRPC(sender, rpc_type,ctx);
8412
8413
8414 switch (rpc_type)
8415 {
8416 #ifndef SERVER
8417 case ERPCs.RPC_SOUND_LOCK_ATTACH:
8418 Param2<bool, string> p = new Param2<bool, string>(false, "");
8419
8421 return;
8422
8423 bool play = p.param1;
8424 string soundSet = p.param2;
8425
8426 if (play)
8427 {
8429 {
8431 {
8433 }
8434 }
8435 else
8436 {
8438 }
8439 }
8440 else
8441 {
8443 }
8444
8445 break;
8446 #endif
8447
8448 }
8449
8451 {
8453 }
8454 }
8455
8456
8457
8458
8460 {
8461 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8462 return plugin.GetID(
name);
8463 }
8464
8466 {
8467 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8468 return plugin.GetName(id);
8469 }
8470
8473 {
8474
8475
8476 int varFlags;
8477 if (!ctx.
Read(varFlags))
8478 return;
8479
8480 if (varFlags & ItemVariableFlags.FLOAT)
8481 {
8483 }
8484 }
8485
8487 {
8488
8489 super.SerializeNumericalVars(floats_out);
8490
8491
8492
8494 {
8496 }
8497
8499 {
8501 }
8502
8504 {
8506 }
8507
8509 {
8514 }
8515
8517 {
8519 }
8520 }
8521
8523 {
8524
8525 super.DeSerializeNumericalVars(floats);
8526
8527
8528 int index = 0;
8529 int mask = Math.Round(floats.Get(index));
8530
8531 index++;
8532
8534 {
8536 {
8538 }
8539 else
8540 {
8541 float quantity = floats.Get(index);
8543 }
8544 index++;
8545 }
8546
8548 {
8549 float wet = floats.Get(index);
8551 index++;
8552 }
8553
8555 {
8556 int liquidtype = Math.Round(floats.Get(index));
8558 index++;
8559 }
8560
8562 {
8564 index++;
8566 index++;
8568 index++;
8570 index++;
8571 }
8572
8574 {
8575 int cleanness = Math.Round(floats.Get(index));
8577 index++;
8578 }
8579 }
8580
8582 {
8583 super.WriteVarsToCTX(ctx);
8584
8585
8587 {
8589 }
8590
8592 {
8594 }
8595
8597 {
8599 }
8600
8602 {
8603 int r,g,b,a;
8609 }
8610
8612 {
8614 }
8615 }
8616
8618 {
8619 if (!super.ReadVarsFromCTX(ctx,version))
8620 return false;
8621
8622 int intValue;
8623 float value;
8624
8625 if (version < 140)
8626 {
8627 if (!ctx.
Read(intValue))
8628 return false;
8629
8630 m_VariablesMask = intValue;
8631 }
8632
8634 {
8635 if (!ctx.
Read(value))
8636 return false;
8637
8639 {
8641 }
8642 else
8643 {
8645 }
8646 }
8647
8648 if (version < 140)
8649 {
8651 {
8652 if (!ctx.
Read(value))
8653 return false;
8654 SetTemperatureDirect(value);
8655 }
8656 }
8657
8659 {
8660 if (!ctx.
Read(value))
8661 return false;
8663 }
8664
8666 {
8667 if (!ctx.
Read(intValue))
8668 return false;
8670 }
8671
8673 {
8674 int r,g,b,a;
8676 return false;
8678 return false;
8680 return false;
8682 return false;
8683
8685 }
8686
8688 {
8689 if (!ctx.
Read(intValue))
8690 return false;
8692 }
8693
8694 if (version >= 138 && version < 140)
8695 {
8697 {
8698 if (!ctx.
Read(intValue))
8699 return false;
8700 SetFrozen(intValue);
8701 }
8702 }
8703
8704 return true;
8705 }
8706
8707
8709 {
8712 {
8714 }
8715
8716 if (!super.OnStoreLoad(ctx, version))
8717 {
8719 return false;
8720 }
8721
8722 if (version >= 114)
8723 {
8724 bool hasQuickBarIndexSaved;
8725
8726 if (!ctx.
Read(hasQuickBarIndexSaved))
8727 {
8729 return false;
8730 }
8731
8732 if (hasQuickBarIndexSaved)
8733 {
8734 int itmQBIndex;
8735
8736
8737 if (!ctx.
Read(itmQBIndex))
8738 {
8740 return false;
8741 }
8742
8743 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
8744 if (itmQBIndex != -1 && parentPlayer)
8745 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
8746 }
8747 }
8748 else
8749 {
8750
8751 PlayerBase player;
8752 int itemQBIndex;
8753 if (version ==
int.
MAX)
8754 {
8755 if (!ctx.
Read(itemQBIndex))
8756 {
8758 return false;
8759 }
8760 }
8761 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
8762 {
8763
8764 if (!ctx.
Read(itemQBIndex))
8765 {
8767 return false;
8768 }
8769 if (itemQBIndex != -1 && player)
8770 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
8771 }
8772 }
8773
8774 if (version < 140)
8775 {
8776
8777 if (!LoadVariables(ctx, version))
8778 {
8780 return false;
8781 }
8782 }
8783
8784
8786 {
8788 return false;
8789 }
8790 if (version >= 132)
8791 {
8793 if (raib)
8794 {
8796 {
8798 return false;
8799 }
8800 }
8801 }
8802
8804 return true;
8805 }
8806
8807
8808
8810 {
8811 super.OnStoreSave(ctx);
8812
8813 PlayerBase player;
8814 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
8815 {
8817
8818 int itemQBIndex = -1;
8819 itemQBIndex = player.FindQuickBarEntityIndex(this);
8820 ctx.
Write(itemQBIndex);
8821 }
8822 else
8823 {
8825 }
8826
8828
8830 if (raib)
8831 {
8833 }
8834 }
8835
8836
8838 {
8839 super.AfterStoreLoad();
8840
8842 {
8844 }
8845
8847 {
8850 }
8851 }
8852
8854 {
8855 super.EEOnAfterLoad();
8856
8858 {
8860 }
8861
8864 }
8865
8867 {
8868 return false;
8869 }
8870
8871
8872
8874 {
8876 {
8877 #ifdef PLATFORM_CONSOLE
8878
8880 {
8882 if (menu)
8883 {
8885 }
8886 }
8887 #endif
8888 }
8889
8891 {
8894 }
8895
8897 {
8898 SetWeightDirty();
8900 }
8902 {
8905 }
8906
8908 {
8911
8914 }
8916 {
8920 }
8921
8922 super.OnVariablesSynchronized();
8923 }
8924
8925
8926
8928 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
8929 {
8930 if (!IsServerCheck(allow_client))
8931 return false;
8932
8934 return false;
8935
8938
8939 if (value <= (min + 0.001))
8940 value = min;
8941
8942 if (value == min)
8943 {
8944 if (destroy_config)
8945 {
8946 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
8947 if (dstr)
8948 {
8950 this.Delete();
8951 return true;
8952 }
8953 }
8954 else if (destroy_forced)
8955 {
8957 this.Delete();
8958 return true;
8959 }
8960
8962 }
8963
8966
8968 {
8969 EntityAI parent = GetHierarchyRoot();
8970 InventoryLocation iLoc = new InventoryLocation();
8971 GetInventory().GetCurrentInventoryLocation(iLoc);
8973 {
8974 int iLocSlot = iLoc.
GetSlot();
8976 {
8978 }
8980 {
8982 }
8983 }
8984 }
8985
8987 {
8989
8990 if (delta)
8992 }
8993
8995
8996 return false;
8997 }
8998
8999
9001 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9002 {
9004 }
9005
9007 {
9010 }
9011
9013 {
9016 }
9017
9019 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9020 {
9021 float value_clamped = Math.Clamp(value, 0, 1);
9023 SetQuantity(result, destroy_config, destroy_forced);
9024 }
9025
9026
9029 {
9031 }
9032
9034 {
9036 }
9037
9038
9039
9040
9041
9042
9043
9044
9045
9046
9048 {
9049 int slot = -1;
9050 GameInventory inventory = GetInventory();
9051 if (inventory)
9052 {
9053 InventoryLocation il = new InventoryLocation;
9056 }
9057
9059 }
9060
9062 {
9063 float quantity_max = 0;
9064
9066 {
9067 if (attSlotID != -1)
9068 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
9069
9070 if (quantity_max <= 0)
9072 }
9073
9074 if (quantity_max <= 0)
9076
9077 return quantity_max;
9078 }
9079
9081 {
9083 }
9084
9086 {
9088 }
9089
9090
9092 {
9094 }
9095
9097 {
9099 }
9100
9102 {
9104 }
9105
9106
9108 {
9109
9110 float weightEx = GetWeightEx();
9111 float special = GetInventoryAndCargoWeight();
9112 return weightEx - special;
9113 }
9114
9115
9117 {
9119 }
9120
9122 {
9124 {
9125 #ifdef DEVELOPER
9126 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9127 {
9128 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
9130 }
9131 #endif
9132
9134 }
9135 else if (HasEnergyManager())
9136 {
9137 #ifdef DEVELOPER
9138 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9139 {
9140 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
9141 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
9142 }
9143 #endif
9144 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
9145 }
9146 else
9147 {
9148 #ifdef DEVELOPER
9149 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9150 {
9151 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
9152 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
9153 }
9154 #endif
9155 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
9156 }
9157 }
9158
9161 {
9162 int item_count = 0;
9164
9165 GameInventory inventory = GetInventory();
9166 CargoBase cargo = inventory.
GetCargo();
9167 if (cargo != NULL)
9168 {
9170 }
9171
9173 for (int i = 0; i < nAttachments; ++i)
9174 {
9176 if (item)
9177 item_count += item.GetNumberOfItems();
9178 }
9179 return item_count;
9180 }
9181
9184 {
9185 float weight = 0;
9186 float wetness = 1;
9187 if (include_wetness)
9190 {
9191 weight = wetness * m_ConfigWeight;
9192 }
9194 {
9195 weight = 1;
9196 }
9197 return weight;
9198 }
9199
9200
9201
9203 {
9204 GameInventory inventory = GetInventory();
9205 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
9206 {
9207 array<EntityAI> items = new array<EntityAI>;
9209 for (int i = 0; i < items.Count(); ++i)
9210 {
9212 if (item)
9213 {
9214 g_Game.ObjectDelete(item);
9215 }
9216 }
9217 }
9218 }
9219
9220
9221
9222
9224 {
9225 float energy = 0;
9226 if (HasEnergyManager())
9227 {
9228 energy = GetCompEM().GetEnergy();
9229 }
9230 return energy;
9231 }
9232
9233
9235 {
9236 super.OnEnergyConsumed();
9237
9239 }
9240
9242 {
9243 super.OnEnergyAdded();
9244
9246 }
9247
9248
9250 {
9251 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
9252 {
9254 {
9255 float energy_0to1 = GetCompEM().GetEnergy0To1();
9257 }
9258 }
9259 }
9260
9261
9263 {
9264 return ConfigGetFloat("heatIsolation");
9265 }
9266
9268 {
9270 }
9271
9273 {
9274 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
9275 if (
g_Game.ConfigIsExisting(paramPath))
9276 return g_Game.ConfigGetFloat(paramPath);
9277
9278 return 0.0;
9279 }
9280
9282 {
9283 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
9284 if (
g_Game.ConfigIsExisting(paramPath))
9285 return g_Game.ConfigGetFloat(paramPath);
9286
9287 return 0.0;
9288 }
9289
9290 override void SetWet(
float value,
bool allow_client =
false)
9291 {
9292 if (!IsServerCheck(allow_client))
9293 return;
9294
9297
9299
9300 m_VarWet = Math.Clamp(value, min, max);
9301
9303 {
9306 }
9307 }
9308
9309 override void AddWet(
float value)
9310 {
9312 }
9313
9315 {
9317 }
9318
9320 {
9322 }
9323
9325 {
9327 }
9328
9330 {
9332 }
9333
9335 {
9337 }
9338
9340 {
9343 if (newLevel != oldLevel)
9344 {
9346 }
9347 }
9348
9350 {
9351 SetWeightDirty();
9352 }
9353
9355 {
9356 return GetWetLevelInternal(
m_VarWet);
9357 }
9358
9359
9360
9362 {
9364 }
9365
9367 {
9369 }
9370
9372 {
9374 }
9375
9377 {
9379 }
9380
9381
9382
9384 {
9385 if (ConfigIsExisting("itemModelLength"))
9386 {
9387 return ConfigGetFloat("itemModelLength");
9388 }
9389 return 0;
9390 }
9391
9393 {
9394 if (ConfigIsExisting("itemAttachOffset"))
9395 {
9396 return ConfigGetFloat("itemAttachOffset");
9397 }
9398 return 0;
9399 }
9400
9401 override void SetCleanness(
int value,
bool allow_client =
false)
9402 {
9403 if (!IsServerCheck(allow_client))
9404 return;
9405
9407
9409
9412 }
9413
9415 {
9417 }
9418
9420 {
9421 return true;
9422 }
9423
9424
9425
9426
9428 {
9430 }
9431
9433 {
9435 }
9436
9437
9438
9439
9440 override void SetColor(
int r,
int g,
int b,
int a)
9441 {
9447 }
9449 override void GetColor(out
int r,out
int g,out
int b,out
int a)
9450 {
9455 }
9456
9458 {
9460 }
9461
9464 {
9465 int r,g,b,a;
9467 r = r/255;
9468 g = g/255;
9469 b = b/255;
9470 a = a/255;
9471 return MiscGameplayFunctions.GetColorString(r, g, b, a);
9472 }
9473
9474
9475
9476 override void SetLiquidType(
int value,
bool allow_client =
false)
9477 {
9478 if (!IsServerCheck(allow_client))
9479 return;
9480
9485 }
9486
9488 {
9489 return ConfigGetInt("varLiquidTypeInit");
9490 }
9491
9493 {
9495 }
9496
9498 {
9500 SetFrozen(false);
9501 }
9502
9505 {
9506 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9507 }
9508
9509
9512 {
9513 PlayerBase nplayer;
9514 if (PlayerBase.CastTo(nplayer, player))
9515 {
9517 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9518 }
9519 }
9520
9521
9524 {
9525 PlayerBase nplayer;
9526 if (PlayerBase.CastTo(nplayer,player))
9527 {
9528 nplayer.SetEnableQuickBarEntityShortcut(this, false);
9529 }
9530
9531 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
9532
9533 if (HasEnergyManager())
9534 {
9535 GetCompEM().UpdatePlugState();
9536 }
9537 }
9538
9539
9541 {
9542 super.OnPlacementStarted(player);
9543
9545 }
9546
9547 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
9548 {
9550 {
9551 m_AdminLog.OnPlacementComplete(player,
this);
9552 }
9553
9554 super.OnPlacementComplete(player, position, orientation);
9555 }
9556
9557
9558
9559
9560
9562 {
9564 {
9565 return true;
9566 }
9567 else
9568 {
9569 return false;
9570 }
9571 }
9572
9573
9575 {
9577 {
9579 }
9580 }
9581
9582
9584 {
9586 }
9587
9589 {
9591 }
9592
9593 override void InsertAgent(
int agent,
float count = 1)
9594 {
9595 if (count < 1)
9596 return;
9597
9599 }
9600
9603 {
9605 }
9606
9607
9609 {
9611 }
9612
9613
9614
9615
9616
9617
9618
9619
9620
9621
9622
9623
9624
9625
9626
9627
9628
9629
9630
9631
9632
9633
9634
9635
9636
9637
9638
9639
9640
9641
9642
9643
9644
9645
9646
9647
9648
9649
9650
9651
9652
9653
9655 {
9657 return false;
9658 return true;
9659 }
9660
9662 {
9663
9665 }
9666
9667
9670 {
9671 super.CheckForRoofLimited(timeTresholdMS);
9672
9673 float time =
g_Game.GetTime();
9674 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
9675 {
9676 m_PreviousRoofTestTime = time;
9677 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
9678 }
9679 }
9680
9681
9683 {
9685 {
9686 return 0;
9687 }
9688
9689 if (GetInventory().GetAttachmentSlotsCount() != 0)
9690 {
9691 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
9692 if (filter)
9693 return filter.GetProtectionLevel(type, false, system);
9694 else
9695 return 0;
9696 }
9697
9698 string subclassPath, entryName;
9699
9700 switch (type)
9701 {
9703 entryName = "biological";
9704 break;
9706 entryName = "chemical";
9707 break;
9708 default:
9709 entryName = "biological";
9710 break;
9711 }
9712
9713 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
9714
9715 return g_Game.ConfigGetFloat(subclassPath + entryName);
9716 }
9717
9718
9719
9722 {
9723 if (!IsMagazine())
9725
9727 }
9728
9729
9730
9731
9732
9737 {
9738 return true;
9739 }
9740
9742 {
9744 }
9745
9746
9747
9748
9749
9751 {
9752 if (parent)
9753 {
9754 if (parent.IsInherited(DayZInfected))
9755 return true;
9756
9757 if (!parent.IsRuined())
9758 return true;
9759 }
9760
9761 return true;
9762 }
9763
9765 {
9766 if (!super.CanPutAsAttachment(parent))
9767 {
9768 return false;
9769 }
9770
9771 if (!IsRuined() && !parent.IsRuined())
9772 {
9773 return true;
9774 }
9775
9776 return false;
9777 }
9778
9780 {
9781
9782
9783
9784
9785 return super.CanReceiveItemIntoCargo(item);
9786 }
9787
9789 {
9790
9791
9792
9793
9794 GameInventory attachmentInv = attachment.GetInventory();
9796 {
9797 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
9798 return false;
9799 }
9800
9801 InventoryLocation loc = new InventoryLocation();
9802 attachment.GetInventory().GetCurrentInventoryLocation(loc);
9803 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
9804 return false;
9805
9806 return super.CanReceiveAttachment(attachment, slotId);
9807 }
9808
9810 {
9811 if (!super.CanReleaseAttachment(attachment))
9812 return false;
9813
9814 return GetInventory().AreChildrenAccessible();
9815 }
9816
9817
9818
9819
9820
9821
9822
9823
9824
9825
9826
9827
9828
9829
9830
9831
9832
9833
9834
9835
9836
9838 {
9839 int id = muzzle_owner.GetMuzzleID();
9840 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
9841
9842 if (WPOF_array)
9843 {
9844 for (int i = 0; i < WPOF_array.Count(); i++)
9845 {
9846 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
9847
9848 if (WPOF)
9849 {
9850 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
9851 }
9852 }
9853 }
9854 }
9855
9856
9858 {
9859 int id = muzzle_owner.GetMuzzleID();
9861
9862 if (WPOBE_array)
9863 {
9864 for (int i = 0; i < WPOBE_array.Count(); i++)
9865 {
9866 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
9867
9868 if (WPOBE)
9869 {
9870 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
9871 }
9872 }
9873 }
9874 }
9875
9876
9878 {
9879 int id = muzzle_owner.GetMuzzleID();
9880 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9881
9882 if (WPOOH_array)
9883 {
9884 for (int i = 0; i < WPOOH_array.Count(); i++)
9885 {
9886 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9887
9888 if (WPOOH)
9889 {
9890 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
9891 }
9892 }
9893 }
9894 }
9895
9896
9898 {
9899 int id = muzzle_owner.GetMuzzleID();
9900 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9901
9902 if (WPOOH_array)
9903 {
9904 for (int i = 0; i < WPOOH_array.Count(); i++)
9905 {
9906 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9907
9908 if (WPOOH)
9909 {
9910 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9911 }
9912 }
9913 }
9914 }
9915
9916
9918 {
9919 int id = muzzle_owner.GetMuzzleID();
9920 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9921
9922 if (WPOOH_array)
9923 {
9924 for (int i = 0; i < WPOOH_array.Count(); i++)
9925 {
9926 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9927
9928 if (WPOOH)
9929 {
9930 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9931 }
9932 }
9933 }
9934 }
9935
9936
9937
9939 {
9941 {
9942 return true;
9943 }
9944
9945 return false;
9946 }
9947
9949 {
9951 {
9952 return true;
9953 }
9954
9955 return false;
9956 }
9957
9959 {
9961 {
9962 return true;
9963 }
9964
9965 return false;
9966 }
9967
9969 {
9970 return false;
9971 }
9972
9975 {
9976 return UATimeSpent.DEFAULT_DEPLOY;
9977 }
9978
9979
9980
9981
9983 {
9985 SetSynchDirty();
9986 }
9987
9989 {
9991 }
9992
9993
9995 {
9996 return false;
9997 }
9998
10001 {
10002 string att_type = "None";
10003
10004 if (ConfigIsExisting("soundAttType"))
10005 {
10006 att_type = ConfigGetString("soundAttType");
10007 }
10008
10010 }
10011
10013 {
10015 }
10016
10017
10018
10019
10020
10026
10028 {
10031
10033 }
10034
10035
10037 {
10039 return;
10040
10042
10045
10048
10049 SoundParameters params = new SoundParameters();
10053 }
10054
10055
10057 {
10059 {
10062
10063 SetSynchDirty();
10064
10067 }
10068 }
10069
10071 {
10073 }
10074
10075
10077 {
10079 return;
10080
10082 SetSynchDirty();
10083
10086 }
10087
10089 {
10092 }
10093
10095 {
10097 }
10098
10099 void OnApply(PlayerBase player);
10100
10102 {
10103 return 1.0;
10104 };
10105
10107 {
10109 }
10110
10112 {
10114 }
10115
10117
10119 {
10120 SetDynamicPhysicsLifeTime(0.01);
10122 }
10123
10125 {
10126 array<string> zone_names = new array<string>;
10127 GetDamageZones(zone_names);
10128 for (int i = 0; i < zone_names.Count(); i++)
10129 {
10130 SetHealthMax(zone_names.Get(i),"Health");
10131 }
10132 SetHealthMax("","Health");
10133 }
10134
10137 {
10138 float global_health = GetHealth01("","Health");
10139 array<string> zones = new array<string>;
10140 GetDamageZones(zones);
10141
10142 for (int i = 0; i < zones.Count(); i++)
10143 {
10144 SetHealth01(zones.Get(i),"Health",global_health);
10145 }
10146 }
10147
10150 {
10151 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
10152 }
10153
10155 {
10156 if (!hasRootAsPlayer)
10157 {
10158 if (refParentIB)
10159 {
10160
10161 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
10162 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
10163
10164 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
10165 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
10166
10169 }
10170 else
10171 {
10172
10175 }
10176 }
10177 }
10178
10180 {
10182 {
10183 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
10184 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
10185 {
10186 float heatPermCoef = 1.0;
10188 while (ent)
10189 {
10190 heatPermCoef *= ent.GetHeatPermeabilityCoef();
10191 ent = ent.GetHierarchyParent();
10192 }
10193
10194 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
10195 }
10196 }
10197 }
10198
10200 {
10201
10202 EntityAI parent = GetHierarchyParent();
10203 if (!parent)
10204 {
10205 hasParent = false;
10206 hasRootAsPlayer = false;
10207 }
10208 else
10209 {
10210 hasParent = true;
10211 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
10212 refParentIB =
ItemBase.Cast(parent);
10213 }
10214 }
10215
10216 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
10217 {
10218
10219 }
10220
10222 {
10223
10224 return false;
10225 }
10226
10228 {
10229
10230
10231 return false;
10232 }
10233
10235 {
10236
10237 return false;
10238 }
10239
10242 {
10243 return !GetIsFrozen() &&
IsOpen();
10244 }
10245
10247 {
10248 bool hasParent = false, hasRootAsPlayer = false;
10250
10251 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
10252 bool foodDecay =
g_Game.IsFoodDecayEnabled();
10253
10254 if (wwtu || foodDecay)
10255 {
10259
10260 if (processWetness || processTemperature || processDecay)
10261 {
10263
10264 if (processWetness)
10265 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
10266
10267 if (processTemperature)
10269
10270 if (processDecay)
10271 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
10272 }
10273 }
10274 }
10275
10278 {
10280 }
10281
10283 {
10286
10287 return super.GetTemperatureFreezeThreshold();
10288 }
10289
10291 {
10294
10295 return super.GetTemperatureThawThreshold();
10296 }
10297
10299 {
10302
10303 return super.GetItemOverheatThreshold();
10304 }
10305
10307 {
10309 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
10310
10311 return super.GetTemperatureFreezeTime();
10312 }
10313
10315 {
10317 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
10318
10319 return super.GetTemperatureThawTime();
10320 }
10321
10326
10328 {
10329 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
10330 }
10331
10333 {
10334 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
10335 }
10336
10339 {
10341 }
10342
10344 {
10346 }
10347
10349 {
10351 }
10352
10355 {
10356 return null;
10357 }
10358
10361 {
10362 return false;
10363 }
10364
10366 {
10368 {
10371 if (!trg)
10372 {
10374 explosive = this;
10375 }
10376
10377 explosive.PairRemote(trg);
10379
10380 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
10381 trg.SetPersistentPairID(persistentID);
10382 explosive.SetPersistentPairID(persistentID);
10383
10384 return true;
10385 }
10386 return false;
10387 }
10388
10391 {
10392 float ret = 1.0;
10395 ret *= GetHealth01();
10396
10397 return ret;
10398 }
10399
10400 #ifdef DEVELOPER
10401 override void SetDebugItem()
10402 {
10403 super.SetDebugItem();
10404 _itemBase = this;
10405 }
10406
10408 {
10409 string text = super.GetDebugText();
10410
10412 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
10413
10414 return text;
10415 }
10416 #endif
10417
10419 {
10420 return true;
10421 }
10422
10424
10426
10428 {
10431 }
10432
10433
10441
10457
10458 [
Obsolete(
"Use ItemSoundHandler instead")]
10461 {
10462 if (!
g_Game.IsDedicatedServer())
10463 {
10464 if (ConfigIsExisting("attachSoundSet"))
10465 {
10466 string cfg_path = "";
10467 string soundset = "";
10468 string type_name =
GetType();
10469
10472 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
10473 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
10474
10475 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
10476 {
10477 for (int i = 0; i < cfg_soundset_array.Count(); i++)
10478 {
10479 if (cfg_slot_array[i] == slot_type)
10480 {
10481 soundset = cfg_soundset_array[i];
10482 break;
10483 }
10484 }
10485 }
10486
10487 if (soundset != "")
10488 {
10489 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
10491 }
10492 }
10493 }
10494 }
10495
10497}
10498
10500{
10502 if (entity)
10503 {
10504 bool is_item = entity.IsInherited(
ItemBase);
10505 if (is_item && full_quantity)
10506 {
10509 }
10510 }
10511 else
10512 {
10514 return NULL;
10515 }
10516 return entity;
10517}
10518
10520{
10521 if (item)
10522 {
10523 if (health > 0)
10524 item.SetHealth("", "", health);
10525
10526 if (item.CanHaveTemperature())
10527 {
10529 if (item.CanFreeze())
10530 item.SetFrozen(false);
10531 }
10532
10533 if (item.HasEnergyManager())
10534 {
10535 if (quantity >= 0)
10536 {
10537 item.GetCompEM().SetEnergy0To1(quantity);
10538 }
10539 else
10540 {
10542 }
10543 }
10544 else if (item.IsMagazine())
10545 {
10546 Magazine mag = Magazine.Cast(item);
10547 if (quantity >= 0)
10548 {
10549 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
10550 }
10551 else
10552 {
10554 }
10555
10556 }
10557 else
10558 {
10559 if (quantity >= 0)
10560 {
10561 item.SetQuantityNormalized(quantity, false);
10562 }
10563 else
10564 {
10566 }
10567
10568 }
10569 }
10570}
10571
10572#ifdef DEVELOPER
10574#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.