5778{
5780 {
5781 return true;
5782 }
5783};
5784
5785
5786
5788{
5792
5794
5797
5798
5799
5800
5801
5810
5816
5821
5826
5847 protected bool m_IsResultOfSplit
5848
5850
5855
5856
5857
5859
5863
5864
5865
5867
5870
5871
5872
5878
5879
5887
5890
5891
5893
5894
5896
5897
5902
5903
5908
5909
5911
5912
5914 {
5919
5920 if (!
GetGame().IsDedicatedServer())
5921 {
5923 {
5925
5927 {
5929 }
5930 }
5931
5934 }
5935
5936 m_OldLocation = null;
5937
5939 {
5941 }
5942
5943 if (ConfigIsExisting("headSelectionsToHide"))
5944 {
5947 }
5948
5950 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
5951 {
5953 }
5954
5956
5957 m_IsResultOfSplit = false;
5958
5960 }
5961
5963 {
5964 super.InitItemVariables();
5965
5971 m_Count = ConfigGetInt(
"count");
5972
5975
5980
5983
5988
6000
6004
6005
6008 if (ConfigIsExisting("canBeSplit"))
6009 {
6012 }
6013
6015 if (ConfigIsExisting("itemBehaviour"))
6017
6018
6021 RegisterNetSyncVariableInt("m_VarLiquidType");
6022 RegisterNetSyncVariableInt("m_Cleanness",0,1);
6023
6024 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
6025 RegisterNetSyncVariableFloat("m_ImpactSpeed");
6026 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
6027
6028 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
6029 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
6030 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
6031 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
6032
6033 RegisterNetSyncVariableBool("m_IsBeingPlaced");
6034 RegisterNetSyncVariableBool("m_IsTakeable");
6035 RegisterNetSyncVariableBool("m_IsHologram");
6036
6039 {
6042 }
6043
6045
6047 if (ConfigIsExisting("temperaturePerQuantityWeight"))
6049
6050 }
6051
6053 {
6055 }
6056
6058 {
6061 {
6066 }
6067 }
6068
6069 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
6070 {
6072 {
6075 }
6076
6078 }
6079
6081 {
6087 }
6088
6090
6092 {
6094
6095 if (!action)
6096 {
6097 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
6098 return;
6099 }
6100
6102 if (!ai)
6103 {
6105 return;
6106 }
6107
6109 if (!action_array)
6110 {
6111 action_array = new array<ActionBase_Basic>;
6113 }
6114 if (LogManager.IsActionLogEnable())
6115 {
6116 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
6117 }
6118
6119 if (action_array.Find(action) != -1)
6120 {
6121 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
6122 }
6123 else
6124 {
6125 action_array.Insert(action);
6126 }
6127 }
6128
6130 {
6132 ActionBase action = player.GetActionManager().GetAction(actionName);
6135
6136 if (action_array)
6137 {
6138 action_array.RemoveItem(action);
6139 }
6140 }
6141
6142
6143
6145 {
6146 ActionOverrideData overrideData = new ActionOverrideData();
6150
6152 if (!actionMap)
6153 {
6156 }
6157
6158 actionMap.Insert(this.
Type(), overrideData);
6159
6160 }
6161
6163
6165
6166
6168 {
6171
6174
6175 string config_to_search = "CfgVehicles";
6176 string muzzle_owner_config;
6177
6179 {
6180 if (IsInherited(Weapon))
6181 config_to_search = "CfgWeapons";
6182
6183 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6184
6185 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
6186
6188
6189 if (config_OnFire_subclass_count > 0)
6190 {
6191 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
6192
6193 for (int i = 0; i < config_OnFire_subclass_count; i++)
6194 {
6195 string particle_class = "";
6197 string config_OnFire_entry = config_OnFire_class + particle_class;
6198 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
6199 WPOF_array.Insert(WPOF);
6200 }
6201
6202
6204 }
6205 }
6206
6208 {
6209 config_to_search = "CfgWeapons";
6210 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6211
6212 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
6213
6215
6216 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
6217 {
6218 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
6219
6220 for (i = 0; i < config_OnBulletCasingEject_count; i++)
6221 {
6222 string particle_class2 = "";
6224 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
6225 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
6226 WPOBE_array.Insert(WPOBE);
6227 }
6228
6229
6231 }
6232 }
6233 }
6234
6235
6237 {
6240
6242 {
6243 string config_to_search = "CfgVehicles";
6244
6245 if (IsInherited(Weapon))
6246 config_to_search = "CfgWeapons";
6247
6248 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6249 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
6250
6251 if (
GetGame().ConfigIsExisting(config_OnOverheating_class))
6252 {
6253
6255
6257 {
6259 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
6261 return;
6262 }
6263
6266
6267
6268
6270 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
6271
6272 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
6273 {
6274 string particle_class = "";
6276 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
6278
6279 if (entry_type == CT_CLASS)
6280 {
6281 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
6282 WPOOH_array.Insert(WPOF);
6283 }
6284 }
6285
6286
6288 }
6289 }
6290 }
6291
6293 {
6295 }
6296
6298 {
6300 {
6302
6305
6308
6309 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6310 }
6311 }
6312
6314 {
6316 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6317
6319 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6320
6322 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6323
6325 {
6327 }
6328 }
6329
6331 {
6333 }
6334
6336 {
6339 else
6341
6343 {
6346 }
6347 else
6348 {
6351
6354 }
6355
6357 }
6358
6360 {
6362 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6363 }
6364
6366 {
6368 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6370 }
6371
6373 {
6375 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6376 }
6377
6379 {
6382
6383 OverheatingParticle OP = new OverheatingParticle();
6388
6390 }
6391
6393 {
6396
6397 return -1;
6398 }
6399
6401 {
6403 {
6406
6407 for (int i = count; i > 0; --i)
6408 {
6409 int id = i - 1;
6412
6415
6416 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
6417 {
6418 if (p)
6419 {
6422 }
6423 }
6424 }
6425 }
6426 }
6427
6429 {
6431 {
6433 {
6434 int id = i - 1;
6436
6437 if (OP)
6438 {
6440
6441 if (p)
6442 {
6444 }
6445
6446 delete OP;
6447 }
6448 }
6449
6452 }
6453 }
6454
6457 {
6458 return 0.0;
6459 }
6460
6461
6463 {
6464 return 250;
6465 }
6466
6468 {
6469 return 0;
6470 }
6471
6474 {
6476 return true;
6477
6478 return false;
6479 }
6480
6483 {
6486
6488 {
6490 }
6491 else
6492 {
6493
6495 }
6496
6498 }
6499
6506 {
6507 return -1;
6508 }
6509
6510
6511
6512
6514 {
6516 {
6518 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6519
6520 if (r_index >= 0)
6521 {
6522 InventoryLocation r_il = new InventoryLocation;
6523 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6524
6525 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6528 {
6529 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6530 }
6532 {
6533 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6534 }
6535
6536 }
6537
6538 player.GetHumanInventory().ClearUserReservedLocation(this);
6539 }
6540
6543 }
6544
6545
6546
6547
6549 {
6550 return ItemBase.m_DebugActionsMask;
6551 }
6552
6554 {
6555 return ItemBase.m_DebugActionsMask & mask;
6556 }
6557
6559 {
6560 ItemBase.m_DebugActionsMask = mask;
6561 }
6562
6564 {
6565 ItemBase.m_DebugActionsMask |= mask;
6566 }
6567
6569 {
6570 ItemBase.m_DebugActionsMask &= ~mask;
6571 }
6572
6574 {
6576 {
6578 }
6579 else
6580 {
6582 }
6583 }
6584
6585
6587 {
6588 if (GetEconomyProfile())
6589 {
6590 float q_max = GetEconomyProfile().GetQuantityMax();
6591 if (q_max > 0)
6592 {
6593 float q_min = GetEconomyProfile().GetQuantityMin();
6594 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
6595
6597 {
6598 ComponentEnergyManager comp = GetCompEM();
6600 {
6602 }
6603 }
6605 {
6607
6608 }
6609
6610 }
6611 }
6612 }
6613
6616 {
6617 EntityAI parent = GetHierarchyParent();
6618
6619 if (parent)
6620 {
6621 InventoryLocation inventory_location_to_lock = new InventoryLocation;
6622 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
6623 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
6624 }
6625 }
6626
6629 {
6630 EntityAI parent = GetHierarchyParent();
6631
6632 if (parent)
6633 {
6634 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
6635 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
6636 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
6637 }
6638 }
6639
6641 {
6642
6643
6644
6645
6647
6649 {
6650 if (ScriptInputUserData.CanStoreInputUserData())
6651 {
6652 ScriptInputUserData ctx = new ScriptInputUserData;
6658 ctx.
Write(use_stack_max);
6661
6663 {
6664 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
6665 }
6666 }
6667 }
6668 else if (!
GetGame().IsMultiplayer())
6669 {
6671 }
6672 }
6673
6675 {
6677 }
6678
6680 {
6682 }
6683
6685 {
6687 }
6688
6690 {
6691
6692 return false;
6693 }
6694
6696 {
6697 return false;
6698 }
6699
6703 {
6704 return false;
6705 }
6706
6708 {
6709 return "";
6710 }
6711
6713
6715 {
6716 return false;
6717 }
6718
6720 {
6721 return true;
6722 }
6723
6724
6725
6727 {
6728 return true;
6729 }
6730
6732 {
6733 return true;
6734 }
6735
6737 {
6738 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6740 }
6741
6743 {
6745 }
6746
6748 {
6750 if (!is_being_placed)
6752 SetSynchDirty();
6753 }
6754
6755
6757
6759 {
6761 }
6762
6764 {
6766 }
6767
6769 {
6770 return 1;
6771 }
6772
6774 {
6775 return false;
6776 }
6777
6779 {
6781 SetSynchDirty();
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
6813
6814
6815
6816
6817
6819 {
6820 super.OnMovedInsideCargo(container);
6821
6822 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6823 }
6824
6825 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
6826 {
6827 super.EEItemLocationChanged(oldLoc,newLoc);
6828
6829 PlayerBase new_player = null;
6830 PlayerBase old_player = null;
6831
6832 if (newLoc.GetParent())
6833 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
6834
6835 if (oldLoc.GetParent())
6836 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
6837
6839 {
6840 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
6841
6842 if (r_index >= 0)
6843 {
6844 InventoryLocation r_il = new InventoryLocation;
6845 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6846
6847 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6850 {
6851 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6852 }
6854 {
6855 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6856 }
6857
6858 }
6859 }
6860
6862 {
6863 if (new_player)
6864 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
6865
6866 if (new_player == old_player)
6867 {
6868
6869 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
6870 {
6872 {
6873 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
6874 {
6875 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6876 }
6877 }
6878 else
6879 {
6880 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6881 }
6882 }
6883
6884 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
6885 {
6886 int type = oldLoc.GetType();
6888 {
6889 oldLoc.GetParent().GetOnSetLock().Invoke(this);
6890 }
6892 {
6893 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
6894 }
6895 }
6896 if (!m_OldLocation)
6897 {
6898 m_OldLocation = new InventoryLocation;
6899 }
6900 m_OldLocation.Copy(oldLoc);
6901 }
6902 else
6903 {
6904 if (m_OldLocation)
6905 {
6906 m_OldLocation.Reset();
6907 }
6908 }
6909
6911 }
6912 else
6913 {
6914 if (new_player)
6915 {
6916 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
6917 if (res_index >= 0)
6918 {
6919 InventoryLocation il = new InventoryLocation;
6920 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
6922 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
6925 {
6926 il.
GetParent().GetOnReleaseLock().Invoke(it);
6927 }
6929 {
6931 }
6932
6933 }
6934 }
6936 {
6937
6939 }
6940
6941 if (m_OldLocation)
6942 {
6943 m_OldLocation.Reset();
6944 }
6945 }
6946 }
6947
6948 override void EOnContact(IEntity other, Contact extra)
6949 {
6951 {
6952 int liquidType = -1;
6954 if (impactSpeed > 0.0)
6955 {
6957 #ifndef SERVER
6959 #else
6961 SetSynchDirty();
6962 #endif
6964 }
6965 }
6966
6967 #ifdef SERVER
6968 if (GetCompEM() && GetCompEM().IsPlugged())
6969 {
6970 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
6971 GetCompEM().UnplugThis();
6972 }
6973 #endif
6974 }
6975
6977
6979 {
6981 }
6982
6984 {
6985
6986 }
6987
6989 {
6990 super.OnItemLocationChanged(old_owner, new_owner);
6991
6992 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
6993 PlayerBase playerNew = PlayerBase.Cast(new_owner);
6994
6995 if (!relatedPlayer && playerNew)
6996 relatedPlayer = playerNew;
6997
6998 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
6999 {
7001 if (actionMgr)
7002 {
7003 ActionBase currentAction = actionMgr.GetRunningAction();
7004 if (currentAction)
7006 }
7007 }
7008
7009 Man ownerPlayerOld = null;
7010 Man ownerPlayerNew = null;
7011
7012 if (old_owner)
7013 {
7014 if (old_owner.
IsMan())
7015 {
7016 ownerPlayerOld = Man.Cast(old_owner);
7017 }
7018 else
7019 {
7020 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
7021 }
7022 }
7023 else
7024 {
7026 {
7028
7029 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
7030 {
7031 GetCompEM().UnplugThis();
7032 }
7033 }
7034 }
7035
7036 if (new_owner)
7037 {
7038 if (new_owner.
IsMan())
7039 {
7040 ownerPlayerNew = Man.Cast(new_owner);
7041 }
7042 else
7043 {
7044 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
7045 }
7046 }
7047
7048 if (ownerPlayerOld != ownerPlayerNew)
7049 {
7050 if (ownerPlayerOld)
7051 {
7052 array<EntityAI> subItemsExit = new array<EntityAI>;
7054 for (int i = 0; i < subItemsExit.Count(); i++)
7055 {
7058 }
7059 }
7060
7061 if (ownerPlayerNew)
7062 {
7063 array<EntityAI> subItemsEnter = new array<EntityAI>;
7065 for (int j = 0; j < subItemsEnter.Count(); j++)
7066 {
7069 }
7070 }
7071 }
7072 else if (ownerPlayerNew != null)
7073 {
7074 PlayerBase nplayer;
7075 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
7076 {
7077 array<EntityAI> subItemsUpdate = new array<EntityAI>;
7079 for (int k = 0; k < subItemsUpdate.Count(); k++)
7080 {
7082 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
7083 }
7084 }
7085 }
7086
7087 if (old_owner)
7088 old_owner.OnChildItemRemoved(this);
7089 if (new_owner)
7090 new_owner.OnChildItemReceived(this);
7091 }
7092
7093
7095 {
7096 super.EEDelete(parent);
7097 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
7098 if (player)
7099 {
7101
7102 if (player.IsAlive())
7103 {
7104 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7105 if (r_index >= 0)
7106 {
7107 InventoryLocation r_il = new InventoryLocation;
7108 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7109
7110 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7113 {
7114 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7115 }
7117 {
7118 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7119 }
7120
7121 }
7122
7123 player.RemoveQuickBarEntityShortcut(this);
7124 }
7125 }
7126 }
7127
7129 {
7130 super.EEKilled(killer);
7131
7134 {
7135 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
7136 {
7137 if (IsMagazine())
7138 {
7139 if (Magazine.Cast(this).GetAmmoCount() > 0)
7140 {
7142 }
7143 }
7144 else
7145 {
7147 }
7148 }
7149 }
7150 }
7151
7153 {
7154 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7155
7156 super.OnWasAttached(parent, slot_id);
7157
7160
7162 }
7163
7165 {
7166 super.OnWasDetached(parent, slot_id);
7167
7170 }
7171
7173 {
7174 int idx;
7177
7178 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7179 if (inventory_slots.Count() < 1)
7180 {
7181 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
7182 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
7183 }
7184 else
7185 {
7186 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
7187 }
7188
7189 idx = inventory_slots.Find(slot);
7190 if (idx < 0)
7191 return "";
7192
7193 return attach_types.Get(idx);
7194 }
7195
7197 {
7198 int idx = -1;
7199 string slot;
7200
7203
7204 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7205 if (inventory_slots.Count() < 1)
7206 {
7207 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
7208 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7209 }
7210 else
7211 {
7212 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
7213 if (detach_types.Count() < 1)
7214 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7215 }
7216
7217 for (int i = 0; i < inventory_slots.Count(); i++)
7218 {
7219 slot = inventory_slots.Get(i);
7220 }
7221
7222 if (slot != "")
7223 {
7224 if (detach_types.Count() == 1)
7225 idx = 0;
7226 else
7227 idx = inventory_slots.Find(slot);
7228 }
7229 if (idx < 0)
7230 return "";
7231
7232 return detach_types.Get(idx);
7233 }
7234
7236 {
7237
7239
7240
7241 float min_time = 1;
7242 float max_time = 3;
7243 float delay = Math.RandomFloat(min_time, max_time);
7244
7245 explode_timer.Run(delay, this, "DoAmmoExplosion");
7246 }
7247
7249 {
7250 Magazine magazine = Magazine.Cast(this);
7251 int pop_sounds_count = 6;
7252 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
7253
7254
7255 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
7256 string sound_name = pop_sounds[ sound_idx ];
7258
7259
7260 magazine.ServerAddAmmoCount(-1);
7261
7262
7263 float min_temp_to_explode = 100;
7264
7265 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
7266 {
7268 }
7269 }
7270
7271
7272 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
7273 {
7274 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
7275
7276 const int CHANCE_DAMAGE_CARGO = 4;
7277 const int CHANCE_DAMAGE_ATTACHMENT = 1;
7278 const int CHANCE_DAMAGE_NOTHING = 2;
7279
7281 {
7282 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
7283 int chances;
7284 int rnd;
7285
7286 if (GetInventory().GetCargo())
7287 {
7288 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7289 rnd = Math.RandomInt(0,chances);
7290
7291 if (rnd < CHANCE_DAMAGE_CARGO)
7292 {
7294 }
7295 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
7296 {
7298 }
7299 }
7300 else
7301 {
7302 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7303 rnd = Math.RandomInt(0,chances);
7304
7305 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
7306 {
7308 }
7309 }
7310 }
7311 }
7312
7314 {
7315 if (GetInventory().GetCargo())
7316 {
7317 int item_count = GetInventory().GetCargo().GetItemCount();
7318 if (item_count > 0)
7319 {
7320 int random_pick = Math.RandomInt(0, item_count);
7322 if (!item.IsExplosive())
7323 {
7324 item.AddHealth("","",damage);
7325 return true;
7326 }
7327 }
7328 }
7329 return false;
7330 }
7331
7333 {
7334 int attachment_count = GetInventory().AttachmentCount();
7335 if (attachment_count > 0)
7336 {
7337 int random_pick = Math.RandomInt(0, attachment_count);
7338 ItemBase attachment =
ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
7339 if (!attachment.IsExplosive())
7340 {
7341 attachment.AddHealth("","",damage);
7342 return true;
7343 }
7344 }
7345 return false;
7346 }
7347
7349 {
7351 }
7352
7354 {
7356 return GetInventory().CanRemoveEntity();
7357
7358 return false;
7359 }
7360
7362 {
7363
7365 return false;
7366
7367
7369 return false;
7370
7371
7372
7374 if (delta == 0)
7375 return false;
7376
7377
7378 return true;
7379 }
7380
7382 {
7384 {
7385 if (ScriptInputUserData.CanStoreInputUserData())
7386 {
7387 ScriptInputUserData ctx = new ScriptInputUserData;
7392 ctx.
Write(destination_entity);
7396 }
7397 }
7398 else if (!
GetGame().IsMultiplayer())
7399 {
7401 }
7402 }
7403
7405 {
7406 float split_quantity_new;
7410 InventoryLocation loc = new InventoryLocation;
7411
7412 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7413 {
7415 split_quantity_new = stack_max;
7416 else
7418
7420 {
7421 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7422 if (new_item)
7423 {
7424 new_item.SetResultOfSplit(true);
7425 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7427 new_item.
SetQuantity(split_quantity_new,
false,
true);
7428 }
7429 }
7430 }
7431 else if (destination_entity && slot_id == -1)
7432 {
7433 if (quantity > stack_max)
7434 split_quantity_new = stack_max;
7435 else
7436 split_quantity_new = quantity;
7437
7439 {
7441 {
7444 }
7445
7446 if (new_item)
7447 {
7448 new_item.SetResultOfSplit(true);
7449 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7451 new_item.
SetQuantity(split_quantity_new,
false,
true);
7452 }
7453 }
7454 }
7455 else
7456 {
7457 if (stack_max != 0)
7458 {
7460 {
7462 }
7463
7464 if (split_quantity_new == 0)
7465 {
7466 if (!
GetGame().IsMultiplayer())
7467 player.PhysicalPredictiveDropItem(this);
7468 else
7469 player.ServerDropEntity(this);
7470 return;
7471 }
7472
7474 {
7476
7477 if (new_item)
7478 {
7479 new_item.SetResultOfSplit(true);
7480 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7483 new_item.PlaceOnSurface();
7484 }
7485 }
7486 }
7487 }
7488 }
7489
7491 {
7492 float split_quantity_new;
7496 InventoryLocation loc = new InventoryLocation;
7497
7498 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7499 {
7501 split_quantity_new = stack_max;
7502 else
7504
7506 {
7507 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7508 if (new_item)
7509 {
7510 new_item.SetResultOfSplit(true);
7511 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7513 new_item.
SetQuantity(split_quantity_new,
false,
true);
7514 }
7515 }
7516 }
7517 else if (destination_entity && slot_id == -1)
7518 {
7519 if (quantity > stack_max)
7520 split_quantity_new = stack_max;
7521 else
7522 split_quantity_new = quantity;
7523
7525 {
7527 {
7530 }
7531
7532 if (new_item)
7533 {
7534 new_item.SetResultOfSplit(true);
7535 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7537 new_item.
SetQuantity(split_quantity_new,
false,
true);
7538 }
7539 }
7540 }
7541 else
7542 {
7543 if (stack_max != 0)
7544 {
7546 {
7548 }
7549
7551 {
7553
7554 if (new_item)
7555 {
7556 new_item.SetResultOfSplit(true);
7557 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7560 new_item.PlaceOnSurface();
7561 }
7562 }
7563 }
7564 }
7565 }
7566
7568 {
7570 {
7571 if (ScriptInputUserData.CanStoreInputUserData())
7572 {
7573 ScriptInputUserData ctx = new ScriptInputUserData;
7578 dst.WriteToContext(ctx);
7580 }
7581 }
7582 else if (!
GetGame().IsMultiplayer())
7583 {
7585 }
7586 }
7587
7589 {
7591 {
7592 if (ScriptInputUserData.CanStoreInputUserData())
7593 {
7594 ScriptInputUserData ctx = new ScriptInputUserData;
7599 ctx.
Write(destination_entity);
7605 }
7606 }
7607 else if (!
GetGame().IsMultiplayer())
7608 {
7610 }
7611 }
7612
7614 {
7616 }
7617
7619 {
7621 float split_quantity_new;
7623 if (dst.IsValid())
7624 {
7625 int slot_id = dst.GetSlot();
7627
7628 if (quantity > stack_max)
7629 split_quantity_new = stack_max;
7630 else
7631 split_quantity_new = quantity;
7632
7634 {
7636
7637 if (new_item)
7638 {
7639 new_item.SetResultOfSplit(true);
7640 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7642 new_item.
SetQuantity(split_quantity_new,
false,
true);
7643 }
7644
7645 return new_item;
7646 }
7647 }
7648
7649 return null;
7650 }
7651
7653 {
7655 float split_quantity_new;
7657 if (destination_entity)
7658 {
7660 if (quantity > stackable)
7661 split_quantity_new = stackable;
7662 else
7663 split_quantity_new = quantity;
7664
7666 {
7667 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
7668 if (new_item)
7669 {
7670 new_item.SetResultOfSplit(true);
7671 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7673 new_item.
SetQuantity(split_quantity_new,
false,
true);
7674 }
7675 }
7676 }
7677 }
7678
7680 {
7682 {
7683 if (ScriptInputUserData.CanStoreInputUserData())
7684 {
7685 ScriptInputUserData ctx = new ScriptInputUserData;
7690 ItemBase destination_entity =
this;
7691 ctx.
Write(destination_entity);
7695 }
7696 }
7697 else if (!
GetGame().IsMultiplayer())
7698 {
7700 }
7701 }
7702
7704 {
7706 float split_quantity_new;
7708 if (player)
7709 {
7711 if (quantity > stackable)
7712 split_quantity_new = stackable;
7713 else
7714 split_quantity_new = quantity;
7715
7717 {
7718 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
7719 new_item =
ItemBase.Cast(in_hands);
7720 if (new_item)
7721 {
7722 new_item.SetResultOfSplit(true);
7723 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7725 new_item.SetQuantity(split_quantity_new, false, true);
7726 }
7727 }
7728 }
7729 }
7730
7732 {
7734 float split_quantity_new = Math.Floor(quantity * 0.5);
7735
7737 return;
7738
7740
7741 if (new_item)
7742 {
7743 if (new_item.GetQuantityMax() < split_quantity_new)
7744 {
7745 split_quantity_new = new_item.GetQuantityMax();
7746 }
7747
7748 new_item.SetResultOfSplit(true);
7749 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7750
7752 {
7755 }
7756 else
7757 {
7759 new_item.
SetQuantity(split_quantity_new,
false,
true);
7760 }
7761 }
7762 }
7763
7765 {
7767 float split_quantity_new = Math.Floor(quantity / 2);
7768
7770 return;
7771
7772 InventoryLocation invloc = new InventoryLocation;
7774
7776 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
7777
7778 if (new_item)
7779 {
7780 if (new_item.GetQuantityMax() < split_quantity_new)
7781 {
7782 split_quantity_new = new_item.GetQuantityMax();
7783 }
7785 {
7788 }
7789 else if (split_quantity_new > 1)
7790 {
7792 new_item.
SetQuantity(split_quantity_new,
false,
true);
7793 }
7794 }
7795 }
7796
7799 {
7800 SetWeightDirty();
7802
7803 if (parent)
7804 parent.OnAttachmentQuantityChangedEx(this, delta);
7805
7807 {
7809 {
7811 }
7813 {
7814 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
7816 }
7817 }
7818
7819 }
7820
7823 {
7824
7825 }
7826
7829 {
7831 }
7832
7834 {
7835 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
7836
7838 {
7839 if (newLevel == GameConstants.STATE_RUINED)
7840 {
7842 EntityAI parent = GetHierarchyParent();
7843 if (parent && parent.IsFireplace())
7844 {
7845 CargoBase cargo = GetInventory().GetCargo();
7846 if (cargo)
7847 {
7849 {
7851 }
7852 }
7853 }
7854 }
7855
7857 {
7858
7860 return;
7861 }
7862
7863 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
7864 {
7866 }
7867 }
7868 }
7869
7870
7872 {
7873 super.OnRightClick();
7874
7876 {
7878 {
7879 if (ScriptInputUserData.CanStoreInputUserData())
7880 {
7881 EntityAI root = GetHierarchyRoot();
7882 Man playerOwner = GetHierarchyRootPlayer();
7883 InventoryLocation dst = new InventoryLocation;
7884
7885
7886 if (!playerOwner && root && root == this)
7887 {
7889 }
7890 else
7891 {
7892
7893 GetInventory().GetCurrentInventoryLocation(dst);
7895 {
7898 {
7900 }
7901 else
7902 {
7904
7905
7906 if (
GetGame().
GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
7907 {
7909 }
7910 else
7911 {
7912 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
7913 }
7914 }
7915 }
7916 }
7917
7918 ScriptInputUserData ctx = new ScriptInputUserData;
7926 }
7927 }
7928 else if (!
GetGame().IsMultiplayer())
7929 {
7931 }
7932 }
7933 }
7934
7936 {
7937 if (root)
7938 {
7939 vector m4[4];
7940 root.GetTransform(m4);
7941 dst.SetGround(this, m4);
7942 }
7943 else
7944 {
7945 GetInventory().GetCurrentInventoryLocation(dst);
7946 }
7947 }
7948
7949 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
7950 {
7951
7952 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
7953 return false;
7954
7955 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
7956 return false;
7957
7958
7960 return false;
7961
7962
7963 Magazine mag = Magazine.Cast(this);
7964 if (mag)
7965 {
7966 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
7967 return false;
7968
7969 if (stack_max_limit)
7970 {
7971 Magazine other_mag = Magazine.Cast(other_item);
7972 if (other_item)
7973 {
7974 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
7975 return false;
7976 }
7977
7978 }
7979 }
7980 else
7981 {
7982
7984 return false;
7985
7987 return false;
7988 }
7989
7990 PlayerBase player = null;
7991 if (CastTo(player, GetHierarchyRootPlayer()))
7992 {
7993 if (player.GetInventory().HasAttachment(this))
7994 return false;
7995
7996 if (player.IsItemsToDelete())
7997 return false;
7998 }
7999
8000 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
8001 return false;
8002
8003 int slotID;
8005 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
8006 return false;
8007
8008 return true;
8009 }
8010
8012 {
8014 }
8015
8017 {
8018 return m_IsResultOfSplit;
8019 }
8020
8022 {
8023 m_IsResultOfSplit = value;
8024 }
8025
8027 {
8029 }
8030
8032 {
8033 float other_item_quantity = other_item.GetQuantity();
8034 float this_free_space;
8035
8037
8039
8040 if (other_item_quantity > this_free_space)
8041 {
8042 return this_free_space;
8043 }
8044 else
8045 {
8046 return other_item_quantity;
8047 }
8048 }
8049
8051 {
8053 }
8054
8056 {
8058 return;
8059
8060 if (!IsMagazine() && other_item)
8061 {
8063 if (quantity_used != 0)
8064 {
8065 float hp1 = GetHealth01("","");
8066 float hp2 = other_item.GetHealth01("","");
8067 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
8068 hpResult = hpResult / (
GetQuantity() + quantity_used);
8069
8070 hpResult *= GetMaxHealth();
8071 Math.Round(hpResult);
8072 SetHealth("", "Health", hpResult);
8073
8075 other_item.AddQuantity(-quantity_used);
8076 }
8077 }
8079 }
8080
8082 {
8083 #ifdef SERVER
8084 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
8085 GetHierarchyParent().IncreaseLifetimeUp();
8086 #endif
8087 };
8088
8090 {
8091 PlayerBase p = PlayerBase.Cast(player);
8092
8093 array<int> recipesIds = p.m_Recipes;
8094 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8095 if (moduleRecipesManager)
8096 {
8097 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
8098 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
8099 }
8100
8101 for (int i = 0;i < recipesIds.Count(); i++)
8102 {
8103 int key = recipesIds.Get(i);
8104 string recipeName = moduleRecipesManager.GetRecipeName(key);
8106 }
8107 }
8108
8109
8110 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
8111 {
8112 super.GetDebugActions(outputList);
8113
8114
8120
8121
8126
8131
8132
8136
8137
8139 {
8143 }
8144
8147
8148
8152
8154
8155 InventoryLocation loc = new InventoryLocation();
8156 GetInventory().GetCurrentInventoryLocation(loc);
8158 {
8159 if (Gizmo_IsSupported())
8162 }
8163
8165 }
8166
8167
8168
8169
8171 {
8172 super.OnAction(action_id, player, ctx);
8173
8175 {
8176 switch (action_id)
8177 {
8180 return true;
8183 return true;
8184 }
8185 }
8186
8188 {
8189 switch (action_id)
8190 {
8192 Delete();
8193 return true;
8194 }
8195 }
8196
8197 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
8198 {
8199 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8200 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
8201 PlayerBase p = PlayerBase.Cast(player);
8202 if (
EActions.RECIPES_RANGE_START < 1000)
8203 {
8204 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
8205 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
8206 }
8207 }
8208 #ifndef SERVER
8209 else if (action_id ==
EActions.WATCH_PLAYER)
8210 {
8211 PluginDeveloper.SetDeveloperItemClientEx(player);
8212 }
8213 #endif
8215 {
8216 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
8217 {
8218 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
8219 OnDebugButtonPressServer(id + 1);
8220 }
8221
8222 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
8223 {
8224 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
8226 }
8227
8228 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
8229 {
8230 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
8232 }
8233
8234 else if (action_id ==
EActions.ADD_QUANTITY)
8235 {
8236 if (IsMagazine())
8237 {
8238 Magazine mag = Magazine.Cast(this);
8239 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
8240 }
8241 else
8242 {
8244 }
8245
8246 if (m_EM)
8247 {
8248 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
8249 }
8250
8251 }
8252
8253 else if (action_id ==
EActions.REMOVE_QUANTITY)
8254 {
8255 if (IsMagazine())
8256 {
8257 Magazine mag2 = Magazine.Cast(this);
8258 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
8259 }
8260 else
8261 {
8263 }
8264 if (m_EM)
8265 {
8266 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
8267 }
8268
8269 }
8270
8271 else if (action_id ==
EActions.SET_QUANTITY_0)
8272 {
8274
8275 if (m_EM)
8276 {
8277 m_EM.SetEnergy(0);
8278 }
8279 }
8280
8281 else if (action_id ==
EActions.SET_MAX_QUANTITY)
8282 {
8284
8285 if (m_EM)
8286 {
8287 m_EM.SetEnergy(m_EM.GetEnergyMax());
8288 }
8289 }
8290
8291 else if (action_id ==
EActions.ADD_HEALTH)
8292 {
8293 AddHealth("","",GetMaxHealth("","Health")/5);
8294 }
8295 else if (action_id ==
EActions.REMOVE_HEALTH)
8296 {
8297 AddHealth("","",-GetMaxHealth("","Health")/5);
8298 }
8299 else if (action_id ==
EActions.DESTROY_HEALTH)
8300 {
8301 SetHealth01("","",0);
8302 }
8303 else if (action_id ==
EActions.WATCH_ITEM)
8304 {
8306 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
8307 #ifdef DEVELOPER
8308 SetDebugDeveloper_item(this);
8309 #endif
8310 }
8311
8312 else if (action_id ==
EActions.ADD_TEMPERATURE)
8313 {
8314 AddTemperature(20);
8315
8316 }
8317
8318 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
8319 {
8320 AddTemperature(-20);
8321
8322 }
8323
8324 else if (action_id ==
EActions.FLIP_FROZEN)
8325 {
8326 SetFrozen(!GetIsFrozen());
8327
8328 }
8329
8330 else if (action_id ==
EActions.ADD_WETNESS)
8331 {
8333
8334 }
8335
8336 else if (action_id ==
EActions.REMOVE_WETNESS)
8337 {
8339
8340 }
8341
8342 else if (action_id ==
EActions.LIQUIDTYPE_UP)
8343 {
8346
8347
8348 }
8349
8350 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
8351 {
8354 }
8355
8356 else if (action_id ==
EActions.MAKE_SPECIAL)
8357 {
8358 auto debugParams = DebugSpawnParams.WithPlayer(player);
8359 OnDebugSpawnEx(debugParams);
8360 }
8361
8362 }
8363
8364
8365 return false;
8366 }
8367
8368
8369
8370
8374
8377
8378
8379
8381 {
8382 return false;
8383 }
8384
8385
8387 {
8388 return true;
8389 }
8390
8391
8393 {
8394 return true;
8395 }
8396
8397
8398
8400 {
8401 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
8403 }
8404
8407 {
8408 return null;
8409 }
8410
8412 {
8413 return false;
8414 }
8415
8417 {
8418 return false;
8419 }
8420
8424
8425
8427 {
8428 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8429 return module_repairing.CanRepair(this, item_repair_kit);
8430 }
8431
8432
8433 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
8434 {
8435 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8436 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
8437 }
8438
8439
8441 {
8442
8443
8444
8445
8446
8447
8448
8449
8450 return 1;
8451 }
8452
8453
8454
8456 {
8458 }
8459
8460
8461
8463 {
8465 }
8466
8467
8476 {
8477 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8478
8479 if (player)
8480 {
8481 player.MessageStatus(text);
8482 }
8483 }
8484
8485
8494 {
8495 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8496
8497 if (player)
8498 {
8499 player.MessageAction(text);
8500 }
8501 }
8502
8503
8512 {
8513 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8514
8515 if (player)
8516 {
8517 player.MessageFriendly(text);
8518 }
8519 }
8520
8521
8530 {
8531 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8532
8533 if (player)
8534 {
8535 player.MessageImportant(text);
8536 }
8537 }
8538
8540 {
8541 return true;
8542 }
8543
8544
8545 override bool KindOf(
string tag)
8546 {
8547 bool found = false;
8548 string item_name = this.
GetType();
8551
8552 int array_size = item_tag_array.Count();
8553 for (int i = 0; i < array_size; i++)
8554 {
8555 if (item_tag_array.Get(i) == tag)
8556 {
8557 found = true;
8558 break;
8559 }
8560 }
8561 return found;
8562 }
8563
8564
8566 {
8567
8568 super.OnRPC(sender, rpc_type,ctx);
8569
8570
8571 switch (rpc_type)
8572 {
8573 #ifndef SERVER
8574 case ERPCs.RPC_SOUND_LOCK_ATTACH:
8575 Param2<bool, string> p = new Param2<bool, string>(false, "");
8576
8578 return;
8579
8580 bool play = p.param1;
8581 string soundSet = p.param2;
8582
8583 if (play)
8584 {
8586 {
8588 {
8590 }
8591 }
8592 else
8593 {
8595 }
8596 }
8597 else
8598 {
8600 }
8601
8602 break;
8603 #endif
8604
8605 }
8606
8608 {
8610 }
8611 }
8612
8613
8614
8615
8617 {
8618 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8619 return plugin.GetID(
name);
8620 }
8621
8623 {
8624 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8625 return plugin.GetName(id);
8626 }
8627
8630 {
8631
8632
8633 int varFlags;
8634 if (!ctx.
Read(varFlags))
8635 return;
8636
8637 if (varFlags & ItemVariableFlags.FLOAT)
8638 {
8640 }
8641 }
8642
8644 {
8645
8646 super.SerializeNumericalVars(floats_out);
8647
8648
8649
8651 {
8653 }
8654
8656 {
8658 }
8659
8661 {
8663 }
8664
8666 {
8671 }
8672
8674 {
8676 }
8677 }
8678
8680 {
8681
8682 super.DeSerializeNumericalVars(floats);
8683
8684
8685 int index = 0;
8686 int mask = Math.Round(floats.Get(index));
8687
8688 index++;
8689
8691 {
8693 {
8695 }
8696 else
8697 {
8698 float quantity = floats.Get(index);
8700 }
8701 index++;
8702 }
8703
8705 {
8706 float wet = floats.Get(index);
8708 index++;
8709 }
8710
8712 {
8713 int liquidtype = Math.Round(floats.Get(index));
8715 index++;
8716 }
8717
8719 {
8721 index++;
8723 index++;
8725 index++;
8727 index++;
8728 }
8729
8731 {
8732 int cleanness = Math.Round(floats.Get(index));
8734 index++;
8735 }
8736 }
8737
8739 {
8740 super.WriteVarsToCTX(ctx);
8741
8742
8744 {
8746 }
8747
8749 {
8751 }
8752
8754 {
8756 }
8757
8759 {
8760 int r,g,b,a;
8766 }
8767
8769 {
8771 }
8772 }
8773
8775 {
8776 if (!super.ReadVarsFromCTX(ctx,version))
8777 return false;
8778
8779 int intValue;
8780 float value;
8781
8782 if (version < 140)
8783 {
8784 if (!ctx.
Read(intValue))
8785 return false;
8786
8787 m_VariablesMask = intValue;
8788 }
8789
8791 {
8792 if (!ctx.
Read(value))
8793 return false;
8794
8796 {
8798 }
8799 else
8800 {
8802 }
8803 }
8804
8805 if (version < 140)
8806 {
8808 {
8809 if (!ctx.
Read(value))
8810 return false;
8811 SetTemperatureDirect(value);
8812 }
8813 }
8814
8816 {
8817 if (!ctx.
Read(value))
8818 return false;
8820 }
8821
8823 {
8824 if (!ctx.
Read(intValue))
8825 return false;
8827 }
8828
8830 {
8831 int r,g,b,a;
8833 return false;
8835 return false;
8837 return false;
8839 return false;
8840
8842 }
8843
8845 {
8846 if (!ctx.
Read(intValue))
8847 return false;
8849 }
8850
8851 if (version >= 138 && version < 140)
8852 {
8854 {
8855 if (!ctx.
Read(intValue))
8856 return false;
8857 SetFrozen(intValue);
8858 }
8859 }
8860
8861 return true;
8862 }
8863
8864
8866 {
8869 {
8871 }
8872
8873 if (!super.OnStoreLoad(ctx, version))
8874 {
8876 return false;
8877 }
8878
8879 if (version >= 114)
8880 {
8881 bool hasQuickBarIndexSaved;
8882
8883 if (!ctx.
Read(hasQuickBarIndexSaved))
8884 {
8886 return false;
8887 }
8888
8889 if (hasQuickBarIndexSaved)
8890 {
8891 int itmQBIndex;
8892
8893
8894 if (!ctx.
Read(itmQBIndex))
8895 {
8897 return false;
8898 }
8899
8900 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
8901 if (itmQBIndex != -1 && parentPlayer)
8902 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
8903 }
8904 }
8905 else
8906 {
8907
8908 PlayerBase player;
8909 int itemQBIndex;
8910 if (version ==
int.
MAX)
8911 {
8912 if (!ctx.
Read(itemQBIndex))
8913 {
8915 return false;
8916 }
8917 }
8918 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
8919 {
8920
8921 if (!ctx.
Read(itemQBIndex))
8922 {
8924 return false;
8925 }
8926 if (itemQBIndex != -1 && player)
8927 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
8928 }
8929 }
8930
8931 if (version < 140)
8932 {
8933
8934 if (!LoadVariables(ctx, version))
8935 {
8937 return false;
8938 }
8939 }
8940
8941
8943 {
8945 return false;
8946 }
8947 if (version >= 132)
8948 {
8950 if (raib)
8951 {
8953 {
8955 return false;
8956 }
8957 }
8958 }
8959
8961 return true;
8962 }
8963
8964
8965
8967 {
8968 super.OnStoreSave(ctx);
8969
8970 PlayerBase player;
8971 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
8972 {
8974
8975 int itemQBIndex = -1;
8976 itemQBIndex = player.FindQuickBarEntityIndex(this);
8977 ctx.
Write(itemQBIndex);
8978 }
8979 else
8980 {
8982 }
8983
8985
8987 if (raib)
8988 {
8990 }
8991 }
8992
8993
8995 {
8996 super.AfterStoreLoad();
8997
8999 {
9001 }
9002
9004 {
9007 }
9008 }
9009
9011 {
9012 super.EEOnAfterLoad();
9013
9015 {
9017 }
9018
9021 }
9022
9024 {
9025 return false;
9026 }
9027
9028
9029
9031 {
9033 {
9034 #ifdef PLATFORM_CONSOLE
9035
9037 {
9039 if (menu)
9040 {
9042 }
9043 }
9044 #endif
9045 }
9046
9048 {
9051 }
9052
9054 {
9055 SetWeightDirty();
9057 }
9059 {
9062 }
9063
9065 {
9068 }
9070 {
9073 }
9074
9075 super.OnVariablesSynchronized();
9076 }
9077
9078
9079
9081 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
9082 {
9083 if (!IsServerCheck(allow_client))
9084 return false;
9085
9087 return false;
9088
9091
9092 if (value <= (min + 0.001))
9093 value = min;
9094
9095 if (value == min)
9096 {
9097 if (destroy_config)
9098 {
9099 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
9100 if (dstr)
9101 {
9103 this.Delete();
9104 return true;
9105 }
9106 }
9107 else if (destroy_forced)
9108 {
9110 this.Delete();
9111 return true;
9112 }
9113
9115 }
9116
9119
9121 {
9123
9124 if (delta)
9126 }
9127
9129
9130 return false;
9131 }
9132
9133
9135 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9136 {
9138 }
9139
9141 {
9144 }
9145
9147 {
9150 }
9151
9153 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9154 {
9155 float value_clamped = Math.Clamp(value, 0, 1);
9157 SetQuantity(result, destroy_config, destroy_forced);
9158 }
9159
9160
9163 {
9165 }
9166
9168 {
9170 }
9171
9172
9173
9174
9175
9176
9177
9178
9179
9180
9182 {
9183 int slot = -1;
9184 if (GetInventory())
9185 {
9186 InventoryLocation il = new InventoryLocation;
9187 GetInventory().GetCurrentInventoryLocation(il);
9189 }
9190
9192 }
9193
9195 {
9196 float quantity_max = 0;
9197
9199 {
9200 if (attSlotID != -1)
9201 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
9202
9203 if (quantity_max <= 0)
9205 }
9206
9207 if (quantity_max <= 0)
9209
9210 return quantity_max;
9211 }
9212
9214 {
9216 }
9217
9219 {
9221 }
9222
9223
9225 {
9227 }
9228
9230 {
9232 }
9233
9235 {
9237 }
9238
9239
9241 {
9242
9243 float weightEx = GetWeightEx();
9244 float special = GetInventoryAndCargoWeight();
9245 return weightEx - special;
9246 }
9247
9248
9250 {
9252 }
9253
9255 {
9257 {
9258 #ifdef DEVELOPER
9259 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9260 {
9261 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
9263 }
9264 #endif
9265
9267 }
9268 else if (HasEnergyManager())
9269 {
9270 #ifdef DEVELOPER
9271 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9272 {
9273 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
9274 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
9275 }
9276 #endif
9277 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
9278 }
9279 else
9280 {
9281 #ifdef DEVELOPER
9282 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9283 {
9284 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
9285 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
9286 }
9287 #endif
9288 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
9289 }
9290 }
9291
9294 {
9295 int item_count = 0;
9297
9298 if (GetInventory().GetCargo() != NULL)
9299 {
9300 item_count = GetInventory().GetCargo().GetItemCount();
9301 }
9302
9303 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
9304 {
9305 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
9306 if (item)
9307 item_count += item.GetNumberOfItems();
9308 }
9309 return item_count;
9310 }
9311
9314 {
9315 float weight = 0;
9316 float wetness = 1;
9317 if (include_wetness)
9320 {
9321 weight = wetness * m_ConfigWeight;
9322 }
9324 {
9325 weight = 1;
9326 }
9327 return weight;
9328 }
9329
9330
9331
9333 {
9334 if ((
GetGame().IsServer() || !
GetGame().IsMultiplayer()) && GetInventory())
9335 {
9336 GameInventory inv = GetInventory();
9337 array<EntityAI> items = new array<EntityAI>;
9339 for (int i = 0; i < items.Count(); i++)
9340 {
9342 if (item)
9343 {
9345 }
9346 }
9347 }
9348 }
9349
9350
9351
9352
9354 {
9355 float energy = 0;
9356 if (HasEnergyManager())
9357 {
9358 energy = GetCompEM().GetEnergy();
9359 }
9360 return energy;
9361 }
9362
9363
9365 {
9366 super.OnEnergyConsumed();
9367
9369 }
9370
9372 {
9373 super.OnEnergyAdded();
9374
9376 }
9377
9378
9380 {
9381 if (
GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
9382 {
9384 {
9385 float energy_0to1 = GetCompEM().GetEnergy0To1();
9387 }
9388 }
9389 }
9390
9391
9393 {
9394 return ConfigGetFloat("heatIsolation");
9395 }
9396
9398 {
9400 }
9401
9403 {
9404 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
9405 if (
GetGame().ConfigIsExisting(paramPath))
9407
9408 return 0.0;
9409 }
9410
9412 {
9413 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
9414 if (
GetGame().ConfigIsExisting(paramPath))
9416
9417 return 0.0;
9418 }
9419
9420 override void SetWet(
float value,
bool allow_client =
false)
9421 {
9422 if (!IsServerCheck(allow_client))
9423 return;
9424
9427
9429
9430 m_VarWet = Math.Clamp(value, min, max);
9431
9433 {
9436 }
9437 }
9438
9439 override void AddWet(
float value)
9440 {
9442 }
9443
9445 {
9447 }
9448
9450 {
9452 }
9453
9455 {
9457 }
9458
9460 {
9462 }
9463
9465 {
9467 }
9468
9470 {
9473 if (newLevel != oldLevel)
9474 {
9476 }
9477 }
9478
9480 {
9481 SetWeightDirty();
9482 }
9483
9485 {
9486 return GetWetLevelInternal(
m_VarWet);
9487 }
9488
9489
9490
9492 {
9494 }
9495
9497 {
9499 }
9500
9502 {
9504 }
9505
9507 {
9509 }
9510
9511
9512
9514 {
9515 if (ConfigIsExisting("itemModelLength"))
9516 {
9517 return ConfigGetFloat("itemModelLength");
9518 }
9519 return 0;
9520 }
9521
9523 {
9524 if (ConfigIsExisting("itemAttachOffset"))
9525 {
9526 return ConfigGetFloat("itemAttachOffset");
9527 }
9528 return 0;
9529 }
9530
9531 override void SetCleanness(
int value,
bool allow_client =
false)
9532 {
9533 if (!IsServerCheck(allow_client))
9534 return;
9535
9537
9539
9542 }
9543
9545 {
9547 }
9548
9550 {
9551 return true;
9552 }
9553
9554
9555
9556
9558 {
9560 }
9561
9563 {
9565 }
9566
9567
9568
9569
9570 override void SetColor(
int r,
int g,
int b,
int a)
9571 {
9577 }
9579 override void GetColor(out
int r,out
int g,out
int b,out
int a)
9580 {
9585 }
9586
9588 {
9590 }
9591
9594 {
9595 int r,g,b,a;
9597 r = r/255;
9598 g = g/255;
9599 b = b/255;
9600 a = a/255;
9601 return MiscGameplayFunctions.GetColorString(r, g, b, a);
9602 }
9603
9604
9605
9606 override void SetLiquidType(
int value,
bool allow_client =
false)
9607 {
9608 if (!IsServerCheck(allow_client))
9609 return;
9610
9615 }
9616
9618 {
9619 return ConfigGetInt("varLiquidTypeInit");
9620 }
9621
9623 {
9625 }
9626
9628 {
9630 SetFrozen(false);
9631 }
9632
9635 {
9636 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9637 }
9638
9639
9642 {
9643 PlayerBase nplayer;
9644 if (PlayerBase.CastTo(nplayer, player))
9645 {
9647
9648 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9649 }
9650 }
9651
9652
9655 {
9656 PlayerBase nplayer;
9657 if (PlayerBase.CastTo(nplayer,player))
9658 {
9659
9660 nplayer.SetEnableQuickBarEntityShortcut(this,false);
9661
9662 }
9663
9664
9665 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
9666
9667
9668 if (HasEnergyManager())
9669 {
9670 GetCompEM().UpdatePlugState();
9671 }
9672 }
9673
9674
9676 {
9677 super.OnPlacementStarted(player);
9678
9680 }
9681
9682 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
9683 {
9685 {
9686 m_AdminLog.OnPlacementComplete(player,
this);
9687 }
9688
9689 super.OnPlacementComplete(player, position, orientation);
9690 }
9691
9692
9693
9694
9695
9697 {
9699 {
9700 return true;
9701 }
9702 else
9703 {
9704 return false;
9705 }
9706 }
9707
9708
9710 {
9712 {
9714 }
9715 }
9716
9717
9719 {
9721 }
9722
9724 {
9726 }
9727
9728 override void InsertAgent(
int agent,
float count = 1)
9729 {
9730 if (count < 1)
9731 return;
9732
9734 }
9735
9738 {
9740 }
9741
9742
9744 {
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
9784
9785
9786
9787
9788
9790 {
9792 return false;
9793 return true;
9794 }
9795
9797 {
9798
9800 }
9801
9802
9805 {
9806 super.CheckForRoofLimited(timeTresholdMS);
9807
9809 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
9810 {
9811 m_PreviousRoofTestTime = time;
9812 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
9813 }
9814 }
9815
9816
9818 {
9820 {
9821 return 0;
9822 }
9823
9824 if (GetInventory().GetAttachmentSlotsCount() != 0)
9825 {
9826 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
9827 if (filter)
9828 return filter.GetProtectionLevel(type, false, system);
9829 else
9830 return 0;
9831 }
9832
9833 string subclassPath, entryName;
9834
9835 switch (type)
9836 {
9838 entryName = "biological";
9839 break;
9841 entryName = "chemical";
9842 break;
9843 default:
9844 entryName = "biological";
9845 break;
9846 }
9847
9848 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
9849
9851 }
9852
9853
9854
9857 {
9858 if (!IsMagazine())
9860
9862 }
9863
9864
9865
9866
9867
9872 {
9873 return true;
9874 }
9875
9877 {
9879 }
9880
9881
9882
9883
9884
9886 {
9887 if (parent)
9888 {
9889 if (parent.IsInherited(DayZInfected))
9890 return true;
9891
9892 if (!parent.IsRuined())
9893 return true;
9894 }
9895
9896 return true;
9897 }
9898
9900 {
9901 if (!super.CanPutAsAttachment(parent))
9902 {
9903 return false;
9904 }
9905
9906 if (!IsRuined() && !parent.IsRuined())
9907 {
9908 return true;
9909 }
9910
9911 return false;
9912 }
9913
9915 {
9916
9917
9918
9919
9920 return super.CanReceiveItemIntoCargo(item);
9921 }
9922
9924 {
9925
9926
9927
9928
9929 GameInventory attachmentInv = attachment.GetInventory();
9931 {
9932 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
9933 return false;
9934 }
9935
9936 InventoryLocation loc = new InventoryLocation();
9937 attachment.GetInventory().GetCurrentInventoryLocation(loc);
9938 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
9939 return false;
9940
9941 return super.CanReceiveAttachment(attachment, slotId);
9942 }
9943
9945 {
9946 if (!super.CanReleaseAttachment(attachment))
9947 return false;
9948
9949 return GetInventory().AreChildrenAccessible();
9950 }
9951
9952
9953
9954
9955
9956
9957
9958
9959
9960
9961
9962
9963
9964
9965
9966
9967
9968
9969
9970
9971
9973 {
9974 int id = muzzle_owner.GetMuzzleID();
9975 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
9976
9977 if (WPOF_array)
9978 {
9979 for (int i = 0; i < WPOF_array.Count(); i++)
9980 {
9981 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
9982
9983 if (WPOF)
9984 {
9985 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
9986 }
9987 }
9988 }
9989 }
9990
9991
9993 {
9994 int id = muzzle_owner.GetMuzzleID();
9996
9997 if (WPOBE_array)
9998 {
9999 for (int i = 0; i < WPOBE_array.Count(); i++)
10000 {
10001 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
10002
10003 if (WPOBE)
10004 {
10005 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10006 }
10007 }
10008 }
10009 }
10010
10011
10013 {
10014 int id = muzzle_owner.GetMuzzleID();
10015 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10016
10017 if (WPOOH_array)
10018 {
10019 for (int i = 0; i < WPOOH_array.Count(); i++)
10020 {
10021 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10022
10023 if (WPOOH)
10024 {
10025 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10026 }
10027 }
10028 }
10029 }
10030
10031
10033 {
10034 int id = muzzle_owner.GetMuzzleID();
10035 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10036
10037 if (WPOOH_array)
10038 {
10039 for (int i = 0; i < WPOOH_array.Count(); i++)
10040 {
10041 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10042
10043 if (WPOOH)
10044 {
10045 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10046 }
10047 }
10048 }
10049 }
10050
10051
10053 {
10054 int id = muzzle_owner.GetMuzzleID();
10055 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10056
10057 if (WPOOH_array)
10058 {
10059 for (int i = 0; i < WPOOH_array.Count(); i++)
10060 {
10061 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10062
10063 if (WPOOH)
10064 {
10065 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10066 }
10067 }
10068 }
10069 }
10070
10071
10072
10074 {
10076 {
10077 return true;
10078 }
10079
10080 return false;
10081 }
10082
10084 {
10086 {
10087 return true;
10088 }
10089
10090 return false;
10091 }
10092
10094 {
10096 {
10097 return true;
10098 }
10099
10100 return false;
10101 }
10102
10104 {
10105 return false;
10106 }
10107
10110 {
10111 return UATimeSpent.DEFAULT_DEPLOY;
10112 }
10113
10114
10115
10116
10118 {
10120 SetSynchDirty();
10121 }
10122
10124 {
10126 }
10127
10128
10130 {
10131 return false;
10132 }
10133
10136 {
10137 string att_type = "None";
10138
10139 if (ConfigIsExisting("soundAttType"))
10140 {
10141 att_type = ConfigGetString("soundAttType");
10142 }
10143
10145 }
10146
10148 {
10150 }
10151
10152
10153
10154
10155
10161
10163 {
10166
10168 }
10169
10170
10172 {
10174 return;
10175
10177
10180
10183
10184 SoundParameters params = new SoundParameters();
10188 }
10189
10190
10192 {
10194 return;
10195
10197 SetSynchDirty();
10198
10201 }
10202
10203
10205 {
10207 return;
10208
10210 SetSynchDirty();
10211
10214 }
10215
10217 {
10219 }
10220
10222 {
10224 }
10225
10228 {
10229 if (!
GetGame().IsDedicatedServer())
10230 {
10231 if (ConfigIsExisting("attachSoundSet"))
10232 {
10233 string cfg_path = "";
10234 string soundset = "";
10235 string type_name =
GetType();
10236
10239 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
10240 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
10241
10242 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
10243 {
10244 for (int i = 0; i < cfg_soundset_array.Count(); i++)
10245 {
10246 if (cfg_slot_array[i] == slot_type)
10247 {
10248 soundset = cfg_soundset_array[i];
10249 break;
10250 }
10251 }
10252 }
10253
10254 if (soundset != "")
10255 {
10256 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
10258 }
10259 }
10260 }
10261 }
10262
10264 {
10265
10266 }
10267
10268 void OnApply(PlayerBase player);
10269
10271 {
10272 return 1.0;
10273 };
10274
10276 {
10278 }
10279
10281 {
10283 }
10284
10286
10288 {
10289 SetDynamicPhysicsLifeTime(0.01);
10291 }
10292
10294 {
10295 array<string> zone_names = new array<string>;
10296 GetDamageZones(zone_names);
10297 for (int i = 0; i < zone_names.Count(); i++)
10298 {
10299 SetHealthMax(zone_names.Get(i),"Health");
10300 }
10301 SetHealthMax("","Health");
10302 }
10303
10306 {
10307 float global_health = GetHealth01("","Health");
10308 array<string> zones = new array<string>;
10309 GetDamageZones(zones);
10310
10311 for (int i = 0; i < zones.Count(); i++)
10312 {
10313 SetHealth01(zones.Get(i),"Health",global_health);
10314 }
10315 }
10316
10319 {
10320 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
10321 }
10322
10324 {
10325 if (!hasRootAsPlayer)
10326 {
10327 if (refParentIB)
10328 {
10329
10330 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
10331 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
10332
10333 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
10334 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
10335
10338 }
10339 else
10340 {
10341
10344 }
10345 }
10346 }
10347
10349 {
10351 {
10352 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
10353 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
10354 {
10355 float heatPermCoef = 1.0;
10357 while (ent)
10358 {
10359 heatPermCoef *= ent.GetHeatPermeabilityCoef();
10360 ent = ent.GetHierarchyParent();
10361 }
10362
10363 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
10364 }
10365 }
10366 }
10367
10369 {
10370
10371 EntityAI parent = GetHierarchyParent();
10372 if (!parent)
10373 {
10374 hasParent = false;
10375 hasRootAsPlayer = false;
10376 }
10377 else
10378 {
10379 hasParent = true;
10380 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
10381 refParentIB =
ItemBase.Cast(parent);
10382 }
10383 }
10384
10385 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
10386 {
10387
10388 }
10389
10391 {
10392
10393 return false;
10394 }
10395
10397 {
10398
10399
10400 return false;
10401 }
10402
10404 {
10405
10406 return false;
10407 }
10408
10411 {
10412 return !GetIsFrozen() &&
IsOpen();
10413 }
10414
10416 {
10417 bool hasParent = false, hasRootAsPlayer = false;
10419
10420 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
10421 bool foodDecay =
g_Game.IsFoodDecayEnabled();
10422
10423 if (wwtu || foodDecay)
10424 {
10428
10429 if (processWetness || processTemperature || processDecay)
10430 {
10432
10433 if (processWetness)
10434 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
10435
10436 if (processTemperature)
10438
10439 if (processDecay)
10440 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
10441 }
10442 }
10443 }
10444
10447 {
10449 }
10450
10452 {
10455
10456 return super.GetTemperatureFreezeThreshold();
10457 }
10458
10460 {
10463
10464 return super.GetTemperatureThawThreshold();
10465 }
10466
10468 {
10471
10472 return super.GetItemOverheatThreshold();
10473 }
10474
10476 {
10478 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
10479
10480 return super.GetTemperatureFreezeTime();
10481 }
10482
10484 {
10486 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
10487
10488 return super.GetTemperatureThawTime();
10489 }
10490
10495
10497 {
10498 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
10499 }
10500
10502 {
10503 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
10504 }
10505
10508 {
10510 }
10511
10513 {
10515 }
10516
10518 {
10520 }
10521
10524 {
10525 return null;
10526 }
10527
10530 {
10531 return false;
10532 }
10533
10535 {
10537 {
10540 if (!trg)
10541 {
10543 explosive = this;
10544 }
10545
10546 explosive.PairRemote(trg);
10548
10549 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
10550 trg.SetPersistentPairID(persistentID);
10551 explosive.SetPersistentPairID(persistentID);
10552
10553 return true;
10554 }
10555 return false;
10556 }
10557
10560 {
10561 float ret = 1.0;
10564 ret *= GetHealth01();
10565
10566 return ret;
10567 }
10568
10569 #ifdef DEVELOPER
10570 override void SetDebugItem()
10571 {
10572 super.SetDebugItem();
10573 _itemBase = this;
10574 }
10575
10577 {
10578 string text = super.GetDebugText();
10579
10581 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
10582
10583 return text;
10584 }
10585 #endif
10586
10588 {
10589 return true;
10590 }
10591
10593
10595
10597 {
10600 }
10601
10602
10610
10626}
10627
10629{
10631 if (entity)
10632 {
10633 bool is_item = entity.IsInherited(
ItemBase);
10634 if (is_item && full_quantity)
10635 {
10638 }
10639 }
10640 else
10641 {
10643 return NULL;
10644 }
10645 return entity;
10646}
10647
10649{
10650 if (item)
10651 {
10652 if (health > 0)
10653 item.SetHealth("", "", health);
10654
10655 if (item.CanHaveTemperature())
10656 {
10658 if (item.CanFreeze())
10659 item.SetFrozen(false);
10660 }
10661
10662 if (item.HasEnergyManager())
10663 {
10664 if (quantity >= 0)
10665 {
10666 item.GetCompEM().SetEnergy0To1(quantity);
10667 }
10668 else
10669 {
10671 }
10672 }
10673 else if (item.IsMagazine())
10674 {
10675 Magazine mag = Magazine.Cast(item);
10676 if (quantity >= 0)
10677 {
10678 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
10679 }
10680 else
10681 {
10683 }
10684
10685 }
10686 else
10687 {
10688 if (quantity >= 0)
10689 {
10690 item.SetQuantityNormalized(quantity, false);
10691 }
10692 else
10693 {
10695 }
10696
10697 }
10698 }
10699}
10700
10701#ifdef DEVELOPER
10703#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.