5657{
5659 {
5660 return true;
5661 }
5662};
5663
5664
5665
5667{
5671
5673
5676
5677
5678
5679
5680
5689
5695
5700
5705
5726 protected bool m_IsResultOfSplit
5727
5729
5734
5735
5736
5738
5742
5743
5744
5746
5749
5750
5751
5757
5758
5766
5769
5770
5772
5773
5775
5776
5781
5782
5787
5788
5790
5791
5793 {
5798
5799 if (!
GetGame().IsDedicatedServer())
5800 {
5802 {
5804
5806 {
5808 }
5809 }
5810
5813 }
5814
5815 m_OldLocation = null;
5816
5818 {
5820 }
5821
5822 if (ConfigIsExisting("headSelectionsToHide"))
5823 {
5826 }
5827
5829 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
5830 {
5832 }
5833
5835
5836 m_IsResultOfSplit = false;
5837
5839 }
5840
5842 {
5843 super.InitItemVariables();
5844
5850 m_Count = ConfigGetInt(
"count");
5851
5854
5859
5862
5867
5879
5883
5884
5887 if (ConfigIsExisting("canBeSplit"))
5888 {
5891 }
5892
5894 if (ConfigIsExisting("itemBehaviour"))
5896
5897
5900 RegisterNetSyncVariableInt("m_VarLiquidType");
5901 RegisterNetSyncVariableInt("m_Cleanness",0,1);
5902
5903 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
5904 RegisterNetSyncVariableFloat("m_ImpactSpeed");
5905 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
5906
5907 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
5908 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
5909 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
5910 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
5911
5912 RegisterNetSyncVariableBool("m_IsBeingPlaced");
5913 RegisterNetSyncVariableBool("m_IsTakeable");
5914 RegisterNetSyncVariableBool("m_IsHologram");
5915
5918 {
5921 }
5922
5924
5926 if (ConfigIsExisting("temperaturePerQuantityWeight"))
5928
5929 }
5930
5932 {
5934 }
5935
5937 {
5940 {
5945 }
5946 }
5947
5948 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
5949 {
5951 {
5954 }
5955
5957 }
5958
5960 {
5966 }
5967
5969
5971 {
5973
5974 if (!action)
5975 {
5976 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
5977 return;
5978 }
5979
5981 if (!ai)
5982 {
5984 return;
5985 }
5986
5988 if (!action_array)
5989 {
5990 action_array = new array<ActionBase_Basic>;
5992 }
5993 if (LogManager.IsActionLogEnable())
5994 {
5995 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
5996 }
5997
5998 if (action_array.Find(action) != -1)
5999 {
6000 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
6001 }
6002 else
6003 {
6004 action_array.Insert(action);
6005 }
6006 }
6007
6009 {
6011 ActionBase action = player.GetActionManager().GetAction(actionName);
6014
6015 if (action_array)
6016 {
6017 action_array.RemoveItem(action);
6018 }
6019 }
6020
6021
6022
6024 {
6025 ActionOverrideData overrideData = new ActionOverrideData();
6029
6031 if (!actionMap)
6032 {
6035 }
6036
6037 actionMap.Insert(this.
Type(), overrideData);
6038
6039 }
6040
6042
6044
6045
6047 {
6050
6053
6054 string config_to_search = "CfgVehicles";
6055 string muzzle_owner_config;
6056
6058 {
6059 if (IsInherited(Weapon))
6060 config_to_search = "CfgWeapons";
6061
6062 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6063
6064 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
6065
6067
6068 if (config_OnFire_subclass_count > 0)
6069 {
6070 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
6071
6072 for (int i = 0; i < config_OnFire_subclass_count; i++)
6073 {
6074 string particle_class = "";
6076 string config_OnFire_entry = config_OnFire_class + particle_class;
6077 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
6078 WPOF_array.Insert(WPOF);
6079 }
6080
6081
6083 }
6084 }
6085
6087 {
6088 config_to_search = "CfgWeapons";
6089 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6090
6091 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
6092
6094
6095 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
6096 {
6097 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
6098
6099 for (i = 0; i < config_OnBulletCasingEject_count; i++)
6100 {
6101 string particle_class2 = "";
6103 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
6104 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
6105 WPOBE_array.Insert(WPOBE);
6106 }
6107
6108
6110 }
6111 }
6112 }
6113
6114
6116 {
6119
6121 {
6122 string config_to_search = "CfgVehicles";
6123
6124 if (IsInherited(Weapon))
6125 config_to_search = "CfgWeapons";
6126
6127 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6128 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
6129
6130 if (
GetGame().ConfigIsExisting(config_OnOverheating_class))
6131 {
6132
6134
6136 {
6138 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
6140 return;
6141 }
6142
6145
6146
6147
6149 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
6150
6151 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
6152 {
6153 string particle_class = "";
6155 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
6157
6158 if (entry_type == CT_CLASS)
6159 {
6160 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
6161 WPOOH_array.Insert(WPOF);
6162 }
6163 }
6164
6165
6167 }
6168 }
6169 }
6170
6172 {
6174 }
6175
6177 {
6179 {
6181
6184
6187
6188 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6189 }
6190 }
6191
6193 {
6195 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6196
6198 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6199
6201 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6202
6204 {
6206 }
6207 }
6208
6210 {
6212 }
6213
6215 {
6218 else
6220
6222 {
6225 }
6226 else
6227 {
6230
6233 }
6234
6236 }
6237
6239 {
6241 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6242 }
6243
6245 {
6247 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6249 }
6250
6252 {
6254 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6255 }
6256
6258 {
6261
6262 OverheatingParticle OP = new OverheatingParticle();
6267
6269 }
6270
6272 {
6275
6276 return -1;
6277 }
6278
6280 {
6282 {
6285
6286 for (int i = count; i > 0; --i)
6287 {
6288 int id = i - 1;
6291
6294
6295 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
6296 {
6297 if (p)
6298 {
6301 }
6302 }
6303 }
6304 }
6305 }
6306
6308 {
6310 {
6312 {
6313 int id = i - 1;
6315
6316 if (OP)
6317 {
6319
6320 if (p)
6321 {
6323 }
6324
6325 delete OP;
6326 }
6327 }
6328
6331 }
6332 }
6333
6336 {
6337 return 0.0;
6338 }
6339
6340
6342 {
6343 return 250;
6344 }
6345
6347 {
6348 return 0;
6349 }
6350
6353 {
6355 return true;
6356
6357 return false;
6358 }
6359
6362 {
6365
6367 {
6369 }
6370 else
6371 {
6372
6374 }
6375
6377 }
6378
6385 {
6386 return -1;
6387 }
6388
6389
6390
6391
6393 {
6395 {
6397 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6398
6399 if (r_index >= 0)
6400 {
6401 InventoryLocation r_il = new InventoryLocation;
6402 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6403
6404 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6407 {
6408 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6409 }
6411 {
6412 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6413 }
6414
6415 }
6416
6417 player.GetHumanInventory().ClearUserReservedLocation(this);
6418 }
6419
6422 }
6423
6424
6425
6426
6428 {
6429 return ItemBase.m_DebugActionsMask;
6430 }
6431
6433 {
6434 return ItemBase.m_DebugActionsMask & mask;
6435 }
6436
6438 {
6439 ItemBase.m_DebugActionsMask = mask;
6440 }
6441
6443 {
6444 ItemBase.m_DebugActionsMask |= mask;
6445 }
6446
6448 {
6449 ItemBase.m_DebugActionsMask &= ~mask;
6450 }
6451
6453 {
6455 {
6457 }
6458 else
6459 {
6461 }
6462 }
6463
6464
6466 {
6467 if (GetEconomyProfile())
6468 {
6469 float q_max = GetEconomyProfile().GetQuantityMax();
6470 if (q_max > 0)
6471 {
6472 float q_min = GetEconomyProfile().GetQuantityMin();
6473 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
6474
6476 {
6477 ComponentEnergyManager comp = GetCompEM();
6479 {
6481 }
6482 }
6484 {
6486
6487 }
6488
6489 }
6490 }
6491 }
6492
6495 {
6496 EntityAI parent = GetHierarchyParent();
6497
6498 if (parent)
6499 {
6500 InventoryLocation inventory_location_to_lock = new InventoryLocation;
6501 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
6502 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
6503 }
6504 }
6505
6508 {
6509 EntityAI parent = GetHierarchyParent();
6510
6511 if (parent)
6512 {
6513 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
6514 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
6515 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
6516 }
6517 }
6518
6520 {
6521
6522
6523
6524
6526
6528 {
6529 if (ScriptInputUserData.CanStoreInputUserData())
6530 {
6531 ScriptInputUserData ctx = new ScriptInputUserData;
6537 ctx.
Write(use_stack_max);
6540
6542 {
6543 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
6544 }
6545 }
6546 }
6547 else if (!
GetGame().IsMultiplayer())
6548 {
6550 }
6551 }
6552
6554 {
6556 }
6557
6559 {
6561 }
6562
6564 {
6566 }
6567
6569 {
6570
6571 return false;
6572 }
6573
6575 {
6576 return false;
6577 }
6578
6582 {
6583 return false;
6584 }
6585
6587 {
6588 return "";
6589 }
6590
6592
6594 {
6595 return false;
6596 }
6597
6599 {
6600 return true;
6601 }
6602
6603
6604
6606 {
6607 return true;
6608 }
6609
6611 {
6612 return true;
6613 }
6614
6616 {
6617 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6619 }
6620
6622 {
6624 }
6625
6627 {
6629 if (!is_being_placed)
6631 SetSynchDirty();
6632 }
6633
6634
6636
6638 {
6640 }
6641
6643 {
6645 }
6646
6648 {
6649 return 1;
6650 }
6651
6653 {
6654 return false;
6655 }
6656
6658 {
6660 SetSynchDirty();
6661 }
6662
6663
6664
6665
6666
6667
6668
6669
6670
6671
6672
6673
6674
6675
6676
6677
6678
6679
6680
6681
6682
6683
6684
6685
6686
6687
6688
6689
6690
6691
6692
6693
6694
6695
6696
6698 {
6699 super.OnMovedInsideCargo(container);
6700
6701 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6702 }
6703
6704 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
6705 {
6706 super.EEItemLocationChanged(oldLoc,newLoc);
6707
6708 PlayerBase new_player = null;
6709 PlayerBase old_player = null;
6710
6711 if (newLoc.GetParent())
6712 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
6713
6714 if (oldLoc.GetParent())
6715 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
6716
6718 {
6719 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
6720
6721 if (r_index >= 0)
6722 {
6723 InventoryLocation r_il = new InventoryLocation;
6724 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6725
6726 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6729 {
6730 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6731 }
6733 {
6734 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6735 }
6736
6737 }
6738 }
6739
6741 {
6742 if (new_player)
6743 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
6744
6745 if (new_player == old_player)
6746 {
6747
6748 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
6749 {
6751 {
6752 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
6753 {
6754 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6755 }
6756 }
6757 else
6758 {
6759 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6760 }
6761 }
6762
6763 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
6764 {
6765 int type = oldLoc.GetType();
6767 {
6768 oldLoc.GetParent().GetOnSetLock().Invoke(this);
6769 }
6771 {
6772 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
6773 }
6774 }
6775 if (!m_OldLocation)
6776 {
6777 m_OldLocation = new InventoryLocation;
6778 }
6779 m_OldLocation.Copy(oldLoc);
6780 }
6781 else
6782 {
6783 if (m_OldLocation)
6784 {
6785 m_OldLocation.Reset();
6786 }
6787 }
6788
6790 }
6791 else
6792 {
6793 if (new_player)
6794 {
6795 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
6796 if (res_index >= 0)
6797 {
6798 InventoryLocation il = new InventoryLocation;
6799 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
6801 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
6804 {
6805 il.
GetParent().GetOnReleaseLock().Invoke(it);
6806 }
6808 {
6810 }
6811
6812 }
6813 }
6815 {
6816
6818 }
6819
6820 if (m_OldLocation)
6821 {
6822 m_OldLocation.Reset();
6823 }
6824 }
6825 }
6826
6827 override void EOnContact(IEntity other, Contact extra)
6828 {
6830 {
6831 int liquidType = -1;
6833 if (impactSpeed > 0.0)
6834 {
6836 #ifndef SERVER
6838 #else
6840 SetSynchDirty();
6841 #endif
6843 }
6844 }
6845
6846 #ifdef SERVER
6847 if (GetCompEM() && GetCompEM().IsPlugged())
6848 {
6849 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
6850 GetCompEM().UnplugThis();
6851 }
6852 #endif
6853 }
6854
6856
6858 {
6860 }
6861
6863 {
6864
6865 }
6866
6868 {
6869 super.OnItemLocationChanged(old_owner, new_owner);
6870
6871 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
6872 PlayerBase playerNew = PlayerBase.Cast(new_owner);
6873
6874 if (!relatedPlayer && playerNew)
6875 relatedPlayer = playerNew;
6876
6877 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
6878 {
6880 if (actionMgr)
6881 {
6882 ActionBase currentAction = actionMgr.GetRunningAction();
6883 if (currentAction)
6885 }
6886 }
6887
6888 Man ownerPlayerOld = null;
6889 Man ownerPlayerNew = null;
6890
6891 if (old_owner)
6892 {
6893 if (old_owner.
IsMan())
6894 {
6895 ownerPlayerOld = Man.Cast(old_owner);
6896 }
6897 else
6898 {
6899 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
6900 }
6901 }
6902 else
6903 {
6905 {
6907
6908 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
6909 {
6910 GetCompEM().UnplugThis();
6911 }
6912 }
6913 }
6914
6915 if (new_owner)
6916 {
6917 if (new_owner.
IsMan())
6918 {
6919 ownerPlayerNew = Man.Cast(new_owner);
6920 }
6921 else
6922 {
6923 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
6924 }
6925 }
6926
6927 if (ownerPlayerOld != ownerPlayerNew)
6928 {
6929 if (ownerPlayerOld)
6930 {
6931 array<EntityAI> subItemsExit = new array<EntityAI>;
6933 for (int i = 0; i < subItemsExit.Count(); i++)
6934 {
6937 }
6938 }
6939
6940 if (ownerPlayerNew)
6941 {
6942 array<EntityAI> subItemsEnter = new array<EntityAI>;
6944 for (int j = 0; j < subItemsEnter.Count(); j++)
6945 {
6948 }
6949 }
6950 }
6951 else if (ownerPlayerNew != null)
6952 {
6953 PlayerBase nplayer;
6954 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
6955 {
6956 array<EntityAI> subItemsUpdate = new array<EntityAI>;
6958 for (int k = 0; k < subItemsUpdate.Count(); k++)
6959 {
6961 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
6962 }
6963 }
6964 }
6965
6966 if (old_owner)
6967 old_owner.OnChildItemRemoved(this);
6968 if (new_owner)
6969 new_owner.OnChildItemReceived(this);
6970 }
6971
6972
6974 {
6975 super.EEDelete(parent);
6976 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
6977 if (player)
6978 {
6980
6981 if (player.IsAlive())
6982 {
6983 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6984 if (r_index >= 0)
6985 {
6986 InventoryLocation r_il = new InventoryLocation;
6987 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6988
6989 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6992 {
6993 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6994 }
6996 {
6997 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6998 }
6999
7000 }
7001
7002 player.RemoveQuickBarEntityShortcut(this);
7003 }
7004 }
7005 }
7006
7008 {
7009 super.EEKilled(killer);
7010
7013 {
7014 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
7015 {
7016 if (IsMagazine())
7017 {
7018 if (Magazine.Cast(this).GetAmmoCount() > 0)
7019 {
7021 }
7022 }
7023 else
7024 {
7026 }
7027 }
7028 }
7029 }
7030
7032 {
7033 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7034
7035 super.OnWasAttached(parent, slot_id);
7036
7039
7041 }
7042
7044 {
7045 super.OnWasDetached(parent, slot_id);
7046
7049 }
7050
7052 {
7053 int idx;
7056
7057 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7058 if (inventory_slots.Count() < 1)
7059 {
7060 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
7061 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
7062 }
7063 else
7064 {
7065 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
7066 }
7067
7068 idx = inventory_slots.Find(slot);
7069 if (idx < 0)
7070 return "";
7071
7072 return attach_types.Get(idx);
7073 }
7074
7076 {
7077 int idx = -1;
7078 string slot;
7079
7082
7083 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7084 if (inventory_slots.Count() < 1)
7085 {
7086 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
7087 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7088 }
7089 else
7090 {
7091 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
7092 if (detach_types.Count() < 1)
7093 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7094 }
7095
7096 for (int i = 0; i < inventory_slots.Count(); i++)
7097 {
7098 slot = inventory_slots.Get(i);
7099 }
7100
7101 if (slot != "")
7102 {
7103 if (detach_types.Count() == 1)
7104 idx = 0;
7105 else
7106 idx = inventory_slots.Find(slot);
7107 }
7108 if (idx < 0)
7109 return "";
7110
7111 return detach_types.Get(idx);
7112 }
7113
7115 {
7116
7118
7119
7120 float min_time = 1;
7121 float max_time = 3;
7122 float delay = Math.RandomFloat(min_time, max_time);
7123
7124 explode_timer.Run(delay, this, "DoAmmoExplosion");
7125 }
7126
7128 {
7129 Magazine magazine = Magazine.Cast(this);
7130 int pop_sounds_count = 6;
7131 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
7132
7133
7134 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
7135 string sound_name = pop_sounds[ sound_idx ];
7137
7138
7139 magazine.ServerAddAmmoCount(-1);
7140
7141
7142 float min_temp_to_explode = 100;
7143
7144 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
7145 {
7147 }
7148 }
7149
7150
7151 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
7152 {
7153 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
7154
7155 const int CHANCE_DAMAGE_CARGO = 4;
7156 const int CHANCE_DAMAGE_ATTACHMENT = 1;
7157 const int CHANCE_DAMAGE_NOTHING = 2;
7158
7160 {
7161 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
7162 int chances;
7163 int rnd;
7164
7165 if (GetInventory().GetCargo())
7166 {
7167 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7168 rnd = Math.RandomInt(0,chances);
7169
7170 if (rnd < CHANCE_DAMAGE_CARGO)
7171 {
7173 }
7174 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
7175 {
7177 }
7178 }
7179 else
7180 {
7181 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7182 rnd = Math.RandomInt(0,chances);
7183
7184 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
7185 {
7187 }
7188 }
7189 }
7190 }
7191
7193 {
7194 if (GetInventory().GetCargo())
7195 {
7196 int item_count = GetInventory().GetCargo().GetItemCount();
7197 if (item_count > 0)
7198 {
7199 int random_pick = Math.RandomInt(0, item_count);
7201 if (!item.IsExplosive())
7202 {
7203 item.AddHealth("","",damage);
7204 return true;
7205 }
7206 }
7207 }
7208 return false;
7209 }
7210
7212 {
7213 int attachment_count = GetInventory().AttachmentCount();
7214 if (attachment_count > 0)
7215 {
7216 int random_pick = Math.RandomInt(0, attachment_count);
7217 ItemBase attachment =
ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
7218 if (!attachment.IsExplosive())
7219 {
7220 attachment.AddHealth("","",damage);
7221 return true;
7222 }
7223 }
7224 return false;
7225 }
7226
7228 {
7230 }
7231
7233 {
7235 return GetInventory().CanRemoveEntity();
7236
7237 return false;
7238 }
7239
7241 {
7242
7244 return false;
7245
7246
7248 return false;
7249
7250
7251
7253 if (delta == 0)
7254 return false;
7255
7256
7257 return true;
7258 }
7259
7261 {
7263 {
7264 if (ScriptInputUserData.CanStoreInputUserData())
7265 {
7266 ScriptInputUserData ctx = new ScriptInputUserData;
7271 ctx.
Write(destination_entity);
7275 }
7276 }
7277 else if (!
GetGame().IsMultiplayer())
7278 {
7280 }
7281 }
7282
7284 {
7285 float split_quantity_new;
7289 InventoryLocation loc = new InventoryLocation;
7290
7291 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7292 {
7294 split_quantity_new = stack_max;
7295 else
7297
7299 {
7300 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7301 if (new_item)
7302 {
7303 new_item.SetResultOfSplit(true);
7304 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7306 new_item.
SetQuantity(split_quantity_new,
false,
true);
7307 }
7308 }
7309 }
7310 else if (destination_entity && slot_id == -1)
7311 {
7312 if (quantity > stack_max)
7313 split_quantity_new = stack_max;
7314 else
7315 split_quantity_new = quantity;
7316
7318 {
7320 {
7323 }
7324
7325 if (new_item)
7326 {
7327 new_item.SetResultOfSplit(true);
7328 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7330 new_item.
SetQuantity(split_quantity_new,
false,
true);
7331 }
7332 }
7333 }
7334 else
7335 {
7336 if (stack_max != 0)
7337 {
7339 {
7341 }
7342
7343 if (split_quantity_new == 0)
7344 {
7345 if (!
GetGame().IsMultiplayer())
7346 player.PhysicalPredictiveDropItem(this);
7347 else
7348 player.ServerDropEntity(this);
7349 return;
7350 }
7351
7353 {
7355
7356 if (new_item)
7357 {
7358 new_item.SetResultOfSplit(true);
7359 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7362 new_item.PlaceOnSurface();
7363 }
7364 }
7365 }
7366 }
7367 }
7368
7370 {
7371 float split_quantity_new;
7375 InventoryLocation loc = new InventoryLocation;
7376
7377 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7378 {
7380 split_quantity_new = stack_max;
7381 else
7383
7385 {
7386 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7387 if (new_item)
7388 {
7389 new_item.SetResultOfSplit(true);
7390 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7392 new_item.
SetQuantity(split_quantity_new,
false,
true);
7393 }
7394 }
7395 }
7396 else if (destination_entity && slot_id == -1)
7397 {
7398 if (quantity > stack_max)
7399 split_quantity_new = stack_max;
7400 else
7401 split_quantity_new = quantity;
7402
7404 {
7406 {
7409 }
7410
7411 if (new_item)
7412 {
7413 new_item.SetResultOfSplit(true);
7414 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7416 new_item.
SetQuantity(split_quantity_new,
false,
true);
7417 }
7418 }
7419 }
7420 else
7421 {
7422 if (stack_max != 0)
7423 {
7425 {
7427 }
7428
7430 {
7432
7433 if (new_item)
7434 {
7435 new_item.SetResultOfSplit(true);
7436 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7439 new_item.PlaceOnSurface();
7440 }
7441 }
7442 }
7443 }
7444 }
7445
7447 {
7449 {
7450 if (ScriptInputUserData.CanStoreInputUserData())
7451 {
7452 ScriptInputUserData ctx = new ScriptInputUserData;
7457 dst.WriteToContext(ctx);
7459 }
7460 }
7461 else if (!
GetGame().IsMultiplayer())
7462 {
7464 }
7465 }
7466
7468 {
7470 {
7471 if (ScriptInputUserData.CanStoreInputUserData())
7472 {
7473 ScriptInputUserData ctx = new ScriptInputUserData;
7478 ctx.
Write(destination_entity);
7484 }
7485 }
7486 else if (!
GetGame().IsMultiplayer())
7487 {
7489 }
7490 }
7491
7493 {
7495 }
7496
7498 {
7500 float split_quantity_new;
7502 if (dst.IsValid())
7503 {
7504 int slot_id = dst.GetSlot();
7506
7507 if (quantity > stack_max)
7508 split_quantity_new = stack_max;
7509 else
7510 split_quantity_new = quantity;
7511
7513 {
7515
7516 if (new_item)
7517 {
7518 new_item.SetResultOfSplit(true);
7519 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7521 new_item.
SetQuantity(split_quantity_new,
false,
true);
7522 }
7523
7524 return new_item;
7525 }
7526 }
7527
7528 return null;
7529 }
7530
7532 {
7534 float split_quantity_new;
7536 if (destination_entity)
7537 {
7539 if (quantity > stackable)
7540 split_quantity_new = stackable;
7541 else
7542 split_quantity_new = quantity;
7543
7545 {
7546 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
7547 if (new_item)
7548 {
7549 new_item.SetResultOfSplit(true);
7550 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7552 new_item.
SetQuantity(split_quantity_new,
false,
true);
7553 }
7554 }
7555 }
7556 }
7557
7559 {
7561 {
7562 if (ScriptInputUserData.CanStoreInputUserData())
7563 {
7564 ScriptInputUserData ctx = new ScriptInputUserData;
7569 ItemBase destination_entity =
this;
7570 ctx.
Write(destination_entity);
7574 }
7575 }
7576 else if (!
GetGame().IsMultiplayer())
7577 {
7579 }
7580 }
7581
7583 {
7585 float split_quantity_new;
7587 if (player)
7588 {
7590 if (quantity > stackable)
7591 split_quantity_new = stackable;
7592 else
7593 split_quantity_new = quantity;
7594
7596 {
7597 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
7598 new_item =
ItemBase.Cast(in_hands);
7599 if (new_item)
7600 {
7601 new_item.SetResultOfSplit(true);
7602 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7604 new_item.SetQuantity(split_quantity_new, false, true);
7605 }
7606 }
7607 }
7608 }
7609
7611 {
7613 float split_quantity_new = Math.Floor(quantity * 0.5);
7614
7616 return;
7617
7619
7620 if (new_item)
7621 {
7622 if (new_item.GetQuantityMax() < split_quantity_new)
7623 {
7624 split_quantity_new = new_item.GetQuantityMax();
7625 }
7626
7627 new_item.SetResultOfSplit(true);
7628 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7629
7631 {
7634 }
7635 else
7636 {
7638 new_item.
SetQuantity(split_quantity_new,
false,
true);
7639 }
7640 }
7641 }
7642
7644 {
7646 float split_quantity_new = Math.Floor(quantity / 2);
7647
7649 return;
7650
7651 InventoryLocation invloc = new InventoryLocation;
7653
7655 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
7656
7657 if (new_item)
7658 {
7659 if (new_item.GetQuantityMax() < split_quantity_new)
7660 {
7661 split_quantity_new = new_item.GetQuantityMax();
7662 }
7664 {
7667 }
7668 else if (split_quantity_new > 1)
7669 {
7671 new_item.
SetQuantity(split_quantity_new,
false,
true);
7672 }
7673 }
7674 }
7675
7678 {
7679 SetWeightDirty();
7681
7682 if (parent)
7683 parent.OnAttachmentQuantityChangedEx(this, delta);
7684
7686 {
7688 {
7690 }
7692 {
7693 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
7695 }
7696 }
7697
7698 }
7699
7702 {
7703
7704 }
7705
7708 {
7710 }
7711
7713 {
7714 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
7715
7717 {
7718 if (newLevel == GameConstants.STATE_RUINED)
7719 {
7721 EntityAI parent = GetHierarchyParent();
7722 if (parent && parent.IsFireplace())
7723 {
7724 CargoBase cargo = GetInventory().GetCargo();
7725 if (cargo)
7726 {
7728 {
7730 }
7731 }
7732 }
7733 }
7734
7736 {
7737
7739 return;
7740 }
7741
7742 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
7743 {
7745 }
7746 }
7747 }
7748
7749
7751 {
7752 super.OnRightClick();
7753
7755 {
7757 {
7758 if (ScriptInputUserData.CanStoreInputUserData())
7759 {
7760 EntityAI root = GetHierarchyRoot();
7761 Man playerOwner = GetHierarchyRootPlayer();
7762 InventoryLocation dst = new InventoryLocation;
7763
7764
7765 if (!playerOwner && root && root == this)
7766 {
7768 }
7769 else
7770 {
7771
7772 GetInventory().GetCurrentInventoryLocation(dst);
7774 {
7777 {
7779 }
7780 else
7781 {
7783
7784
7785 if (
GetGame().
GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
7786 {
7788 }
7789 else
7790 {
7791 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
7792 }
7793 }
7794 }
7795 }
7796
7797 ScriptInputUserData ctx = new ScriptInputUserData;
7805 }
7806 }
7807 else if (!
GetGame().IsMultiplayer())
7808 {
7810 }
7811 }
7812 }
7813
7815 {
7816 if (root)
7817 {
7818 vector m4[4];
7819 root.GetTransform(m4);
7820 dst.SetGround(this, m4);
7821 }
7822 else
7823 {
7824 GetInventory().GetCurrentInventoryLocation(dst);
7825 }
7826 }
7827
7828 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
7829 {
7830
7831 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
7832 return false;
7833
7834 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
7835 return false;
7836
7837
7839 return false;
7840
7841
7842 Magazine mag = Magazine.Cast(this);
7843 if (mag)
7844 {
7845 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
7846 return false;
7847
7848 if (stack_max_limit)
7849 {
7850 Magazine other_mag = Magazine.Cast(other_item);
7851 if (other_item)
7852 {
7853 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
7854 return false;
7855 }
7856
7857 }
7858 }
7859 else
7860 {
7861
7863 return false;
7864
7866 return false;
7867 }
7868
7869 PlayerBase player = null;
7870 if (CastTo(player, GetHierarchyRootPlayer()))
7871 {
7872 if (player.GetInventory().HasAttachment(this))
7873 return false;
7874
7875 if (player.IsItemsToDelete())
7876 return false;
7877 }
7878
7879 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
7880 return false;
7881
7882 int slotID;
7884 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
7885 return false;
7886
7887 return true;
7888 }
7889
7891 {
7893 }
7894
7896 {
7897 return m_IsResultOfSplit;
7898 }
7899
7901 {
7902 m_IsResultOfSplit = value;
7903 }
7904
7906 {
7908 }
7909
7911 {
7912 float other_item_quantity = other_item.GetQuantity();
7913 float this_free_space;
7914
7916
7918
7919 if (other_item_quantity > this_free_space)
7920 {
7921 return this_free_space;
7922 }
7923 else
7924 {
7925 return other_item_quantity;
7926 }
7927 }
7928
7930 {
7932 }
7933
7935 {
7937 return;
7938
7939 if (!IsMagazine() && other_item)
7940 {
7942 if (quantity_used != 0)
7943 {
7944 float hp1 = GetHealth01("","");
7945 float hp2 = other_item.GetHealth01("","");
7946 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
7947 hpResult = hpResult / (
GetQuantity() + quantity_used);
7948
7949 hpResult *= GetMaxHealth();
7950 Math.Round(hpResult);
7951 SetHealth("", "Health", hpResult);
7952
7954 other_item.AddQuantity(-quantity_used);
7955 }
7956 }
7958 }
7959
7961 {
7962 #ifdef SERVER
7963 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
7964 GetHierarchyParent().IncreaseLifetimeUp();
7965 #endif
7966 };
7967
7969 {
7970 PlayerBase p = PlayerBase.Cast(player);
7971
7972 array<int> recipesIds = p.m_Recipes;
7973 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
7974 if (moduleRecipesManager)
7975 {
7976 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
7977 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
7978 }
7979
7980 for (int i = 0;i < recipesIds.Count(); i++)
7981 {
7982 int key = recipesIds.Get(i);
7983 string recipeName = moduleRecipesManager.GetRecipeName(key);
7985 }
7986 }
7987
7988
7989 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
7990 {
7991 super.GetDebugActions(outputList);
7992
7993
7999
8000
8005
8010
8011
8015
8016
8018 {
8022 }
8023
8026
8027
8031
8033
8034 InventoryLocation loc = new InventoryLocation();
8035 GetInventory().GetCurrentInventoryLocation(loc);
8037 {
8038 if (Gizmo_IsSupported())
8041 }
8042
8044 }
8045
8046
8047
8048
8050 {
8051 super.OnAction(action_id, player, ctx);
8052
8054 {
8055 switch (action_id)
8056 {
8059 return true;
8062 return true;
8063 }
8064 }
8065
8067 {
8068 switch (action_id)
8069 {
8071 Delete();
8072 return true;
8073 }
8074 }
8075
8076 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
8077 {
8078 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8079 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
8080 PlayerBase p = PlayerBase.Cast(player);
8081 if (
EActions.RECIPES_RANGE_START < 1000)
8082 {
8083 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
8084 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
8085 }
8086 }
8087 #ifndef SERVER
8088 else if (action_id ==
EActions.WATCH_PLAYER)
8089 {
8090 PluginDeveloper.SetDeveloperItemClientEx(player);
8091 }
8092 #endif
8094 {
8095 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
8096 {
8097 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
8098 OnDebugButtonPressServer(id + 1);
8099 }
8100
8101 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
8102 {
8103 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
8105 }
8106
8107 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
8108 {
8109 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
8111 }
8112
8113 else if (action_id ==
EActions.ADD_QUANTITY)
8114 {
8115 if (IsMagazine())
8116 {
8117 Magazine mag = Magazine.Cast(this);
8118 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
8119 }
8120 else
8121 {
8123 }
8124
8125 if (m_EM)
8126 {
8127 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
8128 }
8129
8130 }
8131
8132 else if (action_id ==
EActions.REMOVE_QUANTITY)
8133 {
8134 if (IsMagazine())
8135 {
8136 Magazine mag2 = Magazine.Cast(this);
8137 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
8138 }
8139 else
8140 {
8142 }
8143 if (m_EM)
8144 {
8145 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
8146 }
8147
8148 }
8149
8150 else if (action_id ==
EActions.SET_QUANTITY_0)
8151 {
8153
8154 if (m_EM)
8155 {
8156 m_EM.SetEnergy(0);
8157 }
8158 }
8159
8160 else if (action_id ==
EActions.SET_MAX_QUANTITY)
8161 {
8163
8164 if (m_EM)
8165 {
8166 m_EM.SetEnergy(m_EM.GetEnergyMax());
8167 }
8168 }
8169
8170 else if (action_id ==
EActions.ADD_HEALTH)
8171 {
8172 AddHealth("","",GetMaxHealth("","Health")/5);
8173 }
8174 else if (action_id ==
EActions.REMOVE_HEALTH)
8175 {
8176 AddHealth("","",-GetMaxHealth("","Health")/5);
8177 }
8178 else if (action_id ==
EActions.DESTROY_HEALTH)
8179 {
8180 SetHealth01("","",0);
8181 }
8182 else if (action_id ==
EActions.WATCH_ITEM)
8183 {
8185 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
8186 #ifdef DEVELOPER
8187 SetDebugDeveloper_item(this);
8188 #endif
8189 }
8190
8191 else if (action_id ==
EActions.ADD_TEMPERATURE)
8192 {
8193 AddTemperature(20);
8194
8195 }
8196
8197 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
8198 {
8199 AddTemperature(-20);
8200
8201 }
8202
8203 else if (action_id ==
EActions.FLIP_FROZEN)
8204 {
8205 SetFrozen(!GetIsFrozen());
8206
8207 }
8208
8209 else if (action_id ==
EActions.ADD_WETNESS)
8210 {
8212
8213 }
8214
8215 else if (action_id ==
EActions.REMOVE_WETNESS)
8216 {
8218
8219 }
8220
8221 else if (action_id ==
EActions.LIQUIDTYPE_UP)
8222 {
8225
8226
8227 }
8228
8229 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
8230 {
8233 }
8234
8235 else if (action_id ==
EActions.MAKE_SPECIAL)
8236 {
8237 auto debugParams = DebugSpawnParams.WithPlayer(player);
8238 OnDebugSpawnEx(debugParams);
8239 }
8240
8241 }
8242
8243
8244 return false;
8245 }
8246
8247
8248
8249
8253
8256
8257
8258
8260 {
8261 return false;
8262 }
8263
8264
8266 {
8267 return true;
8268 }
8269
8270
8272 {
8273 return true;
8274 }
8275
8276
8277
8279 {
8280 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
8282 }
8283
8286 {
8287 return null;
8288 }
8289
8291 {
8292 return false;
8293 }
8294
8296 {
8297 return false;
8298 }
8299
8303
8304
8306 {
8307 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8308 return module_repairing.CanRepair(this, item_repair_kit);
8309 }
8310
8311
8312 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
8313 {
8314 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8315 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
8316 }
8317
8318
8320 {
8321
8322
8323
8324
8325
8326
8327
8328
8329 return 1;
8330 }
8331
8332
8333
8335 {
8337 }
8338
8339
8340
8342 {
8344 }
8345
8346
8355 {
8356 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8357
8358 if (player)
8359 {
8360 player.MessageStatus(text);
8361 }
8362 }
8363
8364
8373 {
8374 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8375
8376 if (player)
8377 {
8378 player.MessageAction(text);
8379 }
8380 }
8381
8382
8391 {
8392 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8393
8394 if (player)
8395 {
8396 player.MessageFriendly(text);
8397 }
8398 }
8399
8400
8409 {
8410 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8411
8412 if (player)
8413 {
8414 player.MessageImportant(text);
8415 }
8416 }
8417
8419 {
8420 return true;
8421 }
8422
8423
8424 override bool KindOf(
string tag)
8425 {
8426 bool found = false;
8427 string item_name = this.
GetType();
8430
8431 int array_size = item_tag_array.Count();
8432 for (int i = 0; i < array_size; i++)
8433 {
8434 if (item_tag_array.Get(i) == tag)
8435 {
8436 found = true;
8437 break;
8438 }
8439 }
8440 return found;
8441 }
8442
8443
8445 {
8446
8447 super.OnRPC(sender, rpc_type,ctx);
8448
8449
8450 switch (rpc_type)
8451 {
8452 #ifndef SERVER
8453 case ERPCs.RPC_SOUND_LOCK_ATTACH:
8454 Param2<bool, string> p = new Param2<bool, string>(false, "");
8455
8457 return;
8458
8459 bool play = p.param1;
8460 string soundSet = p.param2;
8461
8462 if (play)
8463 {
8465 {
8467 {
8469 }
8470 }
8471 else
8472 {
8474 }
8475 }
8476 else
8477 {
8479 }
8480
8481 break;
8482 #endif
8483
8484 }
8485
8487 {
8489 }
8490 }
8491
8492
8493
8494
8496 {
8497 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8498 return plugin.GetID(
name);
8499 }
8500
8502 {
8503 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8504 return plugin.GetName(id);
8505 }
8506
8509 {
8510
8511
8512 int varFlags;
8513 if (!ctx.
Read(varFlags))
8514 return;
8515
8516 if (varFlags & ItemVariableFlags.FLOAT)
8517 {
8519 }
8520 }
8521
8523 {
8524
8525 super.SerializeNumericalVars(floats_out);
8526
8527
8528
8530 {
8532 }
8533
8535 {
8537 }
8538
8540 {
8542 }
8543
8545 {
8550 }
8551
8553 {
8555 }
8556 }
8557
8559 {
8560
8561 super.DeSerializeNumericalVars(floats);
8562
8563
8564 int index = 0;
8565 int mask = Math.Round(floats.Get(index));
8566
8567 index++;
8568
8570 {
8572 {
8574 }
8575 else
8576 {
8577 float quantity = floats.Get(index);
8579 }
8580 index++;
8581 }
8582
8584 {
8585 float wet = floats.Get(index);
8587 index++;
8588 }
8589
8591 {
8592 int liquidtype = Math.Round(floats.Get(index));
8594 index++;
8595 }
8596
8598 {
8600 index++;
8602 index++;
8604 index++;
8606 index++;
8607 }
8608
8610 {
8611 int cleanness = Math.Round(floats.Get(index));
8613 index++;
8614 }
8615 }
8616
8618 {
8619 super.WriteVarsToCTX(ctx);
8620
8621
8623 {
8625 }
8626
8628 {
8630 }
8631
8633 {
8635 }
8636
8638 {
8639 int r,g,b,a;
8645 }
8646
8648 {
8650 }
8651 }
8652
8654 {
8655 if (!super.ReadVarsFromCTX(ctx,version))
8656 return false;
8657
8658 int intValue;
8659 float value;
8660
8661 if (version < 140)
8662 {
8663 if (!ctx.
Read(intValue))
8664 return false;
8665
8666 m_VariablesMask = intValue;
8667 }
8668
8670 {
8671 if (!ctx.
Read(value))
8672 return false;
8673
8675 {
8677 }
8678 else
8679 {
8681 }
8682 }
8683
8684 if (version < 140)
8685 {
8687 {
8688 if (!ctx.
Read(value))
8689 return false;
8690 SetTemperatureDirect(value);
8691 }
8692 }
8693
8695 {
8696 if (!ctx.
Read(value))
8697 return false;
8699 }
8700
8702 {
8703 if (!ctx.
Read(intValue))
8704 return false;
8706 }
8707
8709 {
8710 int r,g,b,a;
8712 return false;
8714 return false;
8716 return false;
8718 return false;
8719
8721 }
8722
8724 {
8725 if (!ctx.
Read(intValue))
8726 return false;
8728 }
8729
8730 if (version >= 138 && version < 140)
8731 {
8733 {
8734 if (!ctx.
Read(intValue))
8735 return false;
8736 SetFrozen(intValue);
8737 }
8738 }
8739
8740 return true;
8741 }
8742
8743
8745 {
8748 {
8750 }
8751
8752 if (!super.OnStoreLoad(ctx, version))
8753 {
8755 return false;
8756 }
8757
8758 if (version >= 114)
8759 {
8760 bool hasQuickBarIndexSaved;
8761
8762 if (!ctx.
Read(hasQuickBarIndexSaved))
8763 {
8765 return false;
8766 }
8767
8768 if (hasQuickBarIndexSaved)
8769 {
8770 int itmQBIndex;
8771
8772
8773 if (!ctx.
Read(itmQBIndex))
8774 {
8776 return false;
8777 }
8778
8779 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
8780 if (itmQBIndex != -1 && parentPlayer)
8781 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
8782 }
8783 }
8784 else
8785 {
8786
8787 PlayerBase player;
8788 int itemQBIndex;
8789 if (version ==
int.
MAX)
8790 {
8791 if (!ctx.
Read(itemQBIndex))
8792 {
8794 return false;
8795 }
8796 }
8797 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
8798 {
8799
8800 if (!ctx.
Read(itemQBIndex))
8801 {
8803 return false;
8804 }
8805 if (itemQBIndex != -1 && player)
8806 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
8807 }
8808 }
8809
8810 if (version < 140)
8811 {
8812
8813 if (!LoadVariables(ctx, version))
8814 {
8816 return false;
8817 }
8818 }
8819
8820
8822 {
8824 return false;
8825 }
8826 if (version >= 132)
8827 {
8829 if (raib)
8830 {
8832 {
8834 return false;
8835 }
8836 }
8837 }
8838
8840 return true;
8841 }
8842
8843
8844
8846 {
8847 super.OnStoreSave(ctx);
8848
8849 PlayerBase player;
8850 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
8851 {
8853
8854 int itemQBIndex = -1;
8855 itemQBIndex = player.FindQuickBarEntityIndex(this);
8856 ctx.
Write(itemQBIndex);
8857 }
8858 else
8859 {
8861 }
8862
8864
8866 if (raib)
8867 {
8869 }
8870 }
8871
8872
8874 {
8875 super.AfterStoreLoad();
8876
8878 {
8880 }
8881
8883 {
8886 }
8887 }
8888
8890 {
8891 super.EEOnAfterLoad();
8892
8894 {
8896 }
8897
8900 }
8901
8903 {
8904 return false;
8905 }
8906
8907
8908
8910 {
8912 {
8913 #ifdef PLATFORM_CONSOLE
8914
8916 {
8918 if (menu)
8919 {
8921 }
8922 }
8923 #endif
8924 }
8925
8927 {
8930 }
8931
8933 {
8934 SetWeightDirty();
8936 }
8938 {
8941 }
8942
8944 {
8947 }
8949 {
8952 }
8953
8954 super.OnVariablesSynchronized();
8955 }
8956
8957
8958
8960 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
8961 {
8962 if (!IsServerCheck(allow_client))
8963 return false;
8964
8966 return false;
8967
8970
8971 if (value <= (min + 0.001))
8972 value = min;
8973
8974 if (value == min)
8975 {
8976 if (destroy_config)
8977 {
8978 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
8979 if (dstr)
8980 {
8982 this.Delete();
8983 return true;
8984 }
8985 }
8986 else if (destroy_forced)
8987 {
8989 this.Delete();
8990 return true;
8991 }
8992
8994 }
8995
8998
9000 {
9002
9003 if (delta)
9005 }
9006
9008
9009 return false;
9010 }
9011
9012
9014 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9015 {
9017 }
9018
9020 {
9023 }
9024
9026 {
9029 }
9030
9032 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9033 {
9034 float value_clamped = Math.Clamp(value, 0, 1);
9036 SetQuantity(result, destroy_config, destroy_forced);
9037 }
9038
9039
9042 {
9044 }
9045
9047 {
9049 }
9050
9051
9052
9053
9054
9055
9056
9057
9058
9059
9061 {
9062 int slot = -1;
9063 if (GetInventory())
9064 {
9065 InventoryLocation il = new InventoryLocation;
9066 GetInventory().GetCurrentInventoryLocation(il);
9068 }
9069
9071 }
9072
9074 {
9075 float quantity_max = 0;
9076
9078 {
9079 if (attSlotID != -1)
9080 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
9081
9082 if (quantity_max <= 0)
9084 }
9085
9086 if (quantity_max <= 0)
9088
9089 return quantity_max;
9090 }
9091
9093 {
9095 }
9096
9098 {
9100 }
9101
9102
9104 {
9106 }
9107
9109 {
9111 }
9112
9114 {
9116 }
9117
9118
9120 {
9121
9122 float weightEx = GetWeightEx();
9123 float special = GetInventoryAndCargoWeight();
9124 return weightEx - special;
9125 }
9126
9127
9129 {
9131 }
9132
9134 {
9136 {
9137 #ifdef DEVELOPER
9138 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9139 {
9140 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
9142 }
9143 #endif
9144
9146 }
9147 else if (HasEnergyManager())
9148 {
9149 #ifdef DEVELOPER
9150 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9151 {
9152 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
9153 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
9154 }
9155 #endif
9156 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
9157 }
9158 else
9159 {
9160 #ifdef DEVELOPER
9161 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9162 {
9163 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
9164 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
9165 }
9166 #endif
9167 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
9168 }
9169 }
9170
9173 {
9174 int item_count = 0;
9176
9177 if (GetInventory().GetCargo() != NULL)
9178 {
9179 item_count = GetInventory().GetCargo().GetItemCount();
9180 }
9181
9182 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
9183 {
9184 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
9185 if (item)
9186 item_count += item.GetNumberOfItems();
9187 }
9188 return item_count;
9189 }
9190
9193 {
9194 float weight = 0;
9195 float wetness = 1;
9196 if (include_wetness)
9199 {
9200 weight = wetness * m_ConfigWeight;
9201 }
9203 {
9204 weight = 1;
9205 }
9206 return weight;
9207 }
9208
9209
9210
9212 {
9213 if ((
GetGame().IsServer() || !
GetGame().IsMultiplayer()) && GetInventory())
9214 {
9215 GameInventory inv = GetInventory();
9216 array<EntityAI> items = new array<EntityAI>;
9218 for (int i = 0; i < items.Count(); i++)
9219 {
9221 if (item)
9222 {
9224 }
9225 }
9226 }
9227 }
9228
9229
9230
9231
9233 {
9234 float energy = 0;
9235 if (HasEnergyManager())
9236 {
9237 energy = GetCompEM().GetEnergy();
9238 }
9239 return energy;
9240 }
9241
9242
9244 {
9245 super.OnEnergyConsumed();
9246
9248 }
9249
9251 {
9252 super.OnEnergyAdded();
9253
9255 }
9256
9257
9259 {
9260 if (
GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
9261 {
9263 {
9264 float energy_0to1 = GetCompEM().GetEnergy0To1();
9266 }
9267 }
9268 }
9269
9270
9272 {
9273 return ConfigGetFloat("heatIsolation");
9274 }
9275
9277 {
9279 }
9280
9282 {
9283 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
9284 if (
GetGame().ConfigIsExisting(paramPath))
9286
9287 return 0.0;
9288 }
9289
9291 {
9292 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
9293 if (
GetGame().ConfigIsExisting(paramPath))
9295
9296 return 0.0;
9297 }
9298
9299 override void SetWet(
float value,
bool allow_client =
false)
9300 {
9301 if (!IsServerCheck(allow_client))
9302 return;
9303
9306
9308
9309 m_VarWet = Math.Clamp(value, min, max);
9310
9312 {
9315 }
9316 }
9317
9318 override void AddWet(
float value)
9319 {
9321 }
9322
9324 {
9326 }
9327
9329 {
9331 }
9332
9334 {
9336 }
9337
9339 {
9341 }
9342
9344 {
9346 }
9347
9349 {
9352 if (newLevel != oldLevel)
9353 {
9355 }
9356 }
9357
9359 {
9360 SetWeightDirty();
9361 }
9362
9364 {
9365 return GetWetLevelInternal(
m_VarWet);
9366 }
9367
9368
9369
9371 {
9373 }
9374
9376 {
9378 }
9379
9381 {
9383 }
9384
9386 {
9388 }
9389
9390
9391
9393 {
9394 if (ConfigIsExisting("itemModelLength"))
9395 {
9396 return ConfigGetFloat("itemModelLength");
9397 }
9398 return 0;
9399 }
9400
9402 {
9403 if (ConfigIsExisting("itemAttachOffset"))
9404 {
9405 return ConfigGetFloat("itemAttachOffset");
9406 }
9407 return 0;
9408 }
9409
9410 override void SetCleanness(
int value,
bool allow_client =
false)
9411 {
9412 if (!IsServerCheck(allow_client))
9413 return;
9414
9416
9418
9421 }
9422
9424 {
9426 }
9427
9429 {
9430 return true;
9431 }
9432
9433
9434
9435
9437 {
9439 }
9440
9442 {
9444 }
9445
9446
9447
9448
9449 override void SetColor(
int r,
int g,
int b,
int a)
9450 {
9456 }
9458 override void GetColor(out
int r,out
int g,out
int b,out
int a)
9459 {
9464 }
9465
9467 {
9469 }
9470
9473 {
9474 int r,g,b,a;
9476 r = r/255;
9477 g = g/255;
9478 b = b/255;
9479 a = a/255;
9480 return MiscGameplayFunctions.GetColorString(r, g, b, a);
9481 }
9482
9483
9484
9485 override void SetLiquidType(
int value,
bool allow_client =
false)
9486 {
9487 if (!IsServerCheck(allow_client))
9488 return;
9489
9494 }
9495
9497 {
9498 return ConfigGetInt("varLiquidTypeInit");
9499 }
9500
9502 {
9504 }
9505
9507 {
9509 SetFrozen(false);
9510 }
9511
9514 {
9515 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9516 }
9517
9518
9521 {
9522 PlayerBase nplayer;
9523 if (PlayerBase.CastTo(nplayer, player))
9524 {
9526
9527 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9528 }
9529 }
9530
9531
9534 {
9535 PlayerBase nplayer;
9536 if (PlayerBase.CastTo(nplayer,player))
9537 {
9538
9539 nplayer.SetEnableQuickBarEntityShortcut(this,false);
9540
9541 }
9542
9543
9544 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
9545
9546
9547 if (HasEnergyManager())
9548 {
9549 GetCompEM().UpdatePlugState();
9550 }
9551 }
9552
9553
9555 {
9556 super.OnPlacementStarted(player);
9557
9559 }
9560
9561 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
9562 {
9564 {
9565 m_AdminLog.OnPlacementComplete(player,
this);
9566 }
9567
9568 super.OnPlacementComplete(player, position, orientation);
9569 }
9570
9571
9572
9573
9574
9576 {
9578 {
9579 return true;
9580 }
9581 else
9582 {
9583 return false;
9584 }
9585 }
9586
9587
9589 {
9591 {
9593 }
9594 }
9595
9596
9598 {
9600 }
9601
9603 {
9605 }
9606
9607 override void InsertAgent(
int agent,
float count = 1)
9608 {
9609 if (count < 1)
9610 return;
9611
9613 }
9614
9617 {
9619 }
9620
9621
9623 {
9625 }
9626
9627
9628
9629
9630
9631
9632
9633
9634
9635
9636
9637
9638
9639
9640
9641
9642
9643
9644
9645
9646
9647
9648
9649
9650
9651
9652
9653
9654
9655
9656
9657
9658
9659
9660
9661
9662
9663
9664
9665
9666
9667
9669 {
9671 return false;
9672 return true;
9673 }
9674
9676 {
9677
9679 }
9680
9681
9684 {
9685 super.CheckForRoofLimited(timeTresholdMS);
9686
9688 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
9689 {
9690 m_PreviousRoofTestTime = time;
9691 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
9692 }
9693 }
9694
9695
9697 {
9699 {
9700 return 0;
9701 }
9702
9703 if (GetInventory().GetAttachmentSlotsCount() != 0)
9704 {
9705 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
9706 if (filter)
9707 return filter.GetProtectionLevel(type, false, system);
9708 else
9709 return 0;
9710 }
9711
9712 string subclassPath, entryName;
9713
9714 switch (type)
9715 {
9717 entryName = "biological";
9718 break;
9720 entryName = "chemical";
9721 break;
9722 default:
9723 entryName = "biological";
9724 break;
9725 }
9726
9727 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
9728
9730 }
9731
9732
9733
9736 {
9737 if (!IsMagazine())
9739
9741 }
9742
9743
9744
9745
9746
9751 {
9752 return true;
9753 }
9754
9756 {
9758 }
9759
9760
9761
9762
9763
9765 {
9766 if (parent)
9767 {
9768 if (parent.IsInherited(DayZInfected))
9769 return true;
9770
9771 if (!parent.IsRuined())
9772 return true;
9773 }
9774
9775 return true;
9776 }
9777
9779 {
9780 if (!super.CanPutAsAttachment(parent))
9781 {
9782 return false;
9783 }
9784
9785 if (!IsRuined() && !parent.IsRuined())
9786 {
9787 return true;
9788 }
9789
9790 return false;
9791 }
9792
9794 {
9795
9796
9797
9798
9799 return super.CanReceiveItemIntoCargo(item);
9800 }
9801
9803 {
9804
9805
9806
9807
9808 GameInventory attachmentInv = attachment.GetInventory();
9810 {
9811 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
9812 return false;
9813 }
9814
9815 InventoryLocation loc = new InventoryLocation();
9816 attachment.GetInventory().GetCurrentInventoryLocation(loc);
9817 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
9818 return false;
9819
9820 return super.CanReceiveAttachment(attachment, slotId);
9821 }
9822
9824 {
9825 if (!super.CanReleaseAttachment(attachment))
9826 return false;
9827
9828 return GetInventory().AreChildrenAccessible();
9829 }
9830
9831
9832
9833
9834
9835
9836
9837
9838
9839
9840
9841
9842
9843
9844
9845
9846
9847
9848
9849
9850
9852 {
9853 int id = muzzle_owner.GetMuzzleID();
9854 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
9855
9856 if (WPOF_array)
9857 {
9858 for (int i = 0; i < WPOF_array.Count(); i++)
9859 {
9860 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
9861
9862 if (WPOF)
9863 {
9864 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
9865 }
9866 }
9867 }
9868 }
9869
9870
9872 {
9873 int id = muzzle_owner.GetMuzzleID();
9875
9876 if (WPOBE_array)
9877 {
9878 for (int i = 0; i < WPOBE_array.Count(); i++)
9879 {
9880 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
9881
9882 if (WPOBE)
9883 {
9884 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
9885 }
9886 }
9887 }
9888 }
9889
9890
9892 {
9893 int id = muzzle_owner.GetMuzzleID();
9894 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9895
9896 if (WPOOH_array)
9897 {
9898 for (int i = 0; i < WPOOH_array.Count(); i++)
9899 {
9900 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9901
9902 if (WPOOH)
9903 {
9904 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
9905 }
9906 }
9907 }
9908 }
9909
9910
9912 {
9913 int id = muzzle_owner.GetMuzzleID();
9914 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9915
9916 if (WPOOH_array)
9917 {
9918 for (int i = 0; i < WPOOH_array.Count(); i++)
9919 {
9920 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9921
9922 if (WPOOH)
9923 {
9924 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9925 }
9926 }
9927 }
9928 }
9929
9930
9932 {
9933 int id = muzzle_owner.GetMuzzleID();
9934 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9935
9936 if (WPOOH_array)
9937 {
9938 for (int i = 0; i < WPOOH_array.Count(); i++)
9939 {
9940 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9941
9942 if (WPOOH)
9943 {
9944 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9945 }
9946 }
9947 }
9948 }
9949
9950
9951
9953 {
9955 {
9956 return true;
9957 }
9958
9959 return false;
9960 }
9961
9963 {
9965 {
9966 return true;
9967 }
9968
9969 return false;
9970 }
9971
9973 {
9975 {
9976 return true;
9977 }
9978
9979 return false;
9980 }
9981
9983 {
9984 return false;
9985 }
9986
9989 {
9990 return UATimeSpent.DEFAULT_DEPLOY;
9991 }
9992
9993
9994
9995
9997 {
9999 SetSynchDirty();
10000 }
10001
10003 {
10005 }
10006
10007
10009 {
10010 return false;
10011 }
10012
10015 {
10016 string att_type = "None";
10017
10018 if (ConfigIsExisting("soundAttType"))
10019 {
10020 att_type = ConfigGetString("soundAttType");
10021 }
10022
10024 }
10025
10027 {
10029 }
10030
10031
10032
10033
10034
10040
10042 {
10045
10047 }
10048
10049
10051 {
10053 return;
10054
10056
10059
10062
10063 SoundParameters params = new SoundParameters();
10067 }
10068
10069
10071 {
10073 return;
10074
10076 SetSynchDirty();
10077
10080 }
10081
10082
10084 {
10086 return;
10087
10089 SetSynchDirty();
10090
10093 }
10094
10096 {
10098 }
10099
10101 {
10103 }
10104
10107 {
10108 if (!
GetGame().IsDedicatedServer())
10109 {
10110 if (ConfigIsExisting("attachSoundSet"))
10111 {
10112 string cfg_path = "";
10113 string soundset = "";
10114 string type_name =
GetType();
10115
10118 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
10119 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
10120
10121 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
10122 {
10123 for (int i = 0; i < cfg_soundset_array.Count(); i++)
10124 {
10125 if (cfg_slot_array[i] == slot_type)
10126 {
10127 soundset = cfg_soundset_array[i];
10128 break;
10129 }
10130 }
10131 }
10132
10133 if (soundset != "")
10134 {
10135 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
10137 }
10138 }
10139 }
10140 }
10141
10143 {
10144
10145 }
10146
10147 void OnApply(PlayerBase player);
10148
10150 {
10151 return 1.0;
10152 };
10153
10155 {
10157 }
10158
10160 {
10162 }
10163
10165
10167 {
10168 SetDynamicPhysicsLifeTime(0.01);
10170 }
10171
10173 {
10174 array<string> zone_names = new array<string>;
10175 GetDamageZones(zone_names);
10176 for (int i = 0; i < zone_names.Count(); i++)
10177 {
10178 SetHealthMax(zone_names.Get(i),"Health");
10179 }
10180 SetHealthMax("","Health");
10181 }
10182
10185 {
10186 float global_health = GetHealth01("","Health");
10187 array<string> zones = new array<string>;
10188 GetDamageZones(zones);
10189
10190 for (int i = 0; i < zones.Count(); i++)
10191 {
10192 SetHealth01(zones.Get(i),"Health",global_health);
10193 }
10194 }
10195
10198 {
10199 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
10200 }
10201
10203 {
10204 if (!hasRootAsPlayer)
10205 {
10206 if (refParentIB)
10207 {
10208
10209 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
10210 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
10211
10212 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
10213 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
10214
10217 }
10218 else
10219 {
10220
10223 }
10224 }
10225 }
10226
10228 {
10230 {
10231 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
10232 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
10233 {
10234 float heatPermCoef = 1.0;
10236 while (ent)
10237 {
10238 heatPermCoef *= ent.GetHeatPermeabilityCoef();
10239 ent = ent.GetHierarchyParent();
10240 }
10241
10242 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
10243 }
10244 }
10245 }
10246
10248 {
10249
10250 EntityAI parent = GetHierarchyParent();
10251 if (!parent)
10252 {
10253 hasParent = false;
10254 hasRootAsPlayer = false;
10255 }
10256 else
10257 {
10258 hasParent = true;
10259 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
10260 refParentIB =
ItemBase.Cast(parent);
10261 }
10262 }
10263
10264 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
10265 {
10266
10267 }
10268
10270 {
10271
10272 return false;
10273 }
10274
10276 {
10277
10278
10279 return false;
10280 }
10281
10283 {
10284
10285 return false;
10286 }
10287
10290 {
10291 return !GetIsFrozen() &&
IsOpen();
10292 }
10293
10295 {
10296 bool hasParent = false, hasRootAsPlayer = false;
10298
10299 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
10300 bool foodDecay =
g_Game.IsFoodDecayEnabled();
10301
10302 if (wwtu || foodDecay)
10303 {
10307
10308 if (processWetness || processTemperature || processDecay)
10309 {
10311
10312 if (processWetness)
10313 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
10314
10315 if (processTemperature)
10317
10318 if (processDecay)
10319 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
10320 }
10321 }
10322 }
10323
10326 {
10328 }
10329
10331 {
10334
10335 return super.GetTemperatureFreezeThreshold();
10336 }
10337
10339 {
10342
10343 return super.GetTemperatureThawThreshold();
10344 }
10345
10347 {
10350
10351 return super.GetItemOverheatThreshold();
10352 }
10353
10355 {
10357 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
10358
10359 return super.GetTemperatureFreezeTime();
10360 }
10361
10363 {
10365 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
10366
10367 return super.GetTemperatureThawTime();
10368 }
10369
10374
10376 {
10377 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
10378 }
10379
10381 {
10382 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
10383 }
10384
10387 {
10389 }
10390
10392 {
10394 }
10395
10397 {
10399 }
10400
10403 {
10404 return null;
10405 }
10406
10409 {
10410 return false;
10411 }
10412
10414 {
10416 {
10419 if (!trg)
10420 {
10422 explosive = this;
10423 }
10424
10425 explosive.PairRemote(trg);
10427
10428 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
10429 trg.SetPersistentPairID(persistentID);
10430 explosive.SetPersistentPairID(persistentID);
10431
10432 return true;
10433 }
10434 return false;
10435 }
10436
10439 {
10440 float ret = 1.0;
10443 ret *= GetHealth01();
10444
10445 return ret;
10446 }
10447
10448 #ifdef DEVELOPER
10449 override void SetDebugItem()
10450 {
10451 super.SetDebugItem();
10452 _itemBase = this;
10453 }
10454
10456 {
10457 string text = super.GetDebugText();
10458
10460 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
10461
10462 return text;
10463 }
10464 #endif
10465
10467 {
10468 return true;
10469 }
10470
10472
10474
10476 {
10479 }
10480
10481
10489
10505}
10506
10508{
10510 if (entity)
10511 {
10512 bool is_item = entity.IsInherited(
ItemBase);
10513 if (is_item && full_quantity)
10514 {
10517 }
10518 }
10519 else
10520 {
10522 return NULL;
10523 }
10524 return entity;
10525}
10526
10528{
10529 if (item)
10530 {
10531 if (health > 0)
10532 item.SetHealth("", "", health);
10533
10534 if (item.CanHaveTemperature())
10535 {
10537 if (item.CanFreeze())
10538 item.SetFrozen(false);
10539 }
10540
10541 if (item.HasEnergyManager())
10542 {
10543 if (quantity >= 0)
10544 {
10545 item.GetCompEM().SetEnergy0To1(quantity);
10546 }
10547 else
10548 {
10550 }
10551 }
10552 else if (item.IsMagazine())
10553 {
10554 Magazine mag = Magazine.Cast(item);
10555 if (quantity >= 0)
10556 {
10557 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
10558 }
10559 else
10560 {
10562 }
10563
10564 }
10565 else
10566 {
10567 if (quantity >= 0)
10568 {
10569 item.SetQuantityNormalized(quantity, false);
10570 }
10571 else
10572 {
10574 }
10575
10576 }
10577 }
10578}
10579
10580#ifdef DEVELOPER
10582#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.