5634{
5636 {
5637 return true;
5638 }
5639};
5640
5641
5642
5644{
5648
5650
5653
5654
5655
5656
5657
5666
5672
5677
5682
5703 protected bool m_IsResultOfSplit
5704
5706
5711
5712
5713
5715
5719
5720
5721
5723
5726
5727
5728
5734
5735
5743
5746
5747
5749
5750
5752
5753
5758
5759
5764
5765
5767
5768
5770 {
5775
5776 if (!
GetGame().IsDedicatedServer())
5777 {
5779 {
5781
5783 {
5785 }
5786 }
5787
5790 }
5791
5792 m_OldLocation = null;
5793
5795 {
5797 }
5798
5799 if (ConfigIsExisting("headSelectionsToHide"))
5800 {
5803 }
5804
5806 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
5807 {
5809 }
5810
5812
5813 m_IsResultOfSplit = false;
5814
5816 }
5817
5819 {
5820 super.InitItemVariables();
5821
5827 m_Count = ConfigGetInt(
"count");
5828
5831
5836
5839
5844
5856
5860
5861
5864 if (ConfigIsExisting("canBeSplit"))
5865 {
5868 }
5869
5871 if (ConfigIsExisting("itemBehaviour"))
5873
5874
5877 RegisterNetSyncVariableInt("m_VarLiquidType");
5878 RegisterNetSyncVariableInt("m_Cleanness",0,1);
5879
5880 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
5881 RegisterNetSyncVariableFloat("m_ImpactSpeed");
5882 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
5883
5884 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
5885 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
5886 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
5887 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
5888
5889 RegisterNetSyncVariableBool("m_IsBeingPlaced");
5890 RegisterNetSyncVariableBool("m_IsTakeable");
5891 RegisterNetSyncVariableBool("m_IsHologram");
5892
5895 {
5898 }
5899
5901
5903 if (ConfigIsExisting("temperaturePerQuantityWeight"))
5905
5906 }
5907
5909 {
5911 }
5912
5914 {
5917 {
5922 }
5923 }
5924
5925 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
5926 {
5928 {
5931 }
5932
5934 }
5935
5937 {
5943 }
5944
5946
5948 {
5950
5951 if (!action)
5952 {
5953 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
5954 return;
5955 }
5956
5958 if (!ai)
5959 {
5961 return;
5962 }
5963
5965 if (!action_array)
5966 {
5967 action_array = new array<ActionBase_Basic>;
5969 }
5970 if (LogManager.IsActionLogEnable())
5971 {
5972 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
5973 }
5974
5975 if (action_array.Find(action) != -1)
5976 {
5977 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
5978 }
5979 else
5980 {
5981 action_array.Insert(action);
5982 }
5983 }
5984
5986 {
5988 ActionBase action = player.GetActionManager().GetAction(actionName);
5991
5992 if (action_array)
5993 {
5994 action_array.RemoveItem(action);
5995 }
5996 }
5997
5998
5999
6001 {
6002 ActionOverrideData overrideData = new ActionOverrideData();
6006
6008 if (!actionMap)
6009 {
6012 }
6013
6014 actionMap.Insert(this.
Type(), overrideData);
6015
6016 }
6017
6019
6021
6022
6024 {
6027
6030
6031 string config_to_search = "CfgVehicles";
6032 string muzzle_owner_config;
6033
6035 {
6036 if (IsInherited(Weapon))
6037 config_to_search = "CfgWeapons";
6038
6039 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6040
6041 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
6042
6044
6045 if (config_OnFire_subclass_count > 0)
6046 {
6047 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
6048
6049 for (int i = 0; i < config_OnFire_subclass_count; i++)
6050 {
6051 string particle_class = "";
6053 string config_OnFire_entry = config_OnFire_class + particle_class;
6054 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
6055 WPOF_array.Insert(WPOF);
6056 }
6057
6058
6060 }
6061 }
6062
6064 {
6065 config_to_search = "CfgWeapons";
6066 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6067
6068 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
6069
6071
6072 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
6073 {
6074 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
6075
6076 for (i = 0; i < config_OnBulletCasingEject_count; i++)
6077 {
6078 string particle_class2 = "";
6080 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
6081 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
6082 WPOBE_array.Insert(WPOBE);
6083 }
6084
6085
6087 }
6088 }
6089 }
6090
6091
6093 {
6096
6098 {
6099 string config_to_search = "CfgVehicles";
6100
6101 if (IsInherited(Weapon))
6102 config_to_search = "CfgWeapons";
6103
6104 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6105 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
6106
6107 if (
GetGame().ConfigIsExisting(config_OnOverheating_class))
6108 {
6109
6111
6113 {
6115 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
6117 return;
6118 }
6119
6122
6123
6124
6126 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
6127
6128 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
6129 {
6130 string particle_class = "";
6132 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
6134
6135 if (entry_type == CT_CLASS)
6136 {
6137 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
6138 WPOOH_array.Insert(WPOF);
6139 }
6140 }
6141
6142
6144 }
6145 }
6146 }
6147
6149 {
6151 }
6152
6154 {
6156 {
6158
6161
6164
6165 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6166 }
6167 }
6168
6170 {
6172 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6173
6175 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6176
6178 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6179
6181 {
6183 }
6184 }
6185
6187 {
6189 }
6190
6192 {
6195 else
6197
6199 {
6202 }
6203 else
6204 {
6207
6210 }
6211
6213 }
6214
6216 {
6218 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6219 }
6220
6222 {
6224 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6226 }
6227
6229 {
6231 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6232 }
6233
6235 {
6238
6239 OverheatingParticle OP = new OverheatingParticle();
6244
6246 }
6247
6249 {
6252
6253 return -1;
6254 }
6255
6257 {
6259 {
6262
6263 for (int i = count; i > 0; --i)
6264 {
6265 int id = i - 1;
6268
6271
6272 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
6273 {
6274 if (p)
6275 {
6278 }
6279 }
6280 }
6281 }
6282 }
6283
6285 {
6287 {
6289 {
6290 int id = i - 1;
6292
6293 if (OP)
6294 {
6296
6297 if (p)
6298 {
6300 }
6301
6302 delete OP;
6303 }
6304 }
6305
6308 }
6309 }
6310
6313 {
6314 return 0.0;
6315 }
6316
6317
6319 {
6320 return 250;
6321 }
6322
6324 {
6325 return 0;
6326 }
6327
6330 {
6332 return true;
6333
6334 return false;
6335 }
6336
6339 {
6342
6344 {
6346 }
6347 else
6348 {
6349
6351 }
6352
6354 }
6355
6362 {
6363 return -1;
6364 }
6365
6366
6367
6368
6370 {
6372 {
6374 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6375
6376 if (r_index >= 0)
6377 {
6378 InventoryLocation r_il = new InventoryLocation;
6379 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6380
6381 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6384 {
6385 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6386 }
6388 {
6389 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6390 }
6391
6392 }
6393
6394 player.GetHumanInventory().ClearUserReservedLocation(this);
6395 }
6396
6399 }
6400
6401
6402
6403
6405 {
6406 return ItemBase.m_DebugActionsMask;
6407 }
6408
6410 {
6411 return ItemBase.m_DebugActionsMask & mask;
6412 }
6413
6415 {
6416 ItemBase.m_DebugActionsMask = mask;
6417 }
6418
6420 {
6421 ItemBase.m_DebugActionsMask |= mask;
6422 }
6423
6425 {
6426 ItemBase.m_DebugActionsMask &= ~mask;
6427 }
6428
6430 {
6432 {
6434 }
6435 else
6436 {
6438 }
6439 }
6440
6441
6443 {
6444 if (GetEconomyProfile())
6445 {
6446 float q_max = GetEconomyProfile().GetQuantityMax();
6447 if (q_max > 0)
6448 {
6449 float q_min = GetEconomyProfile().GetQuantityMin();
6450 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
6451
6453 {
6454 ComponentEnergyManager comp = GetCompEM();
6456 {
6458 }
6459 }
6461 {
6463
6464 }
6465
6466 }
6467 }
6468 }
6469
6472 {
6473 EntityAI parent = GetHierarchyParent();
6474
6475 if (parent)
6476 {
6477 InventoryLocation inventory_location_to_lock = new InventoryLocation;
6478 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
6479 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
6480 }
6481 }
6482
6485 {
6486 EntityAI parent = GetHierarchyParent();
6487
6488 if (parent)
6489 {
6490 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
6491 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
6492 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
6493 }
6494 }
6495
6497 {
6498
6499
6500
6501
6503
6505 {
6506 if (ScriptInputUserData.CanStoreInputUserData())
6507 {
6508 ScriptInputUserData ctx = new ScriptInputUserData;
6514 ctx.
Write(use_stack_max);
6517
6519 {
6520 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
6521 }
6522 }
6523 }
6524 else if (!
GetGame().IsMultiplayer())
6525 {
6527 }
6528 }
6529
6531 {
6533 }
6534
6536 {
6538 }
6539
6541 {
6543 }
6544
6546 {
6547
6548 return false;
6549 }
6550
6552 {
6553 return false;
6554 }
6555
6559 {
6560 return false;
6561 }
6562
6564 {
6565 return "";
6566 }
6567
6569
6571 {
6572 return false;
6573 }
6574
6576 {
6577 return true;
6578 }
6579
6580
6581
6583 {
6584 return true;
6585 }
6586
6588 {
6589 return true;
6590 }
6591
6593 {
6594 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6596 }
6597
6599 {
6601 }
6602
6604 {
6606 if (!is_being_placed)
6608 SetSynchDirty();
6609 }
6610
6611
6613
6615 {
6617 }
6618
6620 {
6622 }
6623
6625 {
6626 return 1;
6627 }
6628
6630 {
6631 return false;
6632 }
6633
6635 {
6637 SetSynchDirty();
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
6669
6670
6671
6672
6673
6675 {
6676 super.OnMovedInsideCargo(container);
6677
6678 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6679 }
6680
6681 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
6682 {
6683 super.EEItemLocationChanged(oldLoc,newLoc);
6684
6685 PlayerBase new_player = null;
6686 PlayerBase old_player = null;
6687
6688 if (newLoc.GetParent())
6689 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
6690
6691 if (oldLoc.GetParent())
6692 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
6693
6695 {
6696 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
6697
6698 if (r_index >= 0)
6699 {
6700 InventoryLocation r_il = new InventoryLocation;
6701 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6702
6703 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6706 {
6707 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6708 }
6710 {
6711 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6712 }
6713
6714 }
6715 }
6716
6718 {
6719 if (new_player)
6720 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
6721
6722 if (new_player == old_player)
6723 {
6724
6725 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
6726 {
6728 {
6729 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
6730 {
6731 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6732 }
6733 }
6734 else
6735 {
6736 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6737 }
6738 }
6739
6740 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
6741 {
6742 int type = oldLoc.GetType();
6744 {
6745 oldLoc.GetParent().GetOnSetLock().Invoke(this);
6746 }
6748 {
6749 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
6750 }
6751 }
6752 if (!m_OldLocation)
6753 {
6754 m_OldLocation = new InventoryLocation;
6755 }
6756 m_OldLocation.Copy(oldLoc);
6757 }
6758 else
6759 {
6760 if (m_OldLocation)
6761 {
6762 m_OldLocation.Reset();
6763 }
6764 }
6765
6767 }
6768 else
6769 {
6770 if (new_player)
6771 {
6772 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
6773 if (res_index >= 0)
6774 {
6775 InventoryLocation il = new InventoryLocation;
6776 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
6778 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
6781 {
6782 il.
GetParent().GetOnReleaseLock().Invoke(it);
6783 }
6785 {
6787 }
6788
6789 }
6790 }
6792 {
6793
6795 }
6796
6797 if (m_OldLocation)
6798 {
6799 m_OldLocation.Reset();
6800 }
6801 }
6802 }
6803
6804 override void EOnContact(IEntity other, Contact extra)
6805 {
6807 {
6808 int liquidType = -1;
6810 if (impactSpeed > 0.0)
6811 {
6813 #ifndef SERVER
6815 #else
6817 SetSynchDirty();
6818 #endif
6820 }
6821 }
6822
6823 #ifdef SERVER
6824 if (GetCompEM() && GetCompEM().IsPlugged())
6825 {
6826 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
6827 GetCompEM().UnplugThis();
6828 }
6829 #endif
6830 }
6831
6833
6835 {
6837 }
6838
6840 {
6841
6842 }
6843
6845 {
6846 super.OnItemLocationChanged(old_owner, new_owner);
6847
6848 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
6849 PlayerBase playerNew = PlayerBase.Cast(new_owner);
6850
6851 if (!relatedPlayer && playerNew)
6852 relatedPlayer = playerNew;
6853
6854 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
6855 {
6857 if (actionMgr)
6858 {
6859 ActionBase currentAction = actionMgr.GetRunningAction();
6860 if (currentAction)
6862 }
6863 }
6864
6865 Man ownerPlayerOld = null;
6866 Man ownerPlayerNew = null;
6867
6868 if (old_owner)
6869 {
6870 if (old_owner.
IsMan())
6871 {
6872 ownerPlayerOld = Man.Cast(old_owner);
6873 }
6874 else
6875 {
6876 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
6877 }
6878 }
6879 else
6880 {
6882 {
6884
6885 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
6886 {
6887 GetCompEM().UnplugThis();
6888 }
6889 }
6890 }
6891
6892 if (new_owner)
6893 {
6894 if (new_owner.
IsMan())
6895 {
6896 ownerPlayerNew = Man.Cast(new_owner);
6897 }
6898 else
6899 {
6900 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
6901 }
6902 }
6903
6904 if (ownerPlayerOld != ownerPlayerNew)
6905 {
6906 if (ownerPlayerOld)
6907 {
6908 array<EntityAI> subItemsExit = new array<EntityAI>;
6910 for (int i = 0; i < subItemsExit.Count(); i++)
6911 {
6914 }
6915 }
6916
6917 if (ownerPlayerNew)
6918 {
6919 array<EntityAI> subItemsEnter = new array<EntityAI>;
6921 for (int j = 0; j < subItemsEnter.Count(); j++)
6922 {
6925 }
6926 }
6927 }
6928 else if (ownerPlayerNew != null)
6929 {
6930 PlayerBase nplayer;
6931 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
6932 {
6933 array<EntityAI> subItemsUpdate = new array<EntityAI>;
6935 for (int k = 0; k < subItemsUpdate.Count(); k++)
6936 {
6938 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
6939 }
6940 }
6941 }
6942
6943 if (old_owner)
6944 old_owner.OnChildItemRemoved(this);
6945 if (new_owner)
6946 new_owner.OnChildItemReceived(this);
6947 }
6948
6949
6951 {
6952 super.EEDelete(parent);
6953 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
6954 if (player)
6955 {
6957
6958 if (player.IsAlive())
6959 {
6960 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6961 if (r_index >= 0)
6962 {
6963 InventoryLocation r_il = new InventoryLocation;
6964 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6965
6966 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6969 {
6970 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6971 }
6973 {
6974 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6975 }
6976
6977 }
6978
6979 player.RemoveQuickBarEntityShortcut(this);
6980 }
6981 }
6982 }
6983
6985 {
6986 super.EEKilled(killer);
6987
6990 {
6991 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
6992 {
6993 if (IsMagazine())
6994 {
6995 if (Magazine.Cast(this).GetAmmoCount() > 0)
6996 {
6998 }
6999 }
7000 else
7001 {
7003 }
7004 }
7005 }
7006 }
7007
7009 {
7010 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7011
7012 super.OnWasAttached(parent, slot_id);
7013
7016
7018 }
7019
7021 {
7022 super.OnWasDetached(parent, slot_id);
7023
7026 }
7027
7029 {
7030 int idx;
7033
7034 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7035 if (inventory_slots.Count() < 1)
7036 {
7037 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
7038 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
7039 }
7040 else
7041 {
7042 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
7043 }
7044
7045 idx = inventory_slots.Find(slot);
7046 if (idx < 0)
7047 return "";
7048
7049 return attach_types.Get(idx);
7050 }
7051
7053 {
7054 int idx = -1;
7055 string slot;
7056
7059
7060 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7061 if (inventory_slots.Count() < 1)
7062 {
7063 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
7064 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7065 }
7066 else
7067 {
7068 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
7069 if (detach_types.Count() < 1)
7070 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7071 }
7072
7073 for (int i = 0; i < inventory_slots.Count(); i++)
7074 {
7075 slot = inventory_slots.Get(i);
7076 }
7077
7078 if (slot != "")
7079 {
7080 if (detach_types.Count() == 1)
7081 idx = 0;
7082 else
7083 idx = inventory_slots.Find(slot);
7084 }
7085 if (idx < 0)
7086 return "";
7087
7088 return detach_types.Get(idx);
7089 }
7090
7092 {
7093
7095
7096
7097 float min_time = 1;
7098 float max_time = 3;
7099 float delay = Math.RandomFloat(min_time, max_time);
7100
7101 explode_timer.Run(delay, this, "DoAmmoExplosion");
7102 }
7103
7105 {
7106 Magazine magazine = Magazine.Cast(this);
7107 int pop_sounds_count = 6;
7108 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
7109
7110
7111 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
7112 string sound_name = pop_sounds[ sound_idx ];
7114
7115
7116 magazine.ServerAddAmmoCount(-1);
7117
7118
7119 float min_temp_to_explode = 100;
7120
7121 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
7122 {
7124 }
7125 }
7126
7127
7128 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
7129 {
7130 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
7131
7132 const int CHANCE_DAMAGE_CARGO = 4;
7133 const int CHANCE_DAMAGE_ATTACHMENT = 1;
7134 const int CHANCE_DAMAGE_NOTHING = 2;
7135
7137 {
7138 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
7139 int chances;
7140 int rnd;
7141
7142 if (GetInventory().GetCargo())
7143 {
7144 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7145 rnd = Math.RandomInt(0,chances);
7146
7147 if (rnd < CHANCE_DAMAGE_CARGO)
7148 {
7150 }
7151 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
7152 {
7154 }
7155 }
7156 else
7157 {
7158 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7159 rnd = Math.RandomInt(0,chances);
7160
7161 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
7162 {
7164 }
7165 }
7166 }
7167 }
7168
7170 {
7171 if (GetInventory().GetCargo())
7172 {
7173 int item_count = GetInventory().GetCargo().GetItemCount();
7174 if (item_count > 0)
7175 {
7176 int random_pick = Math.RandomInt(0, item_count);
7178 if (!item.IsExplosive())
7179 {
7180 item.AddHealth("","",damage);
7181 return true;
7182 }
7183 }
7184 }
7185 return false;
7186 }
7187
7189 {
7190 int attachment_count = GetInventory().AttachmentCount();
7191 if (attachment_count > 0)
7192 {
7193 int random_pick = Math.RandomInt(0, attachment_count);
7194 ItemBase attachment =
ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
7195 if (!attachment.IsExplosive())
7196 {
7197 attachment.AddHealth("","",damage);
7198 return true;
7199 }
7200 }
7201 return false;
7202 }
7203
7205 {
7207 }
7208
7210 {
7212 return GetInventory().CanRemoveEntity();
7213
7214 return false;
7215 }
7216
7218 {
7219
7221 return false;
7222
7223
7225 return false;
7226
7227
7228
7230 if (delta == 0)
7231 return false;
7232
7233
7234 return true;
7235 }
7236
7238 {
7240 {
7241 if (ScriptInputUserData.CanStoreInputUserData())
7242 {
7243 ScriptInputUserData ctx = new ScriptInputUserData;
7248 ctx.
Write(destination_entity);
7252 }
7253 }
7254 else if (!
GetGame().IsMultiplayer())
7255 {
7257 }
7258 }
7259
7261 {
7262 float split_quantity_new;
7266 InventoryLocation loc = new InventoryLocation;
7267
7268 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7269 {
7271 split_quantity_new = stack_max;
7272 else
7274
7276 {
7277 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7278 if (new_item)
7279 {
7280 new_item.SetResultOfSplit(true);
7281 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7283 new_item.
SetQuantity(split_quantity_new,
false,
true);
7284 }
7285 }
7286 }
7287 else if (destination_entity && slot_id == -1)
7288 {
7289 if (quantity > stack_max)
7290 split_quantity_new = stack_max;
7291 else
7292 split_quantity_new = quantity;
7293
7295 {
7297 {
7300 }
7301
7302 if (new_item)
7303 {
7304 new_item.SetResultOfSplit(true);
7305 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7307 new_item.
SetQuantity(split_quantity_new,
false,
true);
7308 }
7309 }
7310 }
7311 else
7312 {
7313 if (stack_max != 0)
7314 {
7316 {
7318 }
7319
7320 if (split_quantity_new == 0)
7321 {
7322 if (!
GetGame().IsMultiplayer())
7323 player.PhysicalPredictiveDropItem(this);
7324 else
7325 player.ServerDropEntity(this);
7326 return;
7327 }
7328
7330 {
7332
7333 if (new_item)
7334 {
7335 new_item.SetResultOfSplit(true);
7336 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7339 new_item.PlaceOnSurface();
7340 }
7341 }
7342 }
7343 }
7344 }
7345
7347 {
7348 float split_quantity_new;
7352 InventoryLocation loc = new InventoryLocation;
7353
7354 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7355 {
7357 split_quantity_new = stack_max;
7358 else
7360
7362 {
7363 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7364 if (new_item)
7365 {
7366 new_item.SetResultOfSplit(true);
7367 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7369 new_item.
SetQuantity(split_quantity_new,
false,
true);
7370 }
7371 }
7372 }
7373 else if (destination_entity && slot_id == -1)
7374 {
7375 if (quantity > stack_max)
7376 split_quantity_new = stack_max;
7377 else
7378 split_quantity_new = quantity;
7379
7381 {
7383 {
7386 }
7387
7388 if (new_item)
7389 {
7390 new_item.SetResultOfSplit(true);
7391 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7393 new_item.
SetQuantity(split_quantity_new,
false,
true);
7394 }
7395 }
7396 }
7397 else
7398 {
7399 if (stack_max != 0)
7400 {
7402 {
7404 }
7405
7407 {
7409
7410 if (new_item)
7411 {
7412 new_item.SetResultOfSplit(true);
7413 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7416 new_item.PlaceOnSurface();
7417 }
7418 }
7419 }
7420 }
7421 }
7422
7424 {
7426 {
7427 if (ScriptInputUserData.CanStoreInputUserData())
7428 {
7429 ScriptInputUserData ctx = new ScriptInputUserData;
7434 dst.WriteToContext(ctx);
7436 }
7437 }
7438 else if (!
GetGame().IsMultiplayer())
7439 {
7441 }
7442 }
7443
7445 {
7447 {
7448 if (ScriptInputUserData.CanStoreInputUserData())
7449 {
7450 ScriptInputUserData ctx = new ScriptInputUserData;
7455 ctx.
Write(destination_entity);
7461 }
7462 }
7463 else if (!
GetGame().IsMultiplayer())
7464 {
7466 }
7467 }
7468
7470 {
7472 }
7473
7475 {
7477 float split_quantity_new;
7479 if (dst.IsValid())
7480 {
7481 int slot_id = dst.GetSlot();
7483
7484 if (quantity > stack_max)
7485 split_quantity_new = stack_max;
7486 else
7487 split_quantity_new = quantity;
7488
7490 {
7492
7493 if (new_item)
7494 {
7495 new_item.SetResultOfSplit(true);
7496 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7498 new_item.
SetQuantity(split_quantity_new,
false,
true);
7499 }
7500
7501 return new_item;
7502 }
7503 }
7504
7505 return null;
7506 }
7507
7509 {
7511 float split_quantity_new;
7513 if (destination_entity)
7514 {
7516 if (quantity > stackable)
7517 split_quantity_new = stackable;
7518 else
7519 split_quantity_new = quantity;
7520
7522 {
7523 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
7524 if (new_item)
7525 {
7526 new_item.SetResultOfSplit(true);
7527 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7529 new_item.
SetQuantity(split_quantity_new,
false,
true);
7530 }
7531 }
7532 }
7533 }
7534
7536 {
7538 {
7539 if (ScriptInputUserData.CanStoreInputUserData())
7540 {
7541 ScriptInputUserData ctx = new ScriptInputUserData;
7546 ItemBase destination_entity =
this;
7547 ctx.
Write(destination_entity);
7551 }
7552 }
7553 else if (!
GetGame().IsMultiplayer())
7554 {
7556 }
7557 }
7558
7560 {
7562 float split_quantity_new;
7564 if (player)
7565 {
7567 if (quantity > stackable)
7568 split_quantity_new = stackable;
7569 else
7570 split_quantity_new = quantity;
7571
7573 {
7574 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
7575 new_item =
ItemBase.Cast(in_hands);
7576 if (new_item)
7577 {
7578 new_item.SetResultOfSplit(true);
7579 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7581 new_item.SetQuantity(split_quantity_new, false, true);
7582 }
7583 }
7584 }
7585 }
7586
7588 {
7590 float split_quantity_new = Math.Floor(quantity * 0.5);
7591
7593 return;
7594
7596
7597 if (new_item)
7598 {
7599 if (new_item.GetQuantityMax() < split_quantity_new)
7600 {
7601 split_quantity_new = new_item.GetQuantityMax();
7602 }
7603
7604 new_item.SetResultOfSplit(true);
7605 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7606
7608 {
7611 }
7612 else
7613 {
7615 new_item.
SetQuantity(split_quantity_new,
false,
true);
7616 }
7617 }
7618 }
7619
7621 {
7623 float split_quantity_new = Math.Floor(quantity / 2);
7624
7626 return;
7627
7628 InventoryLocation invloc = new InventoryLocation;
7630
7632 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
7633
7634 if (new_item)
7635 {
7636 if (new_item.GetQuantityMax() < split_quantity_new)
7637 {
7638 split_quantity_new = new_item.GetQuantityMax();
7639 }
7641 {
7644 }
7645 else if (split_quantity_new > 1)
7646 {
7648 new_item.
SetQuantity(split_quantity_new,
false,
true);
7649 }
7650 }
7651 }
7652
7655 {
7656 SetWeightDirty();
7658
7659 if (parent)
7660 parent.OnAttachmentQuantityChangedEx(this, delta);
7661
7663 {
7665 {
7667 }
7669 {
7670 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
7672 }
7673 }
7674
7675 }
7676
7679 {
7680
7681 }
7682
7685 {
7687 }
7688
7690 {
7691 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
7692
7694 {
7695 if (newLevel == GameConstants.STATE_RUINED)
7696 {
7698 EntityAI parent = GetHierarchyParent();
7699 if (parent && parent.IsFireplace())
7700 {
7701 CargoBase cargo = GetInventory().GetCargo();
7702 if (cargo)
7703 {
7705 {
7707 }
7708 }
7709 }
7710 }
7711
7713 {
7714
7716 return;
7717 }
7718
7719 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
7720 {
7722 }
7723 }
7724 }
7725
7726
7728 {
7729 super.OnRightClick();
7730
7732 {
7734 {
7735 if (ScriptInputUserData.CanStoreInputUserData())
7736 {
7737 EntityAI root = GetHierarchyRoot();
7738 Man playerOwner = GetHierarchyRootPlayer();
7739 InventoryLocation dst = new InventoryLocation;
7740
7741
7742 if (!playerOwner && root && root == this)
7743 {
7745 }
7746 else
7747 {
7748
7749 GetInventory().GetCurrentInventoryLocation(dst);
7751 {
7754 {
7756 }
7757 else
7758 {
7760
7761
7762 if (
GetGame().
GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
7763 {
7765 }
7766 else
7767 {
7768 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
7769 }
7770 }
7771 }
7772 }
7773
7774 ScriptInputUserData ctx = new ScriptInputUserData;
7782 }
7783 }
7784 else if (!
GetGame().IsMultiplayer())
7785 {
7787 }
7788 }
7789 }
7790
7792 {
7793 if (root)
7794 {
7795 vector m4[4];
7796 root.GetTransform(m4);
7797 dst.SetGround(this, m4);
7798 }
7799 else
7800 {
7801 GetInventory().GetCurrentInventoryLocation(dst);
7802 }
7803 }
7804
7805 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
7806 {
7807
7808 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
7809 return false;
7810
7811 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
7812 return false;
7813
7814
7816 return false;
7817
7818
7819 Magazine mag = Magazine.Cast(this);
7820 if (mag)
7821 {
7822 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
7823 return false;
7824
7825 if (stack_max_limit)
7826 {
7827 Magazine other_mag = Magazine.Cast(other_item);
7828 if (other_item)
7829 {
7830 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
7831 return false;
7832 }
7833
7834 }
7835 }
7836 else
7837 {
7838
7840 return false;
7841
7843 return false;
7844 }
7845
7846 PlayerBase player = null;
7847 if (CastTo(player, GetHierarchyRootPlayer()))
7848 {
7849 if (player.GetInventory().HasAttachment(this))
7850 return false;
7851
7852 if (player.IsItemsToDelete())
7853 return false;
7854 }
7855
7856 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
7857 return false;
7858
7859 int slotID;
7861 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
7862 return false;
7863
7864 return true;
7865 }
7866
7868 {
7870 }
7871
7873 {
7874 return m_IsResultOfSplit;
7875 }
7876
7878 {
7879 m_IsResultOfSplit = value;
7880 }
7881
7883 {
7885 }
7886
7888 {
7889 float other_item_quantity = other_item.GetQuantity();
7890 float this_free_space;
7891
7893
7895
7896 if (other_item_quantity > this_free_space)
7897 {
7898 return this_free_space;
7899 }
7900 else
7901 {
7902 return other_item_quantity;
7903 }
7904 }
7905
7907 {
7909 }
7910
7912 {
7914 return;
7915
7916 if (!IsMagazine() && other_item)
7917 {
7919 if (quantity_used != 0)
7920 {
7921 float hp1 = GetHealth01("","");
7922 float hp2 = other_item.GetHealth01("","");
7923 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
7924 hpResult = hpResult / (
GetQuantity() + quantity_used);
7925
7926 hpResult *= GetMaxHealth();
7927 Math.Round(hpResult);
7928 SetHealth("", "Health", hpResult);
7929
7931 other_item.AddQuantity(-quantity_used);
7932 }
7933 }
7935 }
7936
7938 {
7939 #ifdef SERVER
7940 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
7941 GetHierarchyParent().IncreaseLifetimeUp();
7942 #endif
7943 };
7944
7946 {
7947 PlayerBase p = PlayerBase.Cast(player);
7948
7949 array<int> recipesIds = p.m_Recipes;
7950 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
7951 if (moduleRecipesManager)
7952 {
7953 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
7954 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
7955 }
7956
7957 for (int i = 0;i < recipesIds.Count(); i++)
7958 {
7959 int key = recipesIds.Get(i);
7960 string recipeName = moduleRecipesManager.GetRecipeName(key);
7962 }
7963 }
7964
7965
7966 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
7967 {
7968 super.GetDebugActions(outputList);
7969
7970
7976
7977
7982
7987
7988
7992
7993
7995 {
7999 }
8000
8003
8004
8008
8010
8011 InventoryLocation loc = new InventoryLocation();
8012 GetInventory().GetCurrentInventoryLocation(loc);
8014 {
8015 if (Gizmo_IsSupported())
8018 }
8019
8021 }
8022
8023
8024
8025
8027 {
8028 super.OnAction(action_id, player, ctx);
8029
8031 {
8032 switch (action_id)
8033 {
8036 return true;
8039 return true;
8040 }
8041 }
8042
8044 {
8045 switch (action_id)
8046 {
8048 Delete();
8049 return true;
8050 }
8051 }
8052
8053 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
8054 {
8055 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8056 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
8057 PlayerBase p = PlayerBase.Cast(player);
8058 if (
EActions.RECIPES_RANGE_START < 1000)
8059 {
8060 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
8061 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
8062 }
8063 }
8064 #ifndef SERVER
8065 else if (action_id ==
EActions.WATCH_PLAYER)
8066 {
8067 PluginDeveloper.SetDeveloperItemClientEx(player);
8068 }
8069 #endif
8071 {
8072 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
8073 {
8074 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
8075 OnDebugButtonPressServer(id + 1);
8076 }
8077
8078 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
8079 {
8080 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
8082 }
8083
8084 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
8085 {
8086 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
8088 }
8089
8090 else if (action_id ==
EActions.ADD_QUANTITY)
8091 {
8092 if (IsMagazine())
8093 {
8094 Magazine mag = Magazine.Cast(this);
8095 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
8096 }
8097 else
8098 {
8100 }
8101
8102 if (m_EM)
8103 {
8104 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
8105 }
8106
8107 }
8108
8109 else if (action_id ==
EActions.REMOVE_QUANTITY)
8110 {
8111 if (IsMagazine())
8112 {
8113 Magazine mag2 = Magazine.Cast(this);
8114 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
8115 }
8116 else
8117 {
8119 }
8120 if (m_EM)
8121 {
8122 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
8123 }
8124
8125 }
8126
8127 else if (action_id ==
EActions.SET_QUANTITY_0)
8128 {
8130
8131 if (m_EM)
8132 {
8133 m_EM.SetEnergy(0);
8134 }
8135 }
8136
8137 else if (action_id ==
EActions.SET_MAX_QUANTITY)
8138 {
8140
8141 if (m_EM)
8142 {
8143 m_EM.SetEnergy(m_EM.GetEnergyMax());
8144 }
8145 }
8146
8147 else if (action_id ==
EActions.ADD_HEALTH)
8148 {
8149 AddHealth("","",GetMaxHealth("","Health")/5);
8150 }
8151 else if (action_id ==
EActions.REMOVE_HEALTH)
8152 {
8153 AddHealth("","",-GetMaxHealth("","Health")/5);
8154 }
8155 else if (action_id ==
EActions.DESTROY_HEALTH)
8156 {
8157 SetHealth01("","",0);
8158 }
8159 else if (action_id ==
EActions.WATCH_ITEM)
8160 {
8162 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
8163 #ifdef DEVELOPER
8164 SetDebugDeveloper_item(this);
8165 #endif
8166 }
8167
8168 else if (action_id ==
EActions.ADD_TEMPERATURE)
8169 {
8170 AddTemperature(20);
8171
8172 }
8173
8174 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
8175 {
8176 AddTemperature(-20);
8177
8178 }
8179
8180 else if (action_id ==
EActions.FLIP_FROZEN)
8181 {
8182 SetFrozen(!GetIsFrozen());
8183
8184 }
8185
8186 else if (action_id ==
EActions.ADD_WETNESS)
8187 {
8189
8190 }
8191
8192 else if (action_id ==
EActions.REMOVE_WETNESS)
8193 {
8195
8196 }
8197
8198 else if (action_id ==
EActions.LIQUIDTYPE_UP)
8199 {
8202
8203
8204 }
8205
8206 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
8207 {
8210 }
8211
8212 else if (action_id ==
EActions.MAKE_SPECIAL)
8213 {
8214 auto debugParams = DebugSpawnParams.WithPlayer(player);
8215 OnDebugSpawnEx(debugParams);
8216 }
8217
8218 }
8219
8220
8221 return false;
8222 }
8223
8224
8225
8226
8230
8233
8234
8235
8237 {
8238 return false;
8239 }
8240
8241
8243 {
8244 return true;
8245 }
8246
8247
8249 {
8250 return true;
8251 }
8252
8253
8254
8256 {
8257 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
8259 }
8260
8263 {
8264 return null;
8265 }
8266
8268 {
8269 return false;
8270 }
8271
8273 {
8274 return false;
8275 }
8276
8280
8281
8283 {
8284 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8285 return module_repairing.CanRepair(this, item_repair_kit);
8286 }
8287
8288
8289 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
8290 {
8291 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8292 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
8293 }
8294
8295
8297 {
8298
8299
8300
8301
8302
8303
8304
8305
8306 return 1;
8307 }
8308
8309
8310
8312 {
8314 }
8315
8316
8317
8319 {
8321 }
8322
8323
8332 {
8333 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8334
8335 if (player)
8336 {
8337 player.MessageStatus(text);
8338 }
8339 }
8340
8341
8350 {
8351 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8352
8353 if (player)
8354 {
8355 player.MessageAction(text);
8356 }
8357 }
8358
8359
8368 {
8369 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8370
8371 if (player)
8372 {
8373 player.MessageFriendly(text);
8374 }
8375 }
8376
8377
8386 {
8387 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8388
8389 if (player)
8390 {
8391 player.MessageImportant(text);
8392 }
8393 }
8394
8396 {
8397 return true;
8398 }
8399
8400
8401 override bool KindOf(
string tag)
8402 {
8403 bool found = false;
8404 string item_name = this.
GetType();
8407
8408 int array_size = item_tag_array.Count();
8409 for (int i = 0; i < array_size; i++)
8410 {
8411 if (item_tag_array.Get(i) == tag)
8412 {
8413 found = true;
8414 break;
8415 }
8416 }
8417 return found;
8418 }
8419
8420
8422 {
8423
8424 super.OnRPC(sender, rpc_type,ctx);
8425
8426
8427 switch (rpc_type)
8428 {
8429 #ifndef SERVER
8430 case ERPCs.RPC_SOUND_LOCK_ATTACH:
8431 Param2<bool, string> p = new Param2<bool, string>(false, "");
8432
8434 return;
8435
8436 bool play = p.param1;
8437 string soundSet = p.param2;
8438
8439 if (play)
8440 {
8442 {
8444 {
8446 }
8447 }
8448 else
8449 {
8451 }
8452 }
8453 else
8454 {
8456 }
8457
8458 break;
8459 #endif
8460
8461 }
8462
8464 {
8466 }
8467 }
8468
8469
8470
8471
8473 {
8474 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8475 return plugin.GetID(
name);
8476 }
8477
8479 {
8480 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8481 return plugin.GetName(id);
8482 }
8483
8486 {
8487
8488
8489 int varFlags;
8490 if (!ctx.
Read(varFlags))
8491 return;
8492
8493 if (varFlags & ItemVariableFlags.FLOAT)
8494 {
8496 }
8497 }
8498
8500 {
8501
8502 super.SerializeNumericalVars(floats_out);
8503
8504
8505
8507 {
8509 }
8510
8512 {
8514 }
8515
8517 {
8519 }
8520
8522 {
8527 }
8528
8530 {
8532 }
8533 }
8534
8536 {
8537
8538 super.DeSerializeNumericalVars(floats);
8539
8540
8541 int index = 0;
8542 int mask = Math.Round(floats.Get(index));
8543
8544 index++;
8545
8547 {
8549 {
8551 }
8552 else
8553 {
8554 float quantity = floats.Get(index);
8556 }
8557 index++;
8558 }
8559
8561 {
8562 float wet = floats.Get(index);
8564 index++;
8565 }
8566
8568 {
8569 int liquidtype = Math.Round(floats.Get(index));
8571 index++;
8572 }
8573
8575 {
8577 index++;
8579 index++;
8581 index++;
8583 index++;
8584 }
8585
8587 {
8588 int cleanness = Math.Round(floats.Get(index));
8590 index++;
8591 }
8592 }
8593
8595 {
8596 super.WriteVarsToCTX(ctx);
8597
8598
8600 {
8602 }
8603
8605 {
8607 }
8608
8610 {
8612 }
8613
8615 {
8616 int r,g,b,a;
8622 }
8623
8625 {
8627 }
8628 }
8629
8631 {
8632 if (!super.ReadVarsFromCTX(ctx,version))
8633 return false;
8634
8635 int intValue;
8636 float value;
8637
8638 if (version < 140)
8639 {
8640 if (!ctx.
Read(intValue))
8641 return false;
8642
8643 m_VariablesMask = intValue;
8644 }
8645
8647 {
8648 if (!ctx.
Read(value))
8649 return false;
8650
8652 {
8654 }
8655 else
8656 {
8658 }
8659 }
8660
8661 if (version < 140)
8662 {
8664 {
8665 if (!ctx.
Read(value))
8666 return false;
8667 SetTemperatureDirect(value);
8668 }
8669 }
8670
8672 {
8673 if (!ctx.
Read(value))
8674 return false;
8676 }
8677
8679 {
8680 if (!ctx.
Read(intValue))
8681 return false;
8683 }
8684
8686 {
8687 int r,g,b,a;
8689 return false;
8691 return false;
8693 return false;
8695 return false;
8696
8698 }
8699
8701 {
8702 if (!ctx.
Read(intValue))
8703 return false;
8705 }
8706
8707 if (version >= 138 && version < 140)
8708 {
8710 {
8711 if (!ctx.
Read(intValue))
8712 return false;
8713 SetFrozen(intValue);
8714 }
8715 }
8716
8717 return true;
8718 }
8719
8720
8722 {
8725 {
8727 }
8728
8729 if (!super.OnStoreLoad(ctx, version))
8730 {
8732 return false;
8733 }
8734
8735 if (version >= 114)
8736 {
8737 bool hasQuickBarIndexSaved;
8738
8739 if (!ctx.
Read(hasQuickBarIndexSaved))
8740 {
8742 return false;
8743 }
8744
8745 if (hasQuickBarIndexSaved)
8746 {
8747 int itmQBIndex;
8748
8749
8750 if (!ctx.
Read(itmQBIndex))
8751 {
8753 return false;
8754 }
8755
8756 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
8757 if (itmQBIndex != -1 && parentPlayer)
8758 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
8759 }
8760 }
8761 else
8762 {
8763
8764 PlayerBase player;
8765 int itemQBIndex;
8766 if (version ==
int.
MAX)
8767 {
8768 if (!ctx.
Read(itemQBIndex))
8769 {
8771 return false;
8772 }
8773 }
8774 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
8775 {
8776
8777 if (!ctx.
Read(itemQBIndex))
8778 {
8780 return false;
8781 }
8782 if (itemQBIndex != -1 && player)
8783 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
8784 }
8785 }
8786
8787 if (version < 140)
8788 {
8789
8790 if (!LoadVariables(ctx, version))
8791 {
8793 return false;
8794 }
8795 }
8796
8797
8799 {
8801 return false;
8802 }
8803 if (version >= 132)
8804 {
8806 if (raib)
8807 {
8809 {
8811 return false;
8812 }
8813 }
8814 }
8815
8817 return true;
8818 }
8819
8820
8821
8823 {
8824 super.OnStoreSave(ctx);
8825
8826 PlayerBase player;
8827 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
8828 {
8830
8831 int itemQBIndex = -1;
8832 itemQBIndex = player.FindQuickBarEntityIndex(this);
8833 ctx.
Write(itemQBIndex);
8834 }
8835 else
8836 {
8838 }
8839
8841
8843 if (raib)
8844 {
8846 }
8847 }
8848
8849
8851 {
8852 super.AfterStoreLoad();
8853
8855 {
8857 }
8858
8860 {
8863 }
8864 }
8865
8867 {
8868 super.EEOnAfterLoad();
8869
8871 {
8873 }
8874
8877 }
8878
8880 {
8881 return false;
8882 }
8883
8884
8885
8887 {
8889 {
8890 #ifdef PLATFORM_CONSOLE
8891
8893 {
8895 if (menu)
8896 {
8898 }
8899 }
8900 #endif
8901 }
8902
8904 {
8907 }
8908
8910 {
8911 SetWeightDirty();
8913 }
8915 {
8918 }
8919
8921 {
8924 }
8926 {
8929 }
8930
8931 super.OnVariablesSynchronized();
8932 }
8933
8934
8935
8937 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
8938 {
8939 if (!IsServerCheck(allow_client))
8940 return false;
8941
8943 return false;
8944
8947
8948 if (value <= (min + 0.001))
8949 value = min;
8950
8951 if (value == min)
8952 {
8953 if (destroy_config)
8954 {
8955 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
8956 if (dstr)
8957 {
8959 this.Delete();
8960 return true;
8961 }
8962 }
8963 else if (destroy_forced)
8964 {
8966 this.Delete();
8967 return true;
8968 }
8969
8971 }
8972
8975
8977 {
8979
8980 if (delta)
8982 }
8983
8985
8986 return false;
8987 }
8988
8989
8991 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
8992 {
8994 }
8995
8997 {
9000 }
9001
9003 {
9006 }
9007
9009 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9010 {
9011 float value_clamped = Math.Clamp(value, 0, 1);
9013 SetQuantity(result, destroy_config, destroy_forced);
9014 }
9015
9016
9019 {
9021 }
9022
9024 {
9026 }
9027
9028
9029
9030
9031
9032
9033
9034
9035
9036
9038 {
9039 int slot = -1;
9040 if (GetInventory())
9041 {
9042 InventoryLocation il = new InventoryLocation;
9043 GetInventory().GetCurrentInventoryLocation(il);
9045 }
9046
9048 }
9049
9051 {
9052 float quantity_max = 0;
9053
9055 {
9056 if (attSlotID != -1)
9057 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
9058
9059 if (quantity_max <= 0)
9061 }
9062
9063 if (quantity_max <= 0)
9065
9066 return quantity_max;
9067 }
9068
9070 {
9072 }
9073
9075 {
9077 }
9078
9079
9081 {
9083 }
9084
9086 {
9088 }
9089
9091 {
9093 }
9094
9095
9097 {
9098
9099 float weightEx = GetWeightEx();
9100 float special = GetInventoryAndCargoWeight();
9101 return weightEx - special;
9102 }
9103
9104
9106 {
9108 }
9109
9111 {
9113 {
9114 #ifdef DEVELOPER
9115 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9116 {
9117 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
9119 }
9120 #endif
9121
9123 }
9124 else if (HasEnergyManager())
9125 {
9126 #ifdef DEVELOPER
9127 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9128 {
9129 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
9130 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
9131 }
9132 #endif
9133 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
9134 }
9135 else
9136 {
9137 #ifdef DEVELOPER
9138 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9139 {
9140 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
9141 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
9142 }
9143 #endif
9144 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
9145 }
9146 }
9147
9150 {
9151 int item_count = 0;
9153
9154 if (GetInventory().GetCargo() != NULL)
9155 {
9156 item_count = GetInventory().GetCargo().GetItemCount();
9157 }
9158
9159 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
9160 {
9161 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
9162 if (item)
9163 item_count += item.GetNumberOfItems();
9164 }
9165 return item_count;
9166 }
9167
9170 {
9171 float weight = 0;
9172 float wetness = 1;
9173 if (include_wetness)
9176 {
9177 weight = wetness * m_ConfigWeight;
9178 }
9180 {
9181 weight = 1;
9182 }
9183 return weight;
9184 }
9185
9186
9187
9189 {
9190 if ((
GetGame().IsServer() || !
GetGame().IsMultiplayer()) && GetInventory())
9191 {
9192 GameInventory inv = GetInventory();
9193 array<EntityAI> items = new array<EntityAI>;
9195 for (int i = 0; i < items.Count(); i++)
9196 {
9198 if (item)
9199 {
9201 }
9202 }
9203 }
9204 }
9205
9206
9207
9208
9210 {
9211 float energy = 0;
9212 if (HasEnergyManager())
9213 {
9214 energy = GetCompEM().GetEnergy();
9215 }
9216 return energy;
9217 }
9218
9219
9221 {
9222 super.OnEnergyConsumed();
9223
9225 }
9226
9228 {
9229 super.OnEnergyAdded();
9230
9232 }
9233
9234
9236 {
9237 if (
GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
9238 {
9240 {
9241 float energy_0to1 = GetCompEM().GetEnergy0To1();
9243 }
9244 }
9245 }
9246
9247
9249 {
9250 return ConfigGetFloat("heatIsolation");
9251 }
9252
9254 {
9256 }
9257
9259 {
9260 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
9261 if (
GetGame().ConfigIsExisting(paramPath))
9263
9264 return 0.0;
9265 }
9266
9268 {
9269 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
9270 if (
GetGame().ConfigIsExisting(paramPath))
9272
9273 return 0.0;
9274 }
9275
9276 override void SetWet(
float value,
bool allow_client =
false)
9277 {
9278 if (!IsServerCheck(allow_client))
9279 return;
9280
9283
9285
9286 m_VarWet = Math.Clamp(value, min, max);
9287
9289 {
9292 }
9293 }
9294
9295 override void AddWet(
float value)
9296 {
9298 }
9299
9301 {
9303 }
9304
9306 {
9308 }
9309
9311 {
9313 }
9314
9316 {
9318 }
9319
9321 {
9323 }
9324
9326 {
9329 if (newLevel != oldLevel)
9330 {
9332 }
9333 }
9334
9336 {
9337 SetWeightDirty();
9338 }
9339
9341 {
9342 return GetWetLevelInternal(
m_VarWet);
9343 }
9344
9345
9346
9348 {
9350 }
9351
9353 {
9355 }
9356
9358 {
9360 }
9361
9363 {
9365 }
9366
9367
9368
9370 {
9371 if (ConfigIsExisting("itemModelLength"))
9372 {
9373 return ConfigGetFloat("itemModelLength");
9374 }
9375 return 0;
9376 }
9377
9379 {
9380 if (ConfigIsExisting("itemAttachOffset"))
9381 {
9382 return ConfigGetFloat("itemAttachOffset");
9383 }
9384 return 0;
9385 }
9386
9387 override void SetCleanness(
int value,
bool allow_client =
false)
9388 {
9389 if (!IsServerCheck(allow_client))
9390 return;
9391
9393
9395
9398 }
9399
9401 {
9403 }
9404
9406 {
9407 return true;
9408 }
9409
9410
9411
9412
9414 {
9416 }
9417
9419 {
9421 }
9422
9423
9424
9425
9426 override void SetColor(
int r,
int g,
int b,
int a)
9427 {
9433 }
9435 override void GetColor(out
int r,out
int g,out
int b,out
int a)
9436 {
9441 }
9442
9444 {
9446 }
9447
9450 {
9451 int r,g,b,a;
9453 r = r/255;
9454 g = g/255;
9455 b = b/255;
9456 a = a/255;
9457 return MiscGameplayFunctions.GetColorString(r, g, b, a);
9458 }
9459
9460
9461
9462 override void SetLiquidType(
int value,
bool allow_client =
false)
9463 {
9464 if (!IsServerCheck(allow_client))
9465 return;
9466
9471 }
9472
9474 {
9475 return ConfigGetInt("varLiquidTypeInit");
9476 }
9477
9479 {
9481 }
9482
9484 {
9486 SetFrozen(false);
9487 }
9488
9491 {
9492 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9493 }
9494
9495
9498 {
9499 PlayerBase nplayer;
9500 if (PlayerBase.CastTo(nplayer, player))
9501 {
9503
9504 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9505 }
9506 }
9507
9508
9511 {
9512 PlayerBase nplayer;
9513 if (PlayerBase.CastTo(nplayer,player))
9514 {
9515
9516 nplayer.SetEnableQuickBarEntityShortcut(this,false);
9517
9518 }
9519
9520
9521 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
9522
9523
9524 if (HasEnergyManager())
9525 {
9526 GetCompEM().UpdatePlugState();
9527 }
9528 }
9529
9530
9532 {
9533 super.OnPlacementStarted(player);
9534
9536 }
9537
9538 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
9539 {
9541 {
9542 m_AdminLog.OnPlacementComplete(player,
this);
9543 }
9544
9545 super.OnPlacementComplete(player, position, orientation);
9546 }
9547
9548
9549
9550
9551
9553 {
9555 {
9556 return true;
9557 }
9558 else
9559 {
9560 return false;
9561 }
9562 }
9563
9564
9566 {
9568 {
9570 }
9571 }
9572
9573
9575 {
9577 }
9578
9580 {
9582 }
9583
9584 override void InsertAgent(
int agent,
float count = 1)
9585 {
9586 if (count < 1)
9587 return;
9588
9590 }
9591
9594 {
9596 }
9597
9598
9600 {
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
9640
9641
9642
9643
9644
9646 {
9648 return false;
9649 return true;
9650 }
9651
9653 {
9654
9656 }
9657
9658
9661 {
9662 super.CheckForRoofLimited(timeTresholdMS);
9663
9665 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
9666 {
9667 m_PreviousRoofTestTime = time;
9668 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
9669 }
9670 }
9671
9672
9674 {
9676 {
9677 return 0;
9678 }
9679
9680 if (GetInventory().GetAttachmentSlotsCount() != 0)
9681 {
9682 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
9683 if (filter)
9684 return filter.GetProtectionLevel(type, false, system);
9685 else
9686 return 0;
9687 }
9688
9689 string subclassPath, entryName;
9690
9691 switch (type)
9692 {
9694 entryName = "biological";
9695 break;
9697 entryName = "chemical";
9698 break;
9699 default:
9700 entryName = "biological";
9701 break;
9702 }
9703
9704 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
9705
9707 }
9708
9709
9710
9713 {
9714 if (!IsMagazine())
9716
9718 }
9719
9720
9721
9722
9723
9728 {
9729 return true;
9730 }
9731
9733 {
9735 }
9736
9737
9738
9739
9740
9742 {
9743 if (parent)
9744 {
9745 if (parent.IsInherited(DayZInfected))
9746 return true;
9747
9748 if (!parent.IsRuined())
9749 return true;
9750 }
9751
9752 return true;
9753 }
9754
9756 {
9757 if (!super.CanPutAsAttachment(parent))
9758 {
9759 return false;
9760 }
9761
9762 if (!IsRuined() && !parent.IsRuined())
9763 {
9764 return true;
9765 }
9766
9767 return false;
9768 }
9769
9771 {
9772
9773
9774
9775
9776 return super.CanReceiveItemIntoCargo(item);
9777 }
9778
9780 {
9781
9782
9783
9784
9785 GameInventory attachmentInv = attachment.GetInventory();
9787 {
9788 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
9789 return false;
9790 }
9791
9792 InventoryLocation loc = new InventoryLocation();
9793 attachment.GetInventory().GetCurrentInventoryLocation(loc);
9794 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
9795 return false;
9796
9797 return super.CanReceiveAttachment(attachment, slotId);
9798 }
9799
9801 {
9802 if (!super.CanReleaseAttachment(attachment))
9803 return false;
9804
9805 return GetInventory().AreChildrenAccessible();
9806 }
9807
9808
9809
9810
9811
9812
9813
9814
9815
9816
9817
9818
9819
9820
9821
9822
9823
9824
9825
9826
9827
9829 {
9830 int id = muzzle_owner.GetMuzzleID();
9831 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
9832
9833 if (WPOF_array)
9834 {
9835 for (int i = 0; i < WPOF_array.Count(); i++)
9836 {
9837 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
9838
9839 if (WPOF)
9840 {
9841 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
9842 }
9843 }
9844 }
9845 }
9846
9847
9849 {
9850 int id = muzzle_owner.GetMuzzleID();
9852
9853 if (WPOBE_array)
9854 {
9855 for (int i = 0; i < WPOBE_array.Count(); i++)
9856 {
9857 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
9858
9859 if (WPOBE)
9860 {
9861 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
9862 }
9863 }
9864 }
9865 }
9866
9867
9869 {
9870 int id = muzzle_owner.GetMuzzleID();
9871 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9872
9873 if (WPOOH_array)
9874 {
9875 for (int i = 0; i < WPOOH_array.Count(); i++)
9876 {
9877 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9878
9879 if (WPOOH)
9880 {
9881 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
9882 }
9883 }
9884 }
9885 }
9886
9887
9889 {
9890 int id = muzzle_owner.GetMuzzleID();
9891 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9892
9893 if (WPOOH_array)
9894 {
9895 for (int i = 0; i < WPOOH_array.Count(); i++)
9896 {
9897 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9898
9899 if (WPOOH)
9900 {
9901 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9902 }
9903 }
9904 }
9905 }
9906
9907
9909 {
9910 int id = muzzle_owner.GetMuzzleID();
9911 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9912
9913 if (WPOOH_array)
9914 {
9915 for (int i = 0; i < WPOOH_array.Count(); i++)
9916 {
9917 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9918
9919 if (WPOOH)
9920 {
9921 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9922 }
9923 }
9924 }
9925 }
9926
9927
9928
9930 {
9932 {
9933 return true;
9934 }
9935
9936 return false;
9937 }
9938
9940 {
9942 {
9943 return true;
9944 }
9945
9946 return false;
9947 }
9948
9950 {
9952 {
9953 return true;
9954 }
9955
9956 return false;
9957 }
9958
9960 {
9961 return false;
9962 }
9963
9966 {
9967 return UATimeSpent.DEFAULT_DEPLOY;
9968 }
9969
9970
9971
9972
9974 {
9976 SetSynchDirty();
9977 }
9978
9980 {
9982 }
9983
9984
9986 {
9987 return false;
9988 }
9989
9992 {
9993 string att_type = "None";
9994
9995 if (ConfigIsExisting("soundAttType"))
9996 {
9997 att_type = ConfigGetString("soundAttType");
9998 }
9999
10001 }
10002
10004 {
10006 }
10007
10008
10009
10010
10011
10017
10019 {
10022
10024 }
10025
10026
10028 {
10030 return;
10031
10033
10036
10039
10040 SoundParameters params = new SoundParameters();
10044 }
10045
10046
10048 {
10050 return;
10051
10053 SetSynchDirty();
10054
10057 }
10058
10059
10061 {
10063 return;
10064
10066 SetSynchDirty();
10067
10070 }
10071
10073 {
10075 }
10076
10078 {
10080 }
10081
10084 {
10085 if (!
GetGame().IsDedicatedServer())
10086 {
10087 if (ConfigIsExisting("attachSoundSet"))
10088 {
10089 string cfg_path = "";
10090 string soundset = "";
10091 string type_name =
GetType();
10092
10095 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
10096 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
10097
10098 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
10099 {
10100 for (int i = 0; i < cfg_soundset_array.Count(); i++)
10101 {
10102 if (cfg_slot_array[i] == slot_type)
10103 {
10104 soundset = cfg_soundset_array[i];
10105 break;
10106 }
10107 }
10108 }
10109
10110 if (soundset != "")
10111 {
10112 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
10114 }
10115 }
10116 }
10117 }
10118
10120 {
10121
10122 }
10123
10124 void OnApply(PlayerBase player);
10125
10127 {
10128 return 1.0;
10129 };
10130
10132 {
10134 }
10135
10137 {
10139 }
10140
10142
10144 {
10145 SetDynamicPhysicsLifeTime(0.01);
10147 }
10148
10150 {
10151 array<string> zone_names = new array<string>;
10152 GetDamageZones(zone_names);
10153 for (int i = 0; i < zone_names.Count(); i++)
10154 {
10155 SetHealthMax(zone_names.Get(i),"Health");
10156 }
10157 SetHealthMax("","Health");
10158 }
10159
10162 {
10163 float global_health = GetHealth01("","Health");
10164 array<string> zones = new array<string>;
10165 GetDamageZones(zones);
10166
10167 for (int i = 0; i < zones.Count(); i++)
10168 {
10169 SetHealth01(zones.Get(i),"Health",global_health);
10170 }
10171 }
10172
10175 {
10176 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
10177 }
10178
10180 {
10181 if (!hasRootAsPlayer)
10182 {
10183 if (refParentIB)
10184 {
10185
10186 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
10187 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
10188
10189 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
10190 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
10191
10194 }
10195 else
10196 {
10197
10200 }
10201 }
10202 }
10203
10205 {
10207 {
10208 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
10209 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
10210 {
10211 float heatPermCoef = 1.0;
10213 while (ent)
10214 {
10215 heatPermCoef *= ent.GetHeatPermeabilityCoef();
10216 ent = ent.GetHierarchyParent();
10217 }
10218
10219 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
10220 }
10221 }
10222 }
10223
10225 {
10226
10227 EntityAI parent = GetHierarchyParent();
10228 if (!parent)
10229 {
10230 hasParent = false;
10231 hasRootAsPlayer = false;
10232 }
10233 else
10234 {
10235 hasParent = true;
10236 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
10237 refParentIB =
ItemBase.Cast(parent);
10238 }
10239 }
10240
10241 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
10242 {
10243
10244 }
10245
10247 {
10248
10249 return false;
10250 }
10251
10253 {
10254
10255
10256 return false;
10257 }
10258
10260 {
10261
10262 return false;
10263 }
10264
10267 {
10268 return !GetIsFrozen() &&
IsOpen();
10269 }
10270
10272 {
10273 bool hasParent = false, hasRootAsPlayer = false;
10275
10276 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
10277 bool foodDecay =
g_Game.IsFoodDecayEnabled();
10278
10279 if (wwtu || foodDecay)
10280 {
10284
10285 if (processWetness || processTemperature || processDecay)
10286 {
10288
10289 if (processWetness)
10290 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
10291
10292 if (processTemperature)
10294
10295 if (processDecay)
10296 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
10297 }
10298 }
10299 }
10300
10303 {
10305 }
10306
10308 {
10311
10312 return super.GetTemperatureFreezeThreshold();
10313 }
10314
10316 {
10319
10320 return super.GetTemperatureThawThreshold();
10321 }
10322
10324 {
10327
10328 return super.GetItemOverheatThreshold();
10329 }
10330
10332 {
10334 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
10335
10336 return super.GetTemperatureFreezeTime();
10337 }
10338
10340 {
10342 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
10343
10344 return super.GetTemperatureThawTime();
10345 }
10346
10351
10353 {
10354 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
10355 }
10356
10358 {
10359 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
10360 }
10361
10364 {
10366 }
10367
10369 {
10371 }
10372
10374 {
10376 }
10377
10380 {
10381 return null;
10382 }
10383
10386 {
10387 return false;
10388 }
10389
10391 {
10393 {
10396 if (!trg)
10397 {
10399 explosive = this;
10400 }
10401
10402 explosive.PairRemote(trg);
10404
10405 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
10406 trg.SetPersistentPairID(persistentID);
10407 explosive.SetPersistentPairID(persistentID);
10408
10409 return true;
10410 }
10411 return false;
10412 }
10413
10416 {
10417 float ret = 1.0;
10420 ret *= GetHealth01();
10421
10422 return ret;
10423 }
10424
10425 #ifdef DEVELOPER
10426 override void SetDebugItem()
10427 {
10428 super.SetDebugItem();
10429 _itemBase = this;
10430 }
10431
10433 {
10434 string text = super.GetDebugText();
10435
10437 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
10438
10439 return text;
10440 }
10441 #endif
10442
10444 {
10445 return true;
10446 }
10447
10449
10451
10453 {
10456 }
10457
10458
10466
10482}
10483
10485{
10487 if (entity)
10488 {
10489 bool is_item = entity.IsInherited(
ItemBase);
10490 if (is_item && full_quantity)
10491 {
10494 }
10495 }
10496 else
10497 {
10499 return NULL;
10500 }
10501 return entity;
10502}
10503
10505{
10506 if (item)
10507 {
10508 if (health > 0)
10509 item.SetHealth("", "", health);
10510
10511 if (item.CanHaveTemperature())
10512 {
10514 if (item.CanFreeze())
10515 item.SetFrozen(false);
10516 }
10517
10518 if (item.HasEnergyManager())
10519 {
10520 if (quantity >= 0)
10521 {
10522 item.GetCompEM().SetEnergy0To1(quantity);
10523 }
10524 else
10525 {
10527 }
10528 }
10529 else if (item.IsMagazine())
10530 {
10531 Magazine mag = Magazine.Cast(item);
10532 if (quantity >= 0)
10533 {
10534 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
10535 }
10536 else
10537 {
10539 }
10540
10541 }
10542 else
10543 {
10544 if (quantity >= 0)
10545 {
10546 item.SetQuantityNormalized(quantity, false);
10547 }
10548 else
10549 {
10551 }
10552
10553 }
10554 }
10555}
10556
10557#ifdef DEVELOPER
10559#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.