5629{
5631 {
5632 return true;
5633 }
5634};
5635
5636
5637
5639{
5643
5645
5648
5649
5650
5651
5652
5661
5667
5672
5677
5698 protected bool m_IsResultOfSplit
5699
5701
5706
5707
5708
5710
5714
5715
5716
5718
5721
5722
5723
5729
5730
5738
5741
5742
5744
5745
5747
5748
5753
5754
5759
5760
5762
5763
5765 {
5770
5771 if (!
GetGame().IsDedicatedServer())
5772 {
5774 {
5776
5778 {
5780 }
5781 }
5782
5785 }
5786
5787 m_OldLocation = null;
5788
5790 {
5792 }
5793
5794 if (ConfigIsExisting("headSelectionsToHide"))
5795 {
5798 }
5799
5801 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
5802 {
5804 }
5805
5807
5808 m_IsResultOfSplit = false;
5809
5811 }
5812
5814 {
5815 super.InitItemVariables();
5816
5822 m_Count = ConfigGetInt(
"count");
5823
5826
5831
5834
5839
5851
5855
5856
5859 if (ConfigIsExisting("canBeSplit"))
5860 {
5863 }
5864
5866 if (ConfigIsExisting("itemBehaviour"))
5868
5869
5872 RegisterNetSyncVariableInt("m_VarLiquidType");
5873 RegisterNetSyncVariableInt("m_Cleanness",0,1);
5874
5875 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
5876 RegisterNetSyncVariableFloat("m_ImpactSpeed");
5877 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
5878
5879 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
5880 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
5881 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
5882 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
5883
5884 RegisterNetSyncVariableBool("m_IsBeingPlaced");
5885 RegisterNetSyncVariableBool("m_IsTakeable");
5886 RegisterNetSyncVariableBool("m_IsHologram");
5887
5890 {
5893 }
5894
5896
5898 if (ConfigIsExisting("temperaturePerQuantityWeight"))
5900
5901 }
5902
5904 {
5906 }
5907
5909 {
5912 {
5917 }
5918 }
5919
5920 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
5921 {
5923 {
5926 }
5927
5929 }
5930
5932 {
5938 }
5939
5941
5943 {
5945
5946 if (!action)
5947 {
5948 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
5949 return;
5950 }
5951
5953 if (!ai)
5954 {
5956 return;
5957 }
5958
5960 if (!action_array)
5961 {
5962 action_array = new array<ActionBase_Basic>;
5964 }
5965 if (LogManager.IsActionLogEnable())
5966 {
5967 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
5968 }
5969
5970 if (action_array.Find(action) != -1)
5971 {
5972 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
5973 }
5974 else
5975 {
5976 action_array.Insert(action);
5977 }
5978 }
5979
5981 {
5983 ActionBase action = player.GetActionManager().GetAction(actionName);
5986
5987 if (action_array)
5988 {
5989 action_array.RemoveItem(action);
5990 }
5991 }
5992
5993
5994
5996 {
5997 ActionOverrideData overrideData = new ActionOverrideData();
6001
6003 if (!actionMap)
6004 {
6007 }
6008
6009 actionMap.Insert(this.
Type(), overrideData);
6010
6011 }
6012
6014
6016
6017
6019 {
6022
6025
6026 string config_to_search = "CfgVehicles";
6027 string muzzle_owner_config;
6028
6030 {
6031 if (IsInherited(Weapon))
6032 config_to_search = "CfgWeapons";
6033
6034 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6035
6036 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
6037
6039
6040 if (config_OnFire_subclass_count > 0)
6041 {
6042 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
6043
6044 for (int i = 0; i < config_OnFire_subclass_count; i++)
6045 {
6046 string particle_class = "";
6048 string config_OnFire_entry = config_OnFire_class + particle_class;
6049 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
6050 WPOF_array.Insert(WPOF);
6051 }
6052
6053
6055 }
6056 }
6057
6059 {
6060 config_to_search = "CfgWeapons";
6061 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6062
6063 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
6064
6066
6067 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
6068 {
6069 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
6070
6071 for (i = 0; i < config_OnBulletCasingEject_count; i++)
6072 {
6073 string particle_class2 = "";
6075 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
6076 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
6077 WPOBE_array.Insert(WPOBE);
6078 }
6079
6080
6082 }
6083 }
6084 }
6085
6086
6088 {
6091
6093 {
6094 string config_to_search = "CfgVehicles";
6095
6096 if (IsInherited(Weapon))
6097 config_to_search = "CfgWeapons";
6098
6099 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6100 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
6101
6102 if (
GetGame().ConfigIsExisting(config_OnOverheating_class))
6103 {
6104
6106
6108 {
6110 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
6112 return;
6113 }
6114
6117
6118
6119
6121 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
6122
6123 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
6124 {
6125 string particle_class = "";
6127 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
6129
6130 if (entry_type == CT_CLASS)
6131 {
6132 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
6133 WPOOH_array.Insert(WPOF);
6134 }
6135 }
6136
6137
6139 }
6140 }
6141 }
6142
6144 {
6146 }
6147
6149 {
6151 {
6153
6156
6159
6160 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6161 }
6162 }
6163
6165 {
6167 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6168
6170 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6171
6173 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6174
6176 {
6178 }
6179 }
6180
6182 {
6184 }
6185
6187 {
6190 else
6192
6194 {
6197 }
6198 else
6199 {
6202
6205 }
6206
6208 }
6209
6211 {
6213 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6214 }
6215
6217 {
6219 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6221 }
6222
6224 {
6226 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6227 }
6228
6230 {
6233
6234 OverheatingParticle OP = new OverheatingParticle();
6239
6241 }
6242
6244 {
6247
6248 return -1;
6249 }
6250
6252 {
6254 {
6257
6258 for (int i = count; i > 0; --i)
6259 {
6260 int id = i - 1;
6263
6266
6267 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
6268 {
6269 if (p)
6270 {
6273 }
6274 }
6275 }
6276 }
6277 }
6278
6280 {
6282 {
6284 {
6285 int id = i - 1;
6287
6288 if (OP)
6289 {
6291
6292 if (p)
6293 {
6295 }
6296
6297 delete OP;
6298 }
6299 }
6300
6303 }
6304 }
6305
6308 {
6309 return 0.0;
6310 }
6311
6312
6314 {
6315 return 250;
6316 }
6317
6319 {
6320 return 0;
6321 }
6322
6325 {
6327 return true;
6328
6329 return false;
6330 }
6331
6334 {
6337
6339 {
6341 }
6342 else
6343 {
6344
6346 }
6347
6349 }
6350
6357 {
6358 return -1;
6359 }
6360
6361
6362
6363
6365 {
6367 {
6369 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6370
6371 if (r_index >= 0)
6372 {
6373 InventoryLocation r_il = new InventoryLocation;
6374 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6375
6376 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6379 {
6380 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6381 }
6383 {
6384 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6385 }
6386
6387 }
6388
6389 player.GetHumanInventory().ClearUserReservedLocation(this);
6390 }
6391
6394 }
6395
6396
6397
6398
6400 {
6401 return ItemBase.m_DebugActionsMask;
6402 }
6403
6405 {
6406 return ItemBase.m_DebugActionsMask & mask;
6407 }
6408
6410 {
6411 ItemBase.m_DebugActionsMask = mask;
6412 }
6413
6415 {
6416 ItemBase.m_DebugActionsMask |= mask;
6417 }
6418
6420 {
6421 ItemBase.m_DebugActionsMask &= ~mask;
6422 }
6423
6425 {
6427 {
6429 }
6430 else
6431 {
6433 }
6434 }
6435
6436
6438 {
6439 if (GetEconomyProfile())
6440 {
6441 float q_max = GetEconomyProfile().GetQuantityMax();
6442 if (q_max > 0)
6443 {
6444 float q_min = GetEconomyProfile().GetQuantityMin();
6445 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
6446
6448 {
6449 ComponentEnergyManager comp = GetCompEM();
6451 {
6453 }
6454 }
6456 {
6458
6459 }
6460
6461 }
6462 }
6463 }
6464
6467 {
6468 EntityAI parent = GetHierarchyParent();
6469
6470 if (parent)
6471 {
6472 InventoryLocation inventory_location_to_lock = new InventoryLocation;
6473 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
6474 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
6475 }
6476 }
6477
6480 {
6481 EntityAI parent = GetHierarchyParent();
6482
6483 if (parent)
6484 {
6485 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
6486 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
6487 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
6488 }
6489 }
6490
6492 {
6493
6494
6495
6496
6498
6500 {
6501 if (ScriptInputUserData.CanStoreInputUserData())
6502 {
6503 ScriptInputUserData ctx = new ScriptInputUserData;
6509 ctx.
Write(use_stack_max);
6512
6514 {
6515 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
6516 }
6517 }
6518 }
6519 else if (!
GetGame().IsMultiplayer())
6520 {
6522 }
6523 }
6524
6526 {
6528 }
6529
6531 {
6533 }
6534
6536 {
6538 }
6539
6541 {
6542
6543 return false;
6544 }
6545
6547 {
6548 return false;
6549 }
6550
6554 {
6555 return false;
6556 }
6557
6559 {
6560 return "";
6561 }
6562
6564
6566 {
6567 return false;
6568 }
6569
6571 {
6572 return true;
6573 }
6574
6575
6576
6578 {
6579 return true;
6580 }
6581
6583 {
6584 return true;
6585 }
6586
6588 {
6589 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6591 }
6592
6594 {
6596 }
6597
6599 {
6601 if (!is_being_placed)
6603 SetSynchDirty();
6604 }
6605
6606
6608
6610 {
6612 }
6613
6615 {
6617 }
6618
6620 {
6621 return 1;
6622 }
6623
6625 {
6626 return false;
6627 }
6628
6630 {
6632 SetSynchDirty();
6633 }
6634
6635
6636
6637
6638
6639
6640
6641
6642
6643
6644
6645
6646
6647
6648
6649
6650
6651
6652
6653
6654
6655
6656
6657
6658
6659
6660
6661
6662
6663
6664
6665
6666
6667
6668
6670 {
6671 super.OnMovedInsideCargo(container);
6672
6673 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6674 }
6675
6676 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
6677 {
6678 super.EEItemLocationChanged(oldLoc,newLoc);
6679
6680 PlayerBase new_player = null;
6681 PlayerBase old_player = null;
6682
6683 if (newLoc.GetParent())
6684 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
6685
6686 if (oldLoc.GetParent())
6687 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
6688
6690 {
6691 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
6692
6693 if (r_index >= 0)
6694 {
6695 InventoryLocation r_il = new InventoryLocation;
6696 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6697
6698 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6701 {
6702 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6703 }
6705 {
6706 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6707 }
6708
6709 }
6710 }
6711
6713 {
6714 if (new_player)
6715 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
6716
6717 if (new_player == old_player)
6718 {
6719
6720 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
6721 {
6723 {
6724 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
6725 {
6726 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6727 }
6728 }
6729 else
6730 {
6731 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6732 }
6733 }
6734
6735 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
6736 {
6737 int type = oldLoc.GetType();
6739 {
6740 oldLoc.GetParent().GetOnSetLock().Invoke(this);
6741 }
6743 {
6744 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
6745 }
6746 }
6747 if (!m_OldLocation)
6748 {
6749 m_OldLocation = new InventoryLocation;
6750 }
6751 m_OldLocation.Copy(oldLoc);
6752 }
6753 else
6754 {
6755 if (m_OldLocation)
6756 {
6757 m_OldLocation.Reset();
6758 }
6759 }
6760
6762 }
6763 else
6764 {
6765 if (new_player)
6766 {
6767 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
6768 if (res_index >= 0)
6769 {
6770 InventoryLocation il = new InventoryLocation;
6771 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
6773 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
6776 {
6777 il.
GetParent().GetOnReleaseLock().Invoke(it);
6778 }
6780 {
6782 }
6783
6784 }
6785 }
6787 {
6788
6790 }
6791
6792 if (m_OldLocation)
6793 {
6794 m_OldLocation.Reset();
6795 }
6796 }
6797 }
6798
6799 override void EOnContact(IEntity other, Contact extra)
6800 {
6802 {
6803 int liquidType = -1;
6805 if (impactSpeed > 0.0)
6806 {
6808 #ifndef SERVER
6810 #else
6812 SetSynchDirty();
6813 #endif
6815 }
6816 }
6817
6818 #ifdef SERVER
6819 if (GetCompEM() && GetCompEM().IsPlugged())
6820 {
6821 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
6822 GetCompEM().UnplugThis();
6823 }
6824 #endif
6825 }
6826
6828
6830 {
6832 }
6833
6835 {
6836
6837 }
6838
6840 {
6841 super.OnItemLocationChanged(old_owner, new_owner);
6842
6843 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
6844 PlayerBase playerNew = PlayerBase.Cast(new_owner);
6845
6846 if (!relatedPlayer && playerNew)
6847 relatedPlayer = playerNew;
6848
6849 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
6850 {
6852 if (actionMgr)
6853 {
6854 ActionBase currentAction = actionMgr.GetRunningAction();
6855 if (currentAction)
6857 }
6858 }
6859
6860 Man ownerPlayerOld = null;
6861 Man ownerPlayerNew = null;
6862
6863 if (old_owner)
6864 {
6865 if (old_owner.
IsMan())
6866 {
6867 ownerPlayerOld = Man.Cast(old_owner);
6868 }
6869 else
6870 {
6871 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
6872 }
6873 }
6874 else
6875 {
6877 {
6879
6880 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
6881 {
6882 GetCompEM().UnplugThis();
6883 }
6884 }
6885 }
6886
6887 if (new_owner)
6888 {
6889 if (new_owner.
IsMan())
6890 {
6891 ownerPlayerNew = Man.Cast(new_owner);
6892 }
6893 else
6894 {
6895 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
6896 }
6897 }
6898
6899 if (ownerPlayerOld != ownerPlayerNew)
6900 {
6901 if (ownerPlayerOld)
6902 {
6903 array<EntityAI> subItemsExit = new array<EntityAI>;
6905 for (int i = 0; i < subItemsExit.Count(); i++)
6906 {
6909 }
6910 }
6911
6912 if (ownerPlayerNew)
6913 {
6914 array<EntityAI> subItemsEnter = new array<EntityAI>;
6916 for (int j = 0; j < subItemsEnter.Count(); j++)
6917 {
6920 }
6921 }
6922 }
6923 else if (ownerPlayerNew != null)
6924 {
6925 PlayerBase nplayer;
6926 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
6927 {
6928 array<EntityAI> subItemsUpdate = new array<EntityAI>;
6930 for (int k = 0; k < subItemsUpdate.Count(); k++)
6931 {
6933 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
6934 }
6935 }
6936 }
6937
6938 if (old_owner)
6939 old_owner.OnChildItemRemoved(this);
6940 if (new_owner)
6941 new_owner.OnChildItemReceived(this);
6942 }
6943
6944
6946 {
6947 super.EEDelete(parent);
6948 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
6949 if (player)
6950 {
6952
6953 if (player.IsAlive())
6954 {
6955 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6956 if (r_index >= 0)
6957 {
6958 InventoryLocation r_il = new InventoryLocation;
6959 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6960
6961 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6964 {
6965 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6966 }
6968 {
6969 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6970 }
6971
6972 }
6973
6974 player.RemoveQuickBarEntityShortcut(this);
6975 }
6976 }
6977 }
6978
6980 {
6981 super.EEKilled(killer);
6982
6985 {
6986 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
6987 {
6988 if (IsMagazine())
6989 {
6990 if (Magazine.Cast(this).GetAmmoCount() > 0)
6991 {
6993 }
6994 }
6995 else
6996 {
6998 }
6999 }
7000 }
7001 }
7002
7004 {
7005 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7006
7007 super.OnWasAttached(parent, slot_id);
7008
7011
7013 }
7014
7016 {
7017 super.OnWasDetached(parent, slot_id);
7018
7021 }
7022
7024 {
7025 int idx;
7028
7029 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7030 if (inventory_slots.Count() < 1)
7031 {
7032 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
7033 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
7034 }
7035 else
7036 {
7037 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
7038 }
7039
7040 idx = inventory_slots.Find(slot);
7041 if (idx < 0)
7042 return "";
7043
7044 return attach_types.Get(idx);
7045 }
7046
7048 {
7049 int idx = -1;
7050 string slot;
7051
7054
7055 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7056 if (inventory_slots.Count() < 1)
7057 {
7058 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
7059 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7060 }
7061 else
7062 {
7063 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
7064 if (detach_types.Count() < 1)
7065 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7066 }
7067
7068 for (int i = 0; i < inventory_slots.Count(); i++)
7069 {
7070 slot = inventory_slots.Get(i);
7071 }
7072
7073 if (slot != "")
7074 {
7075 if (detach_types.Count() == 1)
7076 idx = 0;
7077 else
7078 idx = inventory_slots.Find(slot);
7079 }
7080 if (idx < 0)
7081 return "";
7082
7083 return detach_types.Get(idx);
7084 }
7085
7087 {
7088
7090
7091
7092 float min_time = 1;
7093 float max_time = 3;
7094 float delay = Math.RandomFloat(min_time, max_time);
7095
7096 explode_timer.Run(delay, this, "DoAmmoExplosion");
7097 }
7098
7100 {
7101 Magazine magazine = Magazine.Cast(this);
7102 int pop_sounds_count = 6;
7103 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
7104
7105
7106 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
7107 string sound_name = pop_sounds[ sound_idx ];
7109
7110
7111 magazine.ServerAddAmmoCount(-1);
7112
7113
7114 float min_temp_to_explode = 100;
7115
7116 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
7117 {
7119 }
7120 }
7121
7122
7123 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
7124 {
7125 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
7126
7127 const int CHANCE_DAMAGE_CARGO = 4;
7128 const int CHANCE_DAMAGE_ATTACHMENT = 1;
7129 const int CHANCE_DAMAGE_NOTHING = 2;
7130
7132 {
7133 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
7134 int chances;
7135 int rnd;
7136
7137 if (GetInventory().GetCargo())
7138 {
7139 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7140 rnd = Math.RandomInt(0,chances);
7141
7142 if (rnd < CHANCE_DAMAGE_CARGO)
7143 {
7145 }
7146 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
7147 {
7149 }
7150 }
7151 else
7152 {
7153 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7154 rnd = Math.RandomInt(0,chances);
7155
7156 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
7157 {
7159 }
7160 }
7161 }
7162 }
7163
7165 {
7166 if (GetInventory().GetCargo())
7167 {
7168 int item_count = GetInventory().GetCargo().GetItemCount();
7169 if (item_count > 0)
7170 {
7171 int random_pick = Math.RandomInt(0, item_count);
7173 if (!item.IsExplosive())
7174 {
7175 item.AddHealth("","",damage);
7176 return true;
7177 }
7178 }
7179 }
7180 return false;
7181 }
7182
7184 {
7185 int attachment_count = GetInventory().AttachmentCount();
7186 if (attachment_count > 0)
7187 {
7188 int random_pick = Math.RandomInt(0, attachment_count);
7189 ItemBase attachment =
ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
7190 if (!attachment.IsExplosive())
7191 {
7192 attachment.AddHealth("","",damage);
7193 return true;
7194 }
7195 }
7196 return false;
7197 }
7198
7200 {
7202 }
7203
7205 {
7207 return GetInventory().CanRemoveEntity();
7208
7209 return false;
7210 }
7211
7213 {
7214
7216 return false;
7217
7218
7220 return false;
7221
7222
7223
7225 if (delta == 0)
7226 return false;
7227
7228
7229 return true;
7230 }
7231
7233 {
7235 {
7236 if (ScriptInputUserData.CanStoreInputUserData())
7237 {
7238 ScriptInputUserData ctx = new ScriptInputUserData;
7243 ctx.
Write(destination_entity);
7247 }
7248 }
7249 else if (!
GetGame().IsMultiplayer())
7250 {
7252 }
7253 }
7254
7256 {
7257 float split_quantity_new;
7261 InventoryLocation loc = new InventoryLocation;
7262
7263 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7264 {
7266 split_quantity_new = stack_max;
7267 else
7269
7271 {
7272 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7273 if (new_item)
7274 {
7275 new_item.SetResultOfSplit(true);
7276 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7278 new_item.
SetQuantity(split_quantity_new,
false,
true);
7279 }
7280 }
7281 }
7282 else if (destination_entity && slot_id == -1)
7283 {
7284 if (quantity > stack_max)
7285 split_quantity_new = stack_max;
7286 else
7287 split_quantity_new = quantity;
7288
7290 {
7292 {
7295 }
7296
7297 if (new_item)
7298 {
7299 new_item.SetResultOfSplit(true);
7300 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7302 new_item.
SetQuantity(split_quantity_new,
false,
true);
7303 }
7304 }
7305 }
7306 else
7307 {
7308 if (stack_max != 0)
7309 {
7311 {
7313 }
7314
7315 if (split_quantity_new == 0)
7316 {
7317 if (!
GetGame().IsMultiplayer())
7318 player.PhysicalPredictiveDropItem(this);
7319 else
7320 player.ServerDropEntity(this);
7321 return;
7322 }
7323
7325 {
7327
7328 if (new_item)
7329 {
7330 new_item.SetResultOfSplit(true);
7331 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7334 new_item.PlaceOnSurface();
7335 }
7336 }
7337 }
7338 }
7339 }
7340
7342 {
7343 float split_quantity_new;
7347 InventoryLocation loc = new InventoryLocation;
7348
7349 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7350 {
7352 split_quantity_new = stack_max;
7353 else
7355
7357 {
7358 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7359 if (new_item)
7360 {
7361 new_item.SetResultOfSplit(true);
7362 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7364 new_item.
SetQuantity(split_quantity_new,
false,
true);
7365 }
7366 }
7367 }
7368 else if (destination_entity && slot_id == -1)
7369 {
7370 if (quantity > stack_max)
7371 split_quantity_new = stack_max;
7372 else
7373 split_quantity_new = quantity;
7374
7376 {
7378 {
7381 }
7382
7383 if (new_item)
7384 {
7385 new_item.SetResultOfSplit(true);
7386 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7388 new_item.
SetQuantity(split_quantity_new,
false,
true);
7389 }
7390 }
7391 }
7392 else
7393 {
7394 if (stack_max != 0)
7395 {
7397 {
7399 }
7400
7402 {
7404
7405 if (new_item)
7406 {
7407 new_item.SetResultOfSplit(true);
7408 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7411 new_item.PlaceOnSurface();
7412 }
7413 }
7414 }
7415 }
7416 }
7417
7419 {
7421 {
7422 if (ScriptInputUserData.CanStoreInputUserData())
7423 {
7424 ScriptInputUserData ctx = new ScriptInputUserData;
7429 dst.WriteToContext(ctx);
7431 }
7432 }
7433 else if (!
GetGame().IsMultiplayer())
7434 {
7436 }
7437 }
7438
7440 {
7442 {
7443 if (ScriptInputUserData.CanStoreInputUserData())
7444 {
7445 ScriptInputUserData ctx = new ScriptInputUserData;
7450 ctx.
Write(destination_entity);
7456 }
7457 }
7458 else if (!
GetGame().IsMultiplayer())
7459 {
7461 }
7462 }
7463
7465 {
7467 }
7468
7470 {
7472 float split_quantity_new;
7474 if (dst.IsValid())
7475 {
7476 int slot_id = dst.GetSlot();
7478
7479 if (quantity > stack_max)
7480 split_quantity_new = stack_max;
7481 else
7482 split_quantity_new = quantity;
7483
7485 {
7487
7488 if (new_item)
7489 {
7490 new_item.SetResultOfSplit(true);
7491 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7493 new_item.
SetQuantity(split_quantity_new,
false,
true);
7494 }
7495
7496 return new_item;
7497 }
7498 }
7499
7500 return null;
7501 }
7502
7504 {
7506 float split_quantity_new;
7508 if (destination_entity)
7509 {
7511 if (quantity > stackable)
7512 split_quantity_new = stackable;
7513 else
7514 split_quantity_new = quantity;
7515
7517 {
7518 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
7519 if (new_item)
7520 {
7521 new_item.SetResultOfSplit(true);
7522 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7524 new_item.
SetQuantity(split_quantity_new,
false,
true);
7525 }
7526 }
7527 }
7528 }
7529
7531 {
7533 {
7534 if (ScriptInputUserData.CanStoreInputUserData())
7535 {
7536 ScriptInputUserData ctx = new ScriptInputUserData;
7541 ItemBase destination_entity =
this;
7542 ctx.
Write(destination_entity);
7546 }
7547 }
7548 else if (!
GetGame().IsMultiplayer())
7549 {
7551 }
7552 }
7553
7555 {
7557 float split_quantity_new;
7559 if (player)
7560 {
7562 if (quantity > stackable)
7563 split_quantity_new = stackable;
7564 else
7565 split_quantity_new = quantity;
7566
7568 {
7569 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
7570 new_item =
ItemBase.Cast(in_hands);
7571 if (new_item)
7572 {
7573 new_item.SetResultOfSplit(true);
7574 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7576 new_item.SetQuantity(split_quantity_new, false, true);
7577 }
7578 }
7579 }
7580 }
7581
7583 {
7585 float split_quantity_new = Math.Floor(quantity * 0.5);
7586
7588 return;
7589
7591
7592 if (new_item)
7593 {
7594 if (new_item.GetQuantityMax() < split_quantity_new)
7595 {
7596 split_quantity_new = new_item.GetQuantityMax();
7597 }
7598
7599 new_item.SetResultOfSplit(true);
7600 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7601
7603 {
7606 }
7607 else
7608 {
7610 new_item.
SetQuantity(split_quantity_new,
false,
true);
7611 }
7612 }
7613 }
7614
7616 {
7618 float split_quantity_new = Math.Floor(quantity / 2);
7619
7621 return;
7622
7623 InventoryLocation invloc = new InventoryLocation;
7625
7627 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
7628
7629 if (new_item)
7630 {
7631 if (new_item.GetQuantityMax() < split_quantity_new)
7632 {
7633 split_quantity_new = new_item.GetQuantityMax();
7634 }
7636 {
7639 }
7640 else if (split_quantity_new > 1)
7641 {
7643 new_item.
SetQuantity(split_quantity_new,
false,
true);
7644 }
7645 }
7646 }
7647
7650 {
7651 SetWeightDirty();
7653
7654 if (parent)
7655 parent.OnAttachmentQuantityChangedEx(this, delta);
7656
7658 {
7660 {
7662 }
7664 {
7665 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
7667 }
7668 }
7669
7670 }
7671
7674 {
7675
7676 }
7677
7680 {
7682 }
7683
7685 {
7686 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
7687
7689 {
7690 if (newLevel == GameConstants.STATE_RUINED)
7691 {
7693 EntityAI parent = GetHierarchyParent();
7694 if (parent && parent.IsFireplace())
7695 {
7696 CargoBase cargo = GetInventory().GetCargo();
7697 if (cargo)
7698 {
7700 {
7702 }
7703 }
7704 }
7705 }
7706
7708 {
7709
7711 return;
7712 }
7713
7714 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
7715 {
7717 }
7718 }
7719 }
7720
7721
7723 {
7724 super.OnRightClick();
7725
7727 {
7729 {
7730 if (ScriptInputUserData.CanStoreInputUserData())
7731 {
7732 EntityAI root = GetHierarchyRoot();
7733 Man playerOwner = GetHierarchyRootPlayer();
7734 InventoryLocation dst = new InventoryLocation;
7735
7736
7737 if (!playerOwner && root && root == this)
7738 {
7740 }
7741 else
7742 {
7743
7744 GetInventory().GetCurrentInventoryLocation(dst);
7746 {
7749 {
7751 }
7752 else
7753 {
7755
7756
7757 if (
GetGame().
GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
7758 {
7760 }
7761 else
7762 {
7763 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
7764 }
7765 }
7766 }
7767 }
7768
7769 ScriptInputUserData ctx = new ScriptInputUserData;
7777 }
7778 }
7779 else if (!
GetGame().IsMultiplayer())
7780 {
7782 }
7783 }
7784 }
7785
7787 {
7788 if (root)
7789 {
7790 vector m4[4];
7791 root.GetTransform(m4);
7792 dst.SetGround(this, m4);
7793 }
7794 else
7795 {
7796 GetInventory().GetCurrentInventoryLocation(dst);
7797 }
7798 }
7799
7800 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
7801 {
7802
7803 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
7804 return false;
7805
7806 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
7807 return false;
7808
7809
7811 return false;
7812
7813
7814 Magazine mag = Magazine.Cast(this);
7815 if (mag)
7816 {
7817 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
7818 return false;
7819
7820 if (stack_max_limit)
7821 {
7822 Magazine other_mag = Magazine.Cast(other_item);
7823 if (other_item)
7824 {
7825 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
7826 return false;
7827 }
7828
7829 }
7830 }
7831 else
7832 {
7833
7835 return false;
7836
7838 return false;
7839 }
7840
7841 PlayerBase player = null;
7842 if (CastTo(player, GetHierarchyRootPlayer()))
7843 {
7844 if (player.GetInventory().HasAttachment(this))
7845 return false;
7846
7847 if (player.IsItemsToDelete())
7848 return false;
7849 }
7850
7851 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
7852 return false;
7853
7854 int slotID;
7856 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
7857 return false;
7858
7859 return true;
7860 }
7861
7863 {
7865 }
7866
7868 {
7869 return m_IsResultOfSplit;
7870 }
7871
7873 {
7874 m_IsResultOfSplit = value;
7875 }
7876
7878 {
7880 }
7881
7883 {
7884 float other_item_quantity = other_item.GetQuantity();
7885 float this_free_space;
7886
7888
7890
7891 if (other_item_quantity > this_free_space)
7892 {
7893 return this_free_space;
7894 }
7895 else
7896 {
7897 return other_item_quantity;
7898 }
7899 }
7900
7902 {
7904 }
7905
7907 {
7909 return;
7910
7911 if (!IsMagazine() && other_item)
7912 {
7914 if (quantity_used != 0)
7915 {
7916 float hp1 = GetHealth01("","");
7917 float hp2 = other_item.GetHealth01("","");
7918 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
7919 hpResult = hpResult / (
GetQuantity() + quantity_used);
7920
7921 hpResult *= GetMaxHealth();
7922 Math.Round(hpResult);
7923 SetHealth("", "Health", hpResult);
7924
7926 other_item.AddQuantity(-quantity_used);
7927 }
7928 }
7930 }
7931
7933 {
7934 #ifdef SERVER
7935 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
7936 GetHierarchyParent().IncreaseLifetimeUp();
7937 #endif
7938 };
7939
7941 {
7942 PlayerBase p = PlayerBase.Cast(player);
7943
7944 array<int> recipesIds = p.m_Recipes;
7945 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
7946 if (moduleRecipesManager)
7947 {
7948 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
7949 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
7950 }
7951
7952 for (int i = 0;i < recipesIds.Count(); i++)
7953 {
7954 int key = recipesIds.Get(i);
7955 string recipeName = moduleRecipesManager.GetRecipeName(key);
7957 }
7958 }
7959
7960
7961 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
7962 {
7963 super.GetDebugActions(outputList);
7964
7965
7971
7972
7977
7982
7983
7987
7988
7990 {
7994 }
7995
7998
7999
8003
8005
8006 InventoryLocation loc = new InventoryLocation();
8007 GetInventory().GetCurrentInventoryLocation(loc);
8009 {
8010 if (Gizmo_IsSupported())
8013 }
8014
8016 }
8017
8018
8019
8020
8022 {
8023 super.OnAction(action_id, player, ctx);
8024
8026 {
8027 switch (action_id)
8028 {
8031 return true;
8034 return true;
8035 }
8036 }
8037
8039 {
8040 switch (action_id)
8041 {
8043 Delete();
8044 return true;
8045 }
8046 }
8047
8048 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
8049 {
8050 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8051 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
8052 PlayerBase p = PlayerBase.Cast(player);
8053 if (
EActions.RECIPES_RANGE_START < 1000)
8054 {
8055 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
8056 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
8057 }
8058 }
8059 #ifndef SERVER
8060 else if (action_id ==
EActions.WATCH_PLAYER)
8061 {
8062 PluginDeveloper.SetDeveloperItemClientEx(player);
8063 }
8064 #endif
8066 {
8067 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
8068 {
8069 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
8070 OnDebugButtonPressServer(id + 1);
8071 }
8072
8073 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
8074 {
8075 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
8077 }
8078
8079 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
8080 {
8081 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
8083 }
8084
8085 else if (action_id ==
EActions.ADD_QUANTITY)
8086 {
8087 if (IsMagazine())
8088 {
8089 Magazine mag = Magazine.Cast(this);
8090 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
8091 }
8092 else
8093 {
8095 }
8096
8097 if (m_EM)
8098 {
8099 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
8100 }
8101
8102 }
8103
8104 else if (action_id ==
EActions.REMOVE_QUANTITY)
8105 {
8106 if (IsMagazine())
8107 {
8108 Magazine mag2 = Magazine.Cast(this);
8109 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
8110 }
8111 else
8112 {
8114 }
8115 if (m_EM)
8116 {
8117 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
8118 }
8119
8120 }
8121
8122 else if (action_id ==
EActions.SET_QUANTITY_0)
8123 {
8125
8126 if (m_EM)
8127 {
8128 m_EM.SetEnergy(0);
8129 }
8130 }
8131
8132 else if (action_id ==
EActions.SET_MAX_QUANTITY)
8133 {
8135
8136 if (m_EM)
8137 {
8138 m_EM.SetEnergy(m_EM.GetEnergyMax());
8139 }
8140 }
8141
8142 else if (action_id ==
EActions.ADD_HEALTH)
8143 {
8144 AddHealth("","",GetMaxHealth("","Health")/5);
8145 }
8146 else if (action_id ==
EActions.REMOVE_HEALTH)
8147 {
8148 AddHealth("","",-GetMaxHealth("","Health")/5);
8149 }
8150 else if (action_id ==
EActions.DESTROY_HEALTH)
8151 {
8152 SetHealth01("","",0);
8153 }
8154 else if (action_id ==
EActions.WATCH_ITEM)
8155 {
8157 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
8158 #ifdef DEVELOPER
8159 SetDebugDeveloper_item(this);
8160 #endif
8161 }
8162
8163 else if (action_id ==
EActions.ADD_TEMPERATURE)
8164 {
8165 AddTemperature(20);
8166
8167 }
8168
8169 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
8170 {
8171 AddTemperature(-20);
8172
8173 }
8174
8175 else if (action_id ==
EActions.FLIP_FROZEN)
8176 {
8177 SetFrozen(!GetIsFrozen());
8178
8179 }
8180
8181 else if (action_id ==
EActions.ADD_WETNESS)
8182 {
8184
8185 }
8186
8187 else if (action_id ==
EActions.REMOVE_WETNESS)
8188 {
8190
8191 }
8192
8193 else if (action_id ==
EActions.LIQUIDTYPE_UP)
8194 {
8197
8198
8199 }
8200
8201 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
8202 {
8205 }
8206
8207 else if (action_id ==
EActions.MAKE_SPECIAL)
8208 {
8209 auto debugParams = DebugSpawnParams.WithPlayer(player);
8210 OnDebugSpawnEx(debugParams);
8211 }
8212
8213 }
8214
8215
8216 return false;
8217 }
8218
8219
8220
8221
8225
8228
8229
8230
8232 {
8233 return false;
8234 }
8235
8236
8238 {
8239 return true;
8240 }
8241
8242
8244 {
8245 return true;
8246 }
8247
8248
8249
8251 {
8252 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
8254 }
8255
8258 {
8259 return null;
8260 }
8261
8263 {
8264 return false;
8265 }
8266
8268 {
8269 return false;
8270 }
8271
8275
8276
8278 {
8279 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8280 return module_repairing.CanRepair(this, item_repair_kit);
8281 }
8282
8283
8284 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
8285 {
8286 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8287 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
8288 }
8289
8290
8292 {
8293
8294
8295
8296
8297
8298
8299
8300
8301 return 1;
8302 }
8303
8304
8305
8307 {
8309 }
8310
8311
8312
8314 {
8316 }
8317
8318
8327 {
8328 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8329
8330 if (player)
8331 {
8332 player.MessageStatus(text);
8333 }
8334 }
8335
8336
8345 {
8346 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8347
8348 if (player)
8349 {
8350 player.MessageAction(text);
8351 }
8352 }
8353
8354
8363 {
8364 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8365
8366 if (player)
8367 {
8368 player.MessageFriendly(text);
8369 }
8370 }
8371
8372
8381 {
8382 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8383
8384 if (player)
8385 {
8386 player.MessageImportant(text);
8387 }
8388 }
8389
8391 {
8392 return true;
8393 }
8394
8395
8396 override bool KindOf(
string tag)
8397 {
8398 bool found = false;
8399 string item_name = this.
GetType();
8402
8403 int array_size = item_tag_array.Count();
8404 for (int i = 0; i < array_size; i++)
8405 {
8406 if (item_tag_array.Get(i) == tag)
8407 {
8408 found = true;
8409 break;
8410 }
8411 }
8412 return found;
8413 }
8414
8415
8417 {
8418
8419 super.OnRPC(sender, rpc_type,ctx);
8420
8421
8422 switch (rpc_type)
8423 {
8424 #ifndef SERVER
8425 case ERPCs.RPC_SOUND_LOCK_ATTACH:
8426 Param2<bool, string> p = new Param2<bool, string>(false, "");
8427
8429 return;
8430
8431 bool play = p.param1;
8432 string soundSet = p.param2;
8433
8434 if (play)
8435 {
8437 {
8439 {
8441 }
8442 }
8443 else
8444 {
8446 }
8447 }
8448 else
8449 {
8451 }
8452
8453 break;
8454 #endif
8455
8456 }
8457
8459 {
8461 }
8462 }
8463
8464
8465
8466
8468 {
8469 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8470 return plugin.GetID(
name);
8471 }
8472
8474 {
8475 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8476 return plugin.GetName(id);
8477 }
8478
8481 {
8482
8483
8484 int varFlags;
8485 if (!ctx.
Read(varFlags))
8486 return;
8487
8488 if (varFlags & ItemVariableFlags.FLOAT)
8489 {
8491 }
8492 }
8493
8495 {
8496
8497 super.SerializeNumericalVars(floats_out);
8498
8499
8500
8502 {
8504 }
8505
8507 {
8509 }
8510
8512 {
8514 }
8515
8517 {
8522 }
8523
8525 {
8527 }
8528 }
8529
8531 {
8532
8533 super.DeSerializeNumericalVars(floats);
8534
8535
8536 int index = 0;
8537 int mask = Math.Round(floats.Get(index));
8538
8539 index++;
8540
8542 {
8544 {
8546 }
8547 else
8548 {
8549 float quantity = floats.Get(index);
8551 }
8552 index++;
8553 }
8554
8556 {
8557 float wet = floats.Get(index);
8559 index++;
8560 }
8561
8563 {
8564 int liquidtype = Math.Round(floats.Get(index));
8566 index++;
8567 }
8568
8570 {
8572 index++;
8574 index++;
8576 index++;
8578 index++;
8579 }
8580
8582 {
8583 int cleanness = Math.Round(floats.Get(index));
8585 index++;
8586 }
8587 }
8588
8590 {
8591 super.WriteVarsToCTX(ctx);
8592
8593
8595 {
8597 }
8598
8600 {
8602 }
8603
8605 {
8607 }
8608
8610 {
8611 int r,g,b,a;
8617 }
8618
8620 {
8622 }
8623 }
8624
8626 {
8627 if (!super.ReadVarsFromCTX(ctx,version))
8628 return false;
8629
8630 int intValue;
8631 float value;
8632
8633 if (version < 140)
8634 {
8635 if (!ctx.
Read(intValue))
8636 return false;
8637
8638 m_VariablesMask = intValue;
8639 }
8640
8642 {
8643 if (!ctx.
Read(value))
8644 return false;
8645
8647 {
8649 }
8650 else
8651 {
8653 }
8654 }
8655
8656 if (version < 140)
8657 {
8659 {
8660 if (!ctx.
Read(value))
8661 return false;
8662 SetTemperatureDirect(value);
8663 }
8664 }
8665
8667 {
8668 if (!ctx.
Read(value))
8669 return false;
8671 }
8672
8674 {
8675 if (!ctx.
Read(intValue))
8676 return false;
8678 }
8679
8681 {
8682 int r,g,b,a;
8684 return false;
8686 return false;
8688 return false;
8690 return false;
8691
8693 }
8694
8696 {
8697 if (!ctx.
Read(intValue))
8698 return false;
8700 }
8701
8702 if (version >= 138 && version < 140)
8703 {
8705 {
8706 if (!ctx.
Read(intValue))
8707 return false;
8708 SetFrozen(intValue);
8709 }
8710 }
8711
8712 return true;
8713 }
8714
8715
8717 {
8720 {
8722 }
8723
8724 if (!super.OnStoreLoad(ctx, version))
8725 {
8727 return false;
8728 }
8729
8730 if (version >= 114)
8731 {
8732 bool hasQuickBarIndexSaved;
8733
8734 if (!ctx.
Read(hasQuickBarIndexSaved))
8735 {
8737 return false;
8738 }
8739
8740 if (hasQuickBarIndexSaved)
8741 {
8742 int itmQBIndex;
8743
8744
8745 if (!ctx.
Read(itmQBIndex))
8746 {
8748 return false;
8749 }
8750
8751 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
8752 if (itmQBIndex != -1 && parentPlayer)
8753 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
8754 }
8755 }
8756 else
8757 {
8758
8759 PlayerBase player;
8760 int itemQBIndex;
8761 if (version ==
int.
MAX)
8762 {
8763 if (!ctx.
Read(itemQBIndex))
8764 {
8766 return false;
8767 }
8768 }
8769 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
8770 {
8771
8772 if (!ctx.
Read(itemQBIndex))
8773 {
8775 return false;
8776 }
8777 if (itemQBIndex != -1 && player)
8778 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
8779 }
8780 }
8781
8782 if (version < 140)
8783 {
8784
8785 if (!LoadVariables(ctx, version))
8786 {
8788 return false;
8789 }
8790 }
8791
8792
8794 {
8796 return false;
8797 }
8798 if (version >= 132)
8799 {
8801 if (raib)
8802 {
8804 {
8806 return false;
8807 }
8808 }
8809 }
8810
8812 return true;
8813 }
8814
8815
8816
8818 {
8819 super.OnStoreSave(ctx);
8820
8821 PlayerBase player;
8822 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
8823 {
8825
8826 int itemQBIndex = -1;
8827 itemQBIndex = player.FindQuickBarEntityIndex(this);
8828 ctx.
Write(itemQBIndex);
8829 }
8830 else
8831 {
8833 }
8834
8836
8838 if (raib)
8839 {
8841 }
8842 }
8843
8844
8846 {
8847 super.AfterStoreLoad();
8848
8850 {
8852 }
8853
8855 {
8858 }
8859 }
8860
8862 {
8863 super.EEOnAfterLoad();
8864
8866 {
8868 }
8869
8872 }
8873
8875 {
8876 return false;
8877 }
8878
8879
8880
8882 {
8884 {
8885 #ifdef PLATFORM_CONSOLE
8886
8888 {
8890 if (menu)
8891 {
8893 }
8894 }
8895 #endif
8896 }
8897
8899 {
8902 }
8903
8905 {
8906 SetWeightDirty();
8908 }
8910 {
8913 }
8914
8916 {
8919 }
8921 {
8924 }
8925
8926 super.OnVariablesSynchronized();
8927 }
8928
8929
8930
8932 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
8933 {
8934 if (!IsServerCheck(allow_client))
8935 return false;
8936
8938 return false;
8939
8942
8943 if (value <= (min + 0.001))
8944 value = min;
8945
8946 if (value == min)
8947 {
8948 if (destroy_config)
8949 {
8950 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
8951 if (dstr)
8952 {
8954 this.Delete();
8955 return true;
8956 }
8957 }
8958 else if (destroy_forced)
8959 {
8961 this.Delete();
8962 return true;
8963 }
8964
8966 }
8967
8970
8972 {
8974
8975 if (delta)
8977 }
8978
8980
8981 return false;
8982 }
8983
8984
8986 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
8987 {
8989 }
8990
8992 {
8995 }
8996
8998 {
9001 }
9002
9004 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9005 {
9006 float value_clamped = Math.Clamp(value, 0, 1);
9008 SetQuantity(result, destroy_config, destroy_forced);
9009 }
9010
9011
9014 {
9016 }
9017
9019 {
9021 }
9022
9023
9024
9025
9026
9027
9028
9029
9030
9031
9033 {
9034 int slot = -1;
9035 if (GetInventory())
9036 {
9037 InventoryLocation il = new InventoryLocation;
9038 GetInventory().GetCurrentInventoryLocation(il);
9040 }
9041
9043 }
9044
9046 {
9047 float quantity_max = 0;
9048
9050 {
9051 if (attSlotID != -1)
9052 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
9053
9054 if (quantity_max <= 0)
9056 }
9057
9058 if (quantity_max <= 0)
9060
9061 return quantity_max;
9062 }
9063
9065 {
9067 }
9068
9070 {
9072 }
9073
9074
9076 {
9078 }
9079
9081 {
9083 }
9084
9086 {
9088 }
9089
9090
9092 {
9093
9094 float weightEx = GetWeightEx();
9095 float special = GetInventoryAndCargoWeight();
9096 return weightEx - special;
9097 }
9098
9099
9101 {
9103 }
9104
9106 {
9108 {
9109 #ifdef DEVELOPER
9110 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9111 {
9112 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
9114 }
9115 #endif
9116
9118 }
9119 else if (HasEnergyManager())
9120 {
9121 #ifdef DEVELOPER
9122 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9123 {
9124 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
9125 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
9126 }
9127 #endif
9128 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
9129 }
9130 else
9131 {
9132 #ifdef DEVELOPER
9133 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9134 {
9135 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
9136 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
9137 }
9138 #endif
9139 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
9140 }
9141 }
9142
9145 {
9146 int item_count = 0;
9148
9149 if (GetInventory().GetCargo() != NULL)
9150 {
9151 item_count = GetInventory().GetCargo().GetItemCount();
9152 }
9153
9154 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
9155 {
9156 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
9157 if (item)
9158 item_count += item.GetNumberOfItems();
9159 }
9160 return item_count;
9161 }
9162
9165 {
9166 float weight = 0;
9167 float wetness = 1;
9168 if (include_wetness)
9171 {
9172 weight = wetness * m_ConfigWeight;
9173 }
9175 {
9176 weight = 1;
9177 }
9178 return weight;
9179 }
9180
9181
9182
9184 {
9185 if ((
GetGame().IsServer() || !
GetGame().IsMultiplayer()) && GetInventory())
9186 {
9187 GameInventory inv = GetInventory();
9188 array<EntityAI> items = new array<EntityAI>;
9190 for (int i = 0; i < items.Count(); i++)
9191 {
9193 if (item)
9194 {
9196 }
9197 }
9198 }
9199 }
9200
9201
9202
9203
9205 {
9206 float energy = 0;
9207 if (HasEnergyManager())
9208 {
9209 energy = GetCompEM().GetEnergy();
9210 }
9211 return energy;
9212 }
9213
9214
9216 {
9217 super.OnEnergyConsumed();
9218
9220 }
9221
9223 {
9224 super.OnEnergyAdded();
9225
9227 }
9228
9229
9231 {
9232 if (
GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
9233 {
9235 {
9236 float energy_0to1 = GetCompEM().GetEnergy0To1();
9238 }
9239 }
9240 }
9241
9242
9244 {
9245 return ConfigGetFloat("heatIsolation");
9246 }
9247
9249 {
9251 }
9252
9254 {
9255 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
9256 if (
GetGame().ConfigIsExisting(paramPath))
9258
9259 return 0.0;
9260 }
9261
9263 {
9264 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
9265 if (
GetGame().ConfigIsExisting(paramPath))
9267
9268 return 0.0;
9269 }
9270
9271 override void SetWet(
float value,
bool allow_client =
false)
9272 {
9273 if (!IsServerCheck(allow_client))
9274 return;
9275
9278
9280
9281 m_VarWet = Math.Clamp(value, min, max);
9282
9284 {
9287 }
9288 }
9289
9290 override void AddWet(
float value)
9291 {
9293 }
9294
9296 {
9298 }
9299
9301 {
9303 }
9304
9306 {
9308 }
9309
9311 {
9313 }
9314
9316 {
9318 }
9319
9321 {
9324 if (newLevel != oldLevel)
9325 {
9327 }
9328 }
9329
9331 {
9332 SetWeightDirty();
9333 }
9334
9336 {
9337 return GetWetLevelInternal(
m_VarWet);
9338 }
9339
9340
9341
9343 {
9345 }
9346
9348 {
9350 }
9351
9353 {
9355 }
9356
9358 {
9360 }
9361
9362
9363
9365 {
9366 if (ConfigIsExisting("itemModelLength"))
9367 {
9368 return ConfigGetFloat("itemModelLength");
9369 }
9370 return 0;
9371 }
9372
9374 {
9375 if (ConfigIsExisting("itemAttachOffset"))
9376 {
9377 return ConfigGetFloat("itemAttachOffset");
9378 }
9379 return 0;
9380 }
9381
9382 override void SetCleanness(
int value,
bool allow_client =
false)
9383 {
9384 if (!IsServerCheck(allow_client))
9385 return;
9386
9388
9390
9393 }
9394
9396 {
9398 }
9399
9401 {
9402 return true;
9403 }
9404
9405
9406
9407
9409 {
9411 }
9412
9414 {
9416 }
9417
9418
9419
9420
9421 override void SetColor(
int r,
int g,
int b,
int a)
9422 {
9428 }
9430 override void GetColor(out
int r,out
int g,out
int b,out
int a)
9431 {
9436 }
9437
9439 {
9441 }
9442
9445 {
9446 int r,g,b,a;
9448 r = r/255;
9449 g = g/255;
9450 b = b/255;
9451 a = a/255;
9452 return MiscGameplayFunctions.GetColorString(r, g, b, a);
9453 }
9454
9455
9456
9457 override void SetLiquidType(
int value,
bool allow_client =
false)
9458 {
9459 if (!IsServerCheck(allow_client))
9460 return;
9461
9466 }
9467
9469 {
9470 return ConfigGetInt("varLiquidTypeInit");
9471 }
9472
9474 {
9476 }
9477
9479 {
9481 SetFrozen(false);
9482 }
9483
9486 {
9487 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9488 }
9489
9490
9493 {
9494 PlayerBase nplayer;
9495 if (PlayerBase.CastTo(nplayer, player))
9496 {
9498
9499 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9500 }
9501 }
9502
9503
9506 {
9507 PlayerBase nplayer;
9508 if (PlayerBase.CastTo(nplayer,player))
9509 {
9510
9511 nplayer.SetEnableQuickBarEntityShortcut(this,false);
9512
9513 }
9514
9515
9516 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
9517
9518
9519 if (HasEnergyManager())
9520 {
9521 GetCompEM().UpdatePlugState();
9522 }
9523 }
9524
9525
9527 {
9528 super.OnPlacementStarted(player);
9529
9531 }
9532
9533 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
9534 {
9536 {
9537 m_AdminLog.OnPlacementComplete(player,
this);
9538 }
9539
9540 super.OnPlacementComplete(player, position, orientation);
9541 }
9542
9543
9544
9545
9546
9548 {
9550 {
9551 return true;
9552 }
9553 else
9554 {
9555 return false;
9556 }
9557 }
9558
9559
9561 {
9563 {
9565 }
9566 }
9567
9568
9570 {
9572 }
9573
9575 {
9577 }
9578
9579 override void InsertAgent(
int agent,
float count = 1)
9580 {
9581 if (count < 1)
9582 return;
9583
9585 }
9586
9589 {
9591 }
9592
9593
9595 {
9597 }
9598
9599
9600
9601
9602
9603
9604
9605
9606
9607
9608
9609
9610
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
9641 {
9643 return false;
9644 return true;
9645 }
9646
9648 {
9649
9651 }
9652
9653
9656 {
9657 super.CheckForRoofLimited(timeTresholdMS);
9658
9660 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
9661 {
9662 m_PreviousRoofTestTime = time;
9663 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
9664 }
9665 }
9666
9667
9669 {
9671 {
9672 return 0;
9673 }
9674
9675 if (GetInventory().GetAttachmentSlotsCount() != 0)
9676 {
9677 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
9678 if (filter)
9679 return filter.GetProtectionLevel(type, false, system);
9680 else
9681 return 0;
9682 }
9683
9684 string subclassPath, entryName;
9685
9686 switch (type)
9687 {
9689 entryName = "biological";
9690 break;
9692 entryName = "chemical";
9693 break;
9694 default:
9695 entryName = "biological";
9696 break;
9697 }
9698
9699 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
9700
9702 }
9703
9704
9705
9708 {
9709 if (!IsMagazine())
9711
9713 }
9714
9715
9716
9717
9718
9723 {
9724 return true;
9725 }
9726
9728 {
9730 }
9731
9732
9733
9734
9735
9737 {
9738 if (parent)
9739 {
9740 if (parent.IsInherited(DayZInfected))
9741 return true;
9742
9743 if (!parent.IsRuined())
9744 return true;
9745 }
9746
9747 return true;
9748 }
9749
9751 {
9752 if (!super.CanPutAsAttachment(parent))
9753 {
9754 return false;
9755 }
9756
9757 if (!IsRuined() && !parent.IsRuined())
9758 {
9759 return true;
9760 }
9761
9762 return false;
9763 }
9764
9766 {
9767
9768
9769
9770
9771 return super.CanReceiveItemIntoCargo(item);
9772 }
9773
9775 {
9776
9777
9778
9779
9780 GameInventory attachmentInv = attachment.GetInventory();
9782 {
9783 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
9784 return false;
9785 }
9786
9787 InventoryLocation loc = new InventoryLocation();
9788 attachment.GetInventory().GetCurrentInventoryLocation(loc);
9789 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
9790 return false;
9791
9792 return super.CanReceiveAttachment(attachment, slotId);
9793 }
9794
9796 {
9797 if (!super.CanReleaseAttachment(attachment))
9798 return false;
9799
9800 return GetInventory().AreChildrenAccessible();
9801 }
9802
9803
9804
9805
9806
9807
9808
9809
9810
9811
9812
9813
9814
9815
9816
9817
9818
9819
9820
9821
9822
9824 {
9825 int id = muzzle_owner.GetMuzzleID();
9826 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
9827
9828 if (WPOF_array)
9829 {
9830 for (int i = 0; i < WPOF_array.Count(); i++)
9831 {
9832 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
9833
9834 if (WPOF)
9835 {
9836 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
9837 }
9838 }
9839 }
9840 }
9841
9842
9844 {
9845 int id = muzzle_owner.GetMuzzleID();
9847
9848 if (WPOBE_array)
9849 {
9850 for (int i = 0; i < WPOBE_array.Count(); i++)
9851 {
9852 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
9853
9854 if (WPOBE)
9855 {
9856 WPOBE.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.OnActivate(weapon, 0, 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.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9897 }
9898 }
9899 }
9900 }
9901
9902
9904 {
9905 int id = muzzle_owner.GetMuzzleID();
9906 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9907
9908 if (WPOOH_array)
9909 {
9910 for (int i = 0; i < WPOOH_array.Count(); i++)
9911 {
9912 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9913
9914 if (WPOOH)
9915 {
9916 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9917 }
9918 }
9919 }
9920 }
9921
9922
9923
9925 {
9927 {
9928 return true;
9929 }
9930
9931 return false;
9932 }
9933
9935 {
9937 {
9938 return true;
9939 }
9940
9941 return false;
9942 }
9943
9945 {
9947 {
9948 return true;
9949 }
9950
9951 return false;
9952 }
9953
9955 {
9956 return false;
9957 }
9958
9961 {
9962 return UATimeSpent.DEFAULT_DEPLOY;
9963 }
9964
9965
9966
9967
9969 {
9971 SetSynchDirty();
9972 }
9973
9975 {
9977 }
9978
9979
9981 {
9982 return false;
9983 }
9984
9987 {
9988 string att_type = "None";
9989
9990 if (ConfigIsExisting("soundAttType"))
9991 {
9992 att_type = ConfigGetString("soundAttType");
9993 }
9994
9996 }
9997
9999 {
10001 }
10002
10003
10004
10005
10006
10012
10014 {
10017
10019 }
10020
10021
10023 {
10025 return;
10026
10028
10031
10034
10035 SoundParameters params = new SoundParameters();
10039 }
10040
10041
10043 {
10045 return;
10046
10048 SetSynchDirty();
10049
10052 }
10053
10054
10056 {
10058 return;
10059
10061 SetSynchDirty();
10062
10065 }
10066
10068 {
10070 }
10071
10073 {
10075 }
10076
10079 {
10080 if (!
GetGame().IsDedicatedServer())
10081 {
10082 if (ConfigIsExisting("attachSoundSet"))
10083 {
10084 string cfg_path = "";
10085 string soundset = "";
10086 string type_name =
GetType();
10087
10090 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
10091 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
10092
10093 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
10094 {
10095 for (int i = 0; i < cfg_soundset_array.Count(); i++)
10096 {
10097 if (cfg_slot_array[i] == slot_type)
10098 {
10099 soundset = cfg_soundset_array[i];
10100 break;
10101 }
10102 }
10103 }
10104
10105 if (soundset != "")
10106 {
10107 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
10109 }
10110 }
10111 }
10112 }
10113
10115 {
10116
10117 }
10118
10119 void OnApply(PlayerBase player);
10120
10122 {
10123 return 1.0;
10124 };
10125
10127 {
10129 }
10130
10132 {
10134 }
10135
10137
10139 {
10140 SetDynamicPhysicsLifeTime(0.01);
10142 }
10143
10145 {
10146 array<string> zone_names = new array<string>;
10147 GetDamageZones(zone_names);
10148 for (int i = 0; i < zone_names.Count(); i++)
10149 {
10150 SetHealthMax(zone_names.Get(i),"Health");
10151 }
10152 SetHealthMax("","Health");
10153 }
10154
10157 {
10158 float global_health = GetHealth01("","Health");
10159 array<string> zones = new array<string>;
10160 GetDamageZones(zones);
10161
10162 for (int i = 0; i < zones.Count(); i++)
10163 {
10164 SetHealth01(zones.Get(i),"Health",global_health);
10165 }
10166 }
10167
10170 {
10171 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
10172 }
10173
10175 {
10176 if (!hasRootAsPlayer)
10177 {
10178 if (refParentIB)
10179 {
10180
10181 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
10182 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
10183
10184 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
10185 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
10186
10189 }
10190 else
10191 {
10192
10195 }
10196 }
10197 }
10198
10200 {
10202 {
10203 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
10204 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
10205 {
10206 float heatPermCoef = 1.0;
10208 while (ent)
10209 {
10210 heatPermCoef *= ent.GetHeatPermeabilityCoef();
10211 ent = ent.GetHierarchyParent();
10212 }
10213
10214 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
10215 }
10216 }
10217 }
10218
10220 {
10221
10222 EntityAI parent = GetHierarchyParent();
10223 if (!parent)
10224 {
10225 hasParent = false;
10226 hasRootAsPlayer = false;
10227 }
10228 else
10229 {
10230 hasParent = true;
10231 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
10232 refParentIB =
ItemBase.Cast(parent);
10233 }
10234 }
10235
10236 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
10237 {
10238
10239 }
10240
10242 {
10243
10244 return false;
10245 }
10246
10248 {
10249
10250
10251 return false;
10252 }
10253
10255 {
10256
10257 return false;
10258 }
10259
10262 {
10263 return !GetIsFrozen() &&
IsOpen();
10264 }
10265
10267 {
10268 bool hasParent = false, hasRootAsPlayer = false;
10270
10271 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
10272 bool foodDecay =
g_Game.IsFoodDecayEnabled();
10273
10274 if (wwtu || foodDecay)
10275 {
10279
10280 if (processWetness || processTemperature || processDecay)
10281 {
10283
10284 if (processWetness)
10285 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
10286
10287 if (processTemperature)
10289
10290 if (processDecay)
10291 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
10292 }
10293 }
10294 }
10295
10298 {
10300 }
10301
10303 {
10306
10307 return super.GetTemperatureFreezeThreshold();
10308 }
10309
10311 {
10314
10315 return super.GetTemperatureThawThreshold();
10316 }
10317
10319 {
10322
10323 return super.GetItemOverheatThreshold();
10324 }
10325
10327 {
10329 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
10330
10331 return super.GetTemperatureFreezeTime();
10332 }
10333
10335 {
10337 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
10338
10339 return super.GetTemperatureThawTime();
10340 }
10341
10346
10348 {
10349 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
10350 }
10351
10353 {
10354 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
10355 }
10356
10359 {
10361 }
10362
10364 {
10366 }
10367
10369 {
10371 }
10372
10375 {
10376 return null;
10377 }
10378
10381 {
10382 return false;
10383 }
10384
10386 {
10388 {
10391 if (!trg)
10392 {
10394 explosive = this;
10395 }
10396
10397 explosive.PairRemote(trg);
10399
10400 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
10401 trg.SetPersistentPairID(persistentID);
10402 explosive.SetPersistentPairID(persistentID);
10403
10404 return true;
10405 }
10406 return false;
10407 }
10408
10411 {
10412 float ret = 1.0;
10415 ret *= GetHealth01();
10416
10417 return ret;
10418 }
10419
10420 #ifdef DEVELOPER
10421 override void SetDebugItem()
10422 {
10423 super.SetDebugItem();
10424 _itemBase = this;
10425 }
10426
10428 {
10429 string text = super.GetDebugText();
10430
10432 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
10433
10434 return text;
10435 }
10436 #endif
10437
10439 {
10440 return true;
10441 }
10442
10444
10446
10448 {
10451 }
10452
10453
10461
10477}
10478
10480{
10482 if (entity)
10483 {
10484 bool is_item = entity.IsInherited(
ItemBase);
10485 if (is_item && full_quantity)
10486 {
10489 }
10490 }
10491 else
10492 {
10494 return NULL;
10495 }
10496 return entity;
10497}
10498
10500{
10501 if (item)
10502 {
10503 if (health > 0)
10504 item.SetHealth("", "", health);
10505
10506 if (item.CanHaveTemperature())
10507 {
10509 if (item.CanFreeze())
10510 item.SetFrozen(false);
10511 }
10512
10513 if (item.HasEnergyManager())
10514 {
10515 if (quantity >= 0)
10516 {
10517 item.GetCompEM().SetEnergy0To1(quantity);
10518 }
10519 else
10520 {
10522 }
10523 }
10524 else if (item.IsMagazine())
10525 {
10526 Magazine mag = Magazine.Cast(item);
10527 if (quantity >= 0)
10528 {
10529 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
10530 }
10531 else
10532 {
10534 }
10535
10536 }
10537 else
10538 {
10539 if (quantity >= 0)
10540 {
10541 item.SetQuantityNormalized(quantity, false);
10542 }
10543 else
10544 {
10546 }
10547
10548 }
10549 }
10550}
10551
10552#ifdef DEVELOPER
10554#endif
Param4< int, int, string, int > TSelectableActionInfoWithColor
Param3 TSelectableActionInfo
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 CanHaveTemperature()
class GP5GasMask extends MaskBase ItemBase
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
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)
void StartItemSoundServer(int id)
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()
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)
void OnItemAttachedAtPlayer(EntityAI item, string slot_name)
proto native UIManager GetUIManager()
proto bool ConfigGetChildName(string path, int index, out string name)
Get name of subclass in config class on path.
proto native float ConfigGetFloat(string path)
Get float value from config on path.
override ScriptCallQueue GetCallQueue(int call_category)
proto native void GizmoSelectObject(Object object)
proto native bool ConfigIsExisting(string path)
proto native void ConfigGetTextArray(string path, out TStringArray values)
Get array of strings from config on path.
proto native DayZPlayer GetPlayer()
proto native void GizmoSelectPhysics(Physics physics)
proto int GetTime()
returns mission time in milliseconds
proto native int ConfigGetType(string path)
Returns type of config value.
AnalyticsManagerClient GetAnalyticsClient()
proto native int ConfigGetChildrenCount(string path)
Get count of subclasses in config class on path.
proto native SoundOnVehicle CreateSoundOnObject(Object source, string sound_name, float distance, bool looped, bool create_local=false)
proto native void ObjectDelete(Object obj)
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 bool EnumerateInventory(InventoryTraversalType tt, out array< EntityAI > items)
enumerate inventory using traversal type and filling items array
proto native CargoBase GetCargo()
cargo
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 void Remove(func fn)
remove specific call from queue
proto void CallLater(func fn, int delay=0, bool repeat=false, 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)
adds call into the queue with given parameters and arguments (arguments are held in memory until the ...
proto bool Write(void value_out)
proto bool Read(void value_in)
proto native float GetDamage(string zoneName, string healthType)
UIScriptedMenu FindMenu(int id)
Returns menu with specific ID if it is open (see MenuID)
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
proto native CGame GetGame()
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
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
class JsonUndergroundAreaTriggerData GetPosition
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.