Returns global muzzle ID. If not found, then it gets automatically registered.
5481{
5483 {
5484 return true;
5485 }
5486};
5487
5488
5489
5491{
5495
5497
5500
5501
5502
5503
5504
5513
5519
5524
5529
5550 protected bool m_IsResultOfSplit
5551
5553
5558
5559
5560
5562
5566
5567
5568
5570
5573
5574
5575
5581
5582
5590
5593
5594
5596
5597
5599
5600
5605
5606
5611
5612
5614
5615
5617 {
5622
5623 if (!
GetGame().IsDedicatedServer())
5624 {
5626 {
5628
5630 {
5632 }
5633 }
5634
5637 }
5638
5639 m_OldLocation = null;
5640
5642 {
5644 }
5645
5646 if (ConfigIsExisting("headSelectionsToHide"))
5647 {
5650 }
5651
5653 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
5654 {
5656 }
5657
5659
5660 m_IsResultOfSplit = false;
5661
5663 }
5664
5666 {
5667 super.InitItemVariables();
5668
5674 m_Count = ConfigGetInt(
"count");
5675
5678
5683
5686
5691
5703
5707
5708
5711 if (ConfigIsExisting("canBeSplit"))
5712 {
5715 }
5716
5718 if (ConfigIsExisting("itemBehaviour"))
5720
5721
5724 RegisterNetSyncVariableInt("m_VarLiquidType");
5725 RegisterNetSyncVariableInt("m_Cleanness",0,1);
5726
5727 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
5728 RegisterNetSyncVariableFloat("m_ImpactSpeed");
5729 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
5730
5731 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
5732 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
5733 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
5734 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
5735
5736 RegisterNetSyncVariableBool("m_IsBeingPlaced");
5737 RegisterNetSyncVariableBool("m_IsTakeable");
5738 RegisterNetSyncVariableBool("m_IsHologram");
5739
5742 {
5745 }
5746
5748
5750 if (ConfigIsExisting("temperaturePerQuantityWeight"))
5752
5753 }
5754
5756 {
5758 }
5759
5761 {
5764 {
5769 }
5770 }
5771
5772 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
5773 {
5775 {
5778 }
5779
5781 }
5782
5784 {
5790 }
5791
5793
5795 {
5797
5798 if (!action)
5799 {
5800 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
5801 return;
5802 }
5803
5805 if (!ai)
5806 {
5808 return;
5809 }
5810
5812 if (!action_array)
5813 {
5814 action_array = new array<ActionBase_Basic>;
5816 }
5817 if (LogManager.IsActionLogEnable())
5818 {
5819 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
5820 }
5821
5822 if (action_array.Find(action) != -1)
5823 {
5824 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
5825 }
5826 else
5827 {
5828 action_array.Insert(action);
5829 }
5830 }
5831
5833 {
5835 ActionBase action = player.GetActionManager().GetAction(actionName);
5838
5839 if (action_array)
5840 {
5841 action_array.RemoveItem(action);
5842 }
5843 }
5844
5845
5846
5848 {
5849 ActionOverrideData overrideData = new ActionOverrideData();
5853
5855 if (!actionMap)
5856 {
5859 }
5860
5861 actionMap.Insert(this.
Type(), overrideData);
5862
5863 }
5864
5866
5868
5869
5871 {
5874
5877
5878 string config_to_search = "CfgVehicles";
5879 string muzzle_owner_config;
5880
5882 {
5883 if (IsInherited(Weapon))
5884 config_to_search = "CfgWeapons";
5885
5886 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
5887
5888 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
5889
5891
5892 if (config_OnFire_subclass_count > 0)
5893 {
5894 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
5895
5896 for (int i = 0; i < config_OnFire_subclass_count; i++)
5897 {
5898 string particle_class = "";
5900 string config_OnFire_entry = config_OnFire_class + particle_class;
5901 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
5902 WPOF_array.Insert(WPOF);
5903 }
5904
5905
5907 }
5908 }
5909
5911 {
5912 config_to_search = "CfgWeapons";
5913 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
5914
5915 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
5916
5918
5919 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
5920 {
5921 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
5922
5923 for (i = 0; i < config_OnBulletCasingEject_count; i++)
5924 {
5925 string particle_class2 = "";
5927 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
5928 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
5929 WPOBE_array.Insert(WPOBE);
5930 }
5931
5932
5934 }
5935 }
5936 }
5937
5938
5940 {
5943
5945 {
5946 string config_to_search = "CfgVehicles";
5947
5948 if (IsInherited(Weapon))
5949 config_to_search = "CfgWeapons";
5950
5951 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
5952 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
5953
5954 if (
GetGame().ConfigIsExisting(config_OnOverheating_class))
5955 {
5956
5958
5960 {
5962 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
5964 return;
5965 }
5966
5969
5970
5971
5973 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
5974
5975 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
5976 {
5977 string particle_class = "";
5979 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
5981
5982 if (entry_type == CT_CLASS)
5983 {
5984 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
5985 WPOOH_array.Insert(WPOF);
5986 }
5987 }
5988
5989
5991 }
5992 }
5993 }
5994
5996 {
5998 }
5999
6001 {
6003 {
6005
6008
6011
6012 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6013 }
6014 }
6015
6017 {
6019 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6020
6022 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6023
6025 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6026
6028 {
6030 }
6031 }
6032
6034 {
6036 }
6037
6039 {
6042 else
6044
6046 {
6049 }
6050 else
6051 {
6054
6057 }
6058
6060 }
6061
6063 {
6065 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6066 }
6067
6069 {
6071 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6073 }
6074
6076 {
6078 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6079 }
6080
6082 {
6085
6086 OverheatingParticle OP = new OverheatingParticle();
6091
6093 }
6094
6096 {
6099
6100 return -1;
6101 }
6102
6104 {
6106 {
6109
6110 for (int i = count; i > 0; --i)
6111 {
6112 int id = i - 1;
6115
6118
6119 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
6120 {
6121 if (p)
6122 {
6125 }
6126 }
6127 }
6128 }
6129 }
6130
6132 {
6134 {
6136 {
6137 int id = i - 1;
6139
6140 if (OP)
6141 {
6143
6144 if (p)
6145 {
6147 }
6148
6149 delete OP;
6150 }
6151 }
6152
6155 }
6156 }
6157
6160 {
6161 return 0.0;
6162 }
6163
6164
6166 {
6167 return 250;
6168 }
6169
6171 {
6172 return 0;
6173 }
6174
6177 {
6179 return true;
6180
6181 return false;
6182 }
6183
6186 {
6189
6191 {
6193 }
6194 else
6195 {
6196
6198 }
6199
6201 }
6202
6209 {
6210 return -1;
6211 }
6212
6213
6214
6215
6217 {
6219 {
6221 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6222
6223 if (r_index >= 0)
6224 {
6225 InventoryLocation r_il = new InventoryLocation;
6226 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6227
6228 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6231 {
6232 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6233 }
6235 {
6236 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6237 }
6238
6239 }
6240
6241 player.GetHumanInventory().ClearUserReservedLocation(this);
6242 }
6243
6246 }
6247
6248
6249
6250
6252 {
6253 return ItemBase.m_DebugActionsMask;
6254 }
6255
6257 {
6258 return ItemBase.m_DebugActionsMask & mask;
6259 }
6260
6262 {
6263 ItemBase.m_DebugActionsMask = mask;
6264 }
6265
6267 {
6268 ItemBase.m_DebugActionsMask |= mask;
6269 }
6270
6272 {
6273 ItemBase.m_DebugActionsMask &= ~mask;
6274 }
6275
6277 {
6279 {
6281 }
6282 else
6283 {
6285 }
6286 }
6287
6288
6290 {
6291 if (GetEconomyProfile())
6292 {
6293 float q_max = GetEconomyProfile().GetQuantityMax();
6294 if (q_max > 0)
6295 {
6296 float q_min = GetEconomyProfile().GetQuantityMin();
6297 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
6298
6300 {
6301 ComponentEnergyManager comp = GetCompEM();
6303 {
6305 }
6306 }
6308 {
6310
6311 }
6312
6313 }
6314 }
6315 }
6316
6319 {
6320 EntityAI parent = GetHierarchyParent();
6321
6322 if (parent)
6323 {
6324 InventoryLocation inventory_location_to_lock = new InventoryLocation;
6325 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
6326 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
6327 }
6328 }
6329
6332 {
6333 EntityAI parent = GetHierarchyParent();
6334
6335 if (parent)
6336 {
6337 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
6338 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
6339 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
6340 }
6341 }
6342
6344 {
6345
6346
6347
6348
6350
6352 {
6353 if (ScriptInputUserData.CanStoreInputUserData())
6354 {
6355 ScriptInputUserData ctx = new ScriptInputUserData;
6361 ctx.
Write(use_stack_max);
6364
6366 {
6367 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
6368 }
6369 }
6370 }
6371 else if (!
GetGame().IsMultiplayer())
6372 {
6374 }
6375 }
6376
6378 {
6380 }
6381
6383 {
6385 }
6386
6388 {
6390 }
6391
6393 {
6394
6395 return false;
6396 }
6397
6399 {
6400 return false;
6401 }
6402
6406 {
6407 return false;
6408 }
6409
6411 {
6412 return "";
6413 }
6414
6416
6418 {
6419 return false;
6420 }
6421
6423 {
6424 return true;
6425 }
6426
6427
6428
6430 {
6431 return true;
6432 }
6433
6435 {
6436 return true;
6437 }
6438
6440 {
6441 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6443 }
6444
6446 {
6448 }
6449
6451 {
6453 if (!is_being_placed)
6455 SetSynchDirty();
6456 }
6457
6458
6460
6462 {
6464 }
6465
6467 {
6469 }
6470
6472 {
6473 return 1;
6474 }
6475
6477 {
6478 return false;
6479 }
6480
6482 {
6484 SetSynchDirty();
6485 }
6486
6487
6488
6489
6490
6491
6492
6493
6494
6495
6496
6497
6498
6499
6500
6501
6502
6503
6504
6505
6506
6507
6508
6509
6510
6511
6512
6513
6514
6515
6516
6517
6518
6519
6520
6522 {
6523 super.OnMovedInsideCargo(container);
6524
6525 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6526 }
6527
6528 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
6529 {
6530 super.EEItemLocationChanged(oldLoc,newLoc);
6531
6532 PlayerBase new_player = null;
6533 PlayerBase old_player = null;
6534
6535 if (newLoc.GetParent())
6536 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
6537
6538 if (oldLoc.GetParent())
6539 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
6540
6542 {
6543 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
6544
6545 if (r_index >= 0)
6546 {
6547 InventoryLocation r_il = new InventoryLocation;
6548 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6549
6550 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6553 {
6554 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6555 }
6557 {
6558 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6559 }
6560
6561 }
6562 }
6563
6565 {
6566 if (new_player)
6567 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
6568
6569 if (new_player == old_player)
6570 {
6571
6572 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
6573 {
6575 {
6576 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
6577 {
6578 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6579 }
6580 }
6581 else
6582 {
6583 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6584 }
6585 }
6586
6587 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
6588 {
6589 int type = oldLoc.GetType();
6591 {
6592 oldLoc.GetParent().GetOnSetLock().Invoke(this);
6593 }
6595 {
6596 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
6597 }
6598 }
6599 if (!m_OldLocation)
6600 {
6601 m_OldLocation = new InventoryLocation;
6602 }
6603 m_OldLocation.Copy(oldLoc);
6604 }
6605 else
6606 {
6607 if (m_OldLocation)
6608 {
6609 m_OldLocation.Reset();
6610 }
6611 }
6612
6614 }
6615 else
6616 {
6617 if (new_player)
6618 {
6619 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
6620 if (res_index >= 0)
6621 {
6622 InventoryLocation il = new InventoryLocation;
6623 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
6625 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
6628 {
6629 il.
GetParent().GetOnReleaseLock().Invoke(it);
6630 }
6632 {
6634 }
6635
6636 }
6637 }
6639 {
6640
6642 }
6643
6644 if (m_OldLocation)
6645 {
6646 m_OldLocation.Reset();
6647 }
6648 }
6649 }
6650
6651 override void EOnContact(IEntity other, Contact extra)
6652 {
6654 {
6655 int liquidType = -1;
6657 if (impactSpeed > 0.0)
6658 {
6660 #ifndef SERVER
6662 #else
6664 SetSynchDirty();
6665 #endif
6667 }
6668 }
6669
6670 #ifdef SERVER
6671 if (GetCompEM() && GetCompEM().IsPlugged())
6672 {
6673 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
6674 GetCompEM().UnplugThis();
6675 }
6676 #endif
6677 }
6678
6680
6682 {
6684 }
6685
6687 {
6688
6689 }
6690
6692 {
6693 super.OnItemLocationChanged(old_owner, new_owner);
6694
6695 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
6696 PlayerBase playerNew = PlayerBase.Cast(new_owner);
6697
6698 if (!relatedPlayer && playerNew)
6699 relatedPlayer = playerNew;
6700
6701 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
6702 {
6704 if (actionMgr)
6705 {
6706 ActionBase currentAction = actionMgr.GetRunningAction();
6707 if (currentAction)
6709 }
6710 }
6711
6712 Man ownerPlayerOld = null;
6713 Man ownerPlayerNew = null;
6714
6715 if (old_owner)
6716 {
6717 if (old_owner.
IsMan())
6718 {
6719 ownerPlayerOld = Man.Cast(old_owner);
6720 }
6721 else
6722 {
6723 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
6724 }
6725 }
6726 else
6727 {
6729 {
6731
6732 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
6733 {
6734 GetCompEM().UnplugThis();
6735 }
6736 }
6737 }
6738
6739 if (new_owner)
6740 {
6741 if (new_owner.
IsMan())
6742 {
6743 ownerPlayerNew = Man.Cast(new_owner);
6744 }
6745 else
6746 {
6747 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
6748 }
6749 }
6750
6751 if (ownerPlayerOld != ownerPlayerNew)
6752 {
6753 if (ownerPlayerOld)
6754 {
6755 array<EntityAI> subItemsExit = new array<EntityAI>;
6757 for (int i = 0; i < subItemsExit.Count(); i++)
6758 {
6761 }
6762 }
6763
6764 if (ownerPlayerNew)
6765 {
6766 array<EntityAI> subItemsEnter = new array<EntityAI>;
6768 for (int j = 0; j < subItemsEnter.Count(); j++)
6769 {
6772 }
6773 }
6774 }
6775 else if (ownerPlayerNew != null)
6776 {
6777 PlayerBase nplayer;
6778 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
6779 {
6780 array<EntityAI> subItemsUpdate = new array<EntityAI>;
6782 for (int k = 0; k < subItemsUpdate.Count(); k++)
6783 {
6785 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
6786 }
6787 }
6788 }
6789
6790 if (old_owner)
6791 old_owner.OnChildItemRemoved(this);
6792 if (new_owner)
6793 new_owner.OnChildItemReceived(this);
6794 }
6795
6796
6798 {
6799 super.EEDelete(parent);
6800 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
6801 if (player)
6802 {
6804
6805 if (player.IsAlive())
6806 {
6807 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6808 if (r_index >= 0)
6809 {
6810 InventoryLocation r_il = new InventoryLocation;
6811 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6812
6813 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6816 {
6817 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6818 }
6820 {
6821 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6822 }
6823
6824 }
6825
6826 player.RemoveQuickBarEntityShortcut(this);
6827 }
6828 }
6829 }
6830
6832 {
6833 super.EEKilled(killer);
6834
6837 {
6838 if (GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
6839 {
6840 if (IsMagazine())
6841 {
6842 if (Magazine.Cast(this).GetAmmoCount() > 0)
6843 {
6845 }
6846 }
6847 else
6848 {
6850 }
6851 }
6852 }
6853 }
6854
6856 {
6857 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6858
6859 super.OnWasAttached(parent, slot_id);
6860
6863
6865 }
6866
6868 {
6869 super.OnWasDetached(parent, slot_id);
6870
6873 }
6874
6876 {
6877 int idx;
6880
6881 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
6882 if (inventory_slots.Count() < 1)
6883 {
6884 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
6885 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
6886 }
6887 else
6888 {
6889 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
6890 }
6891
6892 idx = inventory_slots.Find(slot);
6893 if (idx < 0)
6894 return "";
6895
6896 return attach_types.Get(idx);
6897 }
6898
6900 {
6901 int idx = -1;
6902 string slot;
6903
6906
6907 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
6908 if (inventory_slots.Count() < 1)
6909 {
6910 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
6911 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
6912 }
6913 else
6914 {
6915 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
6916 if (detach_types.Count() < 1)
6917 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
6918 }
6919
6920 for (int i = 0; i < inventory_slots.Count(); i++)
6921 {
6922 slot = inventory_slots.Get(i);
6923 }
6924
6925 if (slot != "")
6926 {
6927 if (detach_types.Count() == 1)
6928 idx = 0;
6929 else
6930 idx = inventory_slots.Find(slot);
6931 }
6932 if (idx < 0)
6933 return "";
6934
6935 return detach_types.Get(idx);
6936 }
6937
6939 {
6940
6942
6943
6944 float min_time = 1;
6945 float max_time = 3;
6946 float delay = Math.RandomFloat(min_time, max_time);
6947
6948 explode_timer.Run(delay, this, "DoAmmoExplosion");
6949 }
6950
6952 {
6953 Magazine magazine = Magazine.Cast(this);
6954 int pop_sounds_count = 6;
6955 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
6956
6957
6958 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
6959 string sound_name = pop_sounds[ sound_idx ];
6961
6962
6963 magazine.ServerAddAmmoCount(-1);
6964
6965
6966 float min_temp_to_explode = 100;
6967
6968 if (magazine.GetAmmoCount() > 0 && GetTemperature() >= min_temp_to_explode)
6969 {
6971 }
6972 }
6973
6974
6975 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
6976 {
6977 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
6978
6979 const int CHANCE_DAMAGE_CARGO = 4;
6980 const int CHANCE_DAMAGE_ATTACHMENT = 1;
6981 const int CHANCE_DAMAGE_NOTHING = 2;
6982
6984 {
6985 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
6986 int chances;
6987 int rnd;
6988
6989 if (GetInventory().GetCargo())
6990 {
6991 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
6992 rnd = Math.RandomInt(0,chances);
6993
6994 if (rnd < CHANCE_DAMAGE_CARGO)
6995 {
6997 }
6998 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
6999 {
7001 }
7002 }
7003 else
7004 {
7005 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7006 rnd = Math.RandomInt(0,chances);
7007
7008 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
7009 {
7011 }
7012 }
7013 }
7014 }
7015
7017 {
7018 if (GetInventory().GetCargo())
7019 {
7020 int item_count = GetInventory().GetCargo().GetItemCount();
7021 if (item_count > 0)
7022 {
7023 int random_pick = Math.RandomInt(0, item_count);
7025 if (!item.IsExplosive())
7026 {
7027 item.AddHealth("","",damage);
7028 return true;
7029 }
7030 }
7031 }
7032 return false;
7033 }
7034
7036 {
7037 int attachment_count = GetInventory().AttachmentCount();
7038 if (attachment_count > 0)
7039 {
7040 int random_pick = Math.RandomInt(0, attachment_count);
7041 ItemBase attachment =
ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
7042 if (!attachment.IsExplosive())
7043 {
7044 attachment.AddHealth("","",damage);
7045 return true;
7046 }
7047 }
7048 return false;
7049 }
7050
7052 {
7054 }
7055
7057 {
7059 return GetInventory().CanRemoveEntity();
7060
7061 return false;
7062 }
7063
7065 {
7067 return;
7068
7070 {
7071 if (ScriptInputUserData.CanStoreInputUserData())
7072 {
7073 ScriptInputUserData ctx = new ScriptInputUserData;
7078 ctx.
Write(destination_entity);
7082 }
7083 }
7084 else if (!
GetGame().IsMultiplayer())
7085 {
7087 }
7088 }
7089
7091 {
7093 return;
7094
7095 float split_quantity_new;
7099 InventoryLocation loc = new InventoryLocation;
7100
7101 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7102 {
7104 split_quantity_new = stack_max;
7105 else
7107
7108 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7109 if (new_item)
7110 {
7111 new_item.SetResultOfSplit(true);
7112 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7114 new_item.SetQuantity(split_quantity_new);
7115 }
7116 }
7117 else if (destination_entity && slot_id == -1)
7118 {
7119 if (quantity > stack_max)
7120 split_quantity_new = stack_max;
7121 else
7122 split_quantity_new = quantity;
7123
7125 {
7128 }
7129
7130 if (new_item)
7131 {
7132 new_item.SetResultOfSplit(true);
7133 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7135 new_item.SetQuantity(split_quantity_new);
7136 }
7137 }
7138 else
7139 {
7140 if (stack_max != 0)
7141 {
7143 {
7145 }
7146
7147 if (split_quantity_new == 0)
7148 {
7149 if (!
GetGame().IsMultiplayer())
7150 player.PhysicalPredictiveDropItem(this);
7151 else
7152 player.ServerDropEntity(this);
7153 return;
7154 }
7155
7157
7158 if (new_item)
7159 {
7160 new_item.SetResultOfSplit(true);
7161 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7163 new_item.SetQuantity(stack_max);
7164 new_item.PlaceOnSurface();
7165 }
7166 }
7167 }
7168 }
7169
7171 {
7173 return;
7174
7175 float split_quantity_new;
7179 InventoryLocation loc = new InventoryLocation;
7180
7181 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7182 {
7184 split_quantity_new = stack_max;
7185 else
7187
7188 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7189 if (new_item)
7190 {
7191 new_item.SetResultOfSplit(true);
7192 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7194 new_item.SetQuantity(split_quantity_new);
7195 }
7196 }
7197 else if (destination_entity && slot_id == -1)
7198 {
7199 if (quantity > stack_max)
7200 split_quantity_new = stack_max;
7201 else
7202 split_quantity_new = quantity;
7203
7205 {
7208 }
7209
7210 if (new_item)
7211 {
7212 new_item.SetResultOfSplit(true);
7213 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7215 new_item.SetQuantity(split_quantity_new);
7216 }
7217 }
7218 else
7219 {
7220 if (stack_max != 0)
7221 {
7223 {
7225 }
7226
7228
7229 if (new_item)
7230 {
7231 new_item.SetResultOfSplit(true);
7232 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7234 new_item.SetQuantity(stack_max);
7235 new_item.PlaceOnSurface();
7236 }
7237 }
7238 }
7239 }
7240
7242 {
7244 return;
7245
7247 {
7248 if (ScriptInputUserData.CanStoreInputUserData())
7249 {
7250 ScriptInputUserData ctx = new ScriptInputUserData;
7255 dst.WriteToContext(ctx);
7257 }
7258 }
7259 else if (!
GetGame().IsMultiplayer())
7260 {
7262 }
7263 }
7264
7266 {
7268 return;
7269
7271 {
7272 if (ScriptInputUserData.CanStoreInputUserData())
7273 {
7274 ScriptInputUserData ctx = new ScriptInputUserData;
7279 ctx.
Write(destination_entity);
7285 }
7286 }
7287 else if (!
GetGame().IsMultiplayer())
7288 {
7290 }
7291 }
7292
7294 {
7296 }
7297
7299 {
7301 return this;
7302
7304 float split_quantity_new;
7306 if (dst.IsValid())
7307 {
7308 int slot_id = dst.GetSlot();
7310
7311 if (quantity > stack_max)
7312 split_quantity_new = stack_max;
7313 else
7314 split_quantity_new = quantity;
7315
7317
7318 if (new_item)
7319 {
7320 new_item.SetResultOfSplit(true);
7321 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7324 }
7325
7326 return new_item;
7327 }
7328
7329 return null;
7330 }
7331
7333 {
7335 return;
7336
7338 float split_quantity_new;
7340 if (destination_entity)
7341 {
7343 if (quantity > stackable)
7344 split_quantity_new = stackable;
7345 else
7346 split_quantity_new = quantity;
7347
7348 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
7349 if (new_item)
7350 {
7351 new_item.SetResultOfSplit(true);
7352 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7354 new_item.SetQuantity(split_quantity_new);
7355 }
7356 }
7357 }
7358
7360 {
7362 return;
7363
7365 {
7366 if (ScriptInputUserData.CanStoreInputUserData())
7367 {
7368 ScriptInputUserData ctx = new ScriptInputUserData;
7373 ItemBase destination_entity =
this;
7374 ctx.
Write(destination_entity);
7378 }
7379 }
7380 else if (!
GetGame().IsMultiplayer())
7381 {
7383 }
7384 }
7385
7387 {
7389 return;
7390
7392 float split_quantity_new;
7394 if (player)
7395 {
7397 if (quantity > stackable)
7398 split_quantity_new = stackable;
7399 else
7400 split_quantity_new = quantity;
7401
7402 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
7403 new_item =
ItemBase.Cast(in_hands);
7404 if (new_item)
7405 {
7406 new_item.SetResultOfSplit(true);
7407 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7409 new_item.SetQuantity(split_quantity_new);
7410 }
7411 }
7412 }
7413
7415 {
7417 return;
7418
7420 float split_quantity_new = Math.Floor(quantity * 0.5);
7421
7423
7424 if (new_item)
7425 {
7426 if (new_item.GetQuantityMax() < split_quantity_new)
7427 {
7428 split_quantity_new = new_item.GetQuantityMax();
7429 }
7430
7431 new_item.SetResultOfSplit(true);
7432 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7433
7435 {
7438 }
7439 else
7440 {
7443 }
7444 }
7445 }
7446
7448 {
7450 return;
7451
7453 float split_quantity_new = Math.Floor(quantity / 2);
7454
7455 InventoryLocation invloc = new InventoryLocation;
7457
7459 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
7460
7461 if (new_item)
7462 {
7463 if (new_item.GetQuantityMax() < split_quantity_new)
7464 {
7465 split_quantity_new = new_item.GetQuantityMax();
7466 }
7468 {
7471 }
7472 else
7473 {
7476 }
7477 }
7478 }
7479
7482 {
7483 SetWeightDirty();
7485
7486 if (parent)
7487 parent.OnAttachmentQuantityChangedEx(this, delta);
7488
7490 {
7492 {
7494 }
7496 {
7497 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
7499 }
7500 }
7501
7502 }
7503
7506 {
7507
7508 }
7509
7512 {
7514 }
7515
7517 {
7518 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
7519
7521 {
7522 if (newLevel == GameConstants.STATE_RUINED)
7523 {
7525 EntityAI parent = GetHierarchyParent();
7526 if (parent && parent.IsFireplace())
7527 {
7528 CargoBase cargo = GetInventory().GetCargo();
7529 if (cargo)
7530 {
7532 {
7534 }
7535 }
7536 }
7537 }
7538
7540 {
7541
7543 return;
7544 }
7545
7546 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
7547 {
7549 }
7550 }
7551 }
7552
7553
7555 {
7556 super.OnRightClick();
7557
7559 {
7561 {
7562 if (ScriptInputUserData.CanStoreInputUserData())
7563 {
7564 vector m4[4];
7566
7567 EntityAI root = GetHierarchyRoot();
7568
7569 InventoryLocation dst = new InventoryLocation;
7571 {
7572 if (root)
7573 {
7574 root.GetTransform(m4);
7576 }
7577 else
7578 GetInventory().GetCurrentInventoryLocation(dst);
7579 }
7580 else
7581 {
7583
7584
7585 if (
GetGame().
GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
7586 {
7587 if (root)
7588 {
7589 root.GetTransform(m4);
7591 }
7592 else
7593 GetInventory().GetCurrentInventoryLocation(dst);
7594 }
7595 else
7596 {
7597 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
7598 }
7599 }
7600
7601 ScriptInputUserData ctx = new ScriptInputUserData;
7609 }
7610 }
7611 else if (!
GetGame().IsMultiplayer())
7612 {
7614 }
7615 }
7616 }
7617
7618 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
7619 {
7620
7621 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
7622 return false;
7623
7624 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
7625 return false;
7626
7627
7629 return false;
7630
7631
7632 Magazine mag = Magazine.Cast(this);
7633 if (mag)
7634 {
7635 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
7636 return false;
7637
7638 if (stack_max_limit)
7639 {
7640 Magazine other_mag = Magazine.Cast(other_item);
7641 if (other_item)
7642 {
7643 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
7644 return false;
7645 }
7646
7647 }
7648 }
7649 else
7650 {
7651
7653 return false;
7654
7656 return false;
7657 }
7658
7659 PlayerBase player = null;
7660 if (CastTo(player, GetHierarchyRootPlayer()))
7661 {
7662 if (player.GetInventory().HasAttachment(this))
7663 return false;
7664
7665 if (player.IsItemsToDelete())
7666 return false;
7667 }
7668
7669 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
7670 return false;
7671
7672 int slotID;
7674 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
7675 return false;
7676
7677 return true;
7678 }
7679
7681 {
7683 }
7684
7686 {
7687 return m_IsResultOfSplit;
7688 }
7689
7691 {
7692 m_IsResultOfSplit = value;
7693 }
7694
7696 {
7698 }
7699
7701 {
7702 float other_item_quantity = other_item.GetQuantity();
7703 float this_free_space;
7704
7706
7708
7709 if (other_item_quantity > this_free_space)
7710 {
7711 return this_free_space;
7712 }
7713 else
7714 {
7715 return other_item_quantity;
7716 }
7717 }
7718
7720 {
7722 }
7723
7725 {
7727 return;
7728
7729 if (!IsMagazine() && other_item)
7730 {
7732 if (quantity_used != 0)
7733 {
7734 float hp1 = GetHealth01("","");
7735 float hp2 = other_item.GetHealth01("","");
7736 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
7737 hpResult = hpResult / (
GetQuantity() + quantity_used);
7738
7739 hpResult *= GetMaxHealth();
7740 Math.Round(hpResult);
7741 SetHealth("", "Health", hpResult);
7742
7744 other_item.AddQuantity(-quantity_used);
7745 }
7746 }
7748 }
7749
7751 {
7752 #ifdef SERVER
7753 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
7754 GetHierarchyParent().IncreaseLifetimeUp();
7755 #endif
7756 };
7757
7759 {
7760 PlayerBase p = PlayerBase.Cast(player);
7761
7762 array<int> recipesIds = p.m_Recipes;
7763 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
7764 if (moduleRecipesManager)
7765 {
7766 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
7767 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
7768 }
7769
7770 for (int i = 0;i < recipesIds.Count(); i++)
7771 {
7772 int key = recipesIds.Get(i);
7773 string recipeName = moduleRecipesManager.GetRecipeName(key);
7775 }
7776 }
7777
7778
7779 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
7780 {
7781 super.GetDebugActions(outputList);
7782
7783
7788
7789
7793
7797
7798
7801
7802
7804 {
7807 }
7808
7810
7813
7817 }
7818
7819
7820
7821
7823 {
7824 super.OnAction(action_id, player, ctx);
7825 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
7826 {
7827 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
7828 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
7829 PlayerBase p = PlayerBase.Cast(player);
7830 if (
EActions.RECIPES_RANGE_START < 1000)
7831 {
7832 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
7833 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
7834 }
7835 }
7836 #ifndef SERVER
7837 else if (action_id ==
EActions.WATCH_PLAYER)
7838 {
7839 PluginDeveloper.SetDeveloperItemClientEx(player);
7840 }
7841 #endif
7843 {
7844 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
7845 {
7846 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
7847 OnDebugButtonPressServer(id + 1);
7848 }
7849
7850 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
7851 {
7852 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
7854 }
7855
7856 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
7857 {
7858 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
7860 }
7861
7862 else if (action_id ==
EActions.ADD_QUANTITY)
7863 {
7864 if (IsMagazine())
7865 {
7866 Magazine mag = Magazine.Cast(this);
7867 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
7868 }
7869 else
7870 {
7872 }
7873
7874 if (m_EM)
7875 {
7876 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
7877 }
7878
7879 }
7880
7881 else if (action_id ==
EActions.REMOVE_QUANTITY)
7882 {
7883 if (IsMagazine())
7884 {
7885 Magazine mag2 = Magazine.Cast(this);
7886 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
7887 }
7888 else
7889 {
7891 }
7892 if (m_EM)
7893 {
7894 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
7895 }
7896
7897 }
7898
7899 else if (action_id ==
EActions.SET_QUANTITY_0)
7900 {
7902
7903 if (m_EM)
7904 {
7905 m_EM.SetEnergy(0);
7906 }
7907 }
7908
7909 else if (action_id ==
EActions.SET_MAX_QUANTITY)
7910 {
7912
7913 if (m_EM)
7914 {
7915 m_EM.SetEnergy(m_EM.GetEnergyMax());
7916 }
7917 }
7918
7919 else if (action_id ==
EActions.ADD_HEALTH)
7920 {
7921 AddHealth("","",GetMaxHealth("","Health")/5);
7922 }
7923 else if (action_id ==
EActions.REMOVE_HEALTH)
7924 {
7925 AddHealth("","",-GetMaxHealth("","Health")/5);
7926 }
7927 else if (action_id ==
EActions.DESTROY_HEALTH)
7928 {
7929 SetHealth01("","",0);
7930 }
7931 else if (action_id ==
EActions.WATCH_ITEM)
7932 {
7934 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
7935 #ifdef DEVELOPER
7936 SetDebugDeveloper_item(this);
7937 #endif
7938 }
7939
7940 else if (action_id ==
EActions.ADD_TEMPERATURE)
7941 {
7942 AddTemperature(20);
7943
7944 }
7945
7946 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
7947 {
7948 AddTemperature(-20);
7949
7950 }
7951
7952 else if (action_id ==
EActions.FLIP_FROZEN)
7953 {
7954 SetFrozen(!GetIsFrozen());
7955
7956 }
7957
7958 else if (action_id ==
EActions.ADD_WETNESS)
7959 {
7961
7962 }
7963
7964 else if (action_id ==
EActions.REMOVE_WETNESS)
7965 {
7967
7968 }
7969
7970 else if (action_id ==
EActions.LIQUIDTYPE_UP)
7971 {
7974
7975
7976 }
7977
7978 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
7979 {
7982 }
7983
7984 else if (action_id ==
EActions.MAKE_SPECIAL)
7985 {
7986 auto debugParams = DebugSpawnParams.WithPlayer(player);
7987 OnDebugSpawnEx(debugParams);
7988 }
7989
7990 else if (action_id ==
EActions.DELETE)
7991 {
7992 Delete();
7993 }
7994
7995 }
7996
7997
7998 return false;
7999 }
8000
8001
8002
8003
8007
8010
8011
8012
8014 {
8015 return false;
8016 }
8017
8018
8020 {
8021 return true;
8022 }
8023
8024
8026 {
8027 return true;
8028 }
8029
8030
8031
8033 {
8034 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
8036 }
8037
8040 {
8041 return null;
8042 }
8043
8045 {
8046 return false;
8047 }
8048
8050 {
8051 return false;
8052 }
8053
8057
8058
8060 {
8061 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8062 return module_repairing.CanRepair(this, item_repair_kit);
8063 }
8064
8065
8066 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
8067 {
8068 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8069 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
8070 }
8071
8072
8074 {
8075
8076
8077
8078
8079
8080
8081
8082
8083 return 1;
8084 }
8085
8086
8087
8089 {
8091 }
8092
8093
8094
8096 {
8098 }
8099
8100
8109 {
8110 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8111
8112 if (player)
8113 {
8114 player.MessageStatus(text);
8115 }
8116 }
8117
8118
8127 {
8128 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8129
8130 if (player)
8131 {
8132 player.MessageAction(text);
8133 }
8134 }
8135
8136
8145 {
8146 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8147
8148 if (player)
8149 {
8150 player.MessageFriendly(text);
8151 }
8152 }
8153
8154
8163 {
8164 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8165
8166 if (player)
8167 {
8168 player.MessageImportant(text);
8169 }
8170 }
8171
8173 {
8174 return true;
8175 }
8176
8177
8178 override bool KindOf(
string tag)
8179 {
8180 bool found = false;
8181 string item_name = this.
GetType();
8184
8185 int array_size = item_tag_array.Count();
8186 for (int i = 0; i < array_size; i++)
8187 {
8188 if (item_tag_array.Get(i) == tag)
8189 {
8190 found = true;
8191 break;
8192 }
8193 }
8194 return found;
8195 }
8196
8197
8199 {
8200
8201 super.OnRPC(sender, rpc_type,ctx);
8202
8203
8204 switch (rpc_type)
8205 {
8206 #ifndef SERVER
8207 case ERPCs.RPC_SOUND_LOCK_ATTACH:
8208 Param2<bool, string> p = new Param2<bool, string>(false, "");
8209
8211 return;
8212
8213 bool play = p.param1;
8214 string soundSet = p.param2;
8215
8216 if (play)
8217 {
8219 {
8221 {
8223 }
8224 }
8225 else
8226 {
8228 }
8229 }
8230 else
8231 {
8233 }
8234
8235 break;
8236 #endif
8237
8238 }
8239
8241 {
8243 }
8244 }
8245
8246
8247
8248
8250 {
8251 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8252 return plugin.GetID(
name);
8253 }
8254
8256 {
8257 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8258 return plugin.GetName(id);
8259 }
8260
8263 {
8264
8265
8266 int varFlags;
8267 if (!ctx.
Read(varFlags))
8268 return;
8269
8270 if (varFlags & ItemVariableFlags.FLOAT)
8271 {
8273 }
8274 }
8275
8277 {
8278
8279 super.SerializeNumericalVars(floats_out);
8280
8281
8282
8284 {
8286 }
8287
8289 {
8291 }
8292
8294 {
8296 }
8297
8299 {
8304 }
8305
8307 {
8309 }
8310 }
8311
8313 {
8314
8315 super.DeSerializeNumericalVars(floats);
8316
8317
8318 int index = 0;
8319 int mask = Math.Round(floats.Get(index));
8320
8321 index++;
8322
8324 {
8326 {
8328 }
8329 else
8330 {
8331 float quantity = floats.Get(index);
8333 }
8334 index++;
8335 }
8336
8338 {
8339 float wet = floats.Get(index);
8341 index++;
8342 }
8343
8345 {
8346 int liquidtype = Math.Round(floats.Get(index));
8348 index++;
8349 }
8350
8352 {
8354 index++;
8356 index++;
8358 index++;
8360 index++;
8361 }
8362
8364 {
8365 int cleanness = Math.Round(floats.Get(index));
8367 index++;
8368 }
8369 }
8370
8372 {
8373 super.WriteVarsToCTX(ctx);
8374
8375
8377 {
8379 }
8380
8382 {
8384 }
8385
8387 {
8389 }
8390
8392 {
8393 int r,g,b,a;
8399 }
8400
8402 {
8404 }
8405 }
8406
8408 {
8409 if (!super.ReadVarsFromCTX(ctx,version))
8410 return false;
8411
8412 int intValue;
8413 float value;
8414
8415 if (version < 140)
8416 {
8417 if (!ctx.
Read(intValue))
8418 return false;
8419
8420 m_VariablesMask = intValue;
8421 }
8422
8424 {
8425 if (!ctx.
Read(value))
8426 return false;
8427
8429 {
8431 }
8432 else
8433 {
8435 }
8436 }
8437
8438 if (version < 140)
8439 {
8441 {
8442 if (!ctx.
Read(value))
8443 return false;
8444 SetTemperatureDirect(value);
8445 }
8446 }
8447
8449 {
8450 if (!ctx.
Read(value))
8451 return false;
8453 }
8454
8456 {
8457 if (!ctx.
Read(intValue))
8458 return false;
8460 }
8461
8463 {
8464 int r,g,b,a;
8466 return false;
8468 return false;
8470 return false;
8472 return false;
8473
8475 }
8476
8478 {
8479 if (!ctx.
Read(intValue))
8480 return false;
8482 }
8483
8484 if (version >= 138 && version < 140)
8485 {
8487 {
8488 if (!ctx.
Read(intValue))
8489 return false;
8490 SetFrozen(intValue);
8491 }
8492 }
8493
8494 return true;
8495 }
8496
8497
8499 {
8502 {
8504 }
8505
8506 if (!super.OnStoreLoad(ctx, version))
8507 {
8509 return false;
8510 }
8511
8512 if (version >= 114)
8513 {
8514 bool hasQuickBarIndexSaved;
8515
8516 if (!ctx.
Read(hasQuickBarIndexSaved))
8517 {
8519 return false;
8520 }
8521
8522 if (hasQuickBarIndexSaved)
8523 {
8524 int itmQBIndex;
8525
8526
8527 if (!ctx.
Read(itmQBIndex))
8528 {
8530 return false;
8531 }
8532
8533 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
8534 if (itmQBIndex != -1 && parentPlayer)
8535 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
8536 }
8537 }
8538 else
8539 {
8540
8541 PlayerBase player;
8542 int itemQBIndex;
8543 if (version ==
int.
MAX)
8544 {
8545 if (!ctx.
Read(itemQBIndex))
8546 {
8548 return false;
8549 }
8550 }
8551 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
8552 {
8553
8554 if (!ctx.
Read(itemQBIndex))
8555 {
8557 return false;
8558 }
8559 if (itemQBIndex != -1 && player)
8560 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
8561 }
8562 }
8563
8564 if (version < 140)
8565 {
8566
8567 if (!LoadVariables(ctx, version))
8568 {
8570 return false;
8571 }
8572 }
8573
8574
8576 {
8578 return false;
8579 }
8580 if (version >= 132)
8581 {
8583 if (raib)
8584 {
8586 {
8588 return false;
8589 }
8590 }
8591 }
8592
8594 return true;
8595 }
8596
8597
8598
8600 {
8601 super.OnStoreSave(ctx);
8602
8603 PlayerBase player;
8604 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
8605 {
8607
8608 int itemQBIndex = -1;
8609 itemQBIndex = player.FindQuickBarEntityIndex(this);
8610 ctx.
Write(itemQBIndex);
8611 }
8612 else
8613 {
8615 }
8616
8618
8620 if (raib)
8621 {
8623 }
8624 }
8625
8626
8628 {
8629 super.AfterStoreLoad();
8630
8632 {
8634 }
8635
8637 {
8640 }
8641 }
8642
8644 {
8645 super.EEOnAfterLoad();
8646
8648 {
8650 }
8651
8654 }
8655
8657 {
8658 return false;
8659 }
8660
8661
8662
8664 {
8666 {
8667 #ifdef PLATFORM_CONSOLE
8668
8670 {
8672 if (menu)
8673 {
8675 }
8676 }
8677 #endif
8678 }
8679
8681 {
8684 }
8685
8687 {
8688 SetWeightDirty();
8690 }
8692 {
8695 }
8696
8698 {
8701 }
8703 {
8706 }
8707
8708 super.OnVariablesSynchronized();
8709 }
8710
8711
8712
8714 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
8715 {
8716 if (!IsServerCheck(allow_client))
8717 return false;
8718
8720 return false;
8721
8724
8725 if (value <= (min + 0.001))
8726 value = min;
8727
8728 if (value == min)
8729 {
8730 if (destroy_config)
8731 {
8732 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
8733 if (dstr)
8734 {
8736 this.Delete();
8737 return true;
8738 }
8739 }
8740 else if (destroy_forced)
8741 {
8743 this.Delete();
8744 return true;
8745 }
8746
8748 }
8749
8752
8754 {
8756
8757 if (delta)
8759 }
8760
8762
8763 return false;
8764 }
8765
8766
8768 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
8769 {
8771 }
8772
8774 {
8777 }
8778
8780 {
8783 }
8784
8787 {
8788 float value_clamped = Math.Clamp(value, 0, 1);
8790 SetQuantity(result, destroy_config, destroy_forced);
8791 }
8792
8793
8796 {
8798 }
8799
8801 {
8803 }
8804
8805
8806
8807
8808
8809
8810
8811
8812
8813
8815 {
8816 int slot = -1;
8817 if (GetInventory())
8818 {
8819 InventoryLocation il = new InventoryLocation;
8820 GetInventory().GetCurrentInventoryLocation(il);
8822 }
8823
8825 }
8826
8828 {
8829 float quantity_max = 0;
8830
8832 {
8833 if (attSlotID != -1)
8834 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
8835
8836 if (quantity_max <= 0)
8838 }
8839
8840 if (quantity_max <= 0)
8842
8843 return quantity_max;
8844 }
8845
8847 {
8849 }
8850
8852 {
8854 }
8855
8856
8858 {
8860 }
8861
8863 {
8865 }
8866
8868 {
8870 }
8871
8872
8874 {
8875
8876 float weightEx = GetWeightEx();
8877 float special = GetInventoryAndCargoWeight();
8878 return weightEx - special;
8879 }
8880
8881
8883 {
8885 }
8886
8888 {
8890 {
8891 #ifdef DEVELOPER
8892 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
8893 {
8894 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
8896 }
8897 #endif
8898
8900 }
8901 else if (HasEnergyManager())
8902 {
8903 #ifdef DEVELOPER
8904 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
8905 {
8906 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
8907 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
8908 }
8909 #endif
8910 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified());
8911 }
8912 else
8913 {
8914 #ifdef DEVELOPER
8915 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
8916 {
8917 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
8918 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
8919 }
8920 #endif
8921 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified());
8922 }
8923 }
8924
8927 {
8928 int item_count = 0;
8930
8931 if (GetInventory().GetCargo() != NULL)
8932 {
8933 item_count = GetInventory().GetCargo().GetItemCount();
8934 }
8935
8936 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
8937 {
8938 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
8939 if (item)
8940 item_count += item.GetNumberOfItems();
8941 }
8942 return item_count;
8943 }
8944
8947 {
8948 float weight = 0;
8949 float wetness = 1;
8950 if (include_wetness)
8953 {
8954 weight = wetness * m_ConfigWeight;
8955 }
8957 {
8958 weight = 1;
8959 }
8960 return weight;
8961 }
8962
8963
8964
8966 {
8967 if ((
GetGame().IsServer() || !
GetGame().IsMultiplayer()) && GetInventory())
8968 {
8969 GameInventory inv = GetInventory();
8970 array<EntityAI> items = new array<EntityAI>;
8972 for (int i = 0; i < items.Count(); i++)
8973 {
8975 if (item)
8976 {
8978 }
8979 }
8980 }
8981 }
8982
8983
8984
8985
8987 {
8988 float energy = 0;
8989 if (HasEnergyManager())
8990 {
8991 energy = GetCompEM().GetEnergy();
8992 }
8993 return energy;
8994 }
8995
8996
8998 {
8999 super.OnEnergyConsumed();
9000
9002 }
9003
9005 {
9006 super.OnEnergyAdded();
9007
9009 }
9010
9011
9013 {
9014 if (
GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
9015 {
9017 {
9018 float energy_0to1 = GetCompEM().GetEnergy0To1();
9020 }
9021 }
9022 }
9023
9024
9026 {
9027 return ConfigGetFloat("heatIsolation");
9028 }
9029
9031 {
9033 }
9034
9036 {
9037 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
9038 if (
GetGame().ConfigIsExisting(paramPath))
9040
9041 return 0.0;
9042 }
9043
9045 {
9046 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
9047 if (
GetGame().ConfigIsExisting(paramPath))
9049
9050 return 0.0;
9051 }
9052
9053 override void SetWet(
float value,
bool allow_client =
false)
9054 {
9055 if (!IsServerCheck(allow_client))
9056 return;
9057
9060
9062
9063 m_VarWet = Math.Clamp(value, min, max);
9064
9066 {
9069 }
9070 }
9071
9072 override void AddWet(
float value)
9073 {
9075 }
9076
9078 {
9080 }
9081
9083 {
9085 }
9086
9088 {
9090 }
9091
9093 {
9095 }
9096
9098 {
9100 }
9101
9103 {
9106 if (newLevel != oldLevel)
9107 {
9109 }
9110 }
9111
9113 {
9114 SetWeightDirty();
9115 }
9116
9118 {
9119 return GetWetLevelInternal(
m_VarWet);
9120 }
9121
9122
9123
9125 {
9127 }
9128
9130 {
9132 }
9133
9135 {
9137 }
9138
9140 {
9142 }
9143
9144
9145
9147 {
9148 if (ConfigIsExisting("itemModelLength"))
9149 {
9150 return ConfigGetFloat("itemModelLength");
9151 }
9152 return 0;
9153 }
9154
9156 {
9157 if (ConfigIsExisting("itemAttachOffset"))
9158 {
9159 return ConfigGetFloat("itemAttachOffset");
9160 }
9161 return 0;
9162 }
9163
9164 override void SetCleanness(
int value,
bool allow_client =
false)
9165 {
9166 if (!IsServerCheck(allow_client))
9167 return;
9168
9170
9172
9175 }
9176
9178 {
9180 }
9181
9183 {
9184 return true;
9185 }
9186
9187
9188
9189
9191 {
9193 }
9194
9196 {
9198 }
9199
9200
9201
9202
9203 override void SetColor(
int r,
int g,
int b,
int a)
9204 {
9210 }
9212 override void GetColor(out
int r,out
int g,out
int b,out
int a)
9213 {
9218 }
9219
9221 {
9223 }
9224
9227 {
9228 int r,g,b,a;
9230 r = r/255;
9231 g = g/255;
9232 b = b/255;
9233 a = a/255;
9234 return MiscGameplayFunctions.GetColorString(r, g, b, a);
9235 }
9236
9237
9238
9239 override void SetLiquidType(
int value,
bool allow_client =
false)
9240 {
9241 if (!IsServerCheck(allow_client))
9242 return;
9243
9248 }
9249
9251 {
9252 return ConfigGetInt("varLiquidTypeInit");
9253 }
9254
9256 {
9258 }
9259
9261 {
9263 SetFrozen(false);
9264 }
9265
9268 {
9269 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9270 }
9271
9272
9275 {
9276 PlayerBase nplayer;
9277 if (PlayerBase.CastTo(nplayer, player))
9278 {
9280
9281 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9282 }
9283 }
9284
9285
9288 {
9289 PlayerBase nplayer;
9290 if (PlayerBase.CastTo(nplayer,player))
9291 {
9292
9293 nplayer.SetEnableQuickBarEntityShortcut(this,false);
9294
9295 }
9296
9297
9298 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
9299
9300
9301 if (HasEnergyManager())
9302 {
9303 GetCompEM().UpdatePlugState();
9304 }
9305 }
9306
9307
9309 {
9310 super.OnPlacementStarted(player);
9311
9313 }
9314
9315 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
9316 {
9318 {
9319 m_AdminLog.OnPlacementComplete(player,
this);
9320 }
9321
9322 super.OnPlacementComplete(player, position, orientation);
9323 }
9324
9325
9326
9327
9328
9330 {
9332 {
9333 return true;
9334 }
9335 else
9336 {
9337 return false;
9338 }
9339 }
9340
9341
9343 {
9345 {
9347 }
9348 }
9349
9350
9352 {
9354 }
9355
9357 {
9359 }
9360
9361 override void InsertAgent(
int agent,
float count = 1)
9362 {
9363 if (count < 1)
9364 return;
9365
9367 }
9368
9371 {
9373 }
9374
9375
9377 {
9379 }
9380
9381
9382
9383
9384
9385
9386
9387
9388
9389
9390
9391
9392
9393
9394
9395
9396
9397
9398
9399
9400
9401
9402
9403
9404
9405
9406
9407
9408
9409
9410
9411
9412
9413
9414
9415
9416
9417
9418
9419
9420
9421
9423 {
9425 return false;
9426 return true;
9427 }
9428
9430 {
9431
9433 }
9434
9435
9438 {
9439 super.CheckForRoofLimited(timeTresholdMS);
9440
9442 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
9443 {
9444 m_PreviousRoofTestTime = time;
9445 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
9446 }
9447 }
9448
9449
9451 {
9453 {
9454 return 0;
9455 }
9456
9457 if (GetInventory().GetAttachmentSlotsCount() != 0)
9458 {
9459 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
9460 if (filter)
9461 return filter.GetProtectionLevel(type, false, system);
9462 else
9463 return 0;
9464 }
9465
9466 string subclassPath, entryName;
9467
9468 switch (type)
9469 {
9471 entryName = "biological";
9472 break;
9474 entryName = "chemical";
9475 break;
9476 default:
9477 entryName = "biological";
9478 break;
9479 }
9480
9481 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
9482
9484 }
9485
9486
9487
9490 {
9491 if (!IsMagazine())
9493
9495 }
9496
9497
9498
9499
9500
9505 {
9506 return true;
9507 }
9508
9510 {
9512 }
9513
9514
9515
9516
9517
9519 {
9520 if (parent)
9521 {
9522 if (parent.IsInherited(DayZInfected))
9523 return true;
9524
9525 if (!parent.IsRuined())
9526 return true;
9527 }
9528
9529 return true;
9530 }
9531
9533 {
9534 if (!super.CanPutAsAttachment(parent))
9535 {
9536 return false;
9537 }
9538
9539 if (!IsRuined() && !parent.IsRuined())
9540 {
9541 return true;
9542 }
9543
9544 return false;
9545 }
9546
9548 {
9549
9550
9551
9552
9553 return super.CanReceiveItemIntoCargo(item);
9554 }
9555
9557 {
9558
9559
9560
9561
9562 GameInventory attachmentInv = attachment.GetInventory();
9564 {
9565 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
9566 return false;
9567 }
9568
9569 InventoryLocation loc = new InventoryLocation();
9570 attachment.GetInventory().GetCurrentInventoryLocation(loc);
9571 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
9572 return false;
9573
9574 return super.CanReceiveAttachment(attachment, slotId);
9575 }
9576
9578 {
9579 if (!super.CanReleaseAttachment(attachment))
9580 return false;
9581
9582 return GetInventory().AreChildrenAccessible();
9583 }
9584
9585
9586
9587
9588
9589
9590
9591
9592
9593
9594
9595
9596
9597
9598
9599
9600
9601
9602
9603
9604
9606 {
9607 int id = muzzle_owner.GetMuzzleID();
9608 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
9609
9610 if (WPOF_array)
9611 {
9612 for (int i = 0; i < WPOF_array.Count(); i++)
9613 {
9614 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
9615
9616 if (WPOF)
9617 {
9618 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
9619 }
9620 }
9621 }
9622 }
9623
9624
9626 {
9627 int id = muzzle_owner.GetMuzzleID();
9629
9630 if (WPOBE_array)
9631 {
9632 for (int i = 0; i < WPOBE_array.Count(); i++)
9633 {
9634 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
9635
9636 if (WPOBE)
9637 {
9638 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
9639 }
9640 }
9641 }
9642 }
9643
9644
9646 {
9647 int id = muzzle_owner.GetMuzzleID();
9648 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9649
9650 if (WPOOH_array)
9651 {
9652 for (int i = 0; i < WPOOH_array.Count(); i++)
9653 {
9654 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9655
9656 if (WPOOH)
9657 {
9658 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
9659 }
9660 }
9661 }
9662 }
9663
9664
9666 {
9667 int id = muzzle_owner.GetMuzzleID();
9668 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9669
9670 if (WPOOH_array)
9671 {
9672 for (int i = 0; i < WPOOH_array.Count(); i++)
9673 {
9674 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9675
9676 if (WPOOH)
9677 {
9678 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9679 }
9680 }
9681 }
9682 }
9683
9684
9686 {
9687 int id = muzzle_owner.GetMuzzleID();
9688 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9689
9690 if (WPOOH_array)
9691 {
9692 for (int i = 0; i < WPOOH_array.Count(); i++)
9693 {
9694 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9695
9696 if (WPOOH)
9697 {
9698 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9699 }
9700 }
9701 }
9702 }
9703
9704
9705
9707 {
9709 {
9710 return true;
9711 }
9712
9713 return false;
9714 }
9715
9717 {
9719 {
9720 return true;
9721 }
9722
9723 return false;
9724 }
9725
9727 {
9729 {
9730 return true;
9731 }
9732
9733 return false;
9734 }
9735
9737 {
9738 return false;
9739 }
9740
9743 {
9744 return UATimeSpent.DEFAULT_DEPLOY;
9745 }
9746
9747
9748
9749
9751 {
9753 SetSynchDirty();
9754 }
9755
9757 {
9759 }
9760
9761
9763 {
9764 return false;
9765 }
9766
9769 {
9770 string att_type = "None";
9771
9772 if (ConfigIsExisting("soundAttType"))
9773 {
9774 att_type = ConfigGetString("soundAttType");
9775 }
9776
9778 }
9779
9781 {
9783 }
9784
9785
9786
9787
9788
9792
9794 {
9797
9799 }
9800
9801
9803 {
9805 return;
9806
9808
9811
9814
9815 SoundParameters params = new SoundParameters();
9819 }
9820
9821
9823 {
9825 return;
9826
9828 SetSynchDirty();
9829
9832 }
9833
9834
9836 {
9838 return;
9839
9841 SetSynchDirty();
9842
9845 }
9846
9848 {
9850 }
9851
9853 {
9855 }
9856
9859 {
9860 if (!
GetGame().IsDedicatedServer())
9861 {
9862 if (ConfigIsExisting("attachSoundSet"))
9863 {
9864 string cfg_path = "";
9865 string soundset = "";
9867
9870 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
9871 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
9872
9873 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
9874 {
9875 for (int i = 0; i < cfg_soundset_array.Count(); i++)
9876 {
9877 if (cfg_slot_array[i] == slot_type)
9878 {
9879 soundset = cfg_soundset_array[i];
9880 break;
9881 }
9882 }
9883 }
9884
9885 if (soundset != "")
9886 {
9887 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
9889 }
9890 }
9891 }
9892 }
9893
9895 {
9896
9897 }
9898
9899 void OnApply(PlayerBase player);
9900
9902 {
9903 return 1.0;
9904 };
9905
9907 {
9909 }
9910
9912 {
9914 }
9915
9917
9919 {
9920 SetDynamicPhysicsLifeTime(0.01);
9922 }
9923
9925 {
9926 array<string> zone_names = new array<string>;
9927 GetDamageZones(zone_names);
9928 for (int i = 0; i < zone_names.Count(); i++)
9929 {
9930 SetHealthMax(zone_names.Get(i),"Health");
9931 }
9932 SetHealthMax("","Health");
9933 }
9934
9937 {
9938 float global_health = GetHealth01("","Health");
9939 array<string> zones = new array<string>;
9940 GetDamageZones(zones);
9941
9942 for (int i = 0; i < zones.Count(); i++)
9943 {
9944 SetHealth01(zones.Get(i),"Health",global_health);
9945 }
9946 }
9947
9950 {
9951 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
9952 }
9953
9955 {
9956 if (!hasRootAsPlayer)
9957 {
9958 if (refParentIB)
9959 {
9960
9961 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
9962 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
9963
9964 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
9965 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
9966
9969 }
9970 else
9971 {
9972
9975 }
9976 }
9977 }
9978
9980 {
9982 {
9983 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
9984 if (GetTemperature() != target || !IsFreezeThawProgressFinished())
9985 {
9986 float heatPermCoef = 1.0;
9988 while (ent)
9989 {
9990 heatPermCoef *= ent.GetHeatPermeabilityCoef();
9991 ent = ent.GetHierarchyParent();
9992 }
9993
9994 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
9995 }
9996 }
9997 }
9998
10000 {
10001
10002 EntityAI parent = GetHierarchyParent();
10003 if (!parent)
10004 {
10005 hasParent = false;
10006 hasRootAsPlayer = false;
10007 }
10008 else
10009 {
10010 hasParent = true;
10011 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
10012 refParentIB =
ItemBase.Cast(parent);
10013 }
10014 }
10015
10016 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
10017 {
10018
10019 }
10020
10022 {
10023
10024 return false;
10025 }
10026
10028 {
10029
10030
10031 return false;
10032 }
10033
10035 {
10036
10037 return false;
10038 }
10039
10042 {
10043 return !GetIsFrozen() &&
IsOpen();
10044 }
10045
10047 {
10048 bool hasParent = false, hasRootAsPlayer = false;
10050
10051 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
10052 bool foodDecay =
g_Game.IsFoodDecayEnabled();
10053
10054 if (wwtu || foodDecay)
10055 {
10059
10060 if (processWetness || processTemperature || processDecay)
10061 {
10063
10064 if (processWetness)
10065 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
10066
10067 if (processTemperature)
10069
10070 if (processDecay)
10071 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
10072 }
10073 }
10074 }
10075
10078 {
10080 }
10081
10083 {
10086
10087 return super.GetTemperatureFreezeThreshold();
10088 }
10089
10091 {
10094
10095 return super.GetTemperatureThawThreshold();
10096 }
10097
10099 {
10102
10103 return super.GetItemOverheatThreshold();
10104 }
10105
10107 {
10109 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
10110
10111 return super.GetTemperatureFreezeTime();
10112 }
10113
10115 {
10117 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
10118
10119 return super.GetTemperatureThawTime();
10120 }
10121
10126
10128 {
10129 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
10130 }
10131
10133 {
10134 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
10135 }
10136
10139 {
10141 }
10142
10144 {
10146 }
10147
10149 {
10151 }
10152
10155 {
10156 return null;
10157 }
10158
10161 {
10162 return false;
10163 }
10164
10166 {
10168 {
10171 if (!trg)
10172 {
10174 explosive = this;
10175 }
10176
10177 explosive.PairRemote(trg);
10179
10180 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
10181 trg.SetPersistentPairID(persistentID);
10182 explosive.SetPersistentPairID(persistentID);
10183
10184 return true;
10185 }
10186 return false;
10187 }
10188
10191 {
10192 float ret = 1.0;
10195 ret *= GetHealth01();
10196
10197 return ret;
10198 }
10199
10200 #ifdef DEVELOPER
10201 override void SetDebugItem()
10202 {
10203 super.SetDebugItem();
10204 _itemBase = this;
10205 }
10206
10208 {
10209 string text = super.GetDebugText();
10210
10212 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
10213
10214 return text;
10215 }
10216 #endif
10217
10219 {
10220 return true;
10221 }
10222
10224
10226
10228 {
10231 }
10232
10233
10241
10257}
10258
10260{
10262 if (entity)
10263 {
10264 bool is_item = entity.IsInherited(
ItemBase);
10265 if (is_item && full_quantity)
10266 {
10269 }
10270 }
10271 else
10272 {
10274 return NULL;
10275 }
10276 return entity;
10277}
10278
10280{
10281 if (item)
10282 {
10283 if (health > 0)
10284 item.SetHealth("", "", health);
10285
10286 if (item.CanHaveTemperature())
10287 {
10289 if (item.CanFreeze())
10290 item.SetFrozen(false);
10291 }
10292
10293 if (item.HasEnergyManager())
10294 {
10295 if (quantity >= 0)
10296 {
10297 item.GetCompEM().SetEnergy0To1(quantity);
10298 }
10299 else
10300 {
10302 }
10303 }
10304 else if (item.IsMagazine())
10305 {
10306 Magazine mag = Magazine.Cast(item);
10307 if (quantity >= 0)
10308 {
10309 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
10310 }
10311 else
10312 {
10314 }
10315
10316 }
10317 else
10318 {
10319 if (quantity >= 0)
10320 {
10321 item.SetQuantityNormalized(quantity, false);
10322 }
10323 else
10324 {
10326 }
10327
10328 }
10329 }
10330}
10331
10332#ifdef DEVELOPER
10334#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
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 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...
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)
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)
bool m_HideSelectionsBySlot
bool IsOverheatingEffectActive()
void SetIsBeingPlaced(bool is_being_placed)
int GetLiquidContainerMask()
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()
override int GetLiquidType()
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)
void Open()
Implementations only.
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 EEOnCECreate()
Called when entity is being created as new by CE/ Debug.
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 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 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
proto native void SetGround(EntityAI e, vector mat[4])
sets current inventory location type to Ground with transformation mat
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 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 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.