Returns global muzzle ID. If not found, then it gets automatically registered.
5553{
5555 {
5556 return true;
5557 }
5558};
5559
5560
5561
5563{
5567
5569
5572
5573
5574
5575
5576
5585
5591
5596
5601
5622 protected bool m_IsResultOfSplit
5623
5625
5630
5631
5632
5634
5638
5639
5640
5642
5645
5646
5647
5653
5654
5662
5665
5666
5668
5669
5671
5672
5677
5678
5683
5684
5686
5687
5689 {
5694
5695 if (!
GetGame().IsDedicatedServer())
5696 {
5698 {
5700
5702 {
5704 }
5705 }
5706
5709 }
5710
5711 m_OldLocation = null;
5712
5714 {
5716 }
5717
5718 if (ConfigIsExisting("headSelectionsToHide"))
5719 {
5722 }
5723
5725 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
5726 {
5728 }
5729
5731
5732 m_IsResultOfSplit = false;
5733
5735 }
5736
5738 {
5739 super.InitItemVariables();
5740
5746 m_Count = ConfigGetInt(
"count");
5747
5750
5755
5758
5763
5775
5779
5780
5783 if (ConfigIsExisting("canBeSplit"))
5784 {
5787 }
5788
5790 if (ConfigIsExisting("itemBehaviour"))
5792
5793
5796 RegisterNetSyncVariableInt("m_VarLiquidType");
5797 RegisterNetSyncVariableInt("m_Cleanness",0,1);
5798
5799 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
5800 RegisterNetSyncVariableFloat("m_ImpactSpeed");
5801 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
5802
5803 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
5804 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
5805 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
5806 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
5807
5808 RegisterNetSyncVariableBool("m_IsBeingPlaced");
5809 RegisterNetSyncVariableBool("m_IsTakeable");
5810 RegisterNetSyncVariableBool("m_IsHologram");
5811
5814 {
5817 }
5818
5820
5822 if (ConfigIsExisting("temperaturePerQuantityWeight"))
5824
5825 }
5826
5828 {
5830 }
5831
5833 {
5836 {
5841 }
5842 }
5843
5844 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
5845 {
5847 {
5850 }
5851
5853 }
5854
5856 {
5862 }
5863
5865
5867 {
5869
5870 if (!action)
5871 {
5872 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
5873 return;
5874 }
5875
5877 if (!ai)
5878 {
5880 return;
5881 }
5882
5884 if (!action_array)
5885 {
5886 action_array = new array<ActionBase_Basic>;
5888 }
5889 if (LogManager.IsActionLogEnable())
5890 {
5891 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
5892 }
5893
5894 if (action_array.Find(action) != -1)
5895 {
5896 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
5897 }
5898 else
5899 {
5900 action_array.Insert(action);
5901 }
5902 }
5903
5905 {
5907 ActionBase action = player.GetActionManager().GetAction(actionName);
5910
5911 if (action_array)
5912 {
5913 action_array.RemoveItem(action);
5914 }
5915 }
5916
5917
5918
5920 {
5921 ActionOverrideData overrideData = new ActionOverrideData();
5925
5927 if (!actionMap)
5928 {
5931 }
5932
5933 actionMap.Insert(this.
Type(), overrideData);
5934
5935 }
5936
5938
5940
5941
5943 {
5946
5949
5950 string config_to_search = "CfgVehicles";
5951 string muzzle_owner_config;
5952
5954 {
5955 if (IsInherited(Weapon))
5956 config_to_search = "CfgWeapons";
5957
5958 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
5959
5960 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
5961
5963
5964 if (config_OnFire_subclass_count > 0)
5965 {
5966 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
5967
5968 for (int i = 0; i < config_OnFire_subclass_count; i++)
5969 {
5970 string particle_class = "";
5972 string config_OnFire_entry = config_OnFire_class + particle_class;
5973 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
5974 WPOF_array.Insert(WPOF);
5975 }
5976
5977
5979 }
5980 }
5981
5983 {
5984 config_to_search = "CfgWeapons";
5985 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
5986
5987 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
5988
5990
5991 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
5992 {
5993 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
5994
5995 for (i = 0; i < config_OnBulletCasingEject_count; i++)
5996 {
5997 string particle_class2 = "";
5999 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
6000 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
6001 WPOBE_array.Insert(WPOBE);
6002 }
6003
6004
6006 }
6007 }
6008 }
6009
6010
6012 {
6015
6017 {
6018 string config_to_search = "CfgVehicles";
6019
6020 if (IsInherited(Weapon))
6021 config_to_search = "CfgWeapons";
6022
6023 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6024 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
6025
6026 if (
GetGame().ConfigIsExisting(config_OnOverheating_class))
6027 {
6028
6030
6032 {
6034 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
6036 return;
6037 }
6038
6041
6042
6043
6045 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
6046
6047 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
6048 {
6049 string particle_class = "";
6051 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
6053
6054 if (entry_type == CT_CLASS)
6055 {
6056 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
6057 WPOOH_array.Insert(WPOF);
6058 }
6059 }
6060
6061
6063 }
6064 }
6065 }
6066
6068 {
6070 }
6071
6073 {
6075 {
6077
6080
6083
6084 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6085 }
6086 }
6087
6089 {
6091 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6092
6094 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6095
6097 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6098
6100 {
6102 }
6103 }
6104
6106 {
6108 }
6109
6111 {
6114 else
6116
6118 {
6121 }
6122 else
6123 {
6126
6129 }
6130
6132 }
6133
6135 {
6137 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6138 }
6139
6141 {
6143 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6145 }
6146
6148 {
6150 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6151 }
6152
6154 {
6157
6158 OverheatingParticle OP = new OverheatingParticle();
6163
6165 }
6166
6168 {
6171
6172 return -1;
6173 }
6174
6176 {
6178 {
6181
6182 for (int i = count; i > 0; --i)
6183 {
6184 int id = i - 1;
6187
6190
6191 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
6192 {
6193 if (p)
6194 {
6197 }
6198 }
6199 }
6200 }
6201 }
6202
6204 {
6206 {
6208 {
6209 int id = i - 1;
6211
6212 if (OP)
6213 {
6215
6216 if (p)
6217 {
6219 }
6220
6221 delete OP;
6222 }
6223 }
6224
6227 }
6228 }
6229
6232 {
6233 return 0.0;
6234 }
6235
6236
6238 {
6239 return 250;
6240 }
6241
6243 {
6244 return 0;
6245 }
6246
6249 {
6251 return true;
6252
6253 return false;
6254 }
6255
6258 {
6261
6263 {
6265 }
6266 else
6267 {
6268
6270 }
6271
6273 }
6274
6281 {
6282 return -1;
6283 }
6284
6285
6286
6287
6289 {
6291 {
6293 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6294
6295 if (r_index >= 0)
6296 {
6297 InventoryLocation r_il = new InventoryLocation;
6298 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6299
6300 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6303 {
6304 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6305 }
6307 {
6308 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6309 }
6310
6311 }
6312
6313 player.GetHumanInventory().ClearUserReservedLocation(this);
6314 }
6315
6318 }
6319
6320
6321
6322
6324 {
6325 return ItemBase.m_DebugActionsMask;
6326 }
6327
6329 {
6330 return ItemBase.m_DebugActionsMask & mask;
6331 }
6332
6334 {
6335 ItemBase.m_DebugActionsMask = mask;
6336 }
6337
6339 {
6340 ItemBase.m_DebugActionsMask |= mask;
6341 }
6342
6344 {
6345 ItemBase.m_DebugActionsMask &= ~mask;
6346 }
6347
6349 {
6351 {
6353 }
6354 else
6355 {
6357 }
6358 }
6359
6360
6362 {
6363 if (GetEconomyProfile())
6364 {
6365 float q_max = GetEconomyProfile().GetQuantityMax();
6366 if (q_max > 0)
6367 {
6368 float q_min = GetEconomyProfile().GetQuantityMin();
6369 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
6370
6372 {
6373 ComponentEnergyManager comp = GetCompEM();
6375 {
6377 }
6378 }
6380 {
6382
6383 }
6384
6385 }
6386 }
6387 }
6388
6391 {
6392 EntityAI parent = GetHierarchyParent();
6393
6394 if (parent)
6395 {
6396 InventoryLocation inventory_location_to_lock = new InventoryLocation;
6397 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
6398 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
6399 }
6400 }
6401
6404 {
6405 EntityAI parent = GetHierarchyParent();
6406
6407 if (parent)
6408 {
6409 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
6410 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
6411 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
6412 }
6413 }
6414
6416 {
6417
6418
6419
6420
6422
6424 {
6425 if (ScriptInputUserData.CanStoreInputUserData())
6426 {
6427 ScriptInputUserData ctx = new ScriptInputUserData;
6433 ctx.
Write(use_stack_max);
6436
6438 {
6439 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
6440 }
6441 }
6442 }
6443 else if (!
GetGame().IsMultiplayer())
6444 {
6446 }
6447 }
6448
6450 {
6452 }
6453
6455 {
6457 }
6458
6460 {
6462 }
6463
6465 {
6466
6467 return false;
6468 }
6469
6471 {
6472 return false;
6473 }
6474
6478 {
6479 return false;
6480 }
6481
6483 {
6484 return "";
6485 }
6486
6488
6490 {
6491 return false;
6492 }
6493
6495 {
6496 return true;
6497 }
6498
6499
6500
6502 {
6503 return true;
6504 }
6505
6507 {
6508 return true;
6509 }
6510
6512 {
6513 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6515 }
6516
6518 {
6520 }
6521
6523 {
6525 if (!is_being_placed)
6527 SetSynchDirty();
6528 }
6529
6530
6532
6534 {
6536 }
6537
6539 {
6541 }
6542
6544 {
6545 return 1;
6546 }
6547
6549 {
6550 return false;
6551 }
6552
6554 {
6556 SetSynchDirty();
6557 }
6558
6559
6560
6561
6562
6563
6564
6565
6566
6567
6568
6569
6570
6571
6572
6573
6574
6575
6576
6577
6578
6579
6580
6581
6582
6583
6584
6585
6586
6587
6588
6589
6590
6591
6592
6594 {
6595 super.OnMovedInsideCargo(container);
6596
6597 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6598 }
6599
6600 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
6601 {
6602 super.EEItemLocationChanged(oldLoc,newLoc);
6603
6604 PlayerBase new_player = null;
6605 PlayerBase old_player = null;
6606
6607 if (newLoc.GetParent())
6608 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
6609
6610 if (oldLoc.GetParent())
6611 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
6612
6614 {
6615 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
6616
6617 if (r_index >= 0)
6618 {
6619 InventoryLocation r_il = new InventoryLocation;
6620 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6621
6622 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6625 {
6626 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6627 }
6629 {
6630 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6631 }
6632
6633 }
6634 }
6635
6637 {
6638 if (new_player)
6639 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
6640
6641 if (new_player == old_player)
6642 {
6643
6644 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
6645 {
6647 {
6648 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
6649 {
6650 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6651 }
6652 }
6653 else
6654 {
6655 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6656 }
6657 }
6658
6659 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
6660 {
6661 int type = oldLoc.GetType();
6663 {
6664 oldLoc.GetParent().GetOnSetLock().Invoke(this);
6665 }
6667 {
6668 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
6669 }
6670 }
6671 if (!m_OldLocation)
6672 {
6673 m_OldLocation = new InventoryLocation;
6674 }
6675 m_OldLocation.Copy(oldLoc);
6676 }
6677 else
6678 {
6679 if (m_OldLocation)
6680 {
6681 m_OldLocation.Reset();
6682 }
6683 }
6684
6686 }
6687 else
6688 {
6689 if (new_player)
6690 {
6691 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
6692 if (res_index >= 0)
6693 {
6694 InventoryLocation il = new InventoryLocation;
6695 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
6697 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
6700 {
6701 il.
GetParent().GetOnReleaseLock().Invoke(it);
6702 }
6704 {
6706 }
6707
6708 }
6709 }
6711 {
6712
6714 }
6715
6716 if (m_OldLocation)
6717 {
6718 m_OldLocation.Reset();
6719 }
6720 }
6721 }
6722
6723 override void EOnContact(IEntity other, Contact extra)
6724 {
6726 {
6727 int liquidType = -1;
6729 if (impactSpeed > 0.0)
6730 {
6732 #ifndef SERVER
6734 #else
6736 SetSynchDirty();
6737 #endif
6739 }
6740 }
6741
6742 #ifdef SERVER
6743 if (GetCompEM() && GetCompEM().IsPlugged())
6744 {
6745 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
6746 GetCompEM().UnplugThis();
6747 }
6748 #endif
6749 }
6750
6752
6754 {
6756 }
6757
6759 {
6760
6761 }
6762
6764 {
6765 super.OnItemLocationChanged(old_owner, new_owner);
6766
6767 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
6768 PlayerBase playerNew = PlayerBase.Cast(new_owner);
6769
6770 if (!relatedPlayer && playerNew)
6771 relatedPlayer = playerNew;
6772
6773 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
6774 {
6776 if (actionMgr)
6777 {
6778 ActionBase currentAction = actionMgr.GetRunningAction();
6779 if (currentAction)
6781 }
6782 }
6783
6784 Man ownerPlayerOld = null;
6785 Man ownerPlayerNew = null;
6786
6787 if (old_owner)
6788 {
6789 if (old_owner.
IsMan())
6790 {
6791 ownerPlayerOld = Man.Cast(old_owner);
6792 }
6793 else
6794 {
6795 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
6796 }
6797 }
6798 else
6799 {
6801 {
6803
6804 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
6805 {
6806 GetCompEM().UnplugThis();
6807 }
6808 }
6809 }
6810
6811 if (new_owner)
6812 {
6813 if (new_owner.
IsMan())
6814 {
6815 ownerPlayerNew = Man.Cast(new_owner);
6816 }
6817 else
6818 {
6819 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
6820 }
6821 }
6822
6823 if (ownerPlayerOld != ownerPlayerNew)
6824 {
6825 if (ownerPlayerOld)
6826 {
6827 array<EntityAI> subItemsExit = new array<EntityAI>;
6829 for (int i = 0; i < subItemsExit.Count(); i++)
6830 {
6833 }
6834 }
6835
6836 if (ownerPlayerNew)
6837 {
6838 array<EntityAI> subItemsEnter = new array<EntityAI>;
6840 for (int j = 0; j < subItemsEnter.Count(); j++)
6841 {
6844 }
6845 }
6846 }
6847 else if (ownerPlayerNew != null)
6848 {
6849 PlayerBase nplayer;
6850 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
6851 {
6852 array<EntityAI> subItemsUpdate = new array<EntityAI>;
6854 for (int k = 0; k < subItemsUpdate.Count(); k++)
6855 {
6857 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
6858 }
6859 }
6860 }
6861
6862 if (old_owner)
6863 old_owner.OnChildItemRemoved(this);
6864 if (new_owner)
6865 new_owner.OnChildItemReceived(this);
6866 }
6867
6868
6870 {
6871 super.EEDelete(parent);
6872 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
6873 if (player)
6874 {
6876
6877 if (player.IsAlive())
6878 {
6879 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6880 if (r_index >= 0)
6881 {
6882 InventoryLocation r_il = new InventoryLocation;
6883 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6884
6885 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6888 {
6889 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6890 }
6892 {
6893 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6894 }
6895
6896 }
6897
6898 player.RemoveQuickBarEntityShortcut(this);
6899 }
6900 }
6901 }
6902
6904 {
6905 super.EEKilled(killer);
6906
6909 {
6910 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
6911 {
6912 if (IsMagazine())
6913 {
6914 if (Magazine.Cast(this).GetAmmoCount() > 0)
6915 {
6917 }
6918 }
6919 else
6920 {
6922 }
6923 }
6924 }
6925 }
6926
6928 {
6929 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6930
6931 super.OnWasAttached(parent, slot_id);
6932
6935
6937 }
6938
6940 {
6941 super.OnWasDetached(parent, slot_id);
6942
6945 }
6946
6948 {
6949 int idx;
6952
6953 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
6954 if (inventory_slots.Count() < 1)
6955 {
6956 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
6957 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
6958 }
6959 else
6960 {
6961 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
6962 }
6963
6964 idx = inventory_slots.Find(slot);
6965 if (idx < 0)
6966 return "";
6967
6968 return attach_types.Get(idx);
6969 }
6970
6972 {
6973 int idx = -1;
6974 string slot;
6975
6978
6979 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
6980 if (inventory_slots.Count() < 1)
6981 {
6982 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
6983 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
6984 }
6985 else
6986 {
6987 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
6988 if (detach_types.Count() < 1)
6989 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
6990 }
6991
6992 for (int i = 0; i < inventory_slots.Count(); i++)
6993 {
6994 slot = inventory_slots.Get(i);
6995 }
6996
6997 if (slot != "")
6998 {
6999 if (detach_types.Count() == 1)
7000 idx = 0;
7001 else
7002 idx = inventory_slots.Find(slot);
7003 }
7004 if (idx < 0)
7005 return "";
7006
7007 return detach_types.Get(idx);
7008 }
7009
7011 {
7012
7014
7015
7016 float min_time = 1;
7017 float max_time = 3;
7018 float delay = Math.RandomFloat(min_time, max_time);
7019
7020 explode_timer.Run(delay, this, "DoAmmoExplosion");
7021 }
7022
7024 {
7025 Magazine magazine = Magazine.Cast(this);
7026 int pop_sounds_count = 6;
7027 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
7028
7029
7030 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
7031 string sound_name = pop_sounds[ sound_idx ];
7033
7034
7035 magazine.ServerAddAmmoCount(-1);
7036
7037
7038 float min_temp_to_explode = 100;
7039
7040 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
7041 {
7043 }
7044 }
7045
7046
7047 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
7048 {
7049 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
7050
7051 const int CHANCE_DAMAGE_CARGO = 4;
7052 const int CHANCE_DAMAGE_ATTACHMENT = 1;
7053 const int CHANCE_DAMAGE_NOTHING = 2;
7054
7056 {
7057 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
7058 int chances;
7059 int rnd;
7060
7061 if (GetInventory().GetCargo())
7062 {
7063 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7064 rnd = Math.RandomInt(0,chances);
7065
7066 if (rnd < CHANCE_DAMAGE_CARGO)
7067 {
7069 }
7070 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
7071 {
7073 }
7074 }
7075 else
7076 {
7077 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7078 rnd = Math.RandomInt(0,chances);
7079
7080 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
7081 {
7083 }
7084 }
7085 }
7086 }
7087
7089 {
7090 if (GetInventory().GetCargo())
7091 {
7092 int item_count = GetInventory().GetCargo().GetItemCount();
7093 if (item_count > 0)
7094 {
7095 int random_pick = Math.RandomInt(0, item_count);
7097 if (!item.IsExplosive())
7098 {
7099 item.AddHealth("","",damage);
7100 return true;
7101 }
7102 }
7103 }
7104 return false;
7105 }
7106
7108 {
7109 int attachment_count = GetInventory().AttachmentCount();
7110 if (attachment_count > 0)
7111 {
7112 int random_pick = Math.RandomInt(0, attachment_count);
7113 ItemBase attachment =
ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
7114 if (!attachment.IsExplosive())
7115 {
7116 attachment.AddHealth("","",damage);
7117 return true;
7118 }
7119 }
7120 return false;
7121 }
7122
7124 {
7126 }
7127
7129 {
7131 return GetInventory().CanRemoveEntity();
7132
7133 return false;
7134 }
7135
7137 {
7138
7140 return false;
7141
7142
7144 return false;
7145
7146
7147
7149 if (delta == 0)
7150 return false;
7151
7152
7153 return true;
7154 }
7155
7157 {
7159 {
7160 if (ScriptInputUserData.CanStoreInputUserData())
7161 {
7162 ScriptInputUserData ctx = new ScriptInputUserData;
7167 ctx.
Write(destination_entity);
7171 }
7172 }
7173 else if (!
GetGame().IsMultiplayer())
7174 {
7176 }
7177 }
7178
7180 {
7181 float split_quantity_new;
7185 InventoryLocation loc = new InventoryLocation;
7186
7187 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7188 {
7190 split_quantity_new = stack_max;
7191 else
7193
7195 {
7196 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7197 if (new_item)
7198 {
7199 new_item.SetResultOfSplit(true);
7200 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7202 new_item.
SetQuantity(split_quantity_new,
false,
true);
7203 }
7204 }
7205 }
7206 else if (destination_entity && slot_id == -1)
7207 {
7208 if (quantity > stack_max)
7209 split_quantity_new = stack_max;
7210 else
7211 split_quantity_new = quantity;
7212
7214 {
7216 {
7219 }
7220
7221 if (new_item)
7222 {
7223 new_item.SetResultOfSplit(true);
7224 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7226 new_item.
SetQuantity(split_quantity_new,
false,
true);
7227 }
7228 }
7229 }
7230 else
7231 {
7232 if (stack_max != 0)
7233 {
7235 {
7237 }
7238
7239 if (split_quantity_new == 0)
7240 {
7241 if (!
GetGame().IsMultiplayer())
7242 player.PhysicalPredictiveDropItem(this);
7243 else
7244 player.ServerDropEntity(this);
7245 return;
7246 }
7247
7249 {
7251
7252 if (new_item)
7253 {
7254 new_item.SetResultOfSplit(true);
7255 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7258 new_item.PlaceOnSurface();
7259 }
7260 }
7261 }
7262 }
7263 }
7264
7266 {
7267 float split_quantity_new;
7271 InventoryLocation loc = new InventoryLocation;
7272
7273 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7274 {
7276 split_quantity_new = stack_max;
7277 else
7279
7281 {
7282 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7283 if (new_item)
7284 {
7285 new_item.SetResultOfSplit(true);
7286 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7288 new_item.
SetQuantity(split_quantity_new,
false,
true);
7289 }
7290 }
7291 }
7292 else if (destination_entity && slot_id == -1)
7293 {
7294 if (quantity > stack_max)
7295 split_quantity_new = stack_max;
7296 else
7297 split_quantity_new = quantity;
7298
7300 {
7302 {
7305 }
7306
7307 if (new_item)
7308 {
7309 new_item.SetResultOfSplit(true);
7310 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7312 new_item.
SetQuantity(split_quantity_new,
false,
true);
7313 }
7314 }
7315 }
7316 else
7317 {
7318 if (stack_max != 0)
7319 {
7321 {
7323 }
7324
7326 {
7328
7329 if (new_item)
7330 {
7331 new_item.SetResultOfSplit(true);
7332 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7335 new_item.PlaceOnSurface();
7336 }
7337 }
7338 }
7339 }
7340 }
7341
7343 {
7345 {
7346 if (ScriptInputUserData.CanStoreInputUserData())
7347 {
7348 ScriptInputUserData ctx = new ScriptInputUserData;
7353 dst.WriteToContext(ctx);
7355 }
7356 }
7357 else if (!
GetGame().IsMultiplayer())
7358 {
7360 }
7361 }
7362
7364 {
7366 {
7367 if (ScriptInputUserData.CanStoreInputUserData())
7368 {
7369 ScriptInputUserData ctx = new ScriptInputUserData;
7374 ctx.
Write(destination_entity);
7380 }
7381 }
7382 else if (!
GetGame().IsMultiplayer())
7383 {
7385 }
7386 }
7387
7389 {
7391 }
7392
7394 {
7396 float split_quantity_new;
7398 if (dst.IsValid())
7399 {
7400 int slot_id = dst.GetSlot();
7402
7403 if (quantity > stack_max)
7404 split_quantity_new = stack_max;
7405 else
7406 split_quantity_new = quantity;
7407
7409 {
7411
7412 if (new_item)
7413 {
7414 new_item.SetResultOfSplit(true);
7415 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7417 new_item.
SetQuantity(split_quantity_new,
false,
true);
7418 }
7419
7420 return new_item;
7421 }
7422 }
7423
7424 return null;
7425 }
7426
7428 {
7430 float split_quantity_new;
7432 if (destination_entity)
7433 {
7435 if (quantity > stackable)
7436 split_quantity_new = stackable;
7437 else
7438 split_quantity_new = quantity;
7439
7441 {
7442 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
7443 if (new_item)
7444 {
7445 new_item.SetResultOfSplit(true);
7446 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7448 new_item.
SetQuantity(split_quantity_new,
false,
true);
7449 }
7450 }
7451 }
7452 }
7453
7455 {
7457 {
7458 if (ScriptInputUserData.CanStoreInputUserData())
7459 {
7460 ScriptInputUserData ctx = new ScriptInputUserData;
7465 ItemBase destination_entity =
this;
7466 ctx.
Write(destination_entity);
7470 }
7471 }
7472 else if (!
GetGame().IsMultiplayer())
7473 {
7475 }
7476 }
7477
7479 {
7481 float split_quantity_new;
7483 if (player)
7484 {
7486 if (quantity > stackable)
7487 split_quantity_new = stackable;
7488 else
7489 split_quantity_new = quantity;
7490
7492 {
7493 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
7494 new_item =
ItemBase.Cast(in_hands);
7495 if (new_item)
7496 {
7497 new_item.SetResultOfSplit(true);
7498 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7500 new_item.SetQuantity(split_quantity_new, false, true);
7501 }
7502 }
7503 }
7504 }
7505
7507 {
7509 float split_quantity_new = Math.Floor(quantity * 0.5);
7510
7512 return;
7513
7515
7516 if (new_item)
7517 {
7518 if (new_item.GetQuantityMax() < split_quantity_new)
7519 {
7520 split_quantity_new = new_item.GetQuantityMax();
7521 }
7522
7523 new_item.SetResultOfSplit(true);
7524 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7525
7527 {
7530 }
7531 else
7532 {
7534 new_item.
SetQuantity(split_quantity_new,
false,
true);
7535 }
7536 }
7537 }
7538
7540 {
7542 float split_quantity_new = Math.Floor(quantity / 2);
7543
7545 return;
7546
7547 InventoryLocation invloc = new InventoryLocation;
7549
7551 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
7552
7553 if (new_item)
7554 {
7555 if (new_item.GetQuantityMax() < split_quantity_new)
7556 {
7557 split_quantity_new = new_item.GetQuantityMax();
7558 }
7560 {
7563 }
7564 else if (split_quantity_new > 1)
7565 {
7567 new_item.
SetQuantity(split_quantity_new,
false,
true);
7568 }
7569 }
7570 }
7571
7574 {
7575 SetWeightDirty();
7577
7578 if (parent)
7579 parent.OnAttachmentQuantityChangedEx(this, delta);
7580
7582 {
7584 {
7586 }
7588 {
7589 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
7591 }
7592 }
7593
7594 }
7595
7598 {
7599
7600 }
7601
7604 {
7606 }
7607
7609 {
7610 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
7611
7613 {
7614 if (newLevel == GameConstants.STATE_RUINED)
7615 {
7617 EntityAI parent = GetHierarchyParent();
7618 if (parent && parent.IsFireplace())
7619 {
7620 CargoBase cargo = GetInventory().GetCargo();
7621 if (cargo)
7622 {
7624 {
7626 }
7627 }
7628 }
7629 }
7630
7632 {
7633
7635 return;
7636 }
7637
7638 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
7639 {
7641 }
7642 }
7643 }
7644
7645
7647 {
7648 super.OnRightClick();
7649
7651 {
7653 {
7654 if (ScriptInputUserData.CanStoreInputUserData())
7655 {
7656 EntityAI root = GetHierarchyRoot();
7657 Man playerOwner = GetHierarchyRootPlayer();
7658 InventoryLocation dst = new InventoryLocation;
7659
7660
7661 if (!playerOwner && root && root == this)
7662 {
7664 }
7665 else
7666 {
7667
7668 GetInventory().GetCurrentInventoryLocation(dst);
7670 {
7673 {
7675 }
7676 else
7677 {
7679
7680
7681 if (
GetGame().
GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
7682 {
7684 }
7685 else
7686 {
7687 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
7688 }
7689 }
7690 }
7691 }
7692
7693 ScriptInputUserData ctx = new ScriptInputUserData;
7701 }
7702 }
7703 else if (!
GetGame().IsMultiplayer())
7704 {
7706 }
7707 }
7708 }
7709
7711 {
7712 if (root)
7713 {
7714 vector m4[4];
7715 root.GetTransform(m4);
7716 dst.SetGround(this, m4);
7717 }
7718 else
7719 {
7720 GetInventory().GetCurrentInventoryLocation(dst);
7721 }
7722 }
7723
7724 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
7725 {
7726
7727 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
7728 return false;
7729
7730 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
7731 return false;
7732
7733
7735 return false;
7736
7737
7738 Magazine mag = Magazine.Cast(this);
7739 if (mag)
7740 {
7741 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
7742 return false;
7743
7744 if (stack_max_limit)
7745 {
7746 Magazine other_mag = Magazine.Cast(other_item);
7747 if (other_item)
7748 {
7749 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
7750 return false;
7751 }
7752
7753 }
7754 }
7755 else
7756 {
7757
7759 return false;
7760
7762 return false;
7763 }
7764
7765 PlayerBase player = null;
7766 if (CastTo(player, GetHierarchyRootPlayer()))
7767 {
7768 if (player.GetInventory().HasAttachment(this))
7769 return false;
7770
7771 if (player.IsItemsToDelete())
7772 return false;
7773 }
7774
7775 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
7776 return false;
7777
7778 int slotID;
7780 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
7781 return false;
7782
7783 return true;
7784 }
7785
7787 {
7789 }
7790
7792 {
7793 return m_IsResultOfSplit;
7794 }
7795
7797 {
7798 m_IsResultOfSplit = value;
7799 }
7800
7802 {
7804 }
7805
7807 {
7808 float other_item_quantity = other_item.GetQuantity();
7809 float this_free_space;
7810
7812
7814
7815 if (other_item_quantity > this_free_space)
7816 {
7817 return this_free_space;
7818 }
7819 else
7820 {
7821 return other_item_quantity;
7822 }
7823 }
7824
7826 {
7828 }
7829
7831 {
7833 return;
7834
7835 if (!IsMagazine() && other_item)
7836 {
7838 if (quantity_used != 0)
7839 {
7840 float hp1 = GetHealth01("","");
7841 float hp2 = other_item.GetHealth01("","");
7842 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
7843 hpResult = hpResult / (
GetQuantity() + quantity_used);
7844
7845 hpResult *= GetMaxHealth();
7846 Math.Round(hpResult);
7847 SetHealth("", "Health", hpResult);
7848
7850 other_item.AddQuantity(-quantity_used);
7851 }
7852 }
7854 }
7855
7857 {
7858 #ifdef SERVER
7859 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
7860 GetHierarchyParent().IncreaseLifetimeUp();
7861 #endif
7862 };
7863
7865 {
7866 PlayerBase p = PlayerBase.Cast(player);
7867
7868 array<int> recipesIds = p.m_Recipes;
7869 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
7870 if (moduleRecipesManager)
7871 {
7872 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
7873 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
7874 }
7875
7876 for (int i = 0;i < recipesIds.Count(); i++)
7877 {
7878 int key = recipesIds.Get(i);
7879 string recipeName = moduleRecipesManager.GetRecipeName(key);
7881 }
7882 }
7883
7884
7885 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
7886 {
7887 super.GetDebugActions(outputList);
7888
7889
7895
7896
7901
7906
7907
7911
7912
7914 {
7918 }
7919
7922
7923
7927
7929
7930 InventoryLocation loc = new InventoryLocation();
7931 GetInventory().GetCurrentInventoryLocation(loc);
7933 {
7934 if (Gizmo_IsSupported())
7937 }
7938
7940 }
7941
7942
7943
7944
7946 {
7947 super.OnAction(action_id, player, ctx);
7948
7950 {
7951 switch (action_id)
7952 {
7955 return true;
7958 return true;
7959 }
7960 }
7961
7963 {
7964 switch (action_id)
7965 {
7967 Delete();
7968 return true;
7969 }
7970 }
7971
7972 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
7973 {
7974 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
7975 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
7976 PlayerBase p = PlayerBase.Cast(player);
7977 if (
EActions.RECIPES_RANGE_START < 1000)
7978 {
7979 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
7980 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
7981 }
7982 }
7983 #ifndef SERVER
7984 else if (action_id ==
EActions.WATCH_PLAYER)
7985 {
7986 PluginDeveloper.SetDeveloperItemClientEx(player);
7987 }
7988 #endif
7990 {
7991 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
7992 {
7993 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
7994 OnDebugButtonPressServer(id + 1);
7995 }
7996
7997 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
7998 {
7999 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
8001 }
8002
8003 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
8004 {
8005 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
8007 }
8008
8009 else if (action_id ==
EActions.ADD_QUANTITY)
8010 {
8011 if (IsMagazine())
8012 {
8013 Magazine mag = Magazine.Cast(this);
8014 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
8015 }
8016 else
8017 {
8019 }
8020
8021 if (m_EM)
8022 {
8023 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
8024 }
8025
8026 }
8027
8028 else if (action_id ==
EActions.REMOVE_QUANTITY)
8029 {
8030 if (IsMagazine())
8031 {
8032 Magazine mag2 = Magazine.Cast(this);
8033 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
8034 }
8035 else
8036 {
8038 }
8039 if (m_EM)
8040 {
8041 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
8042 }
8043
8044 }
8045
8046 else if (action_id ==
EActions.SET_QUANTITY_0)
8047 {
8049
8050 if (m_EM)
8051 {
8052 m_EM.SetEnergy(0);
8053 }
8054 }
8055
8056 else if (action_id ==
EActions.SET_MAX_QUANTITY)
8057 {
8059
8060 if (m_EM)
8061 {
8062 m_EM.SetEnergy(m_EM.GetEnergyMax());
8063 }
8064 }
8065
8066 else if (action_id ==
EActions.ADD_HEALTH)
8067 {
8068 AddHealth("","",GetMaxHealth("","Health")/5);
8069 }
8070 else if (action_id ==
EActions.REMOVE_HEALTH)
8071 {
8072 AddHealth("","",-GetMaxHealth("","Health")/5);
8073 }
8074 else if (action_id ==
EActions.DESTROY_HEALTH)
8075 {
8076 SetHealth01("","",0);
8077 }
8078 else if (action_id ==
EActions.WATCH_ITEM)
8079 {
8081 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
8082 #ifdef DEVELOPER
8083 SetDebugDeveloper_item(this);
8084 #endif
8085 }
8086
8087 else if (action_id ==
EActions.ADD_TEMPERATURE)
8088 {
8089 AddTemperature(20);
8090
8091 }
8092
8093 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
8094 {
8095 AddTemperature(-20);
8096
8097 }
8098
8099 else if (action_id ==
EActions.FLIP_FROZEN)
8100 {
8101 SetFrozen(!GetIsFrozen());
8102
8103 }
8104
8105 else if (action_id ==
EActions.ADD_WETNESS)
8106 {
8108
8109 }
8110
8111 else if (action_id ==
EActions.REMOVE_WETNESS)
8112 {
8114
8115 }
8116
8117 else if (action_id ==
EActions.LIQUIDTYPE_UP)
8118 {
8121
8122
8123 }
8124
8125 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
8126 {
8129 }
8130
8131 else if (action_id ==
EActions.MAKE_SPECIAL)
8132 {
8133 auto debugParams = DebugSpawnParams.WithPlayer(player);
8134 OnDebugSpawnEx(debugParams);
8135 }
8136
8137 }
8138
8139
8140 return false;
8141 }
8142
8143
8144
8145
8149
8152
8153
8154
8156 {
8157 return false;
8158 }
8159
8160
8162 {
8163 return true;
8164 }
8165
8166
8168 {
8169 return true;
8170 }
8171
8172
8173
8175 {
8176 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
8178 }
8179
8182 {
8183 return null;
8184 }
8185
8187 {
8188 return false;
8189 }
8190
8192 {
8193 return false;
8194 }
8195
8199
8200
8202 {
8203 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8204 return module_repairing.CanRepair(this, item_repair_kit);
8205 }
8206
8207
8208 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
8209 {
8210 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8211 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
8212 }
8213
8214
8216 {
8217
8218
8219
8220
8221
8222
8223
8224
8225 return 1;
8226 }
8227
8228
8229
8231 {
8233 }
8234
8235
8236
8238 {
8240 }
8241
8242
8251 {
8252 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8253
8254 if (player)
8255 {
8256 player.MessageStatus(text);
8257 }
8258 }
8259
8260
8269 {
8270 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8271
8272 if (player)
8273 {
8274 player.MessageAction(text);
8275 }
8276 }
8277
8278
8287 {
8288 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8289
8290 if (player)
8291 {
8292 player.MessageFriendly(text);
8293 }
8294 }
8295
8296
8305 {
8306 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8307
8308 if (player)
8309 {
8310 player.MessageImportant(text);
8311 }
8312 }
8313
8315 {
8316 return true;
8317 }
8318
8319
8320 override bool KindOf(
string tag)
8321 {
8322 bool found = false;
8323 string item_name = this.
GetType();
8326
8327 int array_size = item_tag_array.Count();
8328 for (int i = 0; i < array_size; i++)
8329 {
8330 if (item_tag_array.Get(i) == tag)
8331 {
8332 found = true;
8333 break;
8334 }
8335 }
8336 return found;
8337 }
8338
8339
8341 {
8342
8343 super.OnRPC(sender, rpc_type,ctx);
8344
8345
8346 switch (rpc_type)
8347 {
8348 #ifndef SERVER
8349 case ERPCs.RPC_SOUND_LOCK_ATTACH:
8350 Param2<bool, string> p = new Param2<bool, string>(false, "");
8351
8353 return;
8354
8355 bool play = p.param1;
8356 string soundSet = p.param2;
8357
8358 if (play)
8359 {
8361 {
8363 {
8365 }
8366 }
8367 else
8368 {
8370 }
8371 }
8372 else
8373 {
8375 }
8376
8377 break;
8378 #endif
8379
8380 }
8381
8383 {
8385 }
8386 }
8387
8388
8389
8390
8392 {
8393 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8394 return plugin.GetID(
name);
8395 }
8396
8398 {
8399 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8400 return plugin.GetName(id);
8401 }
8402
8405 {
8406
8407
8408 int varFlags;
8409 if (!ctx.
Read(varFlags))
8410 return;
8411
8412 if (varFlags & ItemVariableFlags.FLOAT)
8413 {
8415 }
8416 }
8417
8419 {
8420
8421 super.SerializeNumericalVars(floats_out);
8422
8423
8424
8426 {
8428 }
8429
8431 {
8433 }
8434
8436 {
8438 }
8439
8441 {
8446 }
8447
8449 {
8451 }
8452 }
8453
8455 {
8456
8457 super.DeSerializeNumericalVars(floats);
8458
8459
8460 int index = 0;
8461 int mask = Math.Round(floats.Get(index));
8462
8463 index++;
8464
8466 {
8468 {
8470 }
8471 else
8472 {
8473 float quantity = floats.Get(index);
8475 }
8476 index++;
8477 }
8478
8480 {
8481 float wet = floats.Get(index);
8483 index++;
8484 }
8485
8487 {
8488 int liquidtype = Math.Round(floats.Get(index));
8490 index++;
8491 }
8492
8494 {
8496 index++;
8498 index++;
8500 index++;
8502 index++;
8503 }
8504
8506 {
8507 int cleanness = Math.Round(floats.Get(index));
8509 index++;
8510 }
8511 }
8512
8514 {
8515 super.WriteVarsToCTX(ctx);
8516
8517
8519 {
8521 }
8522
8524 {
8526 }
8527
8529 {
8531 }
8532
8534 {
8535 int r,g,b,a;
8541 }
8542
8544 {
8546 }
8547 }
8548
8550 {
8551 if (!super.ReadVarsFromCTX(ctx,version))
8552 return false;
8553
8554 int intValue;
8555 float value;
8556
8557 if (version < 140)
8558 {
8559 if (!ctx.
Read(intValue))
8560 return false;
8561
8562 m_VariablesMask = intValue;
8563 }
8564
8566 {
8567 if (!ctx.
Read(value))
8568 return false;
8569
8571 {
8573 }
8574 else
8575 {
8577 }
8578 }
8579
8580 if (version < 140)
8581 {
8583 {
8584 if (!ctx.
Read(value))
8585 return false;
8586 SetTemperatureDirect(value);
8587 }
8588 }
8589
8591 {
8592 if (!ctx.
Read(value))
8593 return false;
8595 }
8596
8598 {
8599 if (!ctx.
Read(intValue))
8600 return false;
8602 }
8603
8605 {
8606 int r,g,b,a;
8608 return false;
8610 return false;
8612 return false;
8614 return false;
8615
8617 }
8618
8620 {
8621 if (!ctx.
Read(intValue))
8622 return false;
8624 }
8625
8626 if (version >= 138 && version < 140)
8627 {
8629 {
8630 if (!ctx.
Read(intValue))
8631 return false;
8632 SetFrozen(intValue);
8633 }
8634 }
8635
8636 return true;
8637 }
8638
8639
8641 {
8644 {
8646 }
8647
8648 if (!super.OnStoreLoad(ctx, version))
8649 {
8651 return false;
8652 }
8653
8654 if (version >= 114)
8655 {
8656 bool hasQuickBarIndexSaved;
8657
8658 if (!ctx.
Read(hasQuickBarIndexSaved))
8659 {
8661 return false;
8662 }
8663
8664 if (hasQuickBarIndexSaved)
8665 {
8666 int itmQBIndex;
8667
8668
8669 if (!ctx.
Read(itmQBIndex))
8670 {
8672 return false;
8673 }
8674
8675 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
8676 if (itmQBIndex != -1 && parentPlayer)
8677 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
8678 }
8679 }
8680 else
8681 {
8682
8683 PlayerBase player;
8684 int itemQBIndex;
8685 if (version ==
int.
MAX)
8686 {
8687 if (!ctx.
Read(itemQBIndex))
8688 {
8690 return false;
8691 }
8692 }
8693 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
8694 {
8695
8696 if (!ctx.
Read(itemQBIndex))
8697 {
8699 return false;
8700 }
8701 if (itemQBIndex != -1 && player)
8702 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
8703 }
8704 }
8705
8706 if (version < 140)
8707 {
8708
8709 if (!LoadVariables(ctx, version))
8710 {
8712 return false;
8713 }
8714 }
8715
8716
8718 {
8720 return false;
8721 }
8722 if (version >= 132)
8723 {
8725 if (raib)
8726 {
8728 {
8730 return false;
8731 }
8732 }
8733 }
8734
8736 return true;
8737 }
8738
8739
8740
8742 {
8743 super.OnStoreSave(ctx);
8744
8745 PlayerBase player;
8746 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
8747 {
8749
8750 int itemQBIndex = -1;
8751 itemQBIndex = player.FindQuickBarEntityIndex(this);
8752 ctx.
Write(itemQBIndex);
8753 }
8754 else
8755 {
8757 }
8758
8760
8762 if (raib)
8763 {
8765 }
8766 }
8767
8768
8770 {
8771 super.AfterStoreLoad();
8772
8774 {
8776 }
8777
8779 {
8782 }
8783 }
8784
8786 {
8787 super.EEOnAfterLoad();
8788
8790 {
8792 }
8793
8796 }
8797
8799 {
8800 return false;
8801 }
8802
8803
8804
8806 {
8808 {
8809 #ifdef PLATFORM_CONSOLE
8810
8812 {
8814 if (menu)
8815 {
8817 }
8818 }
8819 #endif
8820 }
8821
8823 {
8826 }
8827
8829 {
8830 SetWeightDirty();
8832 }
8834 {
8837 }
8838
8840 {
8843 }
8845 {
8848 }
8849
8850 super.OnVariablesSynchronized();
8851 }
8852
8853
8854
8856 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
8857 {
8858 if (!IsServerCheck(allow_client))
8859 return false;
8860
8862 return false;
8863
8866
8867 if (value <= (min + 0.001))
8868 value = min;
8869
8870 if (value == min)
8871 {
8872 if (destroy_config)
8873 {
8874 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
8875 if (dstr)
8876 {
8878 this.Delete();
8879 return true;
8880 }
8881 }
8882 else if (destroy_forced)
8883 {
8885 this.Delete();
8886 return true;
8887 }
8888
8890 }
8891
8894
8896 {
8898
8899 if (delta)
8901 }
8902
8904
8905 return false;
8906 }
8907
8908
8910 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
8911 {
8913 }
8914
8916 {
8919 }
8920
8922 {
8925 }
8926
8928 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
8929 {
8930 float value_clamped = Math.Clamp(value, 0, 1);
8932 SetQuantity(result, destroy_config, destroy_forced);
8933 }
8934
8935
8938 {
8940 }
8941
8943 {
8945 }
8946
8947
8948
8949
8950
8951
8952
8953
8954
8955
8957 {
8958 int slot = -1;
8959 if (GetInventory())
8960 {
8961 InventoryLocation il = new InventoryLocation;
8962 GetInventory().GetCurrentInventoryLocation(il);
8964 }
8965
8967 }
8968
8970 {
8971 float quantity_max = 0;
8972
8974 {
8975 if (attSlotID != -1)
8976 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
8977
8978 if (quantity_max <= 0)
8980 }
8981
8982 if (quantity_max <= 0)
8984
8985 return quantity_max;
8986 }
8987
8989 {
8991 }
8992
8994 {
8996 }
8997
8998
9000 {
9002 }
9003
9005 {
9007 }
9008
9010 {
9012 }
9013
9014
9016 {
9017
9018 float weightEx = GetWeightEx();
9019 float special = GetInventoryAndCargoWeight();
9020 return weightEx - special;
9021 }
9022
9023
9025 {
9027 }
9028
9030 {
9032 {
9033 #ifdef DEVELOPER
9034 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9035 {
9036 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
9038 }
9039 #endif
9040
9042 }
9043 else if (HasEnergyManager())
9044 {
9045 #ifdef DEVELOPER
9046 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9047 {
9048 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
9049 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
9050 }
9051 #endif
9052 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
9053 }
9054 else
9055 {
9056 #ifdef DEVELOPER
9057 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9058 {
9059 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
9060 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
9061 }
9062 #endif
9063 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
9064 }
9065 }
9066
9069 {
9070 int item_count = 0;
9072
9073 if (GetInventory().GetCargo() != NULL)
9074 {
9075 item_count = GetInventory().GetCargo().GetItemCount();
9076 }
9077
9078 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
9079 {
9080 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
9081 if (item)
9082 item_count += item.GetNumberOfItems();
9083 }
9084 return item_count;
9085 }
9086
9089 {
9090 float weight = 0;
9091 float wetness = 1;
9092 if (include_wetness)
9095 {
9096 weight = wetness * m_ConfigWeight;
9097 }
9099 {
9100 weight = 1;
9101 }
9102 return weight;
9103 }
9104
9105
9106
9108 {
9109 if ((
GetGame().IsServer() || !
GetGame().IsMultiplayer()) && GetInventory())
9110 {
9111 GameInventory inv = GetInventory();
9112 array<EntityAI> items = new array<EntityAI>;
9114 for (int i = 0; i < items.Count(); i++)
9115 {
9117 if (item)
9118 {
9120 }
9121 }
9122 }
9123 }
9124
9125
9126
9127
9129 {
9130 float energy = 0;
9131 if (HasEnergyManager())
9132 {
9133 energy = GetCompEM().GetEnergy();
9134 }
9135 return energy;
9136 }
9137
9138
9140 {
9141 super.OnEnergyConsumed();
9142
9144 }
9145
9147 {
9148 super.OnEnergyAdded();
9149
9151 }
9152
9153
9155 {
9156 if (
GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
9157 {
9159 {
9160 float energy_0to1 = GetCompEM().GetEnergy0To1();
9162 }
9163 }
9164 }
9165
9166
9168 {
9169 return ConfigGetFloat("heatIsolation");
9170 }
9171
9173 {
9175 }
9176
9178 {
9179 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
9180 if (
GetGame().ConfigIsExisting(paramPath))
9182
9183 return 0.0;
9184 }
9185
9187 {
9188 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
9189 if (
GetGame().ConfigIsExisting(paramPath))
9191
9192 return 0.0;
9193 }
9194
9195 override void SetWet(
float value,
bool allow_client =
false)
9196 {
9197 if (!IsServerCheck(allow_client))
9198 return;
9199
9202
9204
9205 m_VarWet = Math.Clamp(value, min, max);
9206
9208 {
9211 }
9212 }
9213
9214 override void AddWet(
float value)
9215 {
9217 }
9218
9220 {
9222 }
9223
9225 {
9227 }
9228
9230 {
9232 }
9233
9235 {
9237 }
9238
9240 {
9242 }
9243
9245 {
9248 if (newLevel != oldLevel)
9249 {
9251 }
9252 }
9253
9255 {
9256 SetWeightDirty();
9257 }
9258
9260 {
9261 return GetWetLevelInternal(
m_VarWet);
9262 }
9263
9264
9265
9267 {
9269 }
9270
9272 {
9274 }
9275
9277 {
9279 }
9280
9282 {
9284 }
9285
9286
9287
9289 {
9290 if (ConfigIsExisting("itemModelLength"))
9291 {
9292 return ConfigGetFloat("itemModelLength");
9293 }
9294 return 0;
9295 }
9296
9298 {
9299 if (ConfigIsExisting("itemAttachOffset"))
9300 {
9301 return ConfigGetFloat("itemAttachOffset");
9302 }
9303 return 0;
9304 }
9305
9306 override void SetCleanness(
int value,
bool allow_client =
false)
9307 {
9308 if (!IsServerCheck(allow_client))
9309 return;
9310
9312
9314
9317 }
9318
9320 {
9322 }
9323
9325 {
9326 return true;
9327 }
9328
9329
9330
9331
9333 {
9335 }
9336
9338 {
9340 }
9341
9342
9343
9344
9345 override void SetColor(
int r,
int g,
int b,
int a)
9346 {
9352 }
9354 override void GetColor(out
int r,out
int g,out
int b,out
int a)
9355 {
9360 }
9361
9363 {
9365 }
9366
9369 {
9370 int r,g,b,a;
9372 r = r/255;
9373 g = g/255;
9374 b = b/255;
9375 a = a/255;
9376 return MiscGameplayFunctions.GetColorString(r, g, b, a);
9377 }
9378
9379
9380
9381 override void SetLiquidType(
int value,
bool allow_client =
false)
9382 {
9383 if (!IsServerCheck(allow_client))
9384 return;
9385
9390 }
9391
9393 {
9394 return ConfigGetInt("varLiquidTypeInit");
9395 }
9396
9398 {
9400 }
9401
9403 {
9405 SetFrozen(false);
9406 }
9407
9410 {
9411 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9412 }
9413
9414
9417 {
9418 PlayerBase nplayer;
9419 if (PlayerBase.CastTo(nplayer, player))
9420 {
9422
9423 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9424 }
9425 }
9426
9427
9430 {
9431 PlayerBase nplayer;
9432 if (PlayerBase.CastTo(nplayer,player))
9433 {
9434
9435 nplayer.SetEnableQuickBarEntityShortcut(this,false);
9436
9437 }
9438
9439
9440 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
9441
9442
9443 if (HasEnergyManager())
9444 {
9445 GetCompEM().UpdatePlugState();
9446 }
9447 }
9448
9449
9451 {
9452 super.OnPlacementStarted(player);
9453
9455 }
9456
9457 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
9458 {
9460 {
9461 m_AdminLog.OnPlacementComplete(player,
this);
9462 }
9463
9464 super.OnPlacementComplete(player, position, orientation);
9465 }
9466
9467
9468
9469
9470
9472 {
9474 {
9475 return true;
9476 }
9477 else
9478 {
9479 return false;
9480 }
9481 }
9482
9483
9485 {
9487 {
9489 }
9490 }
9491
9492
9494 {
9496 }
9497
9499 {
9501 }
9502
9503 override void InsertAgent(
int agent,
float count = 1)
9504 {
9505 if (count < 1)
9506 return;
9507
9509 }
9510
9513 {
9515 }
9516
9517
9519 {
9521 }
9522
9523
9524
9525
9526
9527
9528
9529
9530
9531
9532
9533
9534
9535
9536
9537
9538
9539
9540
9541
9542
9543
9544
9545
9546
9547
9548
9549
9550
9551
9552
9553
9554
9555
9556
9557
9558
9559
9560
9561
9562
9563
9565 {
9567 return false;
9568 return true;
9569 }
9570
9572 {
9573
9575 }
9576
9577
9580 {
9581 super.CheckForRoofLimited(timeTresholdMS);
9582
9584 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
9585 {
9586 m_PreviousRoofTestTime = time;
9587 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
9588 }
9589 }
9590
9591
9593 {
9595 {
9596 return 0;
9597 }
9598
9599 if (GetInventory().GetAttachmentSlotsCount() != 0)
9600 {
9601 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
9602 if (filter)
9603 return filter.GetProtectionLevel(type, false, system);
9604 else
9605 return 0;
9606 }
9607
9608 string subclassPath, entryName;
9609
9610 switch (type)
9611 {
9613 entryName = "biological";
9614 break;
9616 entryName = "chemical";
9617 break;
9618 default:
9619 entryName = "biological";
9620 break;
9621 }
9622
9623 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
9624
9626 }
9627
9628
9629
9632 {
9633 if (!IsMagazine())
9635
9637 }
9638
9639
9640
9641
9642
9647 {
9648 return true;
9649 }
9650
9652 {
9654 }
9655
9656
9657
9658
9659
9661 {
9662 if (parent)
9663 {
9664 if (parent.IsInherited(DayZInfected))
9665 return true;
9666
9667 if (!parent.IsRuined())
9668 return true;
9669 }
9670
9671 return true;
9672 }
9673
9675 {
9676 if (!super.CanPutAsAttachment(parent))
9677 {
9678 return false;
9679 }
9680
9681 if (!IsRuined() && !parent.IsRuined())
9682 {
9683 return true;
9684 }
9685
9686 return false;
9687 }
9688
9690 {
9691
9692
9693
9694
9695 return super.CanReceiveItemIntoCargo(item);
9696 }
9697
9699 {
9700
9701
9702
9703
9704 GameInventory attachmentInv = attachment.GetInventory();
9706 {
9707 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
9708 return false;
9709 }
9710
9711 InventoryLocation loc = new InventoryLocation();
9712 attachment.GetInventory().GetCurrentInventoryLocation(loc);
9713 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
9714 return false;
9715
9716 return super.CanReceiveAttachment(attachment, slotId);
9717 }
9718
9720 {
9721 if (!super.CanReleaseAttachment(attachment))
9722 return false;
9723
9724 return GetInventory().AreChildrenAccessible();
9725 }
9726
9727
9728
9729
9730
9731
9732
9733
9734
9735
9736
9737
9738
9739
9740
9741
9742
9743
9744
9745
9746
9748 {
9749 int id = muzzle_owner.GetMuzzleID();
9750 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
9751
9752 if (WPOF_array)
9753 {
9754 for (int i = 0; i < WPOF_array.Count(); i++)
9755 {
9756 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
9757
9758 if (WPOF)
9759 {
9760 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
9761 }
9762 }
9763 }
9764 }
9765
9766
9768 {
9769 int id = muzzle_owner.GetMuzzleID();
9771
9772 if (WPOBE_array)
9773 {
9774 for (int i = 0; i < WPOBE_array.Count(); i++)
9775 {
9776 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
9777
9778 if (WPOBE)
9779 {
9780 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
9781 }
9782 }
9783 }
9784 }
9785
9786
9788 {
9789 int id = muzzle_owner.GetMuzzleID();
9790 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9791
9792 if (WPOOH_array)
9793 {
9794 for (int i = 0; i < WPOOH_array.Count(); i++)
9795 {
9796 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9797
9798 if (WPOOH)
9799 {
9800 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
9801 }
9802 }
9803 }
9804 }
9805
9806
9808 {
9809 int id = muzzle_owner.GetMuzzleID();
9810 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9811
9812 if (WPOOH_array)
9813 {
9814 for (int i = 0; i < WPOOH_array.Count(); i++)
9815 {
9816 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9817
9818 if (WPOOH)
9819 {
9820 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9821 }
9822 }
9823 }
9824 }
9825
9826
9828 {
9829 int id = muzzle_owner.GetMuzzleID();
9830 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9831
9832 if (WPOOH_array)
9833 {
9834 for (int i = 0; i < WPOOH_array.Count(); i++)
9835 {
9836 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9837
9838 if (WPOOH)
9839 {
9840 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9841 }
9842 }
9843 }
9844 }
9845
9846
9847
9849 {
9851 {
9852 return true;
9853 }
9854
9855 return false;
9856 }
9857
9859 {
9861 {
9862 return true;
9863 }
9864
9865 return false;
9866 }
9867
9869 {
9871 {
9872 return true;
9873 }
9874
9875 return false;
9876 }
9877
9879 {
9880 return false;
9881 }
9882
9885 {
9886 return UATimeSpent.DEFAULT_DEPLOY;
9887 }
9888
9889
9890
9891
9893 {
9895 SetSynchDirty();
9896 }
9897
9899 {
9901 }
9902
9903
9905 {
9906 return false;
9907 }
9908
9911 {
9912 string att_type = "None";
9913
9914 if (ConfigIsExisting("soundAttType"))
9915 {
9916 att_type = ConfigGetString("soundAttType");
9917 }
9918
9920 }
9921
9923 {
9925 }
9926
9927
9928
9929
9930
9936
9938 {
9941
9943 }
9944
9945
9947 {
9949 return;
9950
9952
9955
9958
9959 SoundParameters params = new SoundParameters();
9963 }
9964
9965
9967 {
9969 return;
9970
9972 SetSynchDirty();
9973
9976 }
9977
9978
9980 {
9982 return;
9983
9985 SetSynchDirty();
9986
9989 }
9990
9992 {
9994 }
9995
9997 {
9999 }
10000
10003 {
10004 if (!
GetGame().IsDedicatedServer())
10005 {
10006 if (ConfigIsExisting("attachSoundSet"))
10007 {
10008 string cfg_path = "";
10009 string soundset = "";
10010 string type_name =
GetType();
10011
10014 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
10015 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
10016
10017 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
10018 {
10019 for (int i = 0; i < cfg_soundset_array.Count(); i++)
10020 {
10021 if (cfg_slot_array[i] == slot_type)
10022 {
10023 soundset = cfg_soundset_array[i];
10024 break;
10025 }
10026 }
10027 }
10028
10029 if (soundset != "")
10030 {
10031 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
10033 }
10034 }
10035 }
10036 }
10037
10039 {
10040
10041 }
10042
10043 void OnApply(PlayerBase player);
10044
10046 {
10047 return 1.0;
10048 };
10049
10051 {
10053 }
10054
10056 {
10058 }
10059
10061
10063 {
10064 SetDynamicPhysicsLifeTime(0.01);
10066 }
10067
10069 {
10070 array<string> zone_names = new array<string>;
10071 GetDamageZones(zone_names);
10072 for (int i = 0; i < zone_names.Count(); i++)
10073 {
10074 SetHealthMax(zone_names.Get(i),"Health");
10075 }
10076 SetHealthMax("","Health");
10077 }
10078
10081 {
10082 float global_health = GetHealth01("","Health");
10083 array<string> zones = new array<string>;
10084 GetDamageZones(zones);
10085
10086 for (int i = 0; i < zones.Count(); i++)
10087 {
10088 SetHealth01(zones.Get(i),"Health",global_health);
10089 }
10090 }
10091
10094 {
10095 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
10096 }
10097
10099 {
10100 if (!hasRootAsPlayer)
10101 {
10102 if (refParentIB)
10103 {
10104
10105 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
10106 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
10107
10108 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
10109 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
10110
10113 }
10114 else
10115 {
10116
10119 }
10120 }
10121 }
10122
10124 {
10126 {
10127 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
10128 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
10129 {
10130 float heatPermCoef = 1.0;
10132 while (ent)
10133 {
10134 heatPermCoef *= ent.GetHeatPermeabilityCoef();
10135 ent = ent.GetHierarchyParent();
10136 }
10137
10138 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
10139 }
10140 }
10141 }
10142
10144 {
10145
10146 EntityAI parent = GetHierarchyParent();
10147 if (!parent)
10148 {
10149 hasParent = false;
10150 hasRootAsPlayer = false;
10151 }
10152 else
10153 {
10154 hasParent = true;
10155 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
10156 refParentIB =
ItemBase.Cast(parent);
10157 }
10158 }
10159
10160 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
10161 {
10162
10163 }
10164
10166 {
10167
10168 return false;
10169 }
10170
10172 {
10173
10174
10175 return false;
10176 }
10177
10179 {
10180
10181 return false;
10182 }
10183
10186 {
10187 return !GetIsFrozen() &&
IsOpen();
10188 }
10189
10191 {
10192 bool hasParent = false, hasRootAsPlayer = false;
10194
10195 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
10196 bool foodDecay =
g_Game.IsFoodDecayEnabled();
10197
10198 if (wwtu || foodDecay)
10199 {
10203
10204 if (processWetness || processTemperature || processDecay)
10205 {
10207
10208 if (processWetness)
10209 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
10210
10211 if (processTemperature)
10213
10214 if (processDecay)
10215 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
10216 }
10217 }
10218 }
10219
10222 {
10224 }
10225
10227 {
10230
10231 return super.GetTemperatureFreezeThreshold();
10232 }
10233
10235 {
10238
10239 return super.GetTemperatureThawThreshold();
10240 }
10241
10243 {
10246
10247 return super.GetItemOverheatThreshold();
10248 }
10249
10251 {
10253 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
10254
10255 return super.GetTemperatureFreezeTime();
10256 }
10257
10259 {
10261 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
10262
10263 return super.GetTemperatureThawTime();
10264 }
10265
10270
10272 {
10273 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
10274 }
10275
10277 {
10278 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
10279 }
10280
10283 {
10285 }
10286
10288 {
10290 }
10291
10293 {
10295 }
10296
10299 {
10300 return null;
10301 }
10302
10305 {
10306 return false;
10307 }
10308
10310 {
10312 {
10315 if (!trg)
10316 {
10318 explosive = this;
10319 }
10320
10321 explosive.PairRemote(trg);
10323
10324 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
10325 trg.SetPersistentPairID(persistentID);
10326 explosive.SetPersistentPairID(persistentID);
10327
10328 return true;
10329 }
10330 return false;
10331 }
10332
10335 {
10336 float ret = 1.0;
10339 ret *= GetHealth01();
10340
10341 return ret;
10342 }
10343
10344 #ifdef DEVELOPER
10345 override void SetDebugItem()
10346 {
10347 super.SetDebugItem();
10348 _itemBase = this;
10349 }
10350
10352 {
10353 string text = super.GetDebugText();
10354
10356 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
10357
10358 return text;
10359 }
10360 #endif
10361
10363 {
10364 return true;
10365 }
10366
10368
10370
10372 {
10375 }
10376
10377
10385
10401}
10402
10404{
10406 if (entity)
10407 {
10408 bool is_item = entity.IsInherited(
ItemBase);
10409 if (is_item && full_quantity)
10410 {
10413 }
10414 }
10415 else
10416 {
10418 return NULL;
10419 }
10420 return entity;
10421}
10422
10424{
10425 if (item)
10426 {
10427 if (health > 0)
10428 item.SetHealth("", "", health);
10429
10430 if (item.CanHaveTemperature())
10431 {
10433 if (item.CanFreeze())
10434 item.SetFrozen(false);
10435 }
10436
10437 if (item.HasEnergyManager())
10438 {
10439 if (quantity >= 0)
10440 {
10441 item.GetCompEM().SetEnergy0To1(quantity);
10442 }
10443 else
10444 {
10446 }
10447 }
10448 else if (item.IsMagazine())
10449 {
10450 Magazine mag = Magazine.Cast(item);
10451 if (quantity >= 0)
10452 {
10453 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
10454 }
10455 else
10456 {
10458 }
10459
10460 }
10461 else
10462 {
10463 if (quantity >= 0)
10464 {
10465 item.SetQuantityNormalized(quantity, false);
10466 }
10467 else
10468 {
10470 }
10471
10472 }
10473 }
10474}
10475
10476#ifdef DEVELOPER
10478#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.