5624{
5626 {
5627 return true;
5628 }
5629};
5630
5631
5632
5634{
5638
5640
5643
5644
5645
5646
5647
5656
5662
5667
5672
5693 protected bool m_IsResultOfSplit
5694
5696
5701
5702
5703
5705
5709
5710
5711
5713
5716
5717
5718
5724
5725
5733
5736
5737
5739
5740
5742
5743
5748
5749
5754
5755
5757
5758
5760 {
5765
5766 if (!
GetGame().IsDedicatedServer())
5767 {
5769 {
5771
5773 {
5775 }
5776 }
5777
5780 }
5781
5782 m_OldLocation = null;
5783
5785 {
5787 }
5788
5789 if (ConfigIsExisting("headSelectionsToHide"))
5790 {
5793 }
5794
5796 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
5797 {
5799 }
5800
5802
5803 m_IsResultOfSplit = false;
5804
5806 }
5807
5809 {
5810 super.InitItemVariables();
5811
5817 m_Count = ConfigGetInt(
"count");
5818
5821
5826
5829
5834
5846
5850
5851
5854 if (ConfigIsExisting("canBeSplit"))
5855 {
5858 }
5859
5861 if (ConfigIsExisting("itemBehaviour"))
5863
5864
5867 RegisterNetSyncVariableInt("m_VarLiquidType");
5868 RegisterNetSyncVariableInt("m_Cleanness",0,1);
5869
5870 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
5871 RegisterNetSyncVariableFloat("m_ImpactSpeed");
5872 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
5873
5874 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
5875 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
5876 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
5877 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
5878
5879 RegisterNetSyncVariableBool("m_IsBeingPlaced");
5880 RegisterNetSyncVariableBool("m_IsTakeable");
5881 RegisterNetSyncVariableBool("m_IsHologram");
5882
5885 {
5888 }
5889
5891
5893 if (ConfigIsExisting("temperaturePerQuantityWeight"))
5895
5896 }
5897
5899 {
5901 }
5902
5904 {
5907 {
5912 }
5913 }
5914
5915 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
5916 {
5918 {
5921 }
5922
5924 }
5925
5927 {
5933 }
5934
5936
5938 {
5940
5941 if (!action)
5942 {
5943 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
5944 return;
5945 }
5946
5948 if (!ai)
5949 {
5951 return;
5952 }
5953
5955 if (!action_array)
5956 {
5957 action_array = new array<ActionBase_Basic>;
5959 }
5960 if (LogManager.IsActionLogEnable())
5961 {
5962 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
5963 }
5964
5965 if (action_array.Find(action) != -1)
5966 {
5967 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
5968 }
5969 else
5970 {
5971 action_array.Insert(action);
5972 }
5973 }
5974
5976 {
5978 ActionBase action = player.GetActionManager().GetAction(actionName);
5981
5982 if (action_array)
5983 {
5984 action_array.RemoveItem(action);
5985 }
5986 }
5987
5988
5989
5991 {
5992 ActionOverrideData overrideData = new ActionOverrideData();
5996
5998 if (!actionMap)
5999 {
6002 }
6003
6004 actionMap.Insert(this.
Type(), overrideData);
6005
6006 }
6007
6009
6011
6012
6014 {
6017
6020
6021 string config_to_search = "CfgVehicles";
6022 string muzzle_owner_config;
6023
6025 {
6026 if (IsInherited(Weapon))
6027 config_to_search = "CfgWeapons";
6028
6029 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6030
6031 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
6032
6034
6035 if (config_OnFire_subclass_count > 0)
6036 {
6037 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
6038
6039 for (int i = 0; i < config_OnFire_subclass_count; i++)
6040 {
6041 string particle_class = "";
6043 string config_OnFire_entry = config_OnFire_class + particle_class;
6044 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
6045 WPOF_array.Insert(WPOF);
6046 }
6047
6048
6050 }
6051 }
6052
6054 {
6055 config_to_search = "CfgWeapons";
6056 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6057
6058 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
6059
6061
6062 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
6063 {
6064 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
6065
6066 for (i = 0; i < config_OnBulletCasingEject_count; i++)
6067 {
6068 string particle_class2 = "";
6070 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
6071 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
6072 WPOBE_array.Insert(WPOBE);
6073 }
6074
6075
6077 }
6078 }
6079 }
6080
6081
6083 {
6086
6088 {
6089 string config_to_search = "CfgVehicles";
6090
6091 if (IsInherited(Weapon))
6092 config_to_search = "CfgWeapons";
6093
6094 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6095 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
6096
6097 if (
GetGame().ConfigIsExisting(config_OnOverheating_class))
6098 {
6099
6101
6103 {
6105 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
6107 return;
6108 }
6109
6112
6113
6114
6116 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
6117
6118 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
6119 {
6120 string particle_class = "";
6122 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
6124
6125 if (entry_type == CT_CLASS)
6126 {
6127 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
6128 WPOOH_array.Insert(WPOF);
6129 }
6130 }
6131
6132
6134 }
6135 }
6136 }
6137
6139 {
6141 }
6142
6144 {
6146 {
6148
6151
6154
6155 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6156 }
6157 }
6158
6160 {
6162 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6163
6165 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6166
6168 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6169
6171 {
6173 }
6174 }
6175
6177 {
6179 }
6180
6182 {
6185 else
6187
6189 {
6192 }
6193 else
6194 {
6197
6200 }
6201
6203 }
6204
6206 {
6208 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6209 }
6210
6212 {
6214 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6216 }
6217
6219 {
6221 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6222 }
6223
6225 {
6228
6229 OverheatingParticle OP = new OverheatingParticle();
6234
6236 }
6237
6239 {
6242
6243 return -1;
6244 }
6245
6247 {
6249 {
6252
6253 for (int i = count; i > 0; --i)
6254 {
6255 int id = i - 1;
6258
6261
6262 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
6263 {
6264 if (p)
6265 {
6268 }
6269 }
6270 }
6271 }
6272 }
6273
6275 {
6277 {
6279 {
6280 int id = i - 1;
6282
6283 if (OP)
6284 {
6286
6287 if (p)
6288 {
6290 }
6291
6292 delete OP;
6293 }
6294 }
6295
6298 }
6299 }
6300
6303 {
6304 return 0.0;
6305 }
6306
6307
6309 {
6310 return 250;
6311 }
6312
6314 {
6315 return 0;
6316 }
6317
6320 {
6322 return true;
6323
6324 return false;
6325 }
6326
6329 {
6332
6334 {
6336 }
6337 else
6338 {
6339
6341 }
6342
6344 }
6345
6352 {
6353 return -1;
6354 }
6355
6356
6357
6358
6360 {
6362 {
6364 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6365
6366 if (r_index >= 0)
6367 {
6368 InventoryLocation r_il = new InventoryLocation;
6369 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6370
6371 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6374 {
6375 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6376 }
6378 {
6379 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6380 }
6381
6382 }
6383
6384 player.GetHumanInventory().ClearUserReservedLocation(this);
6385 }
6386
6389 }
6390
6391
6392
6393
6395 {
6396 return ItemBase.m_DebugActionsMask;
6397 }
6398
6400 {
6401 return ItemBase.m_DebugActionsMask & mask;
6402 }
6403
6405 {
6406 ItemBase.m_DebugActionsMask = mask;
6407 }
6408
6410 {
6411 ItemBase.m_DebugActionsMask |= mask;
6412 }
6413
6415 {
6416 ItemBase.m_DebugActionsMask &= ~mask;
6417 }
6418
6420 {
6422 {
6424 }
6425 else
6426 {
6428 }
6429 }
6430
6431
6433 {
6434 if (GetEconomyProfile())
6435 {
6436 float q_max = GetEconomyProfile().GetQuantityMax();
6437 if (q_max > 0)
6438 {
6439 float q_min = GetEconomyProfile().GetQuantityMin();
6440 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
6441
6443 {
6444 ComponentEnergyManager comp = GetCompEM();
6446 {
6448 }
6449 }
6451 {
6453
6454 }
6455
6456 }
6457 }
6458 }
6459
6462 {
6463 EntityAI parent = GetHierarchyParent();
6464
6465 if (parent)
6466 {
6467 InventoryLocation inventory_location_to_lock = new InventoryLocation;
6468 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
6469 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
6470 }
6471 }
6472
6475 {
6476 EntityAI parent = GetHierarchyParent();
6477
6478 if (parent)
6479 {
6480 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
6481 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
6482 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
6483 }
6484 }
6485
6487 {
6488
6489
6490
6491
6493
6495 {
6496 if (ScriptInputUserData.CanStoreInputUserData())
6497 {
6498 ScriptInputUserData ctx = new ScriptInputUserData;
6504 ctx.
Write(use_stack_max);
6507
6509 {
6510 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
6511 }
6512 }
6513 }
6514 else if (!
GetGame().IsMultiplayer())
6515 {
6517 }
6518 }
6519
6521 {
6523 }
6524
6526 {
6528 }
6529
6531 {
6533 }
6534
6536 {
6537
6538 return false;
6539 }
6540
6542 {
6543 return false;
6544 }
6545
6549 {
6550 return false;
6551 }
6552
6554 {
6555 return "";
6556 }
6557
6559
6561 {
6562 return false;
6563 }
6564
6566 {
6567 return true;
6568 }
6569
6570
6571
6573 {
6574 return true;
6575 }
6576
6578 {
6579 return true;
6580 }
6581
6583 {
6584 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6586 }
6587
6589 {
6591 }
6592
6594 {
6596 if (!is_being_placed)
6598 SetSynchDirty();
6599 }
6600
6601
6603
6605 {
6607 }
6608
6610 {
6612 }
6613
6615 {
6616 return 1;
6617 }
6618
6620 {
6621 return false;
6622 }
6623
6625 {
6627 SetSynchDirty();
6628 }
6629
6630
6631
6632
6633
6634
6635
6636
6637
6638
6639
6640
6641
6642
6643
6644
6645
6646
6647
6648
6649
6650
6651
6652
6653
6654
6655
6656
6657
6658
6659
6660
6661
6662
6663
6665 {
6666 super.OnMovedInsideCargo(container);
6667
6668 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6669 }
6670
6671 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
6672 {
6673 super.EEItemLocationChanged(oldLoc,newLoc);
6674
6675 PlayerBase new_player = null;
6676 PlayerBase old_player = null;
6677
6678 if (newLoc.GetParent())
6679 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
6680
6681 if (oldLoc.GetParent())
6682 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
6683
6685 {
6686 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
6687
6688 if (r_index >= 0)
6689 {
6690 InventoryLocation r_il = new InventoryLocation;
6691 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6692
6693 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6696 {
6697 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6698 }
6700 {
6701 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6702 }
6703
6704 }
6705 }
6706
6708 {
6709 if (new_player)
6710 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
6711
6712 if (new_player == old_player)
6713 {
6714
6715 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
6716 {
6718 {
6719 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
6720 {
6721 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6722 }
6723 }
6724 else
6725 {
6726 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6727 }
6728 }
6729
6730 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
6731 {
6732 int type = oldLoc.GetType();
6734 {
6735 oldLoc.GetParent().GetOnSetLock().Invoke(this);
6736 }
6738 {
6739 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
6740 }
6741 }
6742 if (!m_OldLocation)
6743 {
6744 m_OldLocation = new InventoryLocation;
6745 }
6746 m_OldLocation.Copy(oldLoc);
6747 }
6748 else
6749 {
6750 if (m_OldLocation)
6751 {
6752 m_OldLocation.Reset();
6753 }
6754 }
6755
6757 }
6758 else
6759 {
6760 if (new_player)
6761 {
6762 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
6763 if (res_index >= 0)
6764 {
6765 InventoryLocation il = new InventoryLocation;
6766 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
6768 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
6771 {
6772 il.
GetParent().GetOnReleaseLock().Invoke(it);
6773 }
6775 {
6777 }
6778
6779 }
6780 }
6782 {
6783
6785 }
6786
6787 if (m_OldLocation)
6788 {
6789 m_OldLocation.Reset();
6790 }
6791 }
6792 }
6793
6794 override void EOnContact(IEntity other, Contact extra)
6795 {
6797 {
6798 int liquidType = -1;
6800 if (impactSpeed > 0.0)
6801 {
6803 #ifndef SERVER
6805 #else
6807 SetSynchDirty();
6808 #endif
6810 }
6811 }
6812
6813 #ifdef SERVER
6814 if (GetCompEM() && GetCompEM().IsPlugged())
6815 {
6816 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
6817 GetCompEM().UnplugThis();
6818 }
6819 #endif
6820 }
6821
6823
6825 {
6827 }
6828
6830 {
6831
6832 }
6833
6835 {
6836 super.OnItemLocationChanged(old_owner, new_owner);
6837
6838 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
6839 PlayerBase playerNew = PlayerBase.Cast(new_owner);
6840
6841 if (!relatedPlayer && playerNew)
6842 relatedPlayer = playerNew;
6843
6844 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
6845 {
6847 if (actionMgr)
6848 {
6849 ActionBase currentAction = actionMgr.GetRunningAction();
6850 if (currentAction)
6852 }
6853 }
6854
6855 Man ownerPlayerOld = null;
6856 Man ownerPlayerNew = null;
6857
6858 if (old_owner)
6859 {
6860 if (old_owner.
IsMan())
6861 {
6862 ownerPlayerOld = Man.Cast(old_owner);
6863 }
6864 else
6865 {
6866 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
6867 }
6868 }
6869 else
6870 {
6872 {
6874
6875 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
6876 {
6877 GetCompEM().UnplugThis();
6878 }
6879 }
6880 }
6881
6882 if (new_owner)
6883 {
6884 if (new_owner.
IsMan())
6885 {
6886 ownerPlayerNew = Man.Cast(new_owner);
6887 }
6888 else
6889 {
6890 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
6891 }
6892 }
6893
6894 if (ownerPlayerOld != ownerPlayerNew)
6895 {
6896 if (ownerPlayerOld)
6897 {
6898 array<EntityAI> subItemsExit = new array<EntityAI>;
6900 for (int i = 0; i < subItemsExit.Count(); i++)
6901 {
6904 }
6905 }
6906
6907 if (ownerPlayerNew)
6908 {
6909 array<EntityAI> subItemsEnter = new array<EntityAI>;
6911 for (int j = 0; j < subItemsEnter.Count(); j++)
6912 {
6915 }
6916 }
6917 }
6918 else if (ownerPlayerNew != null)
6919 {
6920 PlayerBase nplayer;
6921 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
6922 {
6923 array<EntityAI> subItemsUpdate = new array<EntityAI>;
6925 for (int k = 0; k < subItemsUpdate.Count(); k++)
6926 {
6928 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
6929 }
6930 }
6931 }
6932
6933 if (old_owner)
6934 old_owner.OnChildItemRemoved(this);
6935 if (new_owner)
6936 new_owner.OnChildItemReceived(this);
6937 }
6938
6939
6941 {
6942 super.EEDelete(parent);
6943 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
6944 if (player)
6945 {
6947
6948 if (player.IsAlive())
6949 {
6950 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6951 if (r_index >= 0)
6952 {
6953 InventoryLocation r_il = new InventoryLocation;
6954 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6955
6956 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6959 {
6960 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6961 }
6963 {
6964 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6965 }
6966
6967 }
6968
6969 player.RemoveQuickBarEntityShortcut(this);
6970 }
6971 }
6972 }
6973
6975 {
6976 super.EEKilled(killer);
6977
6980 {
6981 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
6982 {
6983 if (IsMagazine())
6984 {
6985 if (Magazine.Cast(this).GetAmmoCount() > 0)
6986 {
6988 }
6989 }
6990 else
6991 {
6993 }
6994 }
6995 }
6996 }
6997
6999 {
7000 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7001
7002 super.OnWasAttached(parent, slot_id);
7003
7006
7008 }
7009
7011 {
7012 super.OnWasDetached(parent, slot_id);
7013
7016 }
7017
7019 {
7020 int idx;
7023
7024 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7025 if (inventory_slots.Count() < 1)
7026 {
7027 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
7028 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
7029 }
7030 else
7031 {
7032 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
7033 }
7034
7035 idx = inventory_slots.Find(slot);
7036 if (idx < 0)
7037 return "";
7038
7039 return attach_types.Get(idx);
7040 }
7041
7043 {
7044 int idx = -1;
7045 string slot;
7046
7049
7050 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7051 if (inventory_slots.Count() < 1)
7052 {
7053 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
7054 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7055 }
7056 else
7057 {
7058 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
7059 if (detach_types.Count() < 1)
7060 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7061 }
7062
7063 for (int i = 0; i < inventory_slots.Count(); i++)
7064 {
7065 slot = inventory_slots.Get(i);
7066 }
7067
7068 if (slot != "")
7069 {
7070 if (detach_types.Count() == 1)
7071 idx = 0;
7072 else
7073 idx = inventory_slots.Find(slot);
7074 }
7075 if (idx < 0)
7076 return "";
7077
7078 return detach_types.Get(idx);
7079 }
7080
7082 {
7083
7085
7086
7087 float min_time = 1;
7088 float max_time = 3;
7089 float delay = Math.RandomFloat(min_time, max_time);
7090
7091 explode_timer.Run(delay, this, "DoAmmoExplosion");
7092 }
7093
7095 {
7096 Magazine magazine = Magazine.Cast(this);
7097 int pop_sounds_count = 6;
7098 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
7099
7100
7101 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
7102 string sound_name = pop_sounds[ sound_idx ];
7104
7105
7106 magazine.ServerAddAmmoCount(-1);
7107
7108
7109 float min_temp_to_explode = 100;
7110
7111 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
7112 {
7114 }
7115 }
7116
7117
7118 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
7119 {
7120 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
7121
7122 const int CHANCE_DAMAGE_CARGO = 4;
7123 const int CHANCE_DAMAGE_ATTACHMENT = 1;
7124 const int CHANCE_DAMAGE_NOTHING = 2;
7125
7127 {
7128 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
7129 int chances;
7130 int rnd;
7131
7132 if (GetInventory().GetCargo())
7133 {
7134 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7135 rnd = Math.RandomInt(0,chances);
7136
7137 if (rnd < CHANCE_DAMAGE_CARGO)
7138 {
7140 }
7141 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
7142 {
7144 }
7145 }
7146 else
7147 {
7148 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7149 rnd = Math.RandomInt(0,chances);
7150
7151 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
7152 {
7154 }
7155 }
7156 }
7157 }
7158
7160 {
7161 if (GetInventory().GetCargo())
7162 {
7163 int item_count = GetInventory().GetCargo().GetItemCount();
7164 if (item_count > 0)
7165 {
7166 int random_pick = Math.RandomInt(0, item_count);
7168 if (!item.IsExplosive())
7169 {
7170 item.AddHealth("","",damage);
7171 return true;
7172 }
7173 }
7174 }
7175 return false;
7176 }
7177
7179 {
7180 int attachment_count = GetInventory().AttachmentCount();
7181 if (attachment_count > 0)
7182 {
7183 int random_pick = Math.RandomInt(0, attachment_count);
7184 ItemBase attachment =
ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
7185 if (!attachment.IsExplosive())
7186 {
7187 attachment.AddHealth("","",damage);
7188 return true;
7189 }
7190 }
7191 return false;
7192 }
7193
7195 {
7197 }
7198
7200 {
7202 return GetInventory().CanRemoveEntity();
7203
7204 return false;
7205 }
7206
7208 {
7209
7211 return false;
7212
7213
7215 return false;
7216
7217
7218
7220 if (delta == 0)
7221 return false;
7222
7223
7224 return true;
7225 }
7226
7228 {
7230 {
7231 if (ScriptInputUserData.CanStoreInputUserData())
7232 {
7233 ScriptInputUserData ctx = new ScriptInputUserData;
7238 ctx.
Write(destination_entity);
7242 }
7243 }
7244 else if (!
GetGame().IsMultiplayer())
7245 {
7247 }
7248 }
7249
7251 {
7252 float split_quantity_new;
7256 InventoryLocation loc = new InventoryLocation;
7257
7258 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7259 {
7261 split_quantity_new = stack_max;
7262 else
7264
7266 {
7267 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7268 if (new_item)
7269 {
7270 new_item.SetResultOfSplit(true);
7271 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7273 new_item.
SetQuantity(split_quantity_new,
false,
true);
7274 }
7275 }
7276 }
7277 else if (destination_entity && slot_id == -1)
7278 {
7279 if (quantity > stack_max)
7280 split_quantity_new = stack_max;
7281 else
7282 split_quantity_new = quantity;
7283
7285 {
7287 {
7290 }
7291
7292 if (new_item)
7293 {
7294 new_item.SetResultOfSplit(true);
7295 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7297 new_item.
SetQuantity(split_quantity_new,
false,
true);
7298 }
7299 }
7300 }
7301 else
7302 {
7303 if (stack_max != 0)
7304 {
7306 {
7308 }
7309
7310 if (split_quantity_new == 0)
7311 {
7312 if (!
GetGame().IsMultiplayer())
7313 player.PhysicalPredictiveDropItem(this);
7314 else
7315 player.ServerDropEntity(this);
7316 return;
7317 }
7318
7320 {
7322
7323 if (new_item)
7324 {
7325 new_item.SetResultOfSplit(true);
7326 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7329 new_item.PlaceOnSurface();
7330 }
7331 }
7332 }
7333 }
7334 }
7335
7337 {
7338 float split_quantity_new;
7342 InventoryLocation loc = new InventoryLocation;
7343
7344 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7345 {
7347 split_quantity_new = stack_max;
7348 else
7350
7352 {
7353 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7354 if (new_item)
7355 {
7356 new_item.SetResultOfSplit(true);
7357 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7359 new_item.
SetQuantity(split_quantity_new,
false,
true);
7360 }
7361 }
7362 }
7363 else if (destination_entity && slot_id == -1)
7364 {
7365 if (quantity > stack_max)
7366 split_quantity_new = stack_max;
7367 else
7368 split_quantity_new = quantity;
7369
7371 {
7373 {
7376 }
7377
7378 if (new_item)
7379 {
7380 new_item.SetResultOfSplit(true);
7381 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7383 new_item.
SetQuantity(split_quantity_new,
false,
true);
7384 }
7385 }
7386 }
7387 else
7388 {
7389 if (stack_max != 0)
7390 {
7392 {
7394 }
7395
7397 {
7399
7400 if (new_item)
7401 {
7402 new_item.SetResultOfSplit(true);
7403 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7406 new_item.PlaceOnSurface();
7407 }
7408 }
7409 }
7410 }
7411 }
7412
7414 {
7416 {
7417 if (ScriptInputUserData.CanStoreInputUserData())
7418 {
7419 ScriptInputUserData ctx = new ScriptInputUserData;
7424 dst.WriteToContext(ctx);
7426 }
7427 }
7428 else if (!
GetGame().IsMultiplayer())
7429 {
7431 }
7432 }
7433
7435 {
7437 {
7438 if (ScriptInputUserData.CanStoreInputUserData())
7439 {
7440 ScriptInputUserData ctx = new ScriptInputUserData;
7445 ctx.
Write(destination_entity);
7451 }
7452 }
7453 else if (!
GetGame().IsMultiplayer())
7454 {
7456 }
7457 }
7458
7460 {
7462 }
7463
7465 {
7467 float split_quantity_new;
7469 if (dst.IsValid())
7470 {
7471 int slot_id = dst.GetSlot();
7473
7474 if (quantity > stack_max)
7475 split_quantity_new = stack_max;
7476 else
7477 split_quantity_new = quantity;
7478
7480 {
7482
7483 if (new_item)
7484 {
7485 new_item.SetResultOfSplit(true);
7486 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7488 new_item.
SetQuantity(split_quantity_new,
false,
true);
7489 }
7490
7491 return new_item;
7492 }
7493 }
7494
7495 return null;
7496 }
7497
7499 {
7501 float split_quantity_new;
7503 if (destination_entity)
7504 {
7506 if (quantity > stackable)
7507 split_quantity_new = stackable;
7508 else
7509 split_quantity_new = quantity;
7510
7512 {
7513 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
7514 if (new_item)
7515 {
7516 new_item.SetResultOfSplit(true);
7517 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7519 new_item.
SetQuantity(split_quantity_new,
false,
true);
7520 }
7521 }
7522 }
7523 }
7524
7526 {
7528 {
7529 if (ScriptInputUserData.CanStoreInputUserData())
7530 {
7531 ScriptInputUserData ctx = new ScriptInputUserData;
7536 ItemBase destination_entity =
this;
7537 ctx.
Write(destination_entity);
7541 }
7542 }
7543 else if (!
GetGame().IsMultiplayer())
7544 {
7546 }
7547 }
7548
7550 {
7552 float split_quantity_new;
7554 if (player)
7555 {
7557 if (quantity > stackable)
7558 split_quantity_new = stackable;
7559 else
7560 split_quantity_new = quantity;
7561
7563 {
7564 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
7565 new_item =
ItemBase.Cast(in_hands);
7566 if (new_item)
7567 {
7568 new_item.SetResultOfSplit(true);
7569 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7571 new_item.SetQuantity(split_quantity_new, false, true);
7572 }
7573 }
7574 }
7575 }
7576
7578 {
7580 float split_quantity_new = Math.Floor(quantity * 0.5);
7581
7583 return;
7584
7586
7587 if (new_item)
7588 {
7589 if (new_item.GetQuantityMax() < split_quantity_new)
7590 {
7591 split_quantity_new = new_item.GetQuantityMax();
7592 }
7593
7594 new_item.SetResultOfSplit(true);
7595 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7596
7598 {
7601 }
7602 else
7603 {
7605 new_item.
SetQuantity(split_quantity_new,
false,
true);
7606 }
7607 }
7608 }
7609
7611 {
7613 float split_quantity_new = Math.Floor(quantity / 2);
7614
7616 return;
7617
7618 InventoryLocation invloc = new InventoryLocation;
7620
7622 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
7623
7624 if (new_item)
7625 {
7626 if (new_item.GetQuantityMax() < split_quantity_new)
7627 {
7628 split_quantity_new = new_item.GetQuantityMax();
7629 }
7631 {
7634 }
7635 else if (split_quantity_new > 1)
7636 {
7638 new_item.
SetQuantity(split_quantity_new,
false,
true);
7639 }
7640 }
7641 }
7642
7645 {
7646 SetWeightDirty();
7648
7649 if (parent)
7650 parent.OnAttachmentQuantityChangedEx(this, delta);
7651
7653 {
7655 {
7657 }
7659 {
7660 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
7662 }
7663 }
7664
7665 }
7666
7669 {
7670
7671 }
7672
7675 {
7677 }
7678
7680 {
7681 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
7682
7684 {
7685 if (newLevel == GameConstants.STATE_RUINED)
7686 {
7688 EntityAI parent = GetHierarchyParent();
7689 if (parent && parent.IsFireplace())
7690 {
7691 CargoBase cargo = GetInventory().GetCargo();
7692 if (cargo)
7693 {
7695 {
7697 }
7698 }
7699 }
7700 }
7701
7703 {
7704
7706 return;
7707 }
7708
7709 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
7710 {
7712 }
7713 }
7714 }
7715
7716
7718 {
7719 super.OnRightClick();
7720
7722 {
7724 {
7725 if (ScriptInputUserData.CanStoreInputUserData())
7726 {
7727 EntityAI root = GetHierarchyRoot();
7728 Man playerOwner = GetHierarchyRootPlayer();
7729 InventoryLocation dst = new InventoryLocation;
7730
7731
7732 if (!playerOwner && root && root == this)
7733 {
7735 }
7736 else
7737 {
7738
7739 GetInventory().GetCurrentInventoryLocation(dst);
7741 {
7744 {
7746 }
7747 else
7748 {
7750
7751
7752 if (
GetGame().
GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
7753 {
7755 }
7756 else
7757 {
7758 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
7759 }
7760 }
7761 }
7762 }
7763
7764 ScriptInputUserData ctx = new ScriptInputUserData;
7772 }
7773 }
7774 else if (!
GetGame().IsMultiplayer())
7775 {
7777 }
7778 }
7779 }
7780
7782 {
7783 if (root)
7784 {
7785 vector m4[4];
7786 root.GetTransform(m4);
7787 dst.SetGround(this, m4);
7788 }
7789 else
7790 {
7791 GetInventory().GetCurrentInventoryLocation(dst);
7792 }
7793 }
7794
7795 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
7796 {
7797
7798 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
7799 return false;
7800
7801 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
7802 return false;
7803
7804
7806 return false;
7807
7808
7809 Magazine mag = Magazine.Cast(this);
7810 if (mag)
7811 {
7812 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
7813 return false;
7814
7815 if (stack_max_limit)
7816 {
7817 Magazine other_mag = Magazine.Cast(other_item);
7818 if (other_item)
7819 {
7820 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
7821 return false;
7822 }
7823
7824 }
7825 }
7826 else
7827 {
7828
7830 return false;
7831
7833 return false;
7834 }
7835
7836 PlayerBase player = null;
7837 if (CastTo(player, GetHierarchyRootPlayer()))
7838 {
7839 if (player.GetInventory().HasAttachment(this))
7840 return false;
7841
7842 if (player.IsItemsToDelete())
7843 return false;
7844 }
7845
7846 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
7847 return false;
7848
7849 int slotID;
7851 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
7852 return false;
7853
7854 return true;
7855 }
7856
7858 {
7860 }
7861
7863 {
7864 return m_IsResultOfSplit;
7865 }
7866
7868 {
7869 m_IsResultOfSplit = value;
7870 }
7871
7873 {
7875 }
7876
7878 {
7879 float other_item_quantity = other_item.GetQuantity();
7880 float this_free_space;
7881
7883
7885
7886 if (other_item_quantity > this_free_space)
7887 {
7888 return this_free_space;
7889 }
7890 else
7891 {
7892 return other_item_quantity;
7893 }
7894 }
7895
7897 {
7899 }
7900
7902 {
7904 return;
7905
7906 if (!IsMagazine() && other_item)
7907 {
7909 if (quantity_used != 0)
7910 {
7911 float hp1 = GetHealth01("","");
7912 float hp2 = other_item.GetHealth01("","");
7913 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
7914 hpResult = hpResult / (
GetQuantity() + quantity_used);
7915
7916 hpResult *= GetMaxHealth();
7917 Math.Round(hpResult);
7918 SetHealth("", "Health", hpResult);
7919
7921 other_item.AddQuantity(-quantity_used);
7922 }
7923 }
7925 }
7926
7928 {
7929 #ifdef SERVER
7930 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
7931 GetHierarchyParent().IncreaseLifetimeUp();
7932 #endif
7933 };
7934
7936 {
7937 PlayerBase p = PlayerBase.Cast(player);
7938
7939 array<int> recipesIds = p.m_Recipes;
7940 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
7941 if (moduleRecipesManager)
7942 {
7943 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
7944 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
7945 }
7946
7947 for (int i = 0;i < recipesIds.Count(); i++)
7948 {
7949 int key = recipesIds.Get(i);
7950 string recipeName = moduleRecipesManager.GetRecipeName(key);
7952 }
7953 }
7954
7955
7956 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
7957 {
7958 super.GetDebugActions(outputList);
7959
7960
7966
7967
7972
7977
7978
7982
7983
7985 {
7989 }
7990
7993
7994
7998
8000
8001 InventoryLocation loc = new InventoryLocation();
8002 GetInventory().GetCurrentInventoryLocation(loc);
8004 {
8005 if (Gizmo_IsSupported())
8008 }
8009
8011 }
8012
8013
8014
8015
8017 {
8018 super.OnAction(action_id, player, ctx);
8019
8021 {
8022 switch (action_id)
8023 {
8026 return true;
8029 return true;
8030 }
8031 }
8032
8034 {
8035 switch (action_id)
8036 {
8038 Delete();
8039 return true;
8040 }
8041 }
8042
8043 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
8044 {
8045 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8046 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
8047 PlayerBase p = PlayerBase.Cast(player);
8048 if (
EActions.RECIPES_RANGE_START < 1000)
8049 {
8050 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
8051 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
8052 }
8053 }
8054 #ifndef SERVER
8055 else if (action_id ==
EActions.WATCH_PLAYER)
8056 {
8057 PluginDeveloper.SetDeveloperItemClientEx(player);
8058 }
8059 #endif
8061 {
8062 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
8063 {
8064 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
8065 OnDebugButtonPressServer(id + 1);
8066 }
8067
8068 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
8069 {
8070 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
8072 }
8073
8074 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
8075 {
8076 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
8078 }
8079
8080 else if (action_id ==
EActions.ADD_QUANTITY)
8081 {
8082 if (IsMagazine())
8083 {
8084 Magazine mag = Magazine.Cast(this);
8085 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
8086 }
8087 else
8088 {
8090 }
8091
8092 if (m_EM)
8093 {
8094 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
8095 }
8096
8097 }
8098
8099 else if (action_id ==
EActions.REMOVE_QUANTITY)
8100 {
8101 if (IsMagazine())
8102 {
8103 Magazine mag2 = Magazine.Cast(this);
8104 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
8105 }
8106 else
8107 {
8109 }
8110 if (m_EM)
8111 {
8112 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
8113 }
8114
8115 }
8116
8117 else if (action_id ==
EActions.SET_QUANTITY_0)
8118 {
8120
8121 if (m_EM)
8122 {
8123 m_EM.SetEnergy(0);
8124 }
8125 }
8126
8127 else if (action_id ==
EActions.SET_MAX_QUANTITY)
8128 {
8130
8131 if (m_EM)
8132 {
8133 m_EM.SetEnergy(m_EM.GetEnergyMax());
8134 }
8135 }
8136
8137 else if (action_id ==
EActions.ADD_HEALTH)
8138 {
8139 AddHealth("","",GetMaxHealth("","Health")/5);
8140 }
8141 else if (action_id ==
EActions.REMOVE_HEALTH)
8142 {
8143 AddHealth("","",-GetMaxHealth("","Health")/5);
8144 }
8145 else if (action_id ==
EActions.DESTROY_HEALTH)
8146 {
8147 SetHealth01("","",0);
8148 }
8149 else if (action_id ==
EActions.WATCH_ITEM)
8150 {
8152 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
8153 #ifdef DEVELOPER
8154 SetDebugDeveloper_item(this);
8155 #endif
8156 }
8157
8158 else if (action_id ==
EActions.ADD_TEMPERATURE)
8159 {
8160 AddTemperature(20);
8161
8162 }
8163
8164 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
8165 {
8166 AddTemperature(-20);
8167
8168 }
8169
8170 else if (action_id ==
EActions.FLIP_FROZEN)
8171 {
8172 SetFrozen(!GetIsFrozen());
8173
8174 }
8175
8176 else if (action_id ==
EActions.ADD_WETNESS)
8177 {
8179
8180 }
8181
8182 else if (action_id ==
EActions.REMOVE_WETNESS)
8183 {
8185
8186 }
8187
8188 else if (action_id ==
EActions.LIQUIDTYPE_UP)
8189 {
8192
8193
8194 }
8195
8196 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
8197 {
8200 }
8201
8202 else if (action_id ==
EActions.MAKE_SPECIAL)
8203 {
8204 auto debugParams = DebugSpawnParams.WithPlayer(player);
8205 OnDebugSpawnEx(debugParams);
8206 }
8207
8208 }
8209
8210
8211 return false;
8212 }
8213
8214
8215
8216
8220
8223
8224
8225
8227 {
8228 return false;
8229 }
8230
8231
8233 {
8234 return true;
8235 }
8236
8237
8239 {
8240 return true;
8241 }
8242
8243
8244
8246 {
8247 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
8249 }
8250
8253 {
8254 return null;
8255 }
8256
8258 {
8259 return false;
8260 }
8261
8263 {
8264 return false;
8265 }
8266
8270
8271
8273 {
8274 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8275 return module_repairing.CanRepair(this, item_repair_kit);
8276 }
8277
8278
8279 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
8280 {
8281 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8282 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
8283 }
8284
8285
8287 {
8288
8289
8290
8291
8292
8293
8294
8295
8296 return 1;
8297 }
8298
8299
8300
8302 {
8304 }
8305
8306
8307
8309 {
8311 }
8312
8313
8322 {
8323 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8324
8325 if (player)
8326 {
8327 player.MessageStatus(text);
8328 }
8329 }
8330
8331
8340 {
8341 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8342
8343 if (player)
8344 {
8345 player.MessageAction(text);
8346 }
8347 }
8348
8349
8358 {
8359 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8360
8361 if (player)
8362 {
8363 player.MessageFriendly(text);
8364 }
8365 }
8366
8367
8376 {
8377 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8378
8379 if (player)
8380 {
8381 player.MessageImportant(text);
8382 }
8383 }
8384
8386 {
8387 return true;
8388 }
8389
8390
8391 override bool KindOf(
string tag)
8392 {
8393 bool found = false;
8394 string item_name = this.
GetType();
8397
8398 int array_size = item_tag_array.Count();
8399 for (int i = 0; i < array_size; i++)
8400 {
8401 if (item_tag_array.Get(i) == tag)
8402 {
8403 found = true;
8404 break;
8405 }
8406 }
8407 return found;
8408 }
8409
8410
8412 {
8413
8414 super.OnRPC(sender, rpc_type,ctx);
8415
8416
8417 switch (rpc_type)
8418 {
8419 #ifndef SERVER
8420 case ERPCs.RPC_SOUND_LOCK_ATTACH:
8421 Param2<bool, string> p = new Param2<bool, string>(false, "");
8422
8424 return;
8425
8426 bool play = p.param1;
8427 string soundSet = p.param2;
8428
8429 if (play)
8430 {
8432 {
8434 {
8436 }
8437 }
8438 else
8439 {
8441 }
8442 }
8443 else
8444 {
8446 }
8447
8448 break;
8449 #endif
8450
8451 }
8452
8454 {
8456 }
8457 }
8458
8459
8460
8461
8463 {
8464 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8465 return plugin.GetID(
name);
8466 }
8467
8469 {
8470 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8471 return plugin.GetName(id);
8472 }
8473
8476 {
8477
8478
8479 int varFlags;
8480 if (!ctx.
Read(varFlags))
8481 return;
8482
8483 if (varFlags & ItemVariableFlags.FLOAT)
8484 {
8486 }
8487 }
8488
8490 {
8491
8492 super.SerializeNumericalVars(floats_out);
8493
8494
8495
8497 {
8499 }
8500
8502 {
8504 }
8505
8507 {
8509 }
8510
8512 {
8517 }
8518
8520 {
8522 }
8523 }
8524
8526 {
8527
8528 super.DeSerializeNumericalVars(floats);
8529
8530
8531 int index = 0;
8532 int mask = Math.Round(floats.Get(index));
8533
8534 index++;
8535
8537 {
8539 {
8541 }
8542 else
8543 {
8544 float quantity = floats.Get(index);
8546 }
8547 index++;
8548 }
8549
8551 {
8552 float wet = floats.Get(index);
8554 index++;
8555 }
8556
8558 {
8559 int liquidtype = Math.Round(floats.Get(index));
8561 index++;
8562 }
8563
8565 {
8567 index++;
8569 index++;
8571 index++;
8573 index++;
8574 }
8575
8577 {
8578 int cleanness = Math.Round(floats.Get(index));
8580 index++;
8581 }
8582 }
8583
8585 {
8586 super.WriteVarsToCTX(ctx);
8587
8588
8590 {
8592 }
8593
8595 {
8597 }
8598
8600 {
8602 }
8603
8605 {
8606 int r,g,b,a;
8612 }
8613
8615 {
8617 }
8618 }
8619
8621 {
8622 if (!super.ReadVarsFromCTX(ctx,version))
8623 return false;
8624
8625 int intValue;
8626 float value;
8627
8628 if (version < 140)
8629 {
8630 if (!ctx.
Read(intValue))
8631 return false;
8632
8633 m_VariablesMask = intValue;
8634 }
8635
8637 {
8638 if (!ctx.
Read(value))
8639 return false;
8640
8642 {
8644 }
8645 else
8646 {
8648 }
8649 }
8650
8651 if (version < 140)
8652 {
8654 {
8655 if (!ctx.
Read(value))
8656 return false;
8657 SetTemperatureDirect(value);
8658 }
8659 }
8660
8662 {
8663 if (!ctx.
Read(value))
8664 return false;
8666 }
8667
8669 {
8670 if (!ctx.
Read(intValue))
8671 return false;
8673 }
8674
8676 {
8677 int r,g,b,a;
8679 return false;
8681 return false;
8683 return false;
8685 return false;
8686
8688 }
8689
8691 {
8692 if (!ctx.
Read(intValue))
8693 return false;
8695 }
8696
8697 if (version >= 138 && version < 140)
8698 {
8700 {
8701 if (!ctx.
Read(intValue))
8702 return false;
8703 SetFrozen(intValue);
8704 }
8705 }
8706
8707 return true;
8708 }
8709
8710
8712 {
8715 {
8717 }
8718
8719 if (!super.OnStoreLoad(ctx, version))
8720 {
8722 return false;
8723 }
8724
8725 if (version >= 114)
8726 {
8727 bool hasQuickBarIndexSaved;
8728
8729 if (!ctx.
Read(hasQuickBarIndexSaved))
8730 {
8732 return false;
8733 }
8734
8735 if (hasQuickBarIndexSaved)
8736 {
8737 int itmQBIndex;
8738
8739
8740 if (!ctx.
Read(itmQBIndex))
8741 {
8743 return false;
8744 }
8745
8746 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
8747 if (itmQBIndex != -1 && parentPlayer)
8748 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
8749 }
8750 }
8751 else
8752 {
8753
8754 PlayerBase player;
8755 int itemQBIndex;
8756 if (version ==
int.
MAX)
8757 {
8758 if (!ctx.
Read(itemQBIndex))
8759 {
8761 return false;
8762 }
8763 }
8764 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
8765 {
8766
8767 if (!ctx.
Read(itemQBIndex))
8768 {
8770 return false;
8771 }
8772 if (itemQBIndex != -1 && player)
8773 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
8774 }
8775 }
8776
8777 if (version < 140)
8778 {
8779
8780 if (!LoadVariables(ctx, version))
8781 {
8783 return false;
8784 }
8785 }
8786
8787
8789 {
8791 return false;
8792 }
8793 if (version >= 132)
8794 {
8796 if (raib)
8797 {
8799 {
8801 return false;
8802 }
8803 }
8804 }
8805
8807 return true;
8808 }
8809
8810
8811
8813 {
8814 super.OnStoreSave(ctx);
8815
8816 PlayerBase player;
8817 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
8818 {
8820
8821 int itemQBIndex = -1;
8822 itemQBIndex = player.FindQuickBarEntityIndex(this);
8823 ctx.
Write(itemQBIndex);
8824 }
8825 else
8826 {
8828 }
8829
8831
8833 if (raib)
8834 {
8836 }
8837 }
8838
8839
8841 {
8842 super.AfterStoreLoad();
8843
8845 {
8847 }
8848
8850 {
8853 }
8854 }
8855
8857 {
8858 super.EEOnAfterLoad();
8859
8861 {
8863 }
8864
8867 }
8868
8870 {
8871 return false;
8872 }
8873
8874
8875
8877 {
8879 {
8880 #ifdef PLATFORM_CONSOLE
8881
8883 {
8885 if (menu)
8886 {
8888 }
8889 }
8890 #endif
8891 }
8892
8894 {
8897 }
8898
8900 {
8901 SetWeightDirty();
8903 }
8905 {
8908 }
8909
8911 {
8914 }
8916 {
8919 }
8920
8921 super.OnVariablesSynchronized();
8922 }
8923
8924
8925
8927 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
8928 {
8929 if (!IsServerCheck(allow_client))
8930 return false;
8931
8933 return false;
8934
8937
8938 if (value <= (min + 0.001))
8939 value = min;
8940
8941 if (value == min)
8942 {
8943 if (destroy_config)
8944 {
8945 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
8946 if (dstr)
8947 {
8949 this.Delete();
8950 return true;
8951 }
8952 }
8953 else if (destroy_forced)
8954 {
8956 this.Delete();
8957 return true;
8958 }
8959
8961 }
8962
8965
8967 {
8969
8970 if (delta)
8972 }
8973
8975
8976 return false;
8977 }
8978
8979
8981 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
8982 {
8984 }
8985
8987 {
8990 }
8991
8993 {
8996 }
8997
8999 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9000 {
9001 float value_clamped = Math.Clamp(value, 0, 1);
9003 SetQuantity(result, destroy_config, destroy_forced);
9004 }
9005
9006
9009 {
9011 }
9012
9014 {
9016 }
9017
9018
9019
9020
9021
9022
9023
9024
9025
9026
9028 {
9029 int slot = -1;
9030 if (GetInventory())
9031 {
9032 InventoryLocation il = new InventoryLocation;
9033 GetInventory().GetCurrentInventoryLocation(il);
9035 }
9036
9038 }
9039
9041 {
9042 float quantity_max = 0;
9043
9045 {
9046 if (attSlotID != -1)
9047 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
9048
9049 if (quantity_max <= 0)
9051 }
9052
9053 if (quantity_max <= 0)
9055
9056 return quantity_max;
9057 }
9058
9060 {
9062 }
9063
9065 {
9067 }
9068
9069
9071 {
9073 }
9074
9076 {
9078 }
9079
9081 {
9083 }
9084
9085
9087 {
9088
9089 float weightEx = GetWeightEx();
9090 float special = GetInventoryAndCargoWeight();
9091 return weightEx - special;
9092 }
9093
9094
9096 {
9098 }
9099
9101 {
9103 {
9104 #ifdef DEVELOPER
9105 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9106 {
9107 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
9109 }
9110 #endif
9111
9113 }
9114 else if (HasEnergyManager())
9115 {
9116 #ifdef DEVELOPER
9117 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9118 {
9119 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
9120 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
9121 }
9122 #endif
9123 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
9124 }
9125 else
9126 {
9127 #ifdef DEVELOPER
9128 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9129 {
9130 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
9131 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
9132 }
9133 #endif
9134 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
9135 }
9136 }
9137
9140 {
9141 int item_count = 0;
9143
9144 if (GetInventory().GetCargo() != NULL)
9145 {
9146 item_count = GetInventory().GetCargo().GetItemCount();
9147 }
9148
9149 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
9150 {
9151 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
9152 if (item)
9153 item_count += item.GetNumberOfItems();
9154 }
9155 return item_count;
9156 }
9157
9160 {
9161 float weight = 0;
9162 float wetness = 1;
9163 if (include_wetness)
9166 {
9167 weight = wetness * m_ConfigWeight;
9168 }
9170 {
9171 weight = 1;
9172 }
9173 return weight;
9174 }
9175
9176
9177
9179 {
9180 if ((
GetGame().IsServer() || !
GetGame().IsMultiplayer()) && GetInventory())
9181 {
9182 GameInventory inv = GetInventory();
9183 array<EntityAI> items = new array<EntityAI>;
9185 for (int i = 0; i < items.Count(); i++)
9186 {
9188 if (item)
9189 {
9191 }
9192 }
9193 }
9194 }
9195
9196
9197
9198
9200 {
9201 float energy = 0;
9202 if (HasEnergyManager())
9203 {
9204 energy = GetCompEM().GetEnergy();
9205 }
9206 return energy;
9207 }
9208
9209
9211 {
9212 super.OnEnergyConsumed();
9213
9215 }
9216
9218 {
9219 super.OnEnergyAdded();
9220
9222 }
9223
9224
9226 {
9227 if (
GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
9228 {
9230 {
9231 float energy_0to1 = GetCompEM().GetEnergy0To1();
9233 }
9234 }
9235 }
9236
9237
9239 {
9240 return ConfigGetFloat("heatIsolation");
9241 }
9242
9244 {
9246 }
9247
9249 {
9250 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
9251 if (
GetGame().ConfigIsExisting(paramPath))
9253
9254 return 0.0;
9255 }
9256
9258 {
9259 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
9260 if (
GetGame().ConfigIsExisting(paramPath))
9262
9263 return 0.0;
9264 }
9265
9266 override void SetWet(
float value,
bool allow_client =
false)
9267 {
9268 if (!IsServerCheck(allow_client))
9269 return;
9270
9273
9275
9276 m_VarWet = Math.Clamp(value, min, max);
9277
9279 {
9282 }
9283 }
9284
9285 override void AddWet(
float value)
9286 {
9288 }
9289
9291 {
9293 }
9294
9296 {
9298 }
9299
9301 {
9303 }
9304
9306 {
9308 }
9309
9311 {
9313 }
9314
9316 {
9319 if (newLevel != oldLevel)
9320 {
9322 }
9323 }
9324
9326 {
9327 SetWeightDirty();
9328 }
9329
9331 {
9332 return GetWetLevelInternal(
m_VarWet);
9333 }
9334
9335
9336
9338 {
9340 }
9341
9343 {
9345 }
9346
9348 {
9350 }
9351
9353 {
9355 }
9356
9357
9358
9360 {
9361 if (ConfigIsExisting("itemModelLength"))
9362 {
9363 return ConfigGetFloat("itemModelLength");
9364 }
9365 return 0;
9366 }
9367
9369 {
9370 if (ConfigIsExisting("itemAttachOffset"))
9371 {
9372 return ConfigGetFloat("itemAttachOffset");
9373 }
9374 return 0;
9375 }
9376
9377 override void SetCleanness(
int value,
bool allow_client =
false)
9378 {
9379 if (!IsServerCheck(allow_client))
9380 return;
9381
9383
9385
9388 }
9389
9391 {
9393 }
9394
9396 {
9397 return true;
9398 }
9399
9400
9401
9402
9404 {
9406 }
9407
9409 {
9411 }
9412
9413
9414
9415
9416 override void SetColor(
int r,
int g,
int b,
int a)
9417 {
9423 }
9425 override void GetColor(out
int r,out
int g,out
int b,out
int a)
9426 {
9431 }
9432
9434 {
9436 }
9437
9440 {
9441 int r,g,b,a;
9443 r = r/255;
9444 g = g/255;
9445 b = b/255;
9446 a = a/255;
9447 return MiscGameplayFunctions.GetColorString(r, g, b, a);
9448 }
9449
9450
9451
9452 override void SetLiquidType(
int value,
bool allow_client =
false)
9453 {
9454 if (!IsServerCheck(allow_client))
9455 return;
9456
9461 }
9462
9464 {
9465 return ConfigGetInt("varLiquidTypeInit");
9466 }
9467
9469 {
9471 }
9472
9474 {
9476 SetFrozen(false);
9477 }
9478
9481 {
9482 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9483 }
9484
9485
9488 {
9489 PlayerBase nplayer;
9490 if (PlayerBase.CastTo(nplayer, player))
9491 {
9493
9494 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9495 }
9496 }
9497
9498
9501 {
9502 PlayerBase nplayer;
9503 if (PlayerBase.CastTo(nplayer,player))
9504 {
9505
9506 nplayer.SetEnableQuickBarEntityShortcut(this,false);
9507
9508 }
9509
9510
9511 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
9512
9513
9514 if (HasEnergyManager())
9515 {
9516 GetCompEM().UpdatePlugState();
9517 }
9518 }
9519
9520
9522 {
9523 super.OnPlacementStarted(player);
9524
9526 }
9527
9528 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
9529 {
9531 {
9532 m_AdminLog.OnPlacementComplete(player,
this);
9533 }
9534
9535 super.OnPlacementComplete(player, position, orientation);
9536 }
9537
9538
9539
9540
9541
9543 {
9545 {
9546 return true;
9547 }
9548 else
9549 {
9550 return false;
9551 }
9552 }
9553
9554
9556 {
9558 {
9560 }
9561 }
9562
9563
9565 {
9567 }
9568
9570 {
9572 }
9573
9574 override void InsertAgent(
int agent,
float count = 1)
9575 {
9576 if (count < 1)
9577 return;
9578
9580 }
9581
9584 {
9586 }
9587
9588
9590 {
9592 }
9593
9594
9595
9596
9597
9598
9599
9600
9601
9602
9603
9604
9605
9606
9607
9608
9609
9610
9611
9612
9613
9614
9615
9616
9617
9618
9619
9620
9621
9622
9623
9624
9625
9626
9627
9628
9629
9630
9631
9632
9633
9634
9636 {
9638 return false;
9639 return true;
9640 }
9641
9643 {
9644
9646 }
9647
9648
9651 {
9652 super.CheckForRoofLimited(timeTresholdMS);
9653
9655 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
9656 {
9657 m_PreviousRoofTestTime = time;
9658 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
9659 }
9660 }
9661
9662
9664 {
9666 {
9667 return 0;
9668 }
9669
9670 if (GetInventory().GetAttachmentSlotsCount() != 0)
9671 {
9672 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
9673 if (filter)
9674 return filter.GetProtectionLevel(type, false, system);
9675 else
9676 return 0;
9677 }
9678
9679 string subclassPath, entryName;
9680
9681 switch (type)
9682 {
9684 entryName = "biological";
9685 break;
9687 entryName = "chemical";
9688 break;
9689 default:
9690 entryName = "biological";
9691 break;
9692 }
9693
9694 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
9695
9697 }
9698
9699
9700
9703 {
9704 if (!IsMagazine())
9706
9708 }
9709
9710
9711
9712
9713
9718 {
9719 return true;
9720 }
9721
9723 {
9725 }
9726
9727
9728
9729
9730
9732 {
9733 if (parent)
9734 {
9735 if (parent.IsInherited(DayZInfected))
9736 return true;
9737
9738 if (!parent.IsRuined())
9739 return true;
9740 }
9741
9742 return true;
9743 }
9744
9746 {
9747 if (!super.CanPutAsAttachment(parent))
9748 {
9749 return false;
9750 }
9751
9752 if (!IsRuined() && !parent.IsRuined())
9753 {
9754 return true;
9755 }
9756
9757 return false;
9758 }
9759
9761 {
9762
9763
9764
9765
9766 return super.CanReceiveItemIntoCargo(item);
9767 }
9768
9770 {
9771
9772
9773
9774
9775 GameInventory attachmentInv = attachment.GetInventory();
9777 {
9778 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
9779 return false;
9780 }
9781
9782 InventoryLocation loc = new InventoryLocation();
9783 attachment.GetInventory().GetCurrentInventoryLocation(loc);
9784 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
9785 return false;
9786
9787 return super.CanReceiveAttachment(attachment, slotId);
9788 }
9789
9791 {
9792 if (!super.CanReleaseAttachment(attachment))
9793 return false;
9794
9795 return GetInventory().AreChildrenAccessible();
9796 }
9797
9798
9799
9800
9801
9802
9803
9804
9805
9806
9807
9808
9809
9810
9811
9812
9813
9814
9815
9816
9817
9819 {
9820 int id = muzzle_owner.GetMuzzleID();
9821 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
9822
9823 if (WPOF_array)
9824 {
9825 for (int i = 0; i < WPOF_array.Count(); i++)
9826 {
9827 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
9828
9829 if (WPOF)
9830 {
9831 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
9832 }
9833 }
9834 }
9835 }
9836
9837
9839 {
9840 int id = muzzle_owner.GetMuzzleID();
9842
9843 if (WPOBE_array)
9844 {
9845 for (int i = 0; i < WPOBE_array.Count(); i++)
9846 {
9847 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
9848
9849 if (WPOBE)
9850 {
9851 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
9852 }
9853 }
9854 }
9855 }
9856
9857
9859 {
9860 int id = muzzle_owner.GetMuzzleID();
9861 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9862
9863 if (WPOOH_array)
9864 {
9865 for (int i = 0; i < WPOOH_array.Count(); i++)
9866 {
9867 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9868
9869 if (WPOOH)
9870 {
9871 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
9872 }
9873 }
9874 }
9875 }
9876
9877
9879 {
9880 int id = muzzle_owner.GetMuzzleID();
9881 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9882
9883 if (WPOOH_array)
9884 {
9885 for (int i = 0; i < WPOOH_array.Count(); i++)
9886 {
9887 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9888
9889 if (WPOOH)
9890 {
9891 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9892 }
9893 }
9894 }
9895 }
9896
9897
9899 {
9900 int id = muzzle_owner.GetMuzzleID();
9901 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9902
9903 if (WPOOH_array)
9904 {
9905 for (int i = 0; i < WPOOH_array.Count(); i++)
9906 {
9907 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9908
9909 if (WPOOH)
9910 {
9911 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9912 }
9913 }
9914 }
9915 }
9916
9917
9918
9920 {
9922 {
9923 return true;
9924 }
9925
9926 return false;
9927 }
9928
9930 {
9932 {
9933 return true;
9934 }
9935
9936 return false;
9937 }
9938
9940 {
9942 {
9943 return true;
9944 }
9945
9946 return false;
9947 }
9948
9950 {
9951 return false;
9952 }
9953
9956 {
9957 return UATimeSpent.DEFAULT_DEPLOY;
9958 }
9959
9960
9961
9962
9964 {
9966 SetSynchDirty();
9967 }
9968
9970 {
9972 }
9973
9974
9976 {
9977 return false;
9978 }
9979
9982 {
9983 string att_type = "None";
9984
9985 if (ConfigIsExisting("soundAttType"))
9986 {
9987 att_type = ConfigGetString("soundAttType");
9988 }
9989
9991 }
9992
9994 {
9996 }
9997
9998
9999
10000
10001
10007
10009 {
10012
10014 }
10015
10016
10018 {
10020 return;
10021
10023
10026
10029
10030 SoundParameters params = new SoundParameters();
10034 }
10035
10036
10038 {
10040 return;
10041
10043 SetSynchDirty();
10044
10047 }
10048
10049
10051 {
10053 return;
10054
10056 SetSynchDirty();
10057
10060 }
10061
10063 {
10065 }
10066
10068 {
10070 }
10071
10074 {
10075 if (!
GetGame().IsDedicatedServer())
10076 {
10077 if (ConfigIsExisting("attachSoundSet"))
10078 {
10079 string cfg_path = "";
10080 string soundset = "";
10081 string type_name =
GetType();
10082
10085 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
10086 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
10087
10088 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
10089 {
10090 for (int i = 0; i < cfg_soundset_array.Count(); i++)
10091 {
10092 if (cfg_slot_array[i] == slot_type)
10093 {
10094 soundset = cfg_soundset_array[i];
10095 break;
10096 }
10097 }
10098 }
10099
10100 if (soundset != "")
10101 {
10102 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
10104 }
10105 }
10106 }
10107 }
10108
10110 {
10111
10112 }
10113
10114 void OnApply(PlayerBase player);
10115
10117 {
10118 return 1.0;
10119 };
10120
10122 {
10124 }
10125
10127 {
10129 }
10130
10132
10134 {
10135 SetDynamicPhysicsLifeTime(0.01);
10137 }
10138
10140 {
10141 array<string> zone_names = new array<string>;
10142 GetDamageZones(zone_names);
10143 for (int i = 0; i < zone_names.Count(); i++)
10144 {
10145 SetHealthMax(zone_names.Get(i),"Health");
10146 }
10147 SetHealthMax("","Health");
10148 }
10149
10152 {
10153 float global_health = GetHealth01("","Health");
10154 array<string> zones = new array<string>;
10155 GetDamageZones(zones);
10156
10157 for (int i = 0; i < zones.Count(); i++)
10158 {
10159 SetHealth01(zones.Get(i),"Health",global_health);
10160 }
10161 }
10162
10165 {
10166 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
10167 }
10168
10170 {
10171 if (!hasRootAsPlayer)
10172 {
10173 if (refParentIB)
10174 {
10175
10176 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
10177 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
10178
10179 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
10180 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
10181
10184 }
10185 else
10186 {
10187
10190 }
10191 }
10192 }
10193
10195 {
10197 {
10198 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
10199 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
10200 {
10201 float heatPermCoef = 1.0;
10203 while (ent)
10204 {
10205 heatPermCoef *= ent.GetHeatPermeabilityCoef();
10206 ent = ent.GetHierarchyParent();
10207 }
10208
10209 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
10210 }
10211 }
10212 }
10213
10215 {
10216
10217 EntityAI parent = GetHierarchyParent();
10218 if (!parent)
10219 {
10220 hasParent = false;
10221 hasRootAsPlayer = false;
10222 }
10223 else
10224 {
10225 hasParent = true;
10226 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
10227 refParentIB =
ItemBase.Cast(parent);
10228 }
10229 }
10230
10231 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
10232 {
10233
10234 }
10235
10237 {
10238
10239 return false;
10240 }
10241
10243 {
10244
10245
10246 return false;
10247 }
10248
10250 {
10251
10252 return false;
10253 }
10254
10257 {
10258 return !GetIsFrozen() &&
IsOpen();
10259 }
10260
10262 {
10263 bool hasParent = false, hasRootAsPlayer = false;
10265
10266 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
10267 bool foodDecay =
g_Game.IsFoodDecayEnabled();
10268
10269 if (wwtu || foodDecay)
10270 {
10274
10275 if (processWetness || processTemperature || processDecay)
10276 {
10278
10279 if (processWetness)
10280 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
10281
10282 if (processTemperature)
10284
10285 if (processDecay)
10286 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
10287 }
10288 }
10289 }
10290
10293 {
10295 }
10296
10298 {
10301
10302 return super.GetTemperatureFreezeThreshold();
10303 }
10304
10306 {
10309
10310 return super.GetTemperatureThawThreshold();
10311 }
10312
10314 {
10317
10318 return super.GetItemOverheatThreshold();
10319 }
10320
10322 {
10324 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
10325
10326 return super.GetTemperatureFreezeTime();
10327 }
10328
10330 {
10332 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
10333
10334 return super.GetTemperatureThawTime();
10335 }
10336
10341
10343 {
10344 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
10345 }
10346
10348 {
10349 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
10350 }
10351
10354 {
10356 }
10357
10359 {
10361 }
10362
10364 {
10366 }
10367
10370 {
10371 return null;
10372 }
10373
10376 {
10377 return false;
10378 }
10379
10381 {
10383 {
10386 if (!trg)
10387 {
10389 explosive = this;
10390 }
10391
10392 explosive.PairRemote(trg);
10394
10395 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
10396 trg.SetPersistentPairID(persistentID);
10397 explosive.SetPersistentPairID(persistentID);
10398
10399 return true;
10400 }
10401 return false;
10402 }
10403
10406 {
10407 float ret = 1.0;
10410 ret *= GetHealth01();
10411
10412 return ret;
10413 }
10414
10415 #ifdef DEVELOPER
10416 override void SetDebugItem()
10417 {
10418 super.SetDebugItem();
10419 _itemBase = this;
10420 }
10421
10423 {
10424 string text = super.GetDebugText();
10425
10427 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
10428
10429 return text;
10430 }
10431 #endif
10432
10434 {
10435 return true;
10436 }
10437
10439
10441
10443 {
10446 }
10447
10448
10456
10472}
10473
10475{
10477 if (entity)
10478 {
10479 bool is_item = entity.IsInherited(
ItemBase);
10480 if (is_item && full_quantity)
10481 {
10484 }
10485 }
10486 else
10487 {
10489 return NULL;
10490 }
10491 return entity;
10492}
10493
10495{
10496 if (item)
10497 {
10498 if (health > 0)
10499 item.SetHealth("", "", health);
10500
10501 if (item.CanHaveTemperature())
10502 {
10504 if (item.CanFreeze())
10505 item.SetFrozen(false);
10506 }
10507
10508 if (item.HasEnergyManager())
10509 {
10510 if (quantity >= 0)
10511 {
10512 item.GetCompEM().SetEnergy0To1(quantity);
10513 }
10514 else
10515 {
10517 }
10518 }
10519 else if (item.IsMagazine())
10520 {
10521 Magazine mag = Magazine.Cast(item);
10522 if (quantity >= 0)
10523 {
10524 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
10525 }
10526 else
10527 {
10529 }
10530
10531 }
10532 else
10533 {
10534 if (quantity >= 0)
10535 {
10536 item.SetQuantityNormalized(quantity, false);
10537 }
10538 else
10539 {
10541 }
10542
10543 }
10544 }
10545}
10546
10547#ifdef DEVELOPER
10549#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.