5766{
5768 {
5769 return true;
5770 }
5771};
5772
5773
5774
5776{
5780
5782
5785
5786
5787
5788
5789
5798
5804
5809
5814
5835 protected bool m_IsResultOfSplit
5836
5838
5843
5844
5845
5847
5851
5852
5853
5855
5858
5859
5860
5866
5867
5875
5878
5879
5881
5882
5884
5885
5890
5891
5896
5897
5899
5900
5902 {
5907
5908 if (!
GetGame().IsDedicatedServer())
5909 {
5911 {
5913
5915 {
5917 }
5918 }
5919
5922 }
5923
5924 m_OldLocation = null;
5925
5927 {
5929 }
5930
5931 if (ConfigIsExisting("headSelectionsToHide"))
5932 {
5935 }
5936
5938 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
5939 {
5941 }
5942
5944
5945 m_IsResultOfSplit = false;
5946
5948 }
5949
5951 {
5952 super.InitItemVariables();
5953
5959 m_Count = ConfigGetInt(
"count");
5960
5963
5968
5971
5976
5988
5992
5993
5996 if (ConfigIsExisting("canBeSplit"))
5997 {
6000 }
6001
6003 if (ConfigIsExisting("itemBehaviour"))
6005
6006
6009 RegisterNetSyncVariableInt("m_VarLiquidType");
6010 RegisterNetSyncVariableInt("m_Cleanness",0,1);
6011
6012 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
6013 RegisterNetSyncVariableFloat("m_ImpactSpeed");
6014 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
6015
6016 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
6017 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
6018 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
6019 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
6020
6021 RegisterNetSyncVariableBool("m_IsBeingPlaced");
6022 RegisterNetSyncVariableBool("m_IsTakeable");
6023 RegisterNetSyncVariableBool("m_IsHologram");
6024
6027 {
6030 }
6031
6033
6035 if (ConfigIsExisting("temperaturePerQuantityWeight"))
6037
6038 }
6039
6041 {
6043 }
6044
6046 {
6049 {
6054 }
6055 }
6056
6057 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
6058 {
6060 {
6063 }
6064
6066 }
6067
6069 {
6075 }
6076
6078
6080 {
6082
6083 if (!action)
6084 {
6085 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
6086 return;
6087 }
6088
6090 if (!ai)
6091 {
6093 return;
6094 }
6095
6097 if (!action_array)
6098 {
6099 action_array = new array<ActionBase_Basic>;
6101 }
6102 if (LogManager.IsActionLogEnable())
6103 {
6104 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
6105 }
6106
6107 if (action_array.Find(action) != -1)
6108 {
6109 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
6110 }
6111 else
6112 {
6113 action_array.Insert(action);
6114 }
6115 }
6116
6118 {
6120 ActionBase action = player.GetActionManager().GetAction(actionName);
6123
6124 if (action_array)
6125 {
6126 action_array.RemoveItem(action);
6127 }
6128 }
6129
6130
6131
6133 {
6134 ActionOverrideData overrideData = new ActionOverrideData();
6138
6140 if (!actionMap)
6141 {
6144 }
6145
6146 actionMap.Insert(this.
Type(), overrideData);
6147
6148 }
6149
6151
6153
6154
6156 {
6159
6162
6163 string config_to_search = "CfgVehicles";
6164 string muzzle_owner_config;
6165
6167 {
6168 if (IsInherited(Weapon))
6169 config_to_search = "CfgWeapons";
6170
6171 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6172
6173 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
6174
6176
6177 if (config_OnFire_subclass_count > 0)
6178 {
6179 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
6180
6181 for (int i = 0; i < config_OnFire_subclass_count; i++)
6182 {
6183 string particle_class = "";
6185 string config_OnFire_entry = config_OnFire_class + particle_class;
6186 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
6187 WPOF_array.Insert(WPOF);
6188 }
6189
6190
6192 }
6193 }
6194
6196 {
6197 config_to_search = "CfgWeapons";
6198 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6199
6200 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
6201
6203
6204 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
6205 {
6206 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
6207
6208 for (i = 0; i < config_OnBulletCasingEject_count; i++)
6209 {
6210 string particle_class2 = "";
6212 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
6213 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
6214 WPOBE_array.Insert(WPOBE);
6215 }
6216
6217
6219 }
6220 }
6221 }
6222
6223
6225 {
6228
6230 {
6231 string config_to_search = "CfgVehicles";
6232
6233 if (IsInherited(Weapon))
6234 config_to_search = "CfgWeapons";
6235
6236 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6237 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
6238
6239 if (
GetGame().ConfigIsExisting(config_OnOverheating_class))
6240 {
6241
6243
6245 {
6247 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
6249 return;
6250 }
6251
6254
6255
6256
6258 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
6259
6260 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
6261 {
6262 string particle_class = "";
6264 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
6266
6267 if (entry_type == CT_CLASS)
6268 {
6269 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
6270 WPOOH_array.Insert(WPOF);
6271 }
6272 }
6273
6274
6276 }
6277 }
6278 }
6279
6281 {
6283 }
6284
6286 {
6288 {
6290
6293
6296
6297 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6298 }
6299 }
6300
6302 {
6304 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6305
6307 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6308
6310 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6311
6313 {
6315 }
6316 }
6317
6319 {
6321 }
6322
6324 {
6327 else
6329
6331 {
6334 }
6335 else
6336 {
6339
6342 }
6343
6345 }
6346
6348 {
6350 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6351 }
6352
6354 {
6356 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6358 }
6359
6361 {
6363 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6364 }
6365
6367 {
6370
6371 OverheatingParticle OP = new OverheatingParticle();
6376
6378 }
6379
6381 {
6384
6385 return -1;
6386 }
6387
6389 {
6391 {
6394
6395 for (int i = count; i > 0; --i)
6396 {
6397 int id = i - 1;
6400
6403
6404 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
6405 {
6406 if (p)
6407 {
6410 }
6411 }
6412 }
6413 }
6414 }
6415
6417 {
6419 {
6421 {
6422 int id = i - 1;
6424
6425 if (OP)
6426 {
6428
6429 if (p)
6430 {
6432 }
6433
6434 delete OP;
6435 }
6436 }
6437
6440 }
6441 }
6442
6445 {
6446 return 0.0;
6447 }
6448
6449
6451 {
6452 return 250;
6453 }
6454
6456 {
6457 return 0;
6458 }
6459
6462 {
6464 return true;
6465
6466 return false;
6467 }
6468
6471 {
6474
6476 {
6478 }
6479 else
6480 {
6481
6483 }
6484
6486 }
6487
6494 {
6495 return -1;
6496 }
6497
6498
6499
6500
6502 {
6504 {
6506 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6507
6508 if (r_index >= 0)
6509 {
6510 InventoryLocation r_il = new InventoryLocation;
6511 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6512
6513 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6516 {
6517 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6518 }
6520 {
6521 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6522 }
6523
6524 }
6525
6526 player.GetHumanInventory().ClearUserReservedLocation(this);
6527 }
6528
6531 }
6532
6533
6534
6535
6537 {
6538 return ItemBase.m_DebugActionsMask;
6539 }
6540
6542 {
6543 return ItemBase.m_DebugActionsMask & mask;
6544 }
6545
6547 {
6548 ItemBase.m_DebugActionsMask = mask;
6549 }
6550
6552 {
6553 ItemBase.m_DebugActionsMask |= mask;
6554 }
6555
6557 {
6558 ItemBase.m_DebugActionsMask &= ~mask;
6559 }
6560
6562 {
6564 {
6566 }
6567 else
6568 {
6570 }
6571 }
6572
6573
6575 {
6576 if (GetEconomyProfile())
6577 {
6578 float q_max = GetEconomyProfile().GetQuantityMax();
6579 if (q_max > 0)
6580 {
6581 float q_min = GetEconomyProfile().GetQuantityMin();
6582 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
6583
6585 {
6586 ComponentEnergyManager comp = GetCompEM();
6588 {
6590 }
6591 }
6593 {
6595
6596 }
6597
6598 }
6599 }
6600 }
6601
6604 {
6605 EntityAI parent = GetHierarchyParent();
6606
6607 if (parent)
6608 {
6609 InventoryLocation inventory_location_to_lock = new InventoryLocation;
6610 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
6611 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
6612 }
6613 }
6614
6617 {
6618 EntityAI parent = GetHierarchyParent();
6619
6620 if (parent)
6621 {
6622 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
6623 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
6624 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
6625 }
6626 }
6627
6629 {
6630
6631
6632
6633
6635
6637 {
6638 if (ScriptInputUserData.CanStoreInputUserData())
6639 {
6640 ScriptInputUserData ctx = new ScriptInputUserData;
6646 ctx.
Write(use_stack_max);
6649
6651 {
6652 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
6653 }
6654 }
6655 }
6656 else if (!
GetGame().IsMultiplayer())
6657 {
6659 }
6660 }
6661
6663 {
6665 }
6666
6668 {
6670 }
6671
6673 {
6675 }
6676
6678 {
6679
6680 return false;
6681 }
6682
6684 {
6685 return false;
6686 }
6687
6691 {
6692 return false;
6693 }
6694
6696 {
6697 return "";
6698 }
6699
6701
6703 {
6704 return false;
6705 }
6706
6708 {
6709 return true;
6710 }
6711
6712
6713
6715 {
6716 return true;
6717 }
6718
6720 {
6721 return true;
6722 }
6723
6725 {
6726 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6728 }
6729
6731 {
6733 }
6734
6736 {
6738 if (!is_being_placed)
6740 SetSynchDirty();
6741 }
6742
6743
6745
6747 {
6749 }
6750
6752 {
6754 }
6755
6757 {
6758 return 1;
6759 }
6760
6762 {
6763 return false;
6764 }
6765
6767 {
6769 SetSynchDirty();
6770 }
6771
6772
6773
6774
6775
6776
6777
6778
6779
6780
6781
6782
6783
6784
6785
6786
6787
6788
6789
6790
6791
6792
6793
6794
6795
6796
6797
6798
6799
6800
6801
6802
6803
6804
6805
6807 {
6808 super.OnMovedInsideCargo(container);
6809
6810 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6811 }
6812
6813 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
6814 {
6815 super.EEItemLocationChanged(oldLoc,newLoc);
6816
6817 PlayerBase new_player = null;
6818 PlayerBase old_player = null;
6819
6820 if (newLoc.GetParent())
6821 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
6822
6823 if (oldLoc.GetParent())
6824 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
6825
6827 {
6828 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
6829
6830 if (r_index >= 0)
6831 {
6832 InventoryLocation r_il = new InventoryLocation;
6833 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6834
6835 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6838 {
6839 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6840 }
6842 {
6843 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6844 }
6845
6846 }
6847 }
6848
6850 {
6851 if (new_player)
6852 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
6853
6854 if (new_player == old_player)
6855 {
6856
6857 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
6858 {
6860 {
6861 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
6862 {
6863 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6864 }
6865 }
6866 else
6867 {
6868 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6869 }
6870 }
6871
6872 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
6873 {
6874 int type = oldLoc.GetType();
6876 {
6877 oldLoc.GetParent().GetOnSetLock().Invoke(this);
6878 }
6880 {
6881 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
6882 }
6883 }
6884 if (!m_OldLocation)
6885 {
6886 m_OldLocation = new InventoryLocation;
6887 }
6888 m_OldLocation.Copy(oldLoc);
6889 }
6890 else
6891 {
6892 if (m_OldLocation)
6893 {
6894 m_OldLocation.Reset();
6895 }
6896 }
6897
6899 }
6900 else
6901 {
6902 if (new_player)
6903 {
6904 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
6905 if (res_index >= 0)
6906 {
6907 InventoryLocation il = new InventoryLocation;
6908 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
6910 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
6913 {
6914 il.
GetParent().GetOnReleaseLock().Invoke(it);
6915 }
6917 {
6919 }
6920
6921 }
6922 }
6924 {
6925
6927 }
6928
6929 if (m_OldLocation)
6930 {
6931 m_OldLocation.Reset();
6932 }
6933 }
6934 }
6935
6936 override void EOnContact(IEntity other, Contact extra)
6937 {
6939 {
6940 int liquidType = -1;
6942 if (impactSpeed > 0.0)
6943 {
6945 #ifndef SERVER
6947 #else
6949 SetSynchDirty();
6950 #endif
6952 }
6953 }
6954
6955 #ifdef SERVER
6956 if (GetCompEM() && GetCompEM().IsPlugged())
6957 {
6958 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
6959 GetCompEM().UnplugThis();
6960 }
6961 #endif
6962 }
6963
6965
6967 {
6969 }
6970
6972 {
6973
6974 }
6975
6977 {
6978 super.OnItemLocationChanged(old_owner, new_owner);
6979
6980 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
6981 PlayerBase playerNew = PlayerBase.Cast(new_owner);
6982
6983 if (!relatedPlayer && playerNew)
6984 relatedPlayer = playerNew;
6985
6986 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
6987 {
6989 if (actionMgr)
6990 {
6991 ActionBase currentAction = actionMgr.GetRunningAction();
6992 if (currentAction)
6994 }
6995 }
6996
6997 Man ownerPlayerOld = null;
6998 Man ownerPlayerNew = null;
6999
7000 if (old_owner)
7001 {
7002 if (old_owner.
IsMan())
7003 {
7004 ownerPlayerOld = Man.Cast(old_owner);
7005 }
7006 else
7007 {
7008 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
7009 }
7010 }
7011 else
7012 {
7014 {
7016
7017 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
7018 {
7019 GetCompEM().UnplugThis();
7020 }
7021 }
7022 }
7023
7024 if (new_owner)
7025 {
7026 if (new_owner.
IsMan())
7027 {
7028 ownerPlayerNew = Man.Cast(new_owner);
7029 }
7030 else
7031 {
7032 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
7033 }
7034 }
7035
7036 if (ownerPlayerOld != ownerPlayerNew)
7037 {
7038 if (ownerPlayerOld)
7039 {
7040 array<EntityAI> subItemsExit = new array<EntityAI>;
7042 for (int i = 0; i < subItemsExit.Count(); i++)
7043 {
7046 }
7047 }
7048
7049 if (ownerPlayerNew)
7050 {
7051 array<EntityAI> subItemsEnter = new array<EntityAI>;
7053 for (int j = 0; j < subItemsEnter.Count(); j++)
7054 {
7057 }
7058 }
7059 }
7060 else if (ownerPlayerNew != null)
7061 {
7062 PlayerBase nplayer;
7063 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
7064 {
7065 array<EntityAI> subItemsUpdate = new array<EntityAI>;
7067 for (int k = 0; k < subItemsUpdate.Count(); k++)
7068 {
7070 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
7071 }
7072 }
7073 }
7074
7075 if (old_owner)
7076 old_owner.OnChildItemRemoved(this);
7077 if (new_owner)
7078 new_owner.OnChildItemReceived(this);
7079 }
7080
7081
7083 {
7084 super.EEDelete(parent);
7085 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
7086 if (player)
7087 {
7089
7090 if (player.IsAlive())
7091 {
7092 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7093 if (r_index >= 0)
7094 {
7095 InventoryLocation r_il = new InventoryLocation;
7096 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7097
7098 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7101 {
7102 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7103 }
7105 {
7106 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7107 }
7108
7109 }
7110
7111 player.RemoveQuickBarEntityShortcut(this);
7112 }
7113 }
7114 }
7115
7117 {
7118 super.EEKilled(killer);
7119
7122 {
7123 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
7124 {
7125 if (IsMagazine())
7126 {
7127 if (Magazine.Cast(this).GetAmmoCount() > 0)
7128 {
7130 }
7131 }
7132 else
7133 {
7135 }
7136 }
7137 }
7138 }
7139
7141 {
7142 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7143
7144 super.OnWasAttached(parent, slot_id);
7145
7148
7150 }
7151
7153 {
7154 super.OnWasDetached(parent, slot_id);
7155
7158 }
7159
7161 {
7162 int idx;
7165
7166 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7167 if (inventory_slots.Count() < 1)
7168 {
7169 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
7170 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
7171 }
7172 else
7173 {
7174 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
7175 }
7176
7177 idx = inventory_slots.Find(slot);
7178 if (idx < 0)
7179 return "";
7180
7181 return attach_types.Get(idx);
7182 }
7183
7185 {
7186 int idx = -1;
7187 string slot;
7188
7191
7192 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7193 if (inventory_slots.Count() < 1)
7194 {
7195 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
7196 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7197 }
7198 else
7199 {
7200 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
7201 if (detach_types.Count() < 1)
7202 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7203 }
7204
7205 for (int i = 0; i < inventory_slots.Count(); i++)
7206 {
7207 slot = inventory_slots.Get(i);
7208 }
7209
7210 if (slot != "")
7211 {
7212 if (detach_types.Count() == 1)
7213 idx = 0;
7214 else
7215 idx = inventory_slots.Find(slot);
7216 }
7217 if (idx < 0)
7218 return "";
7219
7220 return detach_types.Get(idx);
7221 }
7222
7224 {
7225
7227
7228
7229 float min_time = 1;
7230 float max_time = 3;
7231 float delay = Math.RandomFloat(min_time, max_time);
7232
7233 explode_timer.Run(delay, this, "DoAmmoExplosion");
7234 }
7235
7237 {
7238 Magazine magazine = Magazine.Cast(this);
7239 int pop_sounds_count = 6;
7240 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
7241
7242
7243 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
7244 string sound_name = pop_sounds[ sound_idx ];
7246
7247
7248 magazine.ServerAddAmmoCount(-1);
7249
7250
7251 float min_temp_to_explode = 100;
7252
7253 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
7254 {
7256 }
7257 }
7258
7259
7260 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
7261 {
7262 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
7263
7264 const int CHANCE_DAMAGE_CARGO = 4;
7265 const int CHANCE_DAMAGE_ATTACHMENT = 1;
7266 const int CHANCE_DAMAGE_NOTHING = 2;
7267
7269 {
7270 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
7271 int chances;
7272 int rnd;
7273
7274 if (GetInventory().GetCargo())
7275 {
7276 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7277 rnd = Math.RandomInt(0,chances);
7278
7279 if (rnd < CHANCE_DAMAGE_CARGO)
7280 {
7282 }
7283 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
7284 {
7286 }
7287 }
7288 else
7289 {
7290 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7291 rnd = Math.RandomInt(0,chances);
7292
7293 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
7294 {
7296 }
7297 }
7298 }
7299 }
7300
7302 {
7303 if (GetInventory().GetCargo())
7304 {
7305 int item_count = GetInventory().GetCargo().GetItemCount();
7306 if (item_count > 0)
7307 {
7308 int random_pick = Math.RandomInt(0, item_count);
7310 if (!item.IsExplosive())
7311 {
7312 item.AddHealth("","",damage);
7313 return true;
7314 }
7315 }
7316 }
7317 return false;
7318 }
7319
7321 {
7322 int attachment_count = GetInventory().AttachmentCount();
7323 if (attachment_count > 0)
7324 {
7325 int random_pick = Math.RandomInt(0, attachment_count);
7326 ItemBase attachment =
ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
7327 if (!attachment.IsExplosive())
7328 {
7329 attachment.AddHealth("","",damage);
7330 return true;
7331 }
7332 }
7333 return false;
7334 }
7335
7337 {
7339 }
7340
7342 {
7344 return GetInventory().CanRemoveEntity();
7345
7346 return false;
7347 }
7348
7350 {
7351
7353 return false;
7354
7355
7357 return false;
7358
7359
7360
7362 if (delta == 0)
7363 return false;
7364
7365
7366 return true;
7367 }
7368
7370 {
7372 {
7373 if (ScriptInputUserData.CanStoreInputUserData())
7374 {
7375 ScriptInputUserData ctx = new ScriptInputUserData;
7380 ctx.
Write(destination_entity);
7384 }
7385 }
7386 else if (!
GetGame().IsMultiplayer())
7387 {
7389 }
7390 }
7391
7393 {
7394 float split_quantity_new;
7398 InventoryLocation loc = new InventoryLocation;
7399
7400 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7401 {
7403 split_quantity_new = stack_max;
7404 else
7406
7408 {
7409 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7410 if (new_item)
7411 {
7412 new_item.SetResultOfSplit(true);
7413 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7415 new_item.
SetQuantity(split_quantity_new,
false,
true);
7416 }
7417 }
7418 }
7419 else if (destination_entity && slot_id == -1)
7420 {
7421 if (quantity > stack_max)
7422 split_quantity_new = stack_max;
7423 else
7424 split_quantity_new = quantity;
7425
7427 {
7429 {
7432 }
7433
7434 if (new_item)
7435 {
7436 new_item.SetResultOfSplit(true);
7437 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7439 new_item.
SetQuantity(split_quantity_new,
false,
true);
7440 }
7441 }
7442 }
7443 else
7444 {
7445 if (stack_max != 0)
7446 {
7448 {
7450 }
7451
7452 if (split_quantity_new == 0)
7453 {
7454 if (!
GetGame().IsMultiplayer())
7455 player.PhysicalPredictiveDropItem(this);
7456 else
7457 player.ServerDropEntity(this);
7458 return;
7459 }
7460
7462 {
7464
7465 if (new_item)
7466 {
7467 new_item.SetResultOfSplit(true);
7468 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7471 new_item.PlaceOnSurface();
7472 }
7473 }
7474 }
7475 }
7476 }
7477
7479 {
7480 float split_quantity_new;
7484 InventoryLocation loc = new InventoryLocation;
7485
7486 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7487 {
7489 split_quantity_new = stack_max;
7490 else
7492
7494 {
7495 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7496 if (new_item)
7497 {
7498 new_item.SetResultOfSplit(true);
7499 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7501 new_item.
SetQuantity(split_quantity_new,
false,
true);
7502 }
7503 }
7504 }
7505 else if (destination_entity && slot_id == -1)
7506 {
7507 if (quantity > stack_max)
7508 split_quantity_new = stack_max;
7509 else
7510 split_quantity_new = quantity;
7511
7513 {
7515 {
7518 }
7519
7520 if (new_item)
7521 {
7522 new_item.SetResultOfSplit(true);
7523 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7525 new_item.
SetQuantity(split_quantity_new,
false,
true);
7526 }
7527 }
7528 }
7529 else
7530 {
7531 if (stack_max != 0)
7532 {
7534 {
7536 }
7537
7539 {
7541
7542 if (new_item)
7543 {
7544 new_item.SetResultOfSplit(true);
7545 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7548 new_item.PlaceOnSurface();
7549 }
7550 }
7551 }
7552 }
7553 }
7554
7556 {
7558 {
7559 if (ScriptInputUserData.CanStoreInputUserData())
7560 {
7561 ScriptInputUserData ctx = new ScriptInputUserData;
7566 dst.WriteToContext(ctx);
7568 }
7569 }
7570 else if (!
GetGame().IsMultiplayer())
7571 {
7573 }
7574 }
7575
7577 {
7579 {
7580 if (ScriptInputUserData.CanStoreInputUserData())
7581 {
7582 ScriptInputUserData ctx = new ScriptInputUserData;
7587 ctx.
Write(destination_entity);
7593 }
7594 }
7595 else if (!
GetGame().IsMultiplayer())
7596 {
7598 }
7599 }
7600
7602 {
7604 }
7605
7607 {
7609 float split_quantity_new;
7611 if (dst.IsValid())
7612 {
7613 int slot_id = dst.GetSlot();
7615
7616 if (quantity > stack_max)
7617 split_quantity_new = stack_max;
7618 else
7619 split_quantity_new = quantity;
7620
7622 {
7624
7625 if (new_item)
7626 {
7627 new_item.SetResultOfSplit(true);
7628 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7630 new_item.
SetQuantity(split_quantity_new,
false,
true);
7631 }
7632
7633 return new_item;
7634 }
7635 }
7636
7637 return null;
7638 }
7639
7641 {
7643 float split_quantity_new;
7645 if (destination_entity)
7646 {
7648 if (quantity > stackable)
7649 split_quantity_new = stackable;
7650 else
7651 split_quantity_new = quantity;
7652
7654 {
7655 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
7656 if (new_item)
7657 {
7658 new_item.SetResultOfSplit(true);
7659 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7661 new_item.
SetQuantity(split_quantity_new,
false,
true);
7662 }
7663 }
7664 }
7665 }
7666
7668 {
7670 {
7671 if (ScriptInputUserData.CanStoreInputUserData())
7672 {
7673 ScriptInputUserData ctx = new ScriptInputUserData;
7678 ItemBase destination_entity =
this;
7679 ctx.
Write(destination_entity);
7683 }
7684 }
7685 else if (!
GetGame().IsMultiplayer())
7686 {
7688 }
7689 }
7690
7692 {
7694 float split_quantity_new;
7696 if (player)
7697 {
7699 if (quantity > stackable)
7700 split_quantity_new = stackable;
7701 else
7702 split_quantity_new = quantity;
7703
7705 {
7706 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
7707 new_item =
ItemBase.Cast(in_hands);
7708 if (new_item)
7709 {
7710 new_item.SetResultOfSplit(true);
7711 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7713 new_item.SetQuantity(split_quantity_new, false, true);
7714 }
7715 }
7716 }
7717 }
7718
7720 {
7722 float split_quantity_new = Math.Floor(quantity * 0.5);
7723
7725 return;
7726
7728
7729 if (new_item)
7730 {
7731 if (new_item.GetQuantityMax() < split_quantity_new)
7732 {
7733 split_quantity_new = new_item.GetQuantityMax();
7734 }
7735
7736 new_item.SetResultOfSplit(true);
7737 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7738
7740 {
7743 }
7744 else
7745 {
7747 new_item.
SetQuantity(split_quantity_new,
false,
true);
7748 }
7749 }
7750 }
7751
7753 {
7755 float split_quantity_new = Math.Floor(quantity / 2);
7756
7758 return;
7759
7760 InventoryLocation invloc = new InventoryLocation;
7762
7764 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
7765
7766 if (new_item)
7767 {
7768 if (new_item.GetQuantityMax() < split_quantity_new)
7769 {
7770 split_quantity_new = new_item.GetQuantityMax();
7771 }
7773 {
7776 }
7777 else if (split_quantity_new > 1)
7778 {
7780 new_item.
SetQuantity(split_quantity_new,
false,
true);
7781 }
7782 }
7783 }
7784
7787 {
7788 SetWeightDirty();
7790
7791 if (parent)
7792 parent.OnAttachmentQuantityChangedEx(this, delta);
7793
7795 {
7797 {
7799 }
7801 {
7802 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
7804 }
7805 }
7806
7807 }
7808
7811 {
7812
7813 }
7814
7817 {
7819 }
7820
7822 {
7823 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
7824
7826 {
7827 if (newLevel == GameConstants.STATE_RUINED)
7828 {
7830 EntityAI parent = GetHierarchyParent();
7831 if (parent && parent.IsFireplace())
7832 {
7833 CargoBase cargo = GetInventory().GetCargo();
7834 if (cargo)
7835 {
7837 {
7839 }
7840 }
7841 }
7842 }
7843
7845 {
7846
7848 return;
7849 }
7850
7851 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
7852 {
7854 }
7855 }
7856 }
7857
7858
7860 {
7861 super.OnRightClick();
7862
7864 {
7866 {
7867 if (ScriptInputUserData.CanStoreInputUserData())
7868 {
7869 EntityAI root = GetHierarchyRoot();
7870 Man playerOwner = GetHierarchyRootPlayer();
7871 InventoryLocation dst = new InventoryLocation;
7872
7873
7874 if (!playerOwner && root && root == this)
7875 {
7877 }
7878 else
7879 {
7880
7881 GetInventory().GetCurrentInventoryLocation(dst);
7883 {
7886 {
7888 }
7889 else
7890 {
7892
7893
7894 if (
GetGame().
GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
7895 {
7897 }
7898 else
7899 {
7900 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
7901 }
7902 }
7903 }
7904 }
7905
7906 ScriptInputUserData ctx = new ScriptInputUserData;
7914 }
7915 }
7916 else if (!
GetGame().IsMultiplayer())
7917 {
7919 }
7920 }
7921 }
7922
7924 {
7925 if (root)
7926 {
7927 vector m4[4];
7928 root.GetTransform(m4);
7929 dst.SetGround(this, m4);
7930 }
7931 else
7932 {
7933 GetInventory().GetCurrentInventoryLocation(dst);
7934 }
7935 }
7936
7937 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
7938 {
7939
7940 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
7941 return false;
7942
7943 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
7944 return false;
7945
7946
7948 return false;
7949
7950
7951 Magazine mag = Magazine.Cast(this);
7952 if (mag)
7953 {
7954 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
7955 return false;
7956
7957 if (stack_max_limit)
7958 {
7959 Magazine other_mag = Magazine.Cast(other_item);
7960 if (other_item)
7961 {
7962 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
7963 return false;
7964 }
7965
7966 }
7967 }
7968 else
7969 {
7970
7972 return false;
7973
7975 return false;
7976 }
7977
7978 PlayerBase player = null;
7979 if (CastTo(player, GetHierarchyRootPlayer()))
7980 {
7981 if (player.GetInventory().HasAttachment(this))
7982 return false;
7983
7984 if (player.IsItemsToDelete())
7985 return false;
7986 }
7987
7988 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
7989 return false;
7990
7991 int slotID;
7993 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
7994 return false;
7995
7996 return true;
7997 }
7998
8000 {
8002 }
8003
8005 {
8006 return m_IsResultOfSplit;
8007 }
8008
8010 {
8011 m_IsResultOfSplit = value;
8012 }
8013
8015 {
8017 }
8018
8020 {
8021 float other_item_quantity = other_item.GetQuantity();
8022 float this_free_space;
8023
8025
8027
8028 if (other_item_quantity > this_free_space)
8029 {
8030 return this_free_space;
8031 }
8032 else
8033 {
8034 return other_item_quantity;
8035 }
8036 }
8037
8039 {
8041 }
8042
8044 {
8046 return;
8047
8048 if (!IsMagazine() && other_item)
8049 {
8051 if (quantity_used != 0)
8052 {
8053 float hp1 = GetHealth01("","");
8054 float hp2 = other_item.GetHealth01("","");
8055 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
8056 hpResult = hpResult / (
GetQuantity() + quantity_used);
8057
8058 hpResult *= GetMaxHealth();
8059 Math.Round(hpResult);
8060 SetHealth("", "Health", hpResult);
8061
8063 other_item.AddQuantity(-quantity_used);
8064 }
8065 }
8067 }
8068
8070 {
8071 #ifdef SERVER
8072 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
8073 GetHierarchyParent().IncreaseLifetimeUp();
8074 #endif
8075 };
8076
8078 {
8079 PlayerBase p = PlayerBase.Cast(player);
8080
8081 array<int> recipesIds = p.m_Recipes;
8082 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8083 if (moduleRecipesManager)
8084 {
8085 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
8086 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
8087 }
8088
8089 for (int i = 0;i < recipesIds.Count(); i++)
8090 {
8091 int key = recipesIds.Get(i);
8092 string recipeName = moduleRecipesManager.GetRecipeName(key);
8094 }
8095 }
8096
8097
8098 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
8099 {
8100 super.GetDebugActions(outputList);
8101
8102
8108
8109
8114
8119
8120
8124
8125
8127 {
8131 }
8132
8135
8136
8140
8142
8143 InventoryLocation loc = new InventoryLocation();
8144 GetInventory().GetCurrentInventoryLocation(loc);
8146 {
8147 if (Gizmo_IsSupported())
8150 }
8151
8153 }
8154
8155
8156
8157
8159 {
8160 super.OnAction(action_id, player, ctx);
8161
8163 {
8164 switch (action_id)
8165 {
8168 return true;
8171 return true;
8172 }
8173 }
8174
8176 {
8177 switch (action_id)
8178 {
8180 Delete();
8181 return true;
8182 }
8183 }
8184
8185 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
8186 {
8187 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8188 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
8189 PlayerBase p = PlayerBase.Cast(player);
8190 if (
EActions.RECIPES_RANGE_START < 1000)
8191 {
8192 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
8193 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
8194 }
8195 }
8196 #ifndef SERVER
8197 else if (action_id ==
EActions.WATCH_PLAYER)
8198 {
8199 PluginDeveloper.SetDeveloperItemClientEx(player);
8200 }
8201 #endif
8203 {
8204 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
8205 {
8206 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
8207 OnDebugButtonPressServer(id + 1);
8208 }
8209
8210 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
8211 {
8212 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
8214 }
8215
8216 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
8217 {
8218 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
8220 }
8221
8222 else if (action_id ==
EActions.ADD_QUANTITY)
8223 {
8224 if (IsMagazine())
8225 {
8226 Magazine mag = Magazine.Cast(this);
8227 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
8228 }
8229 else
8230 {
8232 }
8233
8234 if (m_EM)
8235 {
8236 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
8237 }
8238
8239 }
8240
8241 else if (action_id ==
EActions.REMOVE_QUANTITY)
8242 {
8243 if (IsMagazine())
8244 {
8245 Magazine mag2 = Magazine.Cast(this);
8246 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
8247 }
8248 else
8249 {
8251 }
8252 if (m_EM)
8253 {
8254 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
8255 }
8256
8257 }
8258
8259 else if (action_id ==
EActions.SET_QUANTITY_0)
8260 {
8262
8263 if (m_EM)
8264 {
8265 m_EM.SetEnergy(0);
8266 }
8267 }
8268
8269 else if (action_id ==
EActions.SET_MAX_QUANTITY)
8270 {
8272
8273 if (m_EM)
8274 {
8275 m_EM.SetEnergy(m_EM.GetEnergyMax());
8276 }
8277 }
8278
8279 else if (action_id ==
EActions.ADD_HEALTH)
8280 {
8281 AddHealth("","",GetMaxHealth("","Health")/5);
8282 }
8283 else if (action_id ==
EActions.REMOVE_HEALTH)
8284 {
8285 AddHealth("","",-GetMaxHealth("","Health")/5);
8286 }
8287 else if (action_id ==
EActions.DESTROY_HEALTH)
8288 {
8289 SetHealth01("","",0);
8290 }
8291 else if (action_id ==
EActions.WATCH_ITEM)
8292 {
8294 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
8295 #ifdef DEVELOPER
8296 SetDebugDeveloper_item(this);
8297 #endif
8298 }
8299
8300 else if (action_id ==
EActions.ADD_TEMPERATURE)
8301 {
8302 AddTemperature(20);
8303
8304 }
8305
8306 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
8307 {
8308 AddTemperature(-20);
8309
8310 }
8311
8312 else if (action_id ==
EActions.FLIP_FROZEN)
8313 {
8314 SetFrozen(!GetIsFrozen());
8315
8316 }
8317
8318 else if (action_id ==
EActions.ADD_WETNESS)
8319 {
8321
8322 }
8323
8324 else if (action_id ==
EActions.REMOVE_WETNESS)
8325 {
8327
8328 }
8329
8330 else if (action_id ==
EActions.LIQUIDTYPE_UP)
8331 {
8334
8335
8336 }
8337
8338 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
8339 {
8342 }
8343
8344 else if (action_id ==
EActions.MAKE_SPECIAL)
8345 {
8346 auto debugParams = DebugSpawnParams.WithPlayer(player);
8347 OnDebugSpawnEx(debugParams);
8348 }
8349
8350 }
8351
8352
8353 return false;
8354 }
8355
8356
8357
8358
8362
8365
8366
8367
8369 {
8370 return false;
8371 }
8372
8373
8375 {
8376 return true;
8377 }
8378
8379
8381 {
8382 return true;
8383 }
8384
8385
8386
8388 {
8389 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
8391 }
8392
8395 {
8396 return null;
8397 }
8398
8400 {
8401 return false;
8402 }
8403
8405 {
8406 return false;
8407 }
8408
8412
8413
8415 {
8416 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8417 return module_repairing.CanRepair(this, item_repair_kit);
8418 }
8419
8420
8421 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
8422 {
8423 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8424 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
8425 }
8426
8427
8429 {
8430
8431
8432
8433
8434
8435
8436
8437
8438 return 1;
8439 }
8440
8441
8442
8444 {
8446 }
8447
8448
8449
8451 {
8453 }
8454
8455
8464 {
8465 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8466
8467 if (player)
8468 {
8469 player.MessageStatus(text);
8470 }
8471 }
8472
8473
8482 {
8483 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8484
8485 if (player)
8486 {
8487 player.MessageAction(text);
8488 }
8489 }
8490
8491
8500 {
8501 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8502
8503 if (player)
8504 {
8505 player.MessageFriendly(text);
8506 }
8507 }
8508
8509
8518 {
8519 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8520
8521 if (player)
8522 {
8523 player.MessageImportant(text);
8524 }
8525 }
8526
8528 {
8529 return true;
8530 }
8531
8532
8533 override bool KindOf(
string tag)
8534 {
8535 bool found = false;
8536 string item_name = this.
GetType();
8539
8540 int array_size = item_tag_array.Count();
8541 for (int i = 0; i < array_size; i++)
8542 {
8543 if (item_tag_array.Get(i) == tag)
8544 {
8545 found = true;
8546 break;
8547 }
8548 }
8549 return found;
8550 }
8551
8552
8554 {
8555
8556 super.OnRPC(sender, rpc_type,ctx);
8557
8558
8559 switch (rpc_type)
8560 {
8561 #ifndef SERVER
8562 case ERPCs.RPC_SOUND_LOCK_ATTACH:
8563 Param2<bool, string> p = new Param2<bool, string>(false, "");
8564
8566 return;
8567
8568 bool play = p.param1;
8569 string soundSet = p.param2;
8570
8571 if (play)
8572 {
8574 {
8576 {
8578 }
8579 }
8580 else
8581 {
8583 }
8584 }
8585 else
8586 {
8588 }
8589
8590 break;
8591 #endif
8592
8593 }
8594
8596 {
8598 }
8599 }
8600
8601
8602
8603
8605 {
8606 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8607 return plugin.GetID(
name);
8608 }
8609
8611 {
8612 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8613 return plugin.GetName(id);
8614 }
8615
8618 {
8619
8620
8621 int varFlags;
8622 if (!ctx.
Read(varFlags))
8623 return;
8624
8625 if (varFlags & ItemVariableFlags.FLOAT)
8626 {
8628 }
8629 }
8630
8632 {
8633
8634 super.SerializeNumericalVars(floats_out);
8635
8636
8637
8639 {
8641 }
8642
8644 {
8646 }
8647
8649 {
8651 }
8652
8654 {
8659 }
8660
8662 {
8664 }
8665 }
8666
8668 {
8669
8670 super.DeSerializeNumericalVars(floats);
8671
8672
8673 int index = 0;
8674 int mask = Math.Round(floats.Get(index));
8675
8676 index++;
8677
8679 {
8681 {
8683 }
8684 else
8685 {
8686 float quantity = floats.Get(index);
8688 }
8689 index++;
8690 }
8691
8693 {
8694 float wet = floats.Get(index);
8696 index++;
8697 }
8698
8700 {
8701 int liquidtype = Math.Round(floats.Get(index));
8703 index++;
8704 }
8705
8707 {
8709 index++;
8711 index++;
8713 index++;
8715 index++;
8716 }
8717
8719 {
8720 int cleanness = Math.Round(floats.Get(index));
8722 index++;
8723 }
8724 }
8725
8727 {
8728 super.WriteVarsToCTX(ctx);
8729
8730
8732 {
8734 }
8735
8737 {
8739 }
8740
8742 {
8744 }
8745
8747 {
8748 int r,g,b,a;
8754 }
8755
8757 {
8759 }
8760 }
8761
8763 {
8764 if (!super.ReadVarsFromCTX(ctx,version))
8765 return false;
8766
8767 int intValue;
8768 float value;
8769
8770 if (version < 140)
8771 {
8772 if (!ctx.
Read(intValue))
8773 return false;
8774
8775 m_VariablesMask = intValue;
8776 }
8777
8779 {
8780 if (!ctx.
Read(value))
8781 return false;
8782
8784 {
8786 }
8787 else
8788 {
8790 }
8791 }
8792
8793 if (version < 140)
8794 {
8796 {
8797 if (!ctx.
Read(value))
8798 return false;
8799 SetTemperatureDirect(value);
8800 }
8801 }
8802
8804 {
8805 if (!ctx.
Read(value))
8806 return false;
8808 }
8809
8811 {
8812 if (!ctx.
Read(intValue))
8813 return false;
8815 }
8816
8818 {
8819 int r,g,b,a;
8821 return false;
8823 return false;
8825 return false;
8827 return false;
8828
8830 }
8831
8833 {
8834 if (!ctx.
Read(intValue))
8835 return false;
8837 }
8838
8839 if (version >= 138 && version < 140)
8840 {
8842 {
8843 if (!ctx.
Read(intValue))
8844 return false;
8845 SetFrozen(intValue);
8846 }
8847 }
8848
8849 return true;
8850 }
8851
8852
8854 {
8857 {
8859 }
8860
8861 if (!super.OnStoreLoad(ctx, version))
8862 {
8864 return false;
8865 }
8866
8867 if (version >= 114)
8868 {
8869 bool hasQuickBarIndexSaved;
8870
8871 if (!ctx.
Read(hasQuickBarIndexSaved))
8872 {
8874 return false;
8875 }
8876
8877 if (hasQuickBarIndexSaved)
8878 {
8879 int itmQBIndex;
8880
8881
8882 if (!ctx.
Read(itmQBIndex))
8883 {
8885 return false;
8886 }
8887
8888 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
8889 if (itmQBIndex != -1 && parentPlayer)
8890 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
8891 }
8892 }
8893 else
8894 {
8895
8896 PlayerBase player;
8897 int itemQBIndex;
8898 if (version ==
int.
MAX)
8899 {
8900 if (!ctx.
Read(itemQBIndex))
8901 {
8903 return false;
8904 }
8905 }
8906 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
8907 {
8908
8909 if (!ctx.
Read(itemQBIndex))
8910 {
8912 return false;
8913 }
8914 if (itemQBIndex != -1 && player)
8915 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
8916 }
8917 }
8918
8919 if (version < 140)
8920 {
8921
8922 if (!LoadVariables(ctx, version))
8923 {
8925 return false;
8926 }
8927 }
8928
8929
8931 {
8933 return false;
8934 }
8935 if (version >= 132)
8936 {
8938 if (raib)
8939 {
8941 {
8943 return false;
8944 }
8945 }
8946 }
8947
8949 return true;
8950 }
8951
8952
8953
8955 {
8956 super.OnStoreSave(ctx);
8957
8958 PlayerBase player;
8959 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
8960 {
8962
8963 int itemQBIndex = -1;
8964 itemQBIndex = player.FindQuickBarEntityIndex(this);
8965 ctx.
Write(itemQBIndex);
8966 }
8967 else
8968 {
8970 }
8971
8973
8975 if (raib)
8976 {
8978 }
8979 }
8980
8981
8983 {
8984 super.AfterStoreLoad();
8985
8987 {
8989 }
8990
8992 {
8995 }
8996 }
8997
8999 {
9000 super.EEOnAfterLoad();
9001
9003 {
9005 }
9006
9009 }
9010
9012 {
9013 return false;
9014 }
9015
9016
9017
9019 {
9021 {
9022 #ifdef PLATFORM_CONSOLE
9023
9025 {
9027 if (menu)
9028 {
9030 }
9031 }
9032 #endif
9033 }
9034
9036 {
9039 }
9040
9042 {
9043 SetWeightDirty();
9045 }
9047 {
9050 }
9051
9053 {
9056 }
9058 {
9061 }
9062
9063 super.OnVariablesSynchronized();
9064 }
9065
9066
9067
9069 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
9070 {
9071 if (!IsServerCheck(allow_client))
9072 return false;
9073
9075 return false;
9076
9079
9080 if (value <= (min + 0.001))
9081 value = min;
9082
9083 if (value == min)
9084 {
9085 if (destroy_config)
9086 {
9087 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
9088 if (dstr)
9089 {
9091 this.Delete();
9092 return true;
9093 }
9094 }
9095 else if (destroy_forced)
9096 {
9098 this.Delete();
9099 return true;
9100 }
9101
9103 }
9104
9107
9109 {
9111
9112 if (delta)
9114 }
9115
9117
9118 return false;
9119 }
9120
9121
9123 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9124 {
9126 }
9127
9129 {
9132 }
9133
9135 {
9138 }
9139
9141 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9142 {
9143 float value_clamped = Math.Clamp(value, 0, 1);
9145 SetQuantity(result, destroy_config, destroy_forced);
9146 }
9147
9148
9151 {
9153 }
9154
9156 {
9158 }
9159
9160
9161
9162
9163
9164
9165
9166
9167
9168
9170 {
9171 int slot = -1;
9172 if (GetInventory())
9173 {
9174 InventoryLocation il = new InventoryLocation;
9175 GetInventory().GetCurrentInventoryLocation(il);
9177 }
9178
9180 }
9181
9183 {
9184 float quantity_max = 0;
9185
9187 {
9188 if (attSlotID != -1)
9189 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
9190
9191 if (quantity_max <= 0)
9193 }
9194
9195 if (quantity_max <= 0)
9197
9198 return quantity_max;
9199 }
9200
9202 {
9204 }
9205
9207 {
9209 }
9210
9211
9213 {
9215 }
9216
9218 {
9220 }
9221
9223 {
9225 }
9226
9227
9229 {
9230
9231 float weightEx = GetWeightEx();
9232 float special = GetInventoryAndCargoWeight();
9233 return weightEx - special;
9234 }
9235
9236
9238 {
9240 }
9241
9243 {
9245 {
9246 #ifdef DEVELOPER
9247 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9248 {
9249 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
9251 }
9252 #endif
9253
9255 }
9256 else if (HasEnergyManager())
9257 {
9258 #ifdef DEVELOPER
9259 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9260 {
9261 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
9262 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
9263 }
9264 #endif
9265 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
9266 }
9267 else
9268 {
9269 #ifdef DEVELOPER
9270 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9271 {
9272 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
9273 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
9274 }
9275 #endif
9276 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
9277 }
9278 }
9279
9282 {
9283 int item_count = 0;
9285
9286 if (GetInventory().GetCargo() != NULL)
9287 {
9288 item_count = GetInventory().GetCargo().GetItemCount();
9289 }
9290
9291 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
9292 {
9293 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
9294 if (item)
9295 item_count += item.GetNumberOfItems();
9296 }
9297 return item_count;
9298 }
9299
9302 {
9303 float weight = 0;
9304 float wetness = 1;
9305 if (include_wetness)
9308 {
9309 weight = wetness * m_ConfigWeight;
9310 }
9312 {
9313 weight = 1;
9314 }
9315 return weight;
9316 }
9317
9318
9319
9321 {
9322 if ((
GetGame().IsServer() || !
GetGame().IsMultiplayer()) && GetInventory())
9323 {
9324 GameInventory inv = GetInventory();
9325 array<EntityAI> items = new array<EntityAI>;
9327 for (int i = 0; i < items.Count(); i++)
9328 {
9330 if (item)
9331 {
9333 }
9334 }
9335 }
9336 }
9337
9338
9339
9340
9342 {
9343 float energy = 0;
9344 if (HasEnergyManager())
9345 {
9346 energy = GetCompEM().GetEnergy();
9347 }
9348 return energy;
9349 }
9350
9351
9353 {
9354 super.OnEnergyConsumed();
9355
9357 }
9358
9360 {
9361 super.OnEnergyAdded();
9362
9364 }
9365
9366
9368 {
9369 if (
GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
9370 {
9372 {
9373 float energy_0to1 = GetCompEM().GetEnergy0To1();
9375 }
9376 }
9377 }
9378
9379
9381 {
9382 return ConfigGetFloat("heatIsolation");
9383 }
9384
9386 {
9388 }
9389
9391 {
9392 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
9393 if (
GetGame().ConfigIsExisting(paramPath))
9395
9396 return 0.0;
9397 }
9398
9400 {
9401 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
9402 if (
GetGame().ConfigIsExisting(paramPath))
9404
9405 return 0.0;
9406 }
9407
9408 override void SetWet(
float value,
bool allow_client =
false)
9409 {
9410 if (!IsServerCheck(allow_client))
9411 return;
9412
9415
9417
9418 m_VarWet = Math.Clamp(value, min, max);
9419
9421 {
9424 }
9425 }
9426
9427 override void AddWet(
float value)
9428 {
9430 }
9431
9433 {
9435 }
9436
9438 {
9440 }
9441
9443 {
9445 }
9446
9448 {
9450 }
9451
9453 {
9455 }
9456
9458 {
9461 if (newLevel != oldLevel)
9462 {
9464 }
9465 }
9466
9468 {
9469 SetWeightDirty();
9470 }
9471
9473 {
9474 return GetWetLevelInternal(
m_VarWet);
9475 }
9476
9477
9478
9480 {
9482 }
9483
9485 {
9487 }
9488
9490 {
9492 }
9493
9495 {
9497 }
9498
9499
9500
9502 {
9503 if (ConfigIsExisting("itemModelLength"))
9504 {
9505 return ConfigGetFloat("itemModelLength");
9506 }
9507 return 0;
9508 }
9509
9511 {
9512 if (ConfigIsExisting("itemAttachOffset"))
9513 {
9514 return ConfigGetFloat("itemAttachOffset");
9515 }
9516 return 0;
9517 }
9518
9519 override void SetCleanness(
int value,
bool allow_client =
false)
9520 {
9521 if (!IsServerCheck(allow_client))
9522 return;
9523
9525
9527
9530 }
9531
9533 {
9535 }
9536
9538 {
9539 return true;
9540 }
9541
9542
9543
9544
9546 {
9548 }
9549
9551 {
9553 }
9554
9555
9556
9557
9558 override void SetColor(
int r,
int g,
int b,
int a)
9559 {
9565 }
9567 override void GetColor(out
int r,out
int g,out
int b,out
int a)
9568 {
9573 }
9574
9576 {
9578 }
9579
9582 {
9583 int r,g,b,a;
9585 r = r/255;
9586 g = g/255;
9587 b = b/255;
9588 a = a/255;
9589 return MiscGameplayFunctions.GetColorString(r, g, b, a);
9590 }
9591
9592
9593
9594 override void SetLiquidType(
int value,
bool allow_client =
false)
9595 {
9596 if (!IsServerCheck(allow_client))
9597 return;
9598
9603 }
9604
9606 {
9607 return ConfigGetInt("varLiquidTypeInit");
9608 }
9609
9611 {
9613 }
9614
9616 {
9618 SetFrozen(false);
9619 }
9620
9623 {
9624 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9625 }
9626
9627
9630 {
9631 PlayerBase nplayer;
9632 if (PlayerBase.CastTo(nplayer, player))
9633 {
9635
9636 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9637 }
9638 }
9639
9640
9643 {
9644 PlayerBase nplayer;
9645 if (PlayerBase.CastTo(nplayer,player))
9646 {
9647
9648 nplayer.SetEnableQuickBarEntityShortcut(this,false);
9649
9650 }
9651
9652
9653 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
9654
9655
9656 if (HasEnergyManager())
9657 {
9658 GetCompEM().UpdatePlugState();
9659 }
9660 }
9661
9662
9664 {
9665 super.OnPlacementStarted(player);
9666
9668 }
9669
9670 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
9671 {
9673 {
9674 m_AdminLog.OnPlacementComplete(player,
this);
9675 }
9676
9677 super.OnPlacementComplete(player, position, orientation);
9678 }
9679
9680
9681
9682
9683
9685 {
9687 {
9688 return true;
9689 }
9690 else
9691 {
9692 return false;
9693 }
9694 }
9695
9696
9698 {
9700 {
9702 }
9703 }
9704
9705
9707 {
9709 }
9710
9712 {
9714 }
9715
9716 override void InsertAgent(
int agent,
float count = 1)
9717 {
9718 if (count < 1)
9719 return;
9720
9722 }
9723
9726 {
9728 }
9729
9730
9732 {
9734 }
9735
9736
9737
9738
9739
9740
9741
9742
9743
9744
9745
9746
9747
9748
9749
9750
9751
9752
9753
9754
9755
9756
9757
9758
9759
9760
9761
9762
9763
9764
9765
9766
9767
9768
9769
9770
9771
9772
9773
9774
9775
9776
9778 {
9780 return false;
9781 return true;
9782 }
9783
9785 {
9786
9788 }
9789
9790
9793 {
9794 super.CheckForRoofLimited(timeTresholdMS);
9795
9797 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
9798 {
9799 m_PreviousRoofTestTime = time;
9800 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
9801 }
9802 }
9803
9804
9806 {
9808 {
9809 return 0;
9810 }
9811
9812 if (GetInventory().GetAttachmentSlotsCount() != 0)
9813 {
9814 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
9815 if (filter)
9816 return filter.GetProtectionLevel(type, false, system);
9817 else
9818 return 0;
9819 }
9820
9821 string subclassPath, entryName;
9822
9823 switch (type)
9824 {
9826 entryName = "biological";
9827 break;
9829 entryName = "chemical";
9830 break;
9831 default:
9832 entryName = "biological";
9833 break;
9834 }
9835
9836 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
9837
9839 }
9840
9841
9842
9845 {
9846 if (!IsMagazine())
9848
9850 }
9851
9852
9853
9854
9855
9860 {
9861 return true;
9862 }
9863
9865 {
9867 }
9868
9869
9870
9871
9872
9874 {
9875 if (parent)
9876 {
9877 if (parent.IsInherited(DayZInfected))
9878 return true;
9879
9880 if (!parent.IsRuined())
9881 return true;
9882 }
9883
9884 return true;
9885 }
9886
9888 {
9889 if (!super.CanPutAsAttachment(parent))
9890 {
9891 return false;
9892 }
9893
9894 if (!IsRuined() && !parent.IsRuined())
9895 {
9896 return true;
9897 }
9898
9899 return false;
9900 }
9901
9903 {
9904
9905
9906
9907
9908 return super.CanReceiveItemIntoCargo(item);
9909 }
9910
9912 {
9913
9914
9915
9916
9917 GameInventory attachmentInv = attachment.GetInventory();
9919 {
9920 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
9921 return false;
9922 }
9923
9924 InventoryLocation loc = new InventoryLocation();
9925 attachment.GetInventory().GetCurrentInventoryLocation(loc);
9926 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
9927 return false;
9928
9929 return super.CanReceiveAttachment(attachment, slotId);
9930 }
9931
9933 {
9934 if (!super.CanReleaseAttachment(attachment))
9935 return false;
9936
9937 return GetInventory().AreChildrenAccessible();
9938 }
9939
9940
9941
9942
9943
9944
9945
9946
9947
9948
9949
9950
9951
9952
9953
9954
9955
9956
9957
9958
9959
9961 {
9962 int id = muzzle_owner.GetMuzzleID();
9963 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
9964
9965 if (WPOF_array)
9966 {
9967 for (int i = 0; i < WPOF_array.Count(); i++)
9968 {
9969 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
9970
9971 if (WPOF)
9972 {
9973 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
9974 }
9975 }
9976 }
9977 }
9978
9979
9981 {
9982 int id = muzzle_owner.GetMuzzleID();
9984
9985 if (WPOBE_array)
9986 {
9987 for (int i = 0; i < WPOBE_array.Count(); i++)
9988 {
9989 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
9990
9991 if (WPOBE)
9992 {
9993 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
9994 }
9995 }
9996 }
9997 }
9998
9999
10001 {
10002 int id = muzzle_owner.GetMuzzleID();
10003 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10004
10005 if (WPOOH_array)
10006 {
10007 for (int i = 0; i < WPOOH_array.Count(); i++)
10008 {
10009 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10010
10011 if (WPOOH)
10012 {
10013 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10014 }
10015 }
10016 }
10017 }
10018
10019
10021 {
10022 int id = muzzle_owner.GetMuzzleID();
10023 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10024
10025 if (WPOOH_array)
10026 {
10027 for (int i = 0; i < WPOOH_array.Count(); i++)
10028 {
10029 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10030
10031 if (WPOOH)
10032 {
10033 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10034 }
10035 }
10036 }
10037 }
10038
10039
10041 {
10042 int id = muzzle_owner.GetMuzzleID();
10043 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10044
10045 if (WPOOH_array)
10046 {
10047 for (int i = 0; i < WPOOH_array.Count(); i++)
10048 {
10049 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10050
10051 if (WPOOH)
10052 {
10053 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10054 }
10055 }
10056 }
10057 }
10058
10059
10060
10062 {
10064 {
10065 return true;
10066 }
10067
10068 return false;
10069 }
10070
10072 {
10074 {
10075 return true;
10076 }
10077
10078 return false;
10079 }
10080
10082 {
10084 {
10085 return true;
10086 }
10087
10088 return false;
10089 }
10090
10092 {
10093 return false;
10094 }
10095
10098 {
10099 return UATimeSpent.DEFAULT_DEPLOY;
10100 }
10101
10102
10103
10104
10106 {
10108 SetSynchDirty();
10109 }
10110
10112 {
10114 }
10115
10116
10118 {
10119 return false;
10120 }
10121
10124 {
10125 string att_type = "None";
10126
10127 if (ConfigIsExisting("soundAttType"))
10128 {
10129 att_type = ConfigGetString("soundAttType");
10130 }
10131
10133 }
10134
10136 {
10138 }
10139
10140
10141
10142
10143
10149
10151 {
10154
10156 }
10157
10158
10160 {
10162 return;
10163
10165
10168
10171
10172 SoundParameters params = new SoundParameters();
10176 }
10177
10178
10180 {
10182 return;
10183
10185 SetSynchDirty();
10186
10189 }
10190
10191
10193 {
10195 return;
10196
10198 SetSynchDirty();
10199
10202 }
10203
10205 {
10207 }
10208
10210 {
10212 }
10213
10216 {
10217 if (!
GetGame().IsDedicatedServer())
10218 {
10219 if (ConfigIsExisting("attachSoundSet"))
10220 {
10221 string cfg_path = "";
10222 string soundset = "";
10223 string type_name =
GetType();
10224
10227 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
10228 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
10229
10230 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
10231 {
10232 for (int i = 0; i < cfg_soundset_array.Count(); i++)
10233 {
10234 if (cfg_slot_array[i] == slot_type)
10235 {
10236 soundset = cfg_soundset_array[i];
10237 break;
10238 }
10239 }
10240 }
10241
10242 if (soundset != "")
10243 {
10244 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
10246 }
10247 }
10248 }
10249 }
10250
10252 {
10253
10254 }
10255
10256 void OnApply(PlayerBase player);
10257
10259 {
10260 return 1.0;
10261 };
10262
10264 {
10266 }
10267
10269 {
10271 }
10272
10274
10276 {
10277 SetDynamicPhysicsLifeTime(0.01);
10279 }
10280
10282 {
10283 array<string> zone_names = new array<string>;
10284 GetDamageZones(zone_names);
10285 for (int i = 0; i < zone_names.Count(); i++)
10286 {
10287 SetHealthMax(zone_names.Get(i),"Health");
10288 }
10289 SetHealthMax("","Health");
10290 }
10291
10294 {
10295 float global_health = GetHealth01("","Health");
10296 array<string> zones = new array<string>;
10297 GetDamageZones(zones);
10298
10299 for (int i = 0; i < zones.Count(); i++)
10300 {
10301 SetHealth01(zones.Get(i),"Health",global_health);
10302 }
10303 }
10304
10307 {
10308 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
10309 }
10310
10312 {
10313 if (!hasRootAsPlayer)
10314 {
10315 if (refParentIB)
10316 {
10317
10318 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
10319 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
10320
10321 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
10322 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
10323
10326 }
10327 else
10328 {
10329
10332 }
10333 }
10334 }
10335
10337 {
10339 {
10340 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
10341 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
10342 {
10343 float heatPermCoef = 1.0;
10345 while (ent)
10346 {
10347 heatPermCoef *= ent.GetHeatPermeabilityCoef();
10348 ent = ent.GetHierarchyParent();
10349 }
10350
10351 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
10352 }
10353 }
10354 }
10355
10357 {
10358
10359 EntityAI parent = GetHierarchyParent();
10360 if (!parent)
10361 {
10362 hasParent = false;
10363 hasRootAsPlayer = false;
10364 }
10365 else
10366 {
10367 hasParent = true;
10368 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
10369 refParentIB =
ItemBase.Cast(parent);
10370 }
10371 }
10372
10373 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
10374 {
10375
10376 }
10377
10379 {
10380
10381 return false;
10382 }
10383
10385 {
10386
10387
10388 return false;
10389 }
10390
10392 {
10393
10394 return false;
10395 }
10396
10399 {
10400 return !GetIsFrozen() &&
IsOpen();
10401 }
10402
10404 {
10405 bool hasParent = false, hasRootAsPlayer = false;
10407
10408 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
10409 bool foodDecay =
g_Game.IsFoodDecayEnabled();
10410
10411 if (wwtu || foodDecay)
10412 {
10416
10417 if (processWetness || processTemperature || processDecay)
10418 {
10420
10421 if (processWetness)
10422 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
10423
10424 if (processTemperature)
10426
10427 if (processDecay)
10428 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
10429 }
10430 }
10431 }
10432
10435 {
10437 }
10438
10440 {
10443
10444 return super.GetTemperatureFreezeThreshold();
10445 }
10446
10448 {
10451
10452 return super.GetTemperatureThawThreshold();
10453 }
10454
10456 {
10459
10460 return super.GetItemOverheatThreshold();
10461 }
10462
10464 {
10466 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
10467
10468 return super.GetTemperatureFreezeTime();
10469 }
10470
10472 {
10474 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
10475
10476 return super.GetTemperatureThawTime();
10477 }
10478
10483
10485 {
10486 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
10487 }
10488
10490 {
10491 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
10492 }
10493
10496 {
10498 }
10499
10501 {
10503 }
10504
10506 {
10508 }
10509
10512 {
10513 return null;
10514 }
10515
10518 {
10519 return false;
10520 }
10521
10523 {
10525 {
10528 if (!trg)
10529 {
10531 explosive = this;
10532 }
10533
10534 explosive.PairRemote(trg);
10536
10537 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
10538 trg.SetPersistentPairID(persistentID);
10539 explosive.SetPersistentPairID(persistentID);
10540
10541 return true;
10542 }
10543 return false;
10544 }
10545
10548 {
10549 float ret = 1.0;
10552 ret *= GetHealth01();
10553
10554 return ret;
10555 }
10556
10557 #ifdef DEVELOPER
10558 override void SetDebugItem()
10559 {
10560 super.SetDebugItem();
10561 _itemBase = this;
10562 }
10563
10565 {
10566 string text = super.GetDebugText();
10567
10569 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
10570
10571 return text;
10572 }
10573 #endif
10574
10576 {
10577 return true;
10578 }
10579
10581
10583
10585 {
10588 }
10589
10590
10598
10614}
10615
10617{
10619 if (entity)
10620 {
10621 bool is_item = entity.IsInherited(
ItemBase);
10622 if (is_item && full_quantity)
10623 {
10626 }
10627 }
10628 else
10629 {
10631 return NULL;
10632 }
10633 return entity;
10634}
10635
10637{
10638 if (item)
10639 {
10640 if (health > 0)
10641 item.SetHealth("", "", health);
10642
10643 if (item.CanHaveTemperature())
10644 {
10646 if (item.CanFreeze())
10647 item.SetFrozen(false);
10648 }
10649
10650 if (item.HasEnergyManager())
10651 {
10652 if (quantity >= 0)
10653 {
10654 item.GetCompEM().SetEnergy0To1(quantity);
10655 }
10656 else
10657 {
10659 }
10660 }
10661 else if (item.IsMagazine())
10662 {
10663 Magazine mag = Magazine.Cast(item);
10664 if (quantity >= 0)
10665 {
10666 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
10667 }
10668 else
10669 {
10671 }
10672
10673 }
10674 else
10675 {
10676 if (quantity >= 0)
10677 {
10678 item.SetQuantityNormalized(quantity, false);
10679 }
10680 else
10681 {
10683 }
10684
10685 }
10686 }
10687}
10688
10689#ifdef DEVELOPER
10691#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.