5773{
5775 {
5776 return true;
5777 }
5778};
5779
5780
5781
5783{
5787
5789
5792
5793
5794
5795
5796
5805
5811
5816
5821
5842 protected bool m_IsResultOfSplit
5843
5845
5850
5851
5852
5854
5858
5859
5860
5862
5865
5866
5867
5873
5874
5882
5885
5886
5888
5889
5891
5892
5897
5898
5903
5904
5906
5907
5909 {
5914
5915 if (!
GetGame().IsDedicatedServer())
5916 {
5918 {
5920
5922 {
5924 }
5925 }
5926
5929 }
5930
5931 m_OldLocation = null;
5932
5934 {
5936 }
5937
5938 if (ConfigIsExisting("headSelectionsToHide"))
5939 {
5942 }
5943
5945 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
5946 {
5948 }
5949
5951
5952 m_IsResultOfSplit = false;
5953
5955 }
5956
5958 {
5959 super.InitItemVariables();
5960
5966 m_Count = ConfigGetInt(
"count");
5967
5970
5975
5978
5983
5995
5999
6000
6003 if (ConfigIsExisting("canBeSplit"))
6004 {
6007 }
6008
6010 if (ConfigIsExisting("itemBehaviour"))
6012
6013
6016 RegisterNetSyncVariableInt("m_VarLiquidType");
6017 RegisterNetSyncVariableInt("m_Cleanness",0,1);
6018
6019 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
6020 RegisterNetSyncVariableFloat("m_ImpactSpeed");
6021 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
6022
6023 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
6024 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
6025 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
6026 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
6027
6028 RegisterNetSyncVariableBool("m_IsBeingPlaced");
6029 RegisterNetSyncVariableBool("m_IsTakeable");
6030 RegisterNetSyncVariableBool("m_IsHologram");
6031
6034 {
6037 }
6038
6040
6042 if (ConfigIsExisting("temperaturePerQuantityWeight"))
6044
6045 }
6046
6048 {
6050 }
6051
6053 {
6056 {
6061 }
6062 }
6063
6064 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
6065 {
6067 {
6070 }
6071
6073 }
6074
6076 {
6082 }
6083
6085
6087 {
6089
6090 if (!action)
6091 {
6092 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
6093 return;
6094 }
6095
6097 if (!ai)
6098 {
6100 return;
6101 }
6102
6104 if (!action_array)
6105 {
6106 action_array = new array<ActionBase_Basic>;
6108 }
6109 if (LogManager.IsActionLogEnable())
6110 {
6111 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
6112 }
6113
6114 if (action_array.Find(action) != -1)
6115 {
6116 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
6117 }
6118 else
6119 {
6120 action_array.Insert(action);
6121 }
6122 }
6123
6125 {
6127 ActionBase action = player.GetActionManager().GetAction(actionName);
6130
6131 if (action_array)
6132 {
6133 action_array.RemoveItem(action);
6134 }
6135 }
6136
6137
6138
6140 {
6141 ActionOverrideData overrideData = new ActionOverrideData();
6145
6147 if (!actionMap)
6148 {
6151 }
6152
6153 actionMap.Insert(this.
Type(), overrideData);
6154
6155 }
6156
6158
6160
6161
6163 {
6166
6169
6170 string config_to_search = "CfgVehicles";
6171 string muzzle_owner_config;
6172
6174 {
6175 if (IsInherited(Weapon))
6176 config_to_search = "CfgWeapons";
6177
6178 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6179
6180 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
6181
6183
6184 if (config_OnFire_subclass_count > 0)
6185 {
6186 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
6187
6188 for (int i = 0; i < config_OnFire_subclass_count; i++)
6189 {
6190 string particle_class = "";
6192 string config_OnFire_entry = config_OnFire_class + particle_class;
6193 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
6194 WPOF_array.Insert(WPOF);
6195 }
6196
6197
6199 }
6200 }
6201
6203 {
6204 config_to_search = "CfgWeapons";
6205 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6206
6207 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
6208
6210
6211 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
6212 {
6213 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
6214
6215 for (i = 0; i < config_OnBulletCasingEject_count; i++)
6216 {
6217 string particle_class2 = "";
6219 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
6220 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
6221 WPOBE_array.Insert(WPOBE);
6222 }
6223
6224
6226 }
6227 }
6228 }
6229
6230
6232 {
6235
6237 {
6238 string config_to_search = "CfgVehicles";
6239
6240 if (IsInherited(Weapon))
6241 config_to_search = "CfgWeapons";
6242
6243 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6244 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
6245
6246 if (
GetGame().ConfigIsExisting(config_OnOverheating_class))
6247 {
6248
6250
6252 {
6254 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
6256 return;
6257 }
6258
6261
6262
6263
6265 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
6266
6267 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
6268 {
6269 string particle_class = "";
6271 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
6273
6274 if (entry_type == CT_CLASS)
6275 {
6276 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
6277 WPOOH_array.Insert(WPOF);
6278 }
6279 }
6280
6281
6283 }
6284 }
6285 }
6286
6288 {
6290 }
6291
6293 {
6295 {
6297
6300
6303
6304 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6305 }
6306 }
6307
6309 {
6311 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6312
6314 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6315
6317 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6318
6320 {
6322 }
6323 }
6324
6326 {
6328 }
6329
6331 {
6334 else
6336
6338 {
6341 }
6342 else
6343 {
6346
6349 }
6350
6352 }
6353
6355 {
6357 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6358 }
6359
6361 {
6363 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6365 }
6366
6368 {
6370 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6371 }
6372
6374 {
6377
6378 OverheatingParticle OP = new OverheatingParticle();
6383
6385 }
6386
6388 {
6391
6392 return -1;
6393 }
6394
6396 {
6398 {
6401
6402 for (int i = count; i > 0; --i)
6403 {
6404 int id = i - 1;
6407
6410
6411 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
6412 {
6413 if (p)
6414 {
6417 }
6418 }
6419 }
6420 }
6421 }
6422
6424 {
6426 {
6428 {
6429 int id = i - 1;
6431
6432 if (OP)
6433 {
6435
6436 if (p)
6437 {
6439 }
6440
6441 delete OP;
6442 }
6443 }
6444
6447 }
6448 }
6449
6452 {
6453 return 0.0;
6454 }
6455
6456
6458 {
6459 return 250;
6460 }
6461
6463 {
6464 return 0;
6465 }
6466
6469 {
6471 return true;
6472
6473 return false;
6474 }
6475
6478 {
6481
6483 {
6485 }
6486 else
6487 {
6488
6490 }
6491
6493 }
6494
6501 {
6502 return -1;
6503 }
6504
6505
6506
6507
6509 {
6511 {
6513 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6514
6515 if (r_index >= 0)
6516 {
6517 InventoryLocation r_il = new InventoryLocation;
6518 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6519
6520 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6523 {
6524 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6525 }
6527 {
6528 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6529 }
6530
6531 }
6532
6533 player.GetHumanInventory().ClearUserReservedLocation(this);
6534 }
6535
6538 }
6539
6540
6541
6542
6544 {
6545 return ItemBase.m_DebugActionsMask;
6546 }
6547
6549 {
6550 return ItemBase.m_DebugActionsMask & mask;
6551 }
6552
6554 {
6555 ItemBase.m_DebugActionsMask = mask;
6556 }
6557
6559 {
6560 ItemBase.m_DebugActionsMask |= mask;
6561 }
6562
6564 {
6565 ItemBase.m_DebugActionsMask &= ~mask;
6566 }
6567
6569 {
6571 {
6573 }
6574 else
6575 {
6577 }
6578 }
6579
6580
6582 {
6583 if (GetEconomyProfile())
6584 {
6585 float q_max = GetEconomyProfile().GetQuantityMax();
6586 if (q_max > 0)
6587 {
6588 float q_min = GetEconomyProfile().GetQuantityMin();
6589 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
6590
6592 {
6593 ComponentEnergyManager comp = GetCompEM();
6595 {
6597 }
6598 }
6600 {
6602
6603 }
6604
6605 }
6606 }
6607 }
6608
6611 {
6612 EntityAI parent = GetHierarchyParent();
6613
6614 if (parent)
6615 {
6616 InventoryLocation inventory_location_to_lock = new InventoryLocation;
6617 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
6618 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
6619 }
6620 }
6621
6624 {
6625 EntityAI parent = GetHierarchyParent();
6626
6627 if (parent)
6628 {
6629 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
6630 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
6631 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
6632 }
6633 }
6634
6636 {
6637
6638
6639
6640
6642
6644 {
6645 if (ScriptInputUserData.CanStoreInputUserData())
6646 {
6647 ScriptInputUserData ctx = new ScriptInputUserData;
6653 ctx.
Write(use_stack_max);
6656
6658 {
6659 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
6660 }
6661 }
6662 }
6663 else if (!
GetGame().IsMultiplayer())
6664 {
6666 }
6667 }
6668
6670 {
6672 }
6673
6675 {
6677 }
6678
6680 {
6682 }
6683
6685 {
6686
6687 return false;
6688 }
6689
6691 {
6692 return false;
6693 }
6694
6698 {
6699 return false;
6700 }
6701
6703 {
6704 return "";
6705 }
6706
6708
6710 {
6711 return false;
6712 }
6713
6715 {
6716 return true;
6717 }
6718
6719
6720
6722 {
6723 return true;
6724 }
6725
6727 {
6728 return true;
6729 }
6730
6732 {
6733 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6735 }
6736
6738 {
6740 }
6741
6743 {
6745 if (!is_being_placed)
6747 SetSynchDirty();
6748 }
6749
6750
6752
6754 {
6756 }
6757
6759 {
6761 }
6762
6764 {
6765 return 1;
6766 }
6767
6769 {
6770 return false;
6771 }
6772
6774 {
6776 SetSynchDirty();
6777 }
6778
6779
6780
6781
6782
6783
6784
6785
6786
6787
6788
6789
6790
6791
6792
6793
6794
6795
6796
6797
6798
6799
6800
6801
6802
6803
6804
6805
6806
6807
6808
6809
6810
6811
6812
6814 {
6815 super.OnMovedInsideCargo(container);
6816
6817 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6818 }
6819
6820 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
6821 {
6822 super.EEItemLocationChanged(oldLoc,newLoc);
6823
6824 PlayerBase new_player = null;
6825 PlayerBase old_player = null;
6826
6827 if (newLoc.GetParent())
6828 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
6829
6830 if (oldLoc.GetParent())
6831 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
6832
6834 {
6835 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
6836
6837 if (r_index >= 0)
6838 {
6839 InventoryLocation r_il = new InventoryLocation;
6840 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6841
6842 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6845 {
6846 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6847 }
6849 {
6850 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6851 }
6852
6853 }
6854 }
6855
6857 {
6858 if (new_player)
6859 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
6860
6861 if (new_player == old_player)
6862 {
6863
6864 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
6865 {
6867 {
6868 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
6869 {
6870 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6871 }
6872 }
6873 else
6874 {
6875 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6876 }
6877 }
6878
6879 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
6880 {
6881 int type = oldLoc.GetType();
6883 {
6884 oldLoc.GetParent().GetOnSetLock().Invoke(this);
6885 }
6887 {
6888 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
6889 }
6890 }
6891 if (!m_OldLocation)
6892 {
6893 m_OldLocation = new InventoryLocation;
6894 }
6895 m_OldLocation.Copy(oldLoc);
6896 }
6897 else
6898 {
6899 if (m_OldLocation)
6900 {
6901 m_OldLocation.Reset();
6902 }
6903 }
6904
6906 }
6907 else
6908 {
6909 if (new_player)
6910 {
6911 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
6912 if (res_index >= 0)
6913 {
6914 InventoryLocation il = new InventoryLocation;
6915 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
6917 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
6920 {
6921 il.
GetParent().GetOnReleaseLock().Invoke(it);
6922 }
6924 {
6926 }
6927
6928 }
6929 }
6931 {
6932
6934 }
6935
6936 if (m_OldLocation)
6937 {
6938 m_OldLocation.Reset();
6939 }
6940 }
6941 }
6942
6943 override void EOnContact(IEntity other, Contact extra)
6944 {
6946 {
6947 int liquidType = -1;
6949 if (impactSpeed > 0.0)
6950 {
6952 #ifndef SERVER
6954 #else
6956 SetSynchDirty();
6957 #endif
6959 }
6960 }
6961
6962 #ifdef SERVER
6963 if (GetCompEM() && GetCompEM().IsPlugged())
6964 {
6965 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
6966 GetCompEM().UnplugThis();
6967 }
6968 #endif
6969 }
6970
6972
6974 {
6976 }
6977
6979 {
6980
6981 }
6982
6984 {
6985 super.OnItemLocationChanged(old_owner, new_owner);
6986
6987 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
6988 PlayerBase playerNew = PlayerBase.Cast(new_owner);
6989
6990 if (!relatedPlayer && playerNew)
6991 relatedPlayer = playerNew;
6992
6993 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
6994 {
6996 if (actionMgr)
6997 {
6998 ActionBase currentAction = actionMgr.GetRunningAction();
6999 if (currentAction)
7001 }
7002 }
7003
7004 Man ownerPlayerOld = null;
7005 Man ownerPlayerNew = null;
7006
7007 if (old_owner)
7008 {
7009 if (old_owner.
IsMan())
7010 {
7011 ownerPlayerOld = Man.Cast(old_owner);
7012 }
7013 else
7014 {
7015 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
7016 }
7017 }
7018 else
7019 {
7021 {
7023
7024 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
7025 {
7026 GetCompEM().UnplugThis();
7027 }
7028 }
7029 }
7030
7031 if (new_owner)
7032 {
7033 if (new_owner.
IsMan())
7034 {
7035 ownerPlayerNew = Man.Cast(new_owner);
7036 }
7037 else
7038 {
7039 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
7040 }
7041 }
7042
7043 if (ownerPlayerOld != ownerPlayerNew)
7044 {
7045 if (ownerPlayerOld)
7046 {
7047 array<EntityAI> subItemsExit = new array<EntityAI>;
7049 for (int i = 0; i < subItemsExit.Count(); i++)
7050 {
7053 }
7054 }
7055
7056 if (ownerPlayerNew)
7057 {
7058 array<EntityAI> subItemsEnter = new array<EntityAI>;
7060 for (int j = 0; j < subItemsEnter.Count(); j++)
7061 {
7064 }
7065 }
7066 }
7067 else if (ownerPlayerNew != null)
7068 {
7069 PlayerBase nplayer;
7070 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
7071 {
7072 array<EntityAI> subItemsUpdate = new array<EntityAI>;
7074 for (int k = 0; k < subItemsUpdate.Count(); k++)
7075 {
7077 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
7078 }
7079 }
7080 }
7081
7082 if (old_owner)
7083 old_owner.OnChildItemRemoved(this);
7084 if (new_owner)
7085 new_owner.OnChildItemReceived(this);
7086 }
7087
7088
7090 {
7091 super.EEDelete(parent);
7092 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
7093 if (player)
7094 {
7096
7097 if (player.IsAlive())
7098 {
7099 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7100 if (r_index >= 0)
7101 {
7102 InventoryLocation r_il = new InventoryLocation;
7103 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7104
7105 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7108 {
7109 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7110 }
7112 {
7113 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7114 }
7115
7116 }
7117
7118 player.RemoveQuickBarEntityShortcut(this);
7119 }
7120 }
7121 }
7122
7124 {
7125 super.EEKilled(killer);
7126
7129 {
7130 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
7131 {
7132 if (IsMagazine())
7133 {
7134 if (Magazine.Cast(this).GetAmmoCount() > 0)
7135 {
7137 }
7138 }
7139 else
7140 {
7142 }
7143 }
7144 }
7145 }
7146
7148 {
7149 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7150
7151 super.OnWasAttached(parent, slot_id);
7152
7155
7157 }
7158
7160 {
7161 super.OnWasDetached(parent, slot_id);
7162
7165 }
7166
7168 {
7169 int idx;
7172
7173 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7174 if (inventory_slots.Count() < 1)
7175 {
7176 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
7177 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
7178 }
7179 else
7180 {
7181 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
7182 }
7183
7184 idx = inventory_slots.Find(slot);
7185 if (idx < 0)
7186 return "";
7187
7188 return attach_types.Get(idx);
7189 }
7190
7192 {
7193 int idx = -1;
7194 string slot;
7195
7198
7199 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7200 if (inventory_slots.Count() < 1)
7201 {
7202 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
7203 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7204 }
7205 else
7206 {
7207 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
7208 if (detach_types.Count() < 1)
7209 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7210 }
7211
7212 for (int i = 0; i < inventory_slots.Count(); i++)
7213 {
7214 slot = inventory_slots.Get(i);
7215 }
7216
7217 if (slot != "")
7218 {
7219 if (detach_types.Count() == 1)
7220 idx = 0;
7221 else
7222 idx = inventory_slots.Find(slot);
7223 }
7224 if (idx < 0)
7225 return "";
7226
7227 return detach_types.Get(idx);
7228 }
7229
7231 {
7232
7234
7235
7236 float min_time = 1;
7237 float max_time = 3;
7238 float delay = Math.RandomFloat(min_time, max_time);
7239
7240 explode_timer.Run(delay, this, "DoAmmoExplosion");
7241 }
7242
7244 {
7245 Magazine magazine = Magazine.Cast(this);
7246 int pop_sounds_count = 6;
7247 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
7248
7249
7250 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
7251 string sound_name = pop_sounds[ sound_idx ];
7253
7254
7255 magazine.ServerAddAmmoCount(-1);
7256
7257
7258 float min_temp_to_explode = 100;
7259
7260 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
7261 {
7263 }
7264 }
7265
7266
7267 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
7268 {
7269 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
7270
7271 const int CHANCE_DAMAGE_CARGO = 4;
7272 const int CHANCE_DAMAGE_ATTACHMENT = 1;
7273 const int CHANCE_DAMAGE_NOTHING = 2;
7274
7276 {
7277 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
7278 int chances;
7279 int rnd;
7280
7281 if (GetInventory().GetCargo())
7282 {
7283 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7284 rnd = Math.RandomInt(0,chances);
7285
7286 if (rnd < CHANCE_DAMAGE_CARGO)
7287 {
7289 }
7290 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
7291 {
7293 }
7294 }
7295 else
7296 {
7297 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7298 rnd = Math.RandomInt(0,chances);
7299
7300 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
7301 {
7303 }
7304 }
7305 }
7306 }
7307
7309 {
7310 if (GetInventory().GetCargo())
7311 {
7312 int item_count = GetInventory().GetCargo().GetItemCount();
7313 if (item_count > 0)
7314 {
7315 int random_pick = Math.RandomInt(0, item_count);
7317 if (!item.IsExplosive())
7318 {
7319 item.AddHealth("","",damage);
7320 return true;
7321 }
7322 }
7323 }
7324 return false;
7325 }
7326
7328 {
7329 int attachment_count = GetInventory().AttachmentCount();
7330 if (attachment_count > 0)
7331 {
7332 int random_pick = Math.RandomInt(0, attachment_count);
7333 ItemBase attachment =
ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
7334 if (!attachment.IsExplosive())
7335 {
7336 attachment.AddHealth("","",damage);
7337 return true;
7338 }
7339 }
7340 return false;
7341 }
7342
7344 {
7346 }
7347
7349 {
7351 return GetInventory().CanRemoveEntity();
7352
7353 return false;
7354 }
7355
7357 {
7358
7360 return false;
7361
7362
7364 return false;
7365
7366
7367
7369 if (delta == 0)
7370 return false;
7371
7372
7373 return true;
7374 }
7375
7377 {
7379 {
7380 if (ScriptInputUserData.CanStoreInputUserData())
7381 {
7382 ScriptInputUserData ctx = new ScriptInputUserData;
7387 ctx.
Write(destination_entity);
7391 }
7392 }
7393 else if (!
GetGame().IsMultiplayer())
7394 {
7396 }
7397 }
7398
7400 {
7401 float split_quantity_new;
7405 InventoryLocation loc = new InventoryLocation;
7406
7407 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7408 {
7410 split_quantity_new = stack_max;
7411 else
7413
7415 {
7416 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7417 if (new_item)
7418 {
7419 new_item.SetResultOfSplit(true);
7420 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7422 new_item.
SetQuantity(split_quantity_new,
false,
true);
7423 }
7424 }
7425 }
7426 else if (destination_entity && slot_id == -1)
7427 {
7428 if (quantity > stack_max)
7429 split_quantity_new = stack_max;
7430 else
7431 split_quantity_new = quantity;
7432
7434 {
7436 {
7439 }
7440
7441 if (new_item)
7442 {
7443 new_item.SetResultOfSplit(true);
7444 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7446 new_item.
SetQuantity(split_quantity_new,
false,
true);
7447 }
7448 }
7449 }
7450 else
7451 {
7452 if (stack_max != 0)
7453 {
7455 {
7457 }
7458
7459 if (split_quantity_new == 0)
7460 {
7461 if (!
GetGame().IsMultiplayer())
7462 player.PhysicalPredictiveDropItem(this);
7463 else
7464 player.ServerDropEntity(this);
7465 return;
7466 }
7467
7469 {
7471
7472 if (new_item)
7473 {
7474 new_item.SetResultOfSplit(true);
7475 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7478 new_item.PlaceOnSurface();
7479 }
7480 }
7481 }
7482 }
7483 }
7484
7486 {
7487 float split_quantity_new;
7491 InventoryLocation loc = new InventoryLocation;
7492
7493 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7494 {
7496 split_quantity_new = stack_max;
7497 else
7499
7501 {
7502 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7503 if (new_item)
7504 {
7505 new_item.SetResultOfSplit(true);
7506 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7508 new_item.
SetQuantity(split_quantity_new,
false,
true);
7509 }
7510 }
7511 }
7512 else if (destination_entity && slot_id == -1)
7513 {
7514 if (quantity > stack_max)
7515 split_quantity_new = stack_max;
7516 else
7517 split_quantity_new = quantity;
7518
7520 {
7522 {
7525 }
7526
7527 if (new_item)
7528 {
7529 new_item.SetResultOfSplit(true);
7530 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7532 new_item.
SetQuantity(split_quantity_new,
false,
true);
7533 }
7534 }
7535 }
7536 else
7537 {
7538 if (stack_max != 0)
7539 {
7541 {
7543 }
7544
7546 {
7548
7549 if (new_item)
7550 {
7551 new_item.SetResultOfSplit(true);
7552 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7555 new_item.PlaceOnSurface();
7556 }
7557 }
7558 }
7559 }
7560 }
7561
7563 {
7565 {
7566 if (ScriptInputUserData.CanStoreInputUserData())
7567 {
7568 ScriptInputUserData ctx = new ScriptInputUserData;
7573 dst.WriteToContext(ctx);
7575 }
7576 }
7577 else if (!
GetGame().IsMultiplayer())
7578 {
7580 }
7581 }
7582
7584 {
7586 {
7587 if (ScriptInputUserData.CanStoreInputUserData())
7588 {
7589 ScriptInputUserData ctx = new ScriptInputUserData;
7594 ctx.
Write(destination_entity);
7600 }
7601 }
7602 else if (!
GetGame().IsMultiplayer())
7603 {
7605 }
7606 }
7607
7609 {
7611 }
7612
7614 {
7616 float split_quantity_new;
7618 if (dst.IsValid())
7619 {
7620 int slot_id = dst.GetSlot();
7622
7623 if (quantity > stack_max)
7624 split_quantity_new = stack_max;
7625 else
7626 split_quantity_new = quantity;
7627
7629 {
7631
7632 if (new_item)
7633 {
7634 new_item.SetResultOfSplit(true);
7635 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7637 new_item.
SetQuantity(split_quantity_new,
false,
true);
7638 }
7639
7640 return new_item;
7641 }
7642 }
7643
7644 return null;
7645 }
7646
7648 {
7650 float split_quantity_new;
7652 if (destination_entity)
7653 {
7655 if (quantity > stackable)
7656 split_quantity_new = stackable;
7657 else
7658 split_quantity_new = quantity;
7659
7661 {
7662 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
7663 if (new_item)
7664 {
7665 new_item.SetResultOfSplit(true);
7666 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7668 new_item.
SetQuantity(split_quantity_new,
false,
true);
7669 }
7670 }
7671 }
7672 }
7673
7675 {
7677 {
7678 if (ScriptInputUserData.CanStoreInputUserData())
7679 {
7680 ScriptInputUserData ctx = new ScriptInputUserData;
7685 ItemBase destination_entity =
this;
7686 ctx.
Write(destination_entity);
7690 }
7691 }
7692 else if (!
GetGame().IsMultiplayer())
7693 {
7695 }
7696 }
7697
7699 {
7701 float split_quantity_new;
7703 if (player)
7704 {
7706 if (quantity > stackable)
7707 split_quantity_new = stackable;
7708 else
7709 split_quantity_new = quantity;
7710
7712 {
7713 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
7714 new_item =
ItemBase.Cast(in_hands);
7715 if (new_item)
7716 {
7717 new_item.SetResultOfSplit(true);
7718 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7720 new_item.SetQuantity(split_quantity_new, false, true);
7721 }
7722 }
7723 }
7724 }
7725
7727 {
7729 float split_quantity_new = Math.Floor(quantity * 0.5);
7730
7732 return;
7733
7735
7736 if (new_item)
7737 {
7738 if (new_item.GetQuantityMax() < split_quantity_new)
7739 {
7740 split_quantity_new = new_item.GetQuantityMax();
7741 }
7742
7743 new_item.SetResultOfSplit(true);
7744 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7745
7747 {
7750 }
7751 else
7752 {
7754 new_item.
SetQuantity(split_quantity_new,
false,
true);
7755 }
7756 }
7757 }
7758
7760 {
7762 float split_quantity_new = Math.Floor(quantity / 2);
7763
7765 return;
7766
7767 InventoryLocation invloc = new InventoryLocation;
7769
7771 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
7772
7773 if (new_item)
7774 {
7775 if (new_item.GetQuantityMax() < split_quantity_new)
7776 {
7777 split_quantity_new = new_item.GetQuantityMax();
7778 }
7780 {
7783 }
7784 else if (split_quantity_new > 1)
7785 {
7787 new_item.
SetQuantity(split_quantity_new,
false,
true);
7788 }
7789 }
7790 }
7791
7794 {
7795 SetWeightDirty();
7797
7798 if (parent)
7799 parent.OnAttachmentQuantityChangedEx(this, delta);
7800
7802 {
7804 {
7806 }
7808 {
7809 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
7811 }
7812 }
7813
7814 }
7815
7818 {
7819
7820 }
7821
7824 {
7826 }
7827
7829 {
7830 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
7831
7833 {
7834 if (newLevel == GameConstants.STATE_RUINED)
7835 {
7837 EntityAI parent = GetHierarchyParent();
7838 if (parent && parent.IsFireplace())
7839 {
7840 CargoBase cargo = GetInventory().GetCargo();
7841 if (cargo)
7842 {
7844 {
7846 }
7847 }
7848 }
7849 }
7850
7852 {
7853
7855 return;
7856 }
7857
7858 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
7859 {
7861 }
7862 }
7863 }
7864
7865
7867 {
7868 super.OnRightClick();
7869
7871 {
7873 {
7874 if (ScriptInputUserData.CanStoreInputUserData())
7875 {
7876 EntityAI root = GetHierarchyRoot();
7877 Man playerOwner = GetHierarchyRootPlayer();
7878 InventoryLocation dst = new InventoryLocation;
7879
7880
7881 if (!playerOwner && root && root == this)
7882 {
7884 }
7885 else
7886 {
7887
7888 GetInventory().GetCurrentInventoryLocation(dst);
7890 {
7893 {
7895 }
7896 else
7897 {
7899
7900
7901 if (
GetGame().
GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
7902 {
7904 }
7905 else
7906 {
7907 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
7908 }
7909 }
7910 }
7911 }
7912
7913 ScriptInputUserData ctx = new ScriptInputUserData;
7921 }
7922 }
7923 else if (!
GetGame().IsMultiplayer())
7924 {
7926 }
7927 }
7928 }
7929
7931 {
7932 if (root)
7933 {
7934 vector m4[4];
7935 root.GetTransform(m4);
7936 dst.SetGround(this, m4);
7937 }
7938 else
7939 {
7940 GetInventory().GetCurrentInventoryLocation(dst);
7941 }
7942 }
7943
7944 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
7945 {
7946
7947 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
7948 return false;
7949
7950 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
7951 return false;
7952
7953
7955 return false;
7956
7957
7958 Magazine mag = Magazine.Cast(this);
7959 if (mag)
7960 {
7961 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
7962 return false;
7963
7964 if (stack_max_limit)
7965 {
7966 Magazine other_mag = Magazine.Cast(other_item);
7967 if (other_item)
7968 {
7969 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
7970 return false;
7971 }
7972
7973 }
7974 }
7975 else
7976 {
7977
7979 return false;
7980
7982 return false;
7983 }
7984
7985 PlayerBase player = null;
7986 if (CastTo(player, GetHierarchyRootPlayer()))
7987 {
7988 if (player.GetInventory().HasAttachment(this))
7989 return false;
7990
7991 if (player.IsItemsToDelete())
7992 return false;
7993 }
7994
7995 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
7996 return false;
7997
7998 int slotID;
8000 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
8001 return false;
8002
8003 return true;
8004 }
8005
8007 {
8009 }
8010
8012 {
8013 return m_IsResultOfSplit;
8014 }
8015
8017 {
8018 m_IsResultOfSplit = value;
8019 }
8020
8022 {
8024 }
8025
8027 {
8028 float other_item_quantity = other_item.GetQuantity();
8029 float this_free_space;
8030
8032
8034
8035 if (other_item_quantity > this_free_space)
8036 {
8037 return this_free_space;
8038 }
8039 else
8040 {
8041 return other_item_quantity;
8042 }
8043 }
8044
8046 {
8048 }
8049
8051 {
8053 return;
8054
8055 if (!IsMagazine() && other_item)
8056 {
8058 if (quantity_used != 0)
8059 {
8060 float hp1 = GetHealth01("","");
8061 float hp2 = other_item.GetHealth01("","");
8062 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
8063 hpResult = hpResult / (
GetQuantity() + quantity_used);
8064
8065 hpResult *= GetMaxHealth();
8066 Math.Round(hpResult);
8067 SetHealth("", "Health", hpResult);
8068
8070 other_item.AddQuantity(-quantity_used);
8071 }
8072 }
8074 }
8075
8077 {
8078 #ifdef SERVER
8079 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
8080 GetHierarchyParent().IncreaseLifetimeUp();
8081 #endif
8082 };
8083
8085 {
8086 PlayerBase p = PlayerBase.Cast(player);
8087
8088 array<int> recipesIds = p.m_Recipes;
8089 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8090 if (moduleRecipesManager)
8091 {
8092 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
8093 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
8094 }
8095
8096 for (int i = 0;i < recipesIds.Count(); i++)
8097 {
8098 int key = recipesIds.Get(i);
8099 string recipeName = moduleRecipesManager.GetRecipeName(key);
8101 }
8102 }
8103
8104
8105 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
8106 {
8107 super.GetDebugActions(outputList);
8108
8109
8115
8116
8121
8126
8127
8131
8132
8134 {
8138 }
8139
8142
8143
8147
8149
8150 InventoryLocation loc = new InventoryLocation();
8151 GetInventory().GetCurrentInventoryLocation(loc);
8153 {
8154 if (Gizmo_IsSupported())
8157 }
8158
8160 }
8161
8162
8163
8164
8166 {
8167 super.OnAction(action_id, player, ctx);
8168
8170 {
8171 switch (action_id)
8172 {
8175 return true;
8178 return true;
8179 }
8180 }
8181
8183 {
8184 switch (action_id)
8185 {
8187 Delete();
8188 return true;
8189 }
8190 }
8191
8192 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
8193 {
8194 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8195 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
8196 PlayerBase p = PlayerBase.Cast(player);
8197 if (
EActions.RECIPES_RANGE_START < 1000)
8198 {
8199 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
8200 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
8201 }
8202 }
8203 #ifndef SERVER
8204 else if (action_id ==
EActions.WATCH_PLAYER)
8205 {
8206 PluginDeveloper.SetDeveloperItemClientEx(player);
8207 }
8208 #endif
8210 {
8211 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
8212 {
8213 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
8214 OnDebugButtonPressServer(id + 1);
8215 }
8216
8217 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
8218 {
8219 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
8221 }
8222
8223 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
8224 {
8225 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
8227 }
8228
8229 else if (action_id ==
EActions.ADD_QUANTITY)
8230 {
8231 if (IsMagazine())
8232 {
8233 Magazine mag = Magazine.Cast(this);
8234 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
8235 }
8236 else
8237 {
8239 }
8240
8241 if (m_EM)
8242 {
8243 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
8244 }
8245
8246 }
8247
8248 else if (action_id ==
EActions.REMOVE_QUANTITY)
8249 {
8250 if (IsMagazine())
8251 {
8252 Magazine mag2 = Magazine.Cast(this);
8253 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
8254 }
8255 else
8256 {
8258 }
8259 if (m_EM)
8260 {
8261 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
8262 }
8263
8264 }
8265
8266 else if (action_id ==
EActions.SET_QUANTITY_0)
8267 {
8269
8270 if (m_EM)
8271 {
8272 m_EM.SetEnergy(0);
8273 }
8274 }
8275
8276 else if (action_id ==
EActions.SET_MAX_QUANTITY)
8277 {
8279
8280 if (m_EM)
8281 {
8282 m_EM.SetEnergy(m_EM.GetEnergyMax());
8283 }
8284 }
8285
8286 else if (action_id ==
EActions.ADD_HEALTH)
8287 {
8288 AddHealth("","",GetMaxHealth("","Health")/5);
8289 }
8290 else if (action_id ==
EActions.REMOVE_HEALTH)
8291 {
8292 AddHealth("","",-GetMaxHealth("","Health")/5);
8293 }
8294 else if (action_id ==
EActions.DESTROY_HEALTH)
8295 {
8296 SetHealth01("","",0);
8297 }
8298 else if (action_id ==
EActions.WATCH_ITEM)
8299 {
8301 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
8302 #ifdef DEVELOPER
8303 SetDebugDeveloper_item(this);
8304 #endif
8305 }
8306
8307 else if (action_id ==
EActions.ADD_TEMPERATURE)
8308 {
8309 AddTemperature(20);
8310
8311 }
8312
8313 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
8314 {
8315 AddTemperature(-20);
8316
8317 }
8318
8319 else if (action_id ==
EActions.FLIP_FROZEN)
8320 {
8321 SetFrozen(!GetIsFrozen());
8322
8323 }
8324
8325 else if (action_id ==
EActions.ADD_WETNESS)
8326 {
8328
8329 }
8330
8331 else if (action_id ==
EActions.REMOVE_WETNESS)
8332 {
8334
8335 }
8336
8337 else if (action_id ==
EActions.LIQUIDTYPE_UP)
8338 {
8341
8342
8343 }
8344
8345 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
8346 {
8349 }
8350
8351 else if (action_id ==
EActions.MAKE_SPECIAL)
8352 {
8353 auto debugParams = DebugSpawnParams.WithPlayer(player);
8354 OnDebugSpawnEx(debugParams);
8355 }
8356
8357 }
8358
8359
8360 return false;
8361 }
8362
8363
8364
8365
8369
8372
8373
8374
8376 {
8377 return false;
8378 }
8379
8380
8382 {
8383 return true;
8384 }
8385
8386
8388 {
8389 return true;
8390 }
8391
8392
8393
8395 {
8396 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
8398 }
8399
8402 {
8403 return null;
8404 }
8405
8407 {
8408 return false;
8409 }
8410
8412 {
8413 return false;
8414 }
8415
8419
8420
8422 {
8423 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8424 return module_repairing.CanRepair(this, item_repair_kit);
8425 }
8426
8427
8428 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
8429 {
8430 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8431 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
8432 }
8433
8434
8436 {
8437
8438
8439
8440
8441
8442
8443
8444
8445 return 1;
8446 }
8447
8448
8449
8451 {
8453 }
8454
8455
8456
8458 {
8460 }
8461
8462
8471 {
8472 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8473
8474 if (player)
8475 {
8476 player.MessageStatus(text);
8477 }
8478 }
8479
8480
8489 {
8490 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8491
8492 if (player)
8493 {
8494 player.MessageAction(text);
8495 }
8496 }
8497
8498
8507 {
8508 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8509
8510 if (player)
8511 {
8512 player.MessageFriendly(text);
8513 }
8514 }
8515
8516
8525 {
8526 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8527
8528 if (player)
8529 {
8530 player.MessageImportant(text);
8531 }
8532 }
8533
8535 {
8536 return true;
8537 }
8538
8539
8540 override bool KindOf(
string tag)
8541 {
8542 bool found = false;
8543 string item_name = this.
GetType();
8546
8547 int array_size = item_tag_array.Count();
8548 for (int i = 0; i < array_size; i++)
8549 {
8550 if (item_tag_array.Get(i) == tag)
8551 {
8552 found = true;
8553 break;
8554 }
8555 }
8556 return found;
8557 }
8558
8559
8561 {
8562
8563 super.OnRPC(sender, rpc_type,ctx);
8564
8565
8566 switch (rpc_type)
8567 {
8568 #ifndef SERVER
8569 case ERPCs.RPC_SOUND_LOCK_ATTACH:
8570 Param2<bool, string> p = new Param2<bool, string>(false, "");
8571
8573 return;
8574
8575 bool play = p.param1;
8576 string soundSet = p.param2;
8577
8578 if (play)
8579 {
8581 {
8583 {
8585 }
8586 }
8587 else
8588 {
8590 }
8591 }
8592 else
8593 {
8595 }
8596
8597 break;
8598 #endif
8599
8600 }
8601
8603 {
8605 }
8606 }
8607
8608
8609
8610
8612 {
8613 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8614 return plugin.GetID(
name);
8615 }
8616
8618 {
8619 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8620 return plugin.GetName(id);
8621 }
8622
8625 {
8626
8627
8628 int varFlags;
8629 if (!ctx.
Read(varFlags))
8630 return;
8631
8632 if (varFlags & ItemVariableFlags.FLOAT)
8633 {
8635 }
8636 }
8637
8639 {
8640
8641 super.SerializeNumericalVars(floats_out);
8642
8643
8644
8646 {
8648 }
8649
8651 {
8653 }
8654
8656 {
8658 }
8659
8661 {
8666 }
8667
8669 {
8671 }
8672 }
8673
8675 {
8676
8677 super.DeSerializeNumericalVars(floats);
8678
8679
8680 int index = 0;
8681 int mask = Math.Round(floats.Get(index));
8682
8683 index++;
8684
8686 {
8688 {
8690 }
8691 else
8692 {
8693 float quantity = floats.Get(index);
8695 }
8696 index++;
8697 }
8698
8700 {
8701 float wet = floats.Get(index);
8703 index++;
8704 }
8705
8707 {
8708 int liquidtype = Math.Round(floats.Get(index));
8710 index++;
8711 }
8712
8714 {
8716 index++;
8718 index++;
8720 index++;
8722 index++;
8723 }
8724
8726 {
8727 int cleanness = Math.Round(floats.Get(index));
8729 index++;
8730 }
8731 }
8732
8734 {
8735 super.WriteVarsToCTX(ctx);
8736
8737
8739 {
8741 }
8742
8744 {
8746 }
8747
8749 {
8751 }
8752
8754 {
8755 int r,g,b,a;
8761 }
8762
8764 {
8766 }
8767 }
8768
8770 {
8771 if (!super.ReadVarsFromCTX(ctx,version))
8772 return false;
8773
8774 int intValue;
8775 float value;
8776
8777 if (version < 140)
8778 {
8779 if (!ctx.
Read(intValue))
8780 return false;
8781
8782 m_VariablesMask = intValue;
8783 }
8784
8786 {
8787 if (!ctx.
Read(value))
8788 return false;
8789
8791 {
8793 }
8794 else
8795 {
8797 }
8798 }
8799
8800 if (version < 140)
8801 {
8803 {
8804 if (!ctx.
Read(value))
8805 return false;
8806 SetTemperatureDirect(value);
8807 }
8808 }
8809
8811 {
8812 if (!ctx.
Read(value))
8813 return false;
8815 }
8816
8818 {
8819 if (!ctx.
Read(intValue))
8820 return false;
8822 }
8823
8825 {
8826 int r,g,b,a;
8828 return false;
8830 return false;
8832 return false;
8834 return false;
8835
8837 }
8838
8840 {
8841 if (!ctx.
Read(intValue))
8842 return false;
8844 }
8845
8846 if (version >= 138 && version < 140)
8847 {
8849 {
8850 if (!ctx.
Read(intValue))
8851 return false;
8852 SetFrozen(intValue);
8853 }
8854 }
8855
8856 return true;
8857 }
8858
8859
8861 {
8864 {
8866 }
8867
8868 if (!super.OnStoreLoad(ctx, version))
8869 {
8871 return false;
8872 }
8873
8874 if (version >= 114)
8875 {
8876 bool hasQuickBarIndexSaved;
8877
8878 if (!ctx.
Read(hasQuickBarIndexSaved))
8879 {
8881 return false;
8882 }
8883
8884 if (hasQuickBarIndexSaved)
8885 {
8886 int itmQBIndex;
8887
8888
8889 if (!ctx.
Read(itmQBIndex))
8890 {
8892 return false;
8893 }
8894
8895 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
8896 if (itmQBIndex != -1 && parentPlayer)
8897 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
8898 }
8899 }
8900 else
8901 {
8902
8903 PlayerBase player;
8904 int itemQBIndex;
8905 if (version ==
int.
MAX)
8906 {
8907 if (!ctx.
Read(itemQBIndex))
8908 {
8910 return false;
8911 }
8912 }
8913 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
8914 {
8915
8916 if (!ctx.
Read(itemQBIndex))
8917 {
8919 return false;
8920 }
8921 if (itemQBIndex != -1 && player)
8922 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
8923 }
8924 }
8925
8926 if (version < 140)
8927 {
8928
8929 if (!LoadVariables(ctx, version))
8930 {
8932 return false;
8933 }
8934 }
8935
8936
8938 {
8940 return false;
8941 }
8942 if (version >= 132)
8943 {
8945 if (raib)
8946 {
8948 {
8950 return false;
8951 }
8952 }
8953 }
8954
8956 return true;
8957 }
8958
8959
8960
8962 {
8963 super.OnStoreSave(ctx);
8964
8965 PlayerBase player;
8966 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
8967 {
8969
8970 int itemQBIndex = -1;
8971 itemQBIndex = player.FindQuickBarEntityIndex(this);
8972 ctx.
Write(itemQBIndex);
8973 }
8974 else
8975 {
8977 }
8978
8980
8982 if (raib)
8983 {
8985 }
8986 }
8987
8988
8990 {
8991 super.AfterStoreLoad();
8992
8994 {
8996 }
8997
8999 {
9002 }
9003 }
9004
9006 {
9007 super.EEOnAfterLoad();
9008
9010 {
9012 }
9013
9016 }
9017
9019 {
9020 return false;
9021 }
9022
9023
9024
9026 {
9028 {
9029 #ifdef PLATFORM_CONSOLE
9030
9032 {
9034 if (menu)
9035 {
9037 }
9038 }
9039 #endif
9040 }
9041
9043 {
9046 }
9047
9049 {
9050 SetWeightDirty();
9052 }
9054 {
9057 }
9058
9060 {
9063 }
9065 {
9068 }
9069
9070 super.OnVariablesSynchronized();
9071 }
9072
9073
9074
9076 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
9077 {
9078 if (!IsServerCheck(allow_client))
9079 return false;
9080
9082 return false;
9083
9086
9087 if (value <= (min + 0.001))
9088 value = min;
9089
9090 if (value == min)
9091 {
9092 if (destroy_config)
9093 {
9094 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
9095 if (dstr)
9096 {
9098 this.Delete();
9099 return true;
9100 }
9101 }
9102 else if (destroy_forced)
9103 {
9105 this.Delete();
9106 return true;
9107 }
9108
9110 }
9111
9114
9116 {
9118
9119 if (delta)
9121 }
9122
9124
9125 return false;
9126 }
9127
9128
9130 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9131 {
9133 }
9134
9136 {
9139 }
9140
9142 {
9145 }
9146
9148 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9149 {
9150 float value_clamped = Math.Clamp(value, 0, 1);
9152 SetQuantity(result, destroy_config, destroy_forced);
9153 }
9154
9155
9158 {
9160 }
9161
9163 {
9165 }
9166
9167
9168
9169
9170
9171
9172
9173
9174
9175
9177 {
9178 int slot = -1;
9179 if (GetInventory())
9180 {
9181 InventoryLocation il = new InventoryLocation;
9182 GetInventory().GetCurrentInventoryLocation(il);
9184 }
9185
9187 }
9188
9190 {
9191 float quantity_max = 0;
9192
9194 {
9195 if (attSlotID != -1)
9196 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
9197
9198 if (quantity_max <= 0)
9200 }
9201
9202 if (quantity_max <= 0)
9204
9205 return quantity_max;
9206 }
9207
9209 {
9211 }
9212
9214 {
9216 }
9217
9218
9220 {
9222 }
9223
9225 {
9227 }
9228
9230 {
9232 }
9233
9234
9236 {
9237
9238 float weightEx = GetWeightEx();
9239 float special = GetInventoryAndCargoWeight();
9240 return weightEx - special;
9241 }
9242
9243
9245 {
9247 }
9248
9250 {
9252 {
9253 #ifdef DEVELOPER
9254 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9255 {
9256 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
9258 }
9259 #endif
9260
9262 }
9263 else if (HasEnergyManager())
9264 {
9265 #ifdef DEVELOPER
9266 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9267 {
9268 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
9269 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
9270 }
9271 #endif
9272 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
9273 }
9274 else
9275 {
9276 #ifdef DEVELOPER
9277 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9278 {
9279 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
9280 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
9281 }
9282 #endif
9283 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
9284 }
9285 }
9286
9289 {
9290 int item_count = 0;
9292
9293 if (GetInventory().GetCargo() != NULL)
9294 {
9295 item_count = GetInventory().GetCargo().GetItemCount();
9296 }
9297
9298 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
9299 {
9300 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
9301 if (item)
9302 item_count += item.GetNumberOfItems();
9303 }
9304 return item_count;
9305 }
9306
9309 {
9310 float weight = 0;
9311 float wetness = 1;
9312 if (include_wetness)
9315 {
9316 weight = wetness * m_ConfigWeight;
9317 }
9319 {
9320 weight = 1;
9321 }
9322 return weight;
9323 }
9324
9325
9326
9328 {
9329 if ((
GetGame().IsServer() || !
GetGame().IsMultiplayer()) && GetInventory())
9330 {
9331 GameInventory inv = GetInventory();
9332 array<EntityAI> items = new array<EntityAI>;
9334 for (int i = 0; i < items.Count(); i++)
9335 {
9337 if (item)
9338 {
9340 }
9341 }
9342 }
9343 }
9344
9345
9346
9347
9349 {
9350 float energy = 0;
9351 if (HasEnergyManager())
9352 {
9353 energy = GetCompEM().GetEnergy();
9354 }
9355 return energy;
9356 }
9357
9358
9360 {
9361 super.OnEnergyConsumed();
9362
9364 }
9365
9367 {
9368 super.OnEnergyAdded();
9369
9371 }
9372
9373
9375 {
9376 if (
GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
9377 {
9379 {
9380 float energy_0to1 = GetCompEM().GetEnergy0To1();
9382 }
9383 }
9384 }
9385
9386
9388 {
9389 return ConfigGetFloat("heatIsolation");
9390 }
9391
9393 {
9395 }
9396
9398 {
9399 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
9400 if (
GetGame().ConfigIsExisting(paramPath))
9402
9403 return 0.0;
9404 }
9405
9407 {
9408 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
9409 if (
GetGame().ConfigIsExisting(paramPath))
9411
9412 return 0.0;
9413 }
9414
9415 override void SetWet(
float value,
bool allow_client =
false)
9416 {
9417 if (!IsServerCheck(allow_client))
9418 return;
9419
9422
9424
9425 m_VarWet = Math.Clamp(value, min, max);
9426
9428 {
9431 }
9432 }
9433
9434 override void AddWet(
float value)
9435 {
9437 }
9438
9440 {
9442 }
9443
9445 {
9447 }
9448
9450 {
9452 }
9453
9455 {
9457 }
9458
9460 {
9462 }
9463
9465 {
9468 if (newLevel != oldLevel)
9469 {
9471 }
9472 }
9473
9475 {
9476 SetWeightDirty();
9477 }
9478
9480 {
9481 return GetWetLevelInternal(
m_VarWet);
9482 }
9483
9484
9485
9487 {
9489 }
9490
9492 {
9494 }
9495
9497 {
9499 }
9500
9502 {
9504 }
9505
9506
9507
9509 {
9510 if (ConfigIsExisting("itemModelLength"))
9511 {
9512 return ConfigGetFloat("itemModelLength");
9513 }
9514 return 0;
9515 }
9516
9518 {
9519 if (ConfigIsExisting("itemAttachOffset"))
9520 {
9521 return ConfigGetFloat("itemAttachOffset");
9522 }
9523 return 0;
9524 }
9525
9526 override void SetCleanness(
int value,
bool allow_client =
false)
9527 {
9528 if (!IsServerCheck(allow_client))
9529 return;
9530
9532
9534
9537 }
9538
9540 {
9542 }
9543
9545 {
9546 return true;
9547 }
9548
9549
9550
9551
9553 {
9555 }
9556
9558 {
9560 }
9561
9562
9563
9564
9565 override void SetColor(
int r,
int g,
int b,
int a)
9566 {
9572 }
9574 override void GetColor(out
int r,out
int g,out
int b,out
int a)
9575 {
9580 }
9581
9583 {
9585 }
9586
9589 {
9590 int r,g,b,a;
9592 r = r/255;
9593 g = g/255;
9594 b = b/255;
9595 a = a/255;
9596 return MiscGameplayFunctions.GetColorString(r, g, b, a);
9597 }
9598
9599
9600
9601 override void SetLiquidType(
int value,
bool allow_client =
false)
9602 {
9603 if (!IsServerCheck(allow_client))
9604 return;
9605
9610 }
9611
9613 {
9614 return ConfigGetInt("varLiquidTypeInit");
9615 }
9616
9618 {
9620 }
9621
9623 {
9625 SetFrozen(false);
9626 }
9627
9630 {
9631 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9632 }
9633
9634
9637 {
9638 PlayerBase nplayer;
9639 if (PlayerBase.CastTo(nplayer, player))
9640 {
9642
9643 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9644 }
9645 }
9646
9647
9650 {
9651 PlayerBase nplayer;
9652 if (PlayerBase.CastTo(nplayer,player))
9653 {
9654
9655 nplayer.SetEnableQuickBarEntityShortcut(this,false);
9656
9657 }
9658
9659
9660 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
9661
9662
9663 if (HasEnergyManager())
9664 {
9665 GetCompEM().UpdatePlugState();
9666 }
9667 }
9668
9669
9671 {
9672 super.OnPlacementStarted(player);
9673
9675 }
9676
9677 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
9678 {
9680 {
9681 m_AdminLog.OnPlacementComplete(player,
this);
9682 }
9683
9684 super.OnPlacementComplete(player, position, orientation);
9685 }
9686
9687
9688
9689
9690
9692 {
9694 {
9695 return true;
9696 }
9697 else
9698 {
9699 return false;
9700 }
9701 }
9702
9703
9705 {
9707 {
9709 }
9710 }
9711
9712
9714 {
9716 }
9717
9719 {
9721 }
9722
9723 override void InsertAgent(
int agent,
float count = 1)
9724 {
9725 if (count < 1)
9726 return;
9727
9729 }
9730
9733 {
9735 }
9736
9737
9739 {
9741 }
9742
9743
9744
9745
9746
9747
9748
9749
9750
9751
9752
9753
9754
9755
9756
9757
9758
9759
9760
9761
9762
9763
9764
9765
9766
9767
9768
9769
9770
9771
9772
9773
9774
9775
9776
9777
9778
9779
9780
9781
9782
9783
9785 {
9787 return false;
9788 return true;
9789 }
9790
9792 {
9793
9795 }
9796
9797
9800 {
9801 super.CheckForRoofLimited(timeTresholdMS);
9802
9804 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
9805 {
9806 m_PreviousRoofTestTime = time;
9807 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
9808 }
9809 }
9810
9811
9813 {
9815 {
9816 return 0;
9817 }
9818
9819 if (GetInventory().GetAttachmentSlotsCount() != 0)
9820 {
9821 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
9822 if (filter)
9823 return filter.GetProtectionLevel(type, false, system);
9824 else
9825 return 0;
9826 }
9827
9828 string subclassPath, entryName;
9829
9830 switch (type)
9831 {
9833 entryName = "biological";
9834 break;
9836 entryName = "chemical";
9837 break;
9838 default:
9839 entryName = "biological";
9840 break;
9841 }
9842
9843 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
9844
9846 }
9847
9848
9849
9852 {
9853 if (!IsMagazine())
9855
9857 }
9858
9859
9860
9861
9862
9867 {
9868 return true;
9869 }
9870
9872 {
9874 }
9875
9876
9877
9878
9879
9881 {
9882 if (parent)
9883 {
9884 if (parent.IsInherited(DayZInfected))
9885 return true;
9886
9887 if (!parent.IsRuined())
9888 return true;
9889 }
9890
9891 return true;
9892 }
9893
9895 {
9896 if (!super.CanPutAsAttachment(parent))
9897 {
9898 return false;
9899 }
9900
9901 if (!IsRuined() && !parent.IsRuined())
9902 {
9903 return true;
9904 }
9905
9906 return false;
9907 }
9908
9910 {
9911
9912
9913
9914
9915 return super.CanReceiveItemIntoCargo(item);
9916 }
9917
9919 {
9920
9921
9922
9923
9924 GameInventory attachmentInv = attachment.GetInventory();
9926 {
9927 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
9928 return false;
9929 }
9930
9931 InventoryLocation loc = new InventoryLocation();
9932 attachment.GetInventory().GetCurrentInventoryLocation(loc);
9933 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
9934 return false;
9935
9936 return super.CanReceiveAttachment(attachment, slotId);
9937 }
9938
9940 {
9941 if (!super.CanReleaseAttachment(attachment))
9942 return false;
9943
9944 return GetInventory().AreChildrenAccessible();
9945 }
9946
9947
9948
9949
9950
9951
9952
9953
9954
9955
9956
9957
9958
9959
9960
9961
9962
9963
9964
9965
9966
9968 {
9969 int id = muzzle_owner.GetMuzzleID();
9970 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
9971
9972 if (WPOF_array)
9973 {
9974 for (int i = 0; i < WPOF_array.Count(); i++)
9975 {
9976 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
9977
9978 if (WPOF)
9979 {
9980 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
9981 }
9982 }
9983 }
9984 }
9985
9986
9988 {
9989 int id = muzzle_owner.GetMuzzleID();
9991
9992 if (WPOBE_array)
9993 {
9994 for (int i = 0; i < WPOBE_array.Count(); i++)
9995 {
9996 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
9997
9998 if (WPOBE)
9999 {
10000 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10001 }
10002 }
10003 }
10004 }
10005
10006
10008 {
10009 int id = muzzle_owner.GetMuzzleID();
10010 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10011
10012 if (WPOOH_array)
10013 {
10014 for (int i = 0; i < WPOOH_array.Count(); i++)
10015 {
10016 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10017
10018 if (WPOOH)
10019 {
10020 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10021 }
10022 }
10023 }
10024 }
10025
10026
10028 {
10029 int id = muzzle_owner.GetMuzzleID();
10030 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10031
10032 if (WPOOH_array)
10033 {
10034 for (int i = 0; i < WPOOH_array.Count(); i++)
10035 {
10036 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10037
10038 if (WPOOH)
10039 {
10040 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10041 }
10042 }
10043 }
10044 }
10045
10046
10048 {
10049 int id = muzzle_owner.GetMuzzleID();
10050 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10051
10052 if (WPOOH_array)
10053 {
10054 for (int i = 0; i < WPOOH_array.Count(); i++)
10055 {
10056 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10057
10058 if (WPOOH)
10059 {
10060 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10061 }
10062 }
10063 }
10064 }
10065
10066
10067
10069 {
10071 {
10072 return true;
10073 }
10074
10075 return false;
10076 }
10077
10079 {
10081 {
10082 return true;
10083 }
10084
10085 return false;
10086 }
10087
10089 {
10091 {
10092 return true;
10093 }
10094
10095 return false;
10096 }
10097
10099 {
10100 return false;
10101 }
10102
10105 {
10106 return UATimeSpent.DEFAULT_DEPLOY;
10107 }
10108
10109
10110
10111
10113 {
10115 SetSynchDirty();
10116 }
10117
10119 {
10121 }
10122
10123
10125 {
10126 return false;
10127 }
10128
10131 {
10132 string att_type = "None";
10133
10134 if (ConfigIsExisting("soundAttType"))
10135 {
10136 att_type = ConfigGetString("soundAttType");
10137 }
10138
10140 }
10141
10143 {
10145 }
10146
10147
10148
10149
10150
10156
10158 {
10161
10163 }
10164
10165
10167 {
10169 return;
10170
10172
10175
10178
10179 SoundParameters params = new SoundParameters();
10183 }
10184
10185
10187 {
10189 return;
10190
10192 SetSynchDirty();
10193
10196 }
10197
10198
10200 {
10202 return;
10203
10205 SetSynchDirty();
10206
10209 }
10210
10212 {
10214 }
10215
10217 {
10219 }
10220
10223 {
10224 if (!
GetGame().IsDedicatedServer())
10225 {
10226 if (ConfigIsExisting("attachSoundSet"))
10227 {
10228 string cfg_path = "";
10229 string soundset = "";
10230 string type_name =
GetType();
10231
10234 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
10235 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
10236
10237 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
10238 {
10239 for (int i = 0; i < cfg_soundset_array.Count(); i++)
10240 {
10241 if (cfg_slot_array[i] == slot_type)
10242 {
10243 soundset = cfg_soundset_array[i];
10244 break;
10245 }
10246 }
10247 }
10248
10249 if (soundset != "")
10250 {
10251 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
10253 }
10254 }
10255 }
10256 }
10257
10259 {
10260
10261 }
10262
10263 void OnApply(PlayerBase player);
10264
10266 {
10267 return 1.0;
10268 };
10269
10271 {
10273 }
10274
10276 {
10278 }
10279
10281
10283 {
10284 SetDynamicPhysicsLifeTime(0.01);
10286 }
10287
10289 {
10290 array<string> zone_names = new array<string>;
10291 GetDamageZones(zone_names);
10292 for (int i = 0; i < zone_names.Count(); i++)
10293 {
10294 SetHealthMax(zone_names.Get(i),"Health");
10295 }
10296 SetHealthMax("","Health");
10297 }
10298
10301 {
10302 float global_health = GetHealth01("","Health");
10303 array<string> zones = new array<string>;
10304 GetDamageZones(zones);
10305
10306 for (int i = 0; i < zones.Count(); i++)
10307 {
10308 SetHealth01(zones.Get(i),"Health",global_health);
10309 }
10310 }
10311
10314 {
10315 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
10316 }
10317
10319 {
10320 if (!hasRootAsPlayer)
10321 {
10322 if (refParentIB)
10323 {
10324
10325 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
10326 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
10327
10328 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
10329 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
10330
10333 }
10334 else
10335 {
10336
10339 }
10340 }
10341 }
10342
10344 {
10346 {
10347 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
10348 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
10349 {
10350 float heatPermCoef = 1.0;
10352 while (ent)
10353 {
10354 heatPermCoef *= ent.GetHeatPermeabilityCoef();
10355 ent = ent.GetHierarchyParent();
10356 }
10357
10358 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
10359 }
10360 }
10361 }
10362
10364 {
10365
10366 EntityAI parent = GetHierarchyParent();
10367 if (!parent)
10368 {
10369 hasParent = false;
10370 hasRootAsPlayer = false;
10371 }
10372 else
10373 {
10374 hasParent = true;
10375 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
10376 refParentIB =
ItemBase.Cast(parent);
10377 }
10378 }
10379
10380 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
10381 {
10382
10383 }
10384
10386 {
10387
10388 return false;
10389 }
10390
10392 {
10393
10394
10395 return false;
10396 }
10397
10399 {
10400
10401 return false;
10402 }
10403
10406 {
10407 return !GetIsFrozen() &&
IsOpen();
10408 }
10409
10411 {
10412 bool hasParent = false, hasRootAsPlayer = false;
10414
10415 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
10416 bool foodDecay =
g_Game.IsFoodDecayEnabled();
10417
10418 if (wwtu || foodDecay)
10419 {
10423
10424 if (processWetness || processTemperature || processDecay)
10425 {
10427
10428 if (processWetness)
10429 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
10430
10431 if (processTemperature)
10433
10434 if (processDecay)
10435 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
10436 }
10437 }
10438 }
10439
10442 {
10444 }
10445
10447 {
10450
10451 return super.GetTemperatureFreezeThreshold();
10452 }
10453
10455 {
10458
10459 return super.GetTemperatureThawThreshold();
10460 }
10461
10463 {
10466
10467 return super.GetItemOverheatThreshold();
10468 }
10469
10471 {
10473 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
10474
10475 return super.GetTemperatureFreezeTime();
10476 }
10477
10479 {
10481 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
10482
10483 return super.GetTemperatureThawTime();
10484 }
10485
10490
10492 {
10493 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
10494 }
10495
10497 {
10498 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
10499 }
10500
10503 {
10505 }
10506
10508 {
10510 }
10511
10513 {
10515 }
10516
10519 {
10520 return null;
10521 }
10522
10525 {
10526 return false;
10527 }
10528
10530 {
10532 {
10535 if (!trg)
10536 {
10538 explosive = this;
10539 }
10540
10541 explosive.PairRemote(trg);
10543
10544 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
10545 trg.SetPersistentPairID(persistentID);
10546 explosive.SetPersistentPairID(persistentID);
10547
10548 return true;
10549 }
10550 return false;
10551 }
10552
10555 {
10556 float ret = 1.0;
10559 ret *= GetHealth01();
10560
10561 return ret;
10562 }
10563
10564 #ifdef DEVELOPER
10565 override void SetDebugItem()
10566 {
10567 super.SetDebugItem();
10568 _itemBase = this;
10569 }
10570
10572 {
10573 string text = super.GetDebugText();
10574
10576 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
10577
10578 return text;
10579 }
10580 #endif
10581
10583 {
10584 return true;
10585 }
10586
10588
10590
10592 {
10595 }
10596
10597
10605
10621}
10622
10624{
10626 if (entity)
10627 {
10628 bool is_item = entity.IsInherited(
ItemBase);
10629 if (is_item && full_quantity)
10630 {
10633 }
10634 }
10635 else
10636 {
10638 return NULL;
10639 }
10640 return entity;
10641}
10642
10644{
10645 if (item)
10646 {
10647 if (health > 0)
10648 item.SetHealth("", "", health);
10649
10650 if (item.CanHaveTemperature())
10651 {
10653 if (item.CanFreeze())
10654 item.SetFrozen(false);
10655 }
10656
10657 if (item.HasEnergyManager())
10658 {
10659 if (quantity >= 0)
10660 {
10661 item.GetCompEM().SetEnergy0To1(quantity);
10662 }
10663 else
10664 {
10666 }
10667 }
10668 else if (item.IsMagazine())
10669 {
10670 Magazine mag = Magazine.Cast(item);
10671 if (quantity >= 0)
10672 {
10673 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
10674 }
10675 else
10676 {
10678 }
10679
10680 }
10681 else
10682 {
10683 if (quantity >= 0)
10684 {
10685 item.SetQuantityNormalized(quantity, false);
10686 }
10687 else
10688 {
10690 }
10691
10692 }
10693 }
10694}
10695
10696#ifdef DEVELOPER
10698#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.