5802{
5804 {
5805 return true;
5806 }
5807};
5808
5809
5810
5812{
5816
5818
5821
5822
5823
5824
5825
5834
5840
5845
5850
5871 protected bool m_IsResultOfSplit
5872
5874
5879
5880
5881
5883
5887
5888
5889
5891
5894
5895
5896
5902
5903
5911
5914
5915
5917
5918
5920
5921
5926
5927
5932
5933
5935
5936
5938 {
5943
5944 if (!
GetGame().IsDedicatedServer())
5945 {
5947 {
5949
5951 {
5953 }
5954 }
5955
5958 }
5959
5960 m_OldLocation = null;
5961
5963 {
5965 }
5966
5967 if (ConfigIsExisting("headSelectionsToHide"))
5968 {
5971 }
5972
5974 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
5975 {
5977 }
5978
5980
5981 m_IsResultOfSplit = false;
5982
5984 }
5985
5987 {
5988 super.InitItemVariables();
5989
5995 m_Count = ConfigGetInt(
"count");
5996
5999
6004
6007
6012
6024
6028
6029
6032 if (ConfigIsExisting("canBeSplit"))
6033 {
6036 }
6037
6039 if (ConfigIsExisting("itemBehaviour"))
6041
6042
6045 RegisterNetSyncVariableInt("m_VarLiquidType");
6046 RegisterNetSyncVariableInt("m_Cleanness",0,1);
6047
6048 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
6049 RegisterNetSyncVariableFloat("m_ImpactSpeed");
6050 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
6051
6052 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
6053 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
6054 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
6055 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
6056
6057 RegisterNetSyncVariableBool("m_IsBeingPlaced");
6058 RegisterNetSyncVariableBool("m_IsTakeable");
6059 RegisterNetSyncVariableBool("m_IsHologram");
6060
6063 {
6066 }
6067
6069
6071 if (ConfigIsExisting("temperaturePerQuantityWeight"))
6073
6074 }
6075
6077 {
6079 }
6080
6082 {
6085 {
6090 }
6091 }
6092
6093 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
6094 {
6096 {
6099 }
6100
6102 }
6103
6105 {
6111 }
6112
6114
6116 {
6118
6119 if (!action)
6120 {
6121 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
6122 return;
6123 }
6124
6126 if (!ai)
6127 {
6129 return;
6130 }
6131
6133 if (!action_array)
6134 {
6135 action_array = new array<ActionBase_Basic>;
6137 }
6138 if (LogManager.IsActionLogEnable())
6139 {
6140 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
6141 }
6142
6143 if (action_array.Find(action) != -1)
6144 {
6145 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
6146 }
6147 else
6148 {
6149 action_array.Insert(action);
6150 }
6151 }
6152
6154 {
6156 ActionBase action = player.GetActionManager().GetAction(actionName);
6159
6160 if (action_array)
6161 {
6162 action_array.RemoveItem(action);
6163 }
6164 }
6165
6166
6167
6169 {
6170 ActionOverrideData overrideData = new ActionOverrideData();
6174
6176 if (!actionMap)
6177 {
6180 }
6181
6182 actionMap.Insert(this.
Type(), overrideData);
6183
6184 }
6185
6187
6189
6190
6192 {
6195
6198
6199 string config_to_search = "CfgVehicles";
6200 string muzzle_owner_config;
6201
6203 {
6204 if (IsInherited(Weapon))
6205 config_to_search = "CfgWeapons";
6206
6207 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6208
6209 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
6210
6212
6213 if (config_OnFire_subclass_count > 0)
6214 {
6215 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
6216
6217 for (int i = 0; i < config_OnFire_subclass_count; i++)
6218 {
6219 string particle_class = "";
6221 string config_OnFire_entry = config_OnFire_class + particle_class;
6222 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
6223 WPOF_array.Insert(WPOF);
6224 }
6225
6226
6228 }
6229 }
6230
6232 {
6233 config_to_search = "CfgWeapons";
6234 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6235
6236 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
6237
6239
6240 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
6241 {
6242 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
6243
6244 for (i = 0; i < config_OnBulletCasingEject_count; i++)
6245 {
6246 string particle_class2 = "";
6248 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
6249 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
6250 WPOBE_array.Insert(WPOBE);
6251 }
6252
6253
6255 }
6256 }
6257 }
6258
6259
6261 {
6264
6266 {
6267 string config_to_search = "CfgVehicles";
6268
6269 if (IsInherited(Weapon))
6270 config_to_search = "CfgWeapons";
6271
6272 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6273 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
6274
6275 if (
GetGame().ConfigIsExisting(config_OnOverheating_class))
6276 {
6277
6279
6281 {
6283 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
6285 return;
6286 }
6287
6290
6291
6292
6294 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
6295
6296 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
6297 {
6298 string particle_class = "";
6300 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
6302
6303 if (entry_type == CT_CLASS)
6304 {
6305 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
6306 WPOOH_array.Insert(WPOF);
6307 }
6308 }
6309
6310
6312 }
6313 }
6314 }
6315
6317 {
6319 }
6320
6322 {
6324 {
6326
6329
6332
6333 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6334 }
6335 }
6336
6338 {
6340 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6341
6343 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6344
6346 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6347
6349 {
6351 }
6352 }
6353
6355 {
6357 }
6358
6360 {
6363 else
6365
6367 {
6370 }
6371 else
6372 {
6375
6378 }
6379
6381 }
6382
6384 {
6386 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6387 }
6388
6390 {
6392 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6394 }
6395
6397 {
6399 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6400 }
6401
6403 {
6406
6407 OverheatingParticle OP = new OverheatingParticle();
6412
6414 }
6415
6417 {
6420
6421 return -1;
6422 }
6423
6425 {
6427 {
6430
6431 for (int i = count; i > 0; --i)
6432 {
6433 int id = i - 1;
6436
6439
6440 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
6441 {
6442 if (p)
6443 {
6446 }
6447 }
6448 }
6449 }
6450 }
6451
6453 {
6455 {
6457 {
6458 int id = i - 1;
6460
6461 if (OP)
6462 {
6464
6465 if (p)
6466 {
6468 }
6469
6470 delete OP;
6471 }
6472 }
6473
6476 }
6477 }
6478
6481 {
6482 return 0.0;
6483 }
6484
6485
6487 {
6488 return 250;
6489 }
6490
6492 {
6493 return 0;
6494 }
6495
6498 {
6500 return true;
6501
6502 return false;
6503 }
6504
6507 {
6510
6512 {
6514 }
6515 else
6516 {
6517
6519 }
6520
6522 }
6523
6530 {
6531 return -1;
6532 }
6533
6534
6535
6536
6538 {
6540 {
6542 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6543
6544 if (r_index >= 0)
6545 {
6546 InventoryLocation r_il = new InventoryLocation;
6547 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6548
6549 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6552 {
6553 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6554 }
6556 {
6557 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6558 }
6559
6560 }
6561
6562 player.GetHumanInventory().ClearUserReservedLocation(this);
6563 }
6564
6567 }
6568
6569
6570
6571
6573 {
6574 return ItemBase.m_DebugActionsMask;
6575 }
6576
6578 {
6579 return ItemBase.m_DebugActionsMask & mask;
6580 }
6581
6583 {
6584 ItemBase.m_DebugActionsMask = mask;
6585 }
6586
6588 {
6589 ItemBase.m_DebugActionsMask |= mask;
6590 }
6591
6593 {
6594 ItemBase.m_DebugActionsMask &= ~mask;
6595 }
6596
6598 {
6600 {
6602 }
6603 else
6604 {
6606 }
6607 }
6608
6609
6611 {
6612 if (GetEconomyProfile())
6613 {
6614 float q_max = GetEconomyProfile().GetQuantityMax();
6615 if (q_max > 0)
6616 {
6617 float q_min = GetEconomyProfile().GetQuantityMin();
6618 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
6619
6621 {
6622 ComponentEnergyManager comp = GetCompEM();
6624 {
6626 }
6627 }
6629 {
6631
6632 }
6633
6634 }
6635 }
6636 }
6637
6640 {
6641 EntityAI parent = GetHierarchyParent();
6642
6643 if (parent)
6644 {
6645 InventoryLocation inventory_location_to_lock = new InventoryLocation;
6646 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
6647 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
6648 }
6649 }
6650
6653 {
6654 EntityAI parent = GetHierarchyParent();
6655
6656 if (parent)
6657 {
6658 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
6659 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
6660 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
6661 }
6662 }
6663
6665 {
6666
6667
6668
6669
6671
6673 {
6674 if (ScriptInputUserData.CanStoreInputUserData())
6675 {
6676 ScriptInputUserData ctx = new ScriptInputUserData;
6682 ctx.
Write(use_stack_max);
6685
6687 {
6688 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
6689 }
6690 }
6691 }
6692 else if (!
GetGame().IsMultiplayer())
6693 {
6695 }
6696 }
6697
6699 {
6701 }
6702
6704 {
6706 }
6707
6709 {
6711 }
6712
6714 {
6715
6716 return false;
6717 }
6718
6720 {
6721 return false;
6722 }
6723
6727 {
6728 return false;
6729 }
6730
6732 {
6733 return "";
6734 }
6735
6737
6739 {
6740 return false;
6741 }
6742
6744 {
6745 return true;
6746 }
6747
6748
6749
6751 {
6752 return true;
6753 }
6754
6756 {
6757 return true;
6758 }
6759
6761 {
6762 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6764 }
6765
6767 {
6769 }
6770
6772 {
6774 if (!is_being_placed)
6776 SetSynchDirty();
6777 }
6778
6779
6781
6783 {
6785 }
6786
6788 {
6790 }
6791
6793 {
6794 return 1;
6795 }
6796
6798 {
6799 return false;
6800 }
6801
6803 {
6805 SetSynchDirty();
6806 }
6807
6808
6809
6810
6811
6812
6813
6814
6815
6816
6817
6818
6819
6820
6821
6822
6823
6824
6825
6826
6827
6828
6829
6830
6831
6832
6833
6834
6835
6836
6837
6838
6839
6840
6841
6843 {
6844 super.OnMovedInsideCargo(container);
6845
6846 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6847 }
6848
6849 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
6850 {
6851 super.EEItemLocationChanged(oldLoc,newLoc);
6852
6853 PlayerBase new_player = null;
6854 PlayerBase old_player = null;
6855
6856 if (newLoc.GetParent())
6857 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
6858
6859 if (oldLoc.GetParent())
6860 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
6861
6863 {
6864 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
6865
6866 if (r_index >= 0)
6867 {
6868 InventoryLocation r_il = new InventoryLocation;
6869 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6870
6871 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6874 {
6875 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6876 }
6878 {
6879 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6880 }
6881
6882 }
6883 }
6884
6886 {
6887 if (new_player)
6888 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
6889
6890 if (new_player == old_player)
6891 {
6892
6893 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
6894 {
6896 {
6897 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
6898 {
6899 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6900 }
6901 }
6902 else
6903 {
6904 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6905 }
6906 }
6907
6908 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
6909 {
6910 int type = oldLoc.GetType();
6912 {
6913 oldLoc.GetParent().GetOnSetLock().Invoke(this);
6914 }
6916 {
6917 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
6918 }
6919 }
6920 if (!m_OldLocation)
6921 {
6922 m_OldLocation = new InventoryLocation;
6923 }
6924 m_OldLocation.Copy(oldLoc);
6925 }
6926 else
6927 {
6928 if (m_OldLocation)
6929 {
6930 m_OldLocation.Reset();
6931 }
6932 }
6933
6935 }
6936 else
6937 {
6938 if (new_player)
6939 {
6940 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
6941 if (res_index >= 0)
6942 {
6943 InventoryLocation il = new InventoryLocation;
6944 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
6946 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
6949 {
6950 il.
GetParent().GetOnReleaseLock().Invoke(it);
6951 }
6953 {
6955 }
6956
6957 }
6958 }
6960 {
6961
6963 }
6964
6965 if (m_OldLocation)
6966 {
6967 m_OldLocation.Reset();
6968 }
6969 }
6970 }
6971
6972 override void EOnContact(IEntity other, Contact extra)
6973 {
6975 {
6976 int liquidType = -1;
6978 if (impactSpeed > 0.0)
6979 {
6981 #ifndef SERVER
6983 #else
6985 SetSynchDirty();
6986 #endif
6988 }
6989 }
6990
6991 #ifdef SERVER
6992 if (GetCompEM() && GetCompEM().IsPlugged())
6993 {
6994 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
6995 GetCompEM().UnplugThis();
6996 }
6997 #endif
6998 }
6999
7001
7003 {
7005 }
7006
7008 {
7009
7010 }
7011
7013 {
7014 super.OnItemLocationChanged(old_owner, new_owner);
7015
7016 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
7017 PlayerBase playerNew = PlayerBase.Cast(new_owner);
7018
7019 if (!relatedPlayer && playerNew)
7020 relatedPlayer = playerNew;
7021
7022 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
7023 {
7025 if (actionMgr)
7026 {
7027 ActionBase currentAction = actionMgr.GetRunningAction();
7028 if (currentAction)
7030 }
7031 }
7032
7033 Man ownerPlayerOld = null;
7034 Man ownerPlayerNew = null;
7035
7036 if (old_owner)
7037 {
7038 if (old_owner.
IsMan())
7039 {
7040 ownerPlayerOld = Man.Cast(old_owner);
7041 }
7042 else
7043 {
7044 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
7045 }
7046 }
7047 else
7048 {
7050 {
7052
7053 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
7054 {
7055 GetCompEM().UnplugThis();
7056 }
7057 }
7058 }
7059
7060 if (new_owner)
7061 {
7062 if (new_owner.
IsMan())
7063 {
7064 ownerPlayerNew = Man.Cast(new_owner);
7065 }
7066 else
7067 {
7068 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
7069 }
7070 }
7071
7072 if (ownerPlayerOld != ownerPlayerNew)
7073 {
7074 if (ownerPlayerOld)
7075 {
7076 array<EntityAI> subItemsExit = new array<EntityAI>;
7078 for (int i = 0; i < subItemsExit.Count(); i++)
7079 {
7082 }
7083 }
7084
7085 if (ownerPlayerNew)
7086 {
7087 array<EntityAI> subItemsEnter = new array<EntityAI>;
7089 for (int j = 0; j < subItemsEnter.Count(); j++)
7090 {
7093 }
7094 }
7095 }
7096 else if (ownerPlayerNew != null)
7097 {
7098 PlayerBase nplayer;
7099 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
7100 {
7101 array<EntityAI> subItemsUpdate = new array<EntityAI>;
7103 for (int k = 0; k < subItemsUpdate.Count(); k++)
7104 {
7106 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
7107 }
7108 }
7109 }
7110
7111 if (old_owner)
7112 old_owner.OnChildItemRemoved(this);
7113 if (new_owner)
7114 new_owner.OnChildItemReceived(this);
7115 }
7116
7117
7119 {
7120 super.EEDelete(parent);
7121 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
7122 if (player)
7123 {
7125
7126 if (player.IsAlive())
7127 {
7128 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7129 if (r_index >= 0)
7130 {
7131 InventoryLocation r_il = new InventoryLocation;
7132 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7133
7134 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7137 {
7138 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7139 }
7141 {
7142 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7143 }
7144
7145 }
7146
7147 player.RemoveQuickBarEntityShortcut(this);
7148 }
7149 }
7150 }
7151
7153 {
7154 super.EEKilled(killer);
7155
7158 {
7159 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
7160 {
7161 if (IsMagazine())
7162 {
7163 if (Magazine.Cast(this).GetAmmoCount() > 0)
7164 {
7166 }
7167 }
7168 else
7169 {
7171 }
7172 }
7173 }
7174 }
7175
7177 {
7178 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7179
7180 super.OnWasAttached(parent, slot_id);
7181
7184
7186 }
7187
7189 {
7190 super.OnWasDetached(parent, slot_id);
7191
7194 }
7195
7197 {
7198 int idx;
7201
7202 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7203 if (inventory_slots.Count() < 1)
7204 {
7205 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
7206 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
7207 }
7208 else
7209 {
7210 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
7211 }
7212
7213 idx = inventory_slots.Find(slot);
7214 if (idx < 0)
7215 return "";
7216
7217 return attach_types.Get(idx);
7218 }
7219
7221 {
7222 int idx = -1;
7223 string slot;
7224
7227
7228 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7229 if (inventory_slots.Count() < 1)
7230 {
7231 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
7232 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7233 }
7234 else
7235 {
7236 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
7237 if (detach_types.Count() < 1)
7238 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7239 }
7240
7241 for (int i = 0; i < inventory_slots.Count(); i++)
7242 {
7243 slot = inventory_slots.Get(i);
7244 }
7245
7246 if (slot != "")
7247 {
7248 if (detach_types.Count() == 1)
7249 idx = 0;
7250 else
7251 idx = inventory_slots.Find(slot);
7252 }
7253 if (idx < 0)
7254 return "";
7255
7256 return detach_types.Get(idx);
7257 }
7258
7260 {
7261
7263
7264
7265 float min_time = 1;
7266 float max_time = 3;
7267 float delay = Math.RandomFloat(min_time, max_time);
7268
7269 explode_timer.Run(delay, this, "DoAmmoExplosion");
7270 }
7271
7273 {
7274 Magazine magazine = Magazine.Cast(this);
7275 int pop_sounds_count = 6;
7276 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
7277
7278
7279 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
7280 string sound_name = pop_sounds[ sound_idx ];
7282
7283
7284 magazine.ServerAddAmmoCount(-1);
7285
7286
7287 float min_temp_to_explode = 100;
7288
7289 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
7290 {
7292 }
7293 }
7294
7295
7296 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
7297 {
7298 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
7299
7300 const int CHANCE_DAMAGE_CARGO = 4;
7301 const int CHANCE_DAMAGE_ATTACHMENT = 1;
7302 const int CHANCE_DAMAGE_NOTHING = 2;
7303
7305 {
7306 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
7307 int chances;
7308 int rnd;
7309
7310 if (GetInventory().GetCargo())
7311 {
7312 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7313 rnd = Math.RandomInt(0,chances);
7314
7315 if (rnd < CHANCE_DAMAGE_CARGO)
7316 {
7318 }
7319 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
7320 {
7322 }
7323 }
7324 else
7325 {
7326 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7327 rnd = Math.RandomInt(0,chances);
7328
7329 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
7330 {
7332 }
7333 }
7334 }
7335 }
7336
7338 {
7339 if (GetInventory().GetCargo())
7340 {
7341 int item_count = GetInventory().GetCargo().GetItemCount();
7342 if (item_count > 0)
7343 {
7344 int random_pick = Math.RandomInt(0, item_count);
7346 if (!item.IsExplosive())
7347 {
7348 item.AddHealth("","",damage);
7349 return true;
7350 }
7351 }
7352 }
7353 return false;
7354 }
7355
7357 {
7358 int attachment_count = GetInventory().AttachmentCount();
7359 if (attachment_count > 0)
7360 {
7361 int random_pick = Math.RandomInt(0, attachment_count);
7362 ItemBase attachment =
ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
7363 if (!attachment.IsExplosive())
7364 {
7365 attachment.AddHealth("","",damage);
7366 return true;
7367 }
7368 }
7369 return false;
7370 }
7371
7373 {
7375 }
7376
7378 {
7380 return GetInventory().CanRemoveEntity();
7381
7382 return false;
7383 }
7384
7386 {
7387
7389 return false;
7390
7391
7393 return false;
7394
7395
7396
7398 if (delta == 0)
7399 return false;
7400
7401
7402 return true;
7403 }
7404
7406 {
7408 {
7409 if (ScriptInputUserData.CanStoreInputUserData())
7410 {
7411 ScriptInputUserData ctx = new ScriptInputUserData;
7416 ctx.
Write(destination_entity);
7420 }
7421 }
7422 else if (!
GetGame().IsMultiplayer())
7423 {
7425 }
7426 }
7427
7429 {
7430 float split_quantity_new;
7434 InventoryLocation loc = new InventoryLocation;
7435
7436 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7437 {
7439 split_quantity_new = stack_max;
7440 else
7442
7444 {
7445 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
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 if (destination_entity && slot_id == -1)
7456 {
7457 if (quantity > stack_max)
7458 split_quantity_new = stack_max;
7459 else
7460 split_quantity_new = quantity;
7461
7463 {
7465 {
7468 }
7469
7470 if (new_item)
7471 {
7472 new_item.SetResultOfSplit(true);
7473 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7475 new_item.
SetQuantity(split_quantity_new,
false,
true);
7476 }
7477 }
7478 }
7479 else
7480 {
7481 if (stack_max != 0)
7482 {
7484 {
7486 }
7487
7488 if (split_quantity_new == 0)
7489 {
7490 if (!
GetGame().IsMultiplayer())
7491 player.PhysicalPredictiveDropItem(this);
7492 else
7493 player.ServerDropEntity(this);
7494 return;
7495 }
7496
7498 {
7500
7501 if (new_item)
7502 {
7503 new_item.SetResultOfSplit(true);
7504 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7507 new_item.PlaceOnSurface();
7508 }
7509 }
7510 }
7511 }
7512 }
7513
7515 {
7516 float split_quantity_new;
7520 InventoryLocation loc = new InventoryLocation;
7521
7522 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7523 {
7525 split_quantity_new = stack_max;
7526 else
7528
7530 {
7531 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
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 if (destination_entity && slot_id == -1)
7542 {
7543 if (quantity > stack_max)
7544 split_quantity_new = stack_max;
7545 else
7546 split_quantity_new = quantity;
7547
7549 {
7551 {
7554 }
7555
7556 if (new_item)
7557 {
7558 new_item.SetResultOfSplit(true);
7559 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7561 new_item.
SetQuantity(split_quantity_new,
false,
true);
7562 }
7563 }
7564 }
7565 else
7566 {
7567 if (stack_max != 0)
7568 {
7570 {
7572 }
7573
7575 {
7577
7578 if (new_item)
7579 {
7580 new_item.SetResultOfSplit(true);
7581 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7584 new_item.PlaceOnSurface();
7585 }
7586 }
7587 }
7588 }
7589 }
7590
7592 {
7594 {
7595 if (ScriptInputUserData.CanStoreInputUserData())
7596 {
7597 ScriptInputUserData ctx = new ScriptInputUserData;
7602 dst.WriteToContext(ctx);
7604 }
7605 }
7606 else if (!
GetGame().IsMultiplayer())
7607 {
7609 }
7610 }
7611
7613 {
7615 {
7616 if (ScriptInputUserData.CanStoreInputUserData())
7617 {
7618 ScriptInputUserData ctx = new ScriptInputUserData;
7623 ctx.
Write(destination_entity);
7629 }
7630 }
7631 else if (!
GetGame().IsMultiplayer())
7632 {
7634 }
7635 }
7636
7638 {
7640 }
7641
7643 {
7645 float split_quantity_new;
7647 if (dst.IsValid())
7648 {
7649 int slot_id = dst.GetSlot();
7651
7652 if (quantity > stack_max)
7653 split_quantity_new = stack_max;
7654 else
7655 split_quantity_new = quantity;
7656
7658 {
7660
7661 if (new_item)
7662 {
7663 new_item.SetResultOfSplit(true);
7664 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7666 new_item.
SetQuantity(split_quantity_new,
false,
true);
7667 }
7668
7669 return new_item;
7670 }
7671 }
7672
7673 return null;
7674 }
7675
7677 {
7679 float split_quantity_new;
7681 if (destination_entity)
7682 {
7684 if (quantity > stackable)
7685 split_quantity_new = stackable;
7686 else
7687 split_quantity_new = quantity;
7688
7690 {
7691 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
7692 if (new_item)
7693 {
7694 new_item.SetResultOfSplit(true);
7695 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7697 new_item.
SetQuantity(split_quantity_new,
false,
true);
7698 }
7699 }
7700 }
7701 }
7702
7704 {
7706 {
7707 if (ScriptInputUserData.CanStoreInputUserData())
7708 {
7709 ScriptInputUserData ctx = new ScriptInputUserData;
7714 ItemBase destination_entity =
this;
7715 ctx.
Write(destination_entity);
7719 }
7720 }
7721 else if (!
GetGame().IsMultiplayer())
7722 {
7724 }
7725 }
7726
7728 {
7730 float split_quantity_new;
7732 if (player)
7733 {
7735 if (quantity > stackable)
7736 split_quantity_new = stackable;
7737 else
7738 split_quantity_new = quantity;
7739
7741 {
7742 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
7743 new_item =
ItemBase.Cast(in_hands);
7744 if (new_item)
7745 {
7746 new_item.SetResultOfSplit(true);
7747 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7749 new_item.SetQuantity(split_quantity_new, false, true);
7750 }
7751 }
7752 }
7753 }
7754
7756 {
7758 float split_quantity_new = Math.Floor(quantity * 0.5);
7759
7761 return;
7762
7764
7765 if (new_item)
7766 {
7767 if (new_item.GetQuantityMax() < split_quantity_new)
7768 {
7769 split_quantity_new = new_item.GetQuantityMax();
7770 }
7771
7772 new_item.SetResultOfSplit(true);
7773 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7774
7776 {
7779 }
7780 else
7781 {
7783 new_item.
SetQuantity(split_quantity_new,
false,
true);
7784 }
7785 }
7786 }
7787
7789 {
7791 float split_quantity_new = Math.Floor(quantity / 2);
7792
7794 return;
7795
7796 InventoryLocation invloc = new InventoryLocation;
7798
7800 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
7801
7802 if (new_item)
7803 {
7804 if (new_item.GetQuantityMax() < split_quantity_new)
7805 {
7806 split_quantity_new = new_item.GetQuantityMax();
7807 }
7809 {
7812 }
7813 else if (split_quantity_new > 1)
7814 {
7816 new_item.
SetQuantity(split_quantity_new,
false,
true);
7817 }
7818 }
7819 }
7820
7823 {
7824 SetWeightDirty();
7826
7827 if (parent)
7828 parent.OnAttachmentQuantityChangedEx(this, delta);
7829
7831 {
7833 {
7835 }
7837 {
7838 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
7840 }
7841 }
7842
7843 }
7844
7847 {
7848
7849 }
7850
7853 {
7855 }
7856
7858 {
7859 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
7860
7862 {
7863 if (newLevel == GameConstants.STATE_RUINED)
7864 {
7866 EntityAI parent = GetHierarchyParent();
7867 if (parent && parent.IsFireplace())
7868 {
7869 CargoBase cargo = GetInventory().GetCargo();
7870 if (cargo)
7871 {
7873 {
7875 }
7876 }
7877 }
7878 }
7879
7881 {
7882
7884 return;
7885 }
7886
7887 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
7888 {
7890 }
7891 }
7892 }
7893
7894
7896 {
7897 super.OnRightClick();
7898
7900 {
7902 {
7903 if (ScriptInputUserData.CanStoreInputUserData())
7904 {
7905 EntityAI root = GetHierarchyRoot();
7906 Man playerOwner = GetHierarchyRootPlayer();
7907 InventoryLocation dst = new InventoryLocation;
7908
7909
7910 if (!playerOwner && root && root == this)
7911 {
7913 }
7914 else
7915 {
7916
7917 GetInventory().GetCurrentInventoryLocation(dst);
7919 {
7922 {
7924 }
7925 else
7926 {
7928
7929
7930 if (
GetGame().
GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
7931 {
7933 }
7934 else
7935 {
7936 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
7937 }
7938 }
7939 }
7940 }
7941
7942 ScriptInputUserData ctx = new ScriptInputUserData;
7950 }
7951 }
7952 else if (!
GetGame().IsMultiplayer())
7953 {
7955 }
7956 }
7957 }
7958
7960 {
7961 if (root)
7962 {
7963 vector m4[4];
7964 root.GetTransform(m4);
7965 dst.SetGround(this, m4);
7966 }
7967 else
7968 {
7969 GetInventory().GetCurrentInventoryLocation(dst);
7970 }
7971 }
7972
7973 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
7974 {
7975
7976 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
7977 return false;
7978
7979 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
7980 return false;
7981
7982
7984 return false;
7985
7986
7987 Magazine mag = Magazine.Cast(this);
7988 if (mag)
7989 {
7990 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
7991 return false;
7992
7993 if (stack_max_limit)
7994 {
7995 Magazine other_mag = Magazine.Cast(other_item);
7996 if (other_item)
7997 {
7998 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
7999 return false;
8000 }
8001
8002 }
8003 }
8004 else
8005 {
8006
8008 return false;
8009
8011 return false;
8012 }
8013
8014 PlayerBase player = null;
8015 if (CastTo(player, GetHierarchyRootPlayer()))
8016 {
8017 if (player.GetInventory().HasAttachment(this))
8018 return false;
8019
8020 if (player.IsItemsToDelete())
8021 return false;
8022 }
8023
8024 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
8025 return false;
8026
8027 int slotID;
8029 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
8030 return false;
8031
8032 return true;
8033 }
8034
8036 {
8038 }
8039
8041 {
8042 return m_IsResultOfSplit;
8043 }
8044
8046 {
8047 m_IsResultOfSplit = value;
8048 }
8049
8051 {
8053 }
8054
8056 {
8057 float other_item_quantity = other_item.GetQuantity();
8058 float this_free_space;
8059
8061
8063
8064 if (other_item_quantity > this_free_space)
8065 {
8066 return this_free_space;
8067 }
8068 else
8069 {
8070 return other_item_quantity;
8071 }
8072 }
8073
8075 {
8077 }
8078
8080 {
8082 return;
8083
8084 if (!IsMagazine() && other_item)
8085 {
8087 if (quantity_used != 0)
8088 {
8089 float hp1 = GetHealth01("","");
8090 float hp2 = other_item.GetHealth01("","");
8091 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
8092 hpResult = hpResult / (
GetQuantity() + quantity_used);
8093
8094 hpResult *= GetMaxHealth();
8095 Math.Round(hpResult);
8096 SetHealth("", "Health", hpResult);
8097
8099 other_item.AddQuantity(-quantity_used);
8100 }
8101 }
8103 }
8104
8106 {
8107 #ifdef SERVER
8108 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
8109 GetHierarchyParent().IncreaseLifetimeUp();
8110 #endif
8111 };
8112
8114 {
8115 PlayerBase p = PlayerBase.Cast(player);
8116
8117 array<int> recipesIds = p.m_Recipes;
8118 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8119 if (moduleRecipesManager)
8120 {
8121 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
8122 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
8123 }
8124
8125 for (int i = 0;i < recipesIds.Count(); i++)
8126 {
8127 int key = recipesIds.Get(i);
8128 string recipeName = moduleRecipesManager.GetRecipeName(key);
8130 }
8131 }
8132
8133
8134 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
8135 {
8136 super.GetDebugActions(outputList);
8137
8138
8144
8145
8150
8155
8156
8160
8161
8163 {
8167 }
8168
8171
8172
8176
8178
8179 InventoryLocation loc = new InventoryLocation();
8180 GetInventory().GetCurrentInventoryLocation(loc);
8182 {
8183 if (Gizmo_IsSupported())
8186 }
8187
8189 }
8190
8191
8192
8193
8195 {
8196 super.OnAction(action_id, player, ctx);
8197
8199 {
8200 switch (action_id)
8201 {
8204 return true;
8207 return true;
8208 }
8209 }
8210
8212 {
8213 switch (action_id)
8214 {
8216 Delete();
8217 return true;
8218 }
8219 }
8220
8221 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
8222 {
8223 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8224 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
8225 PlayerBase p = PlayerBase.Cast(player);
8226 if (
EActions.RECIPES_RANGE_START < 1000)
8227 {
8228 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
8229 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
8230 }
8231 }
8232 #ifndef SERVER
8233 else if (action_id ==
EActions.WATCH_PLAYER)
8234 {
8235 PluginDeveloper.SetDeveloperItemClientEx(player);
8236 }
8237 #endif
8239 {
8240 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
8241 {
8242 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
8243 OnDebugButtonPressServer(id + 1);
8244 }
8245
8246 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
8247 {
8248 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
8250 }
8251
8252 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
8253 {
8254 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
8256 }
8257
8258 else if (action_id ==
EActions.ADD_QUANTITY)
8259 {
8260 if (IsMagazine())
8261 {
8262 Magazine mag = Magazine.Cast(this);
8263 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
8264 }
8265 else
8266 {
8268 }
8269
8270 if (m_EM)
8271 {
8272 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
8273 }
8274
8275 }
8276
8277 else if (action_id ==
EActions.REMOVE_QUANTITY)
8278 {
8279 if (IsMagazine())
8280 {
8281 Magazine mag2 = Magazine.Cast(this);
8282 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
8283 }
8284 else
8285 {
8287 }
8288 if (m_EM)
8289 {
8290 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
8291 }
8292
8293 }
8294
8295 else if (action_id ==
EActions.SET_QUANTITY_0)
8296 {
8298
8299 if (m_EM)
8300 {
8301 m_EM.SetEnergy(0);
8302 }
8303 }
8304
8305 else if (action_id ==
EActions.SET_MAX_QUANTITY)
8306 {
8308
8309 if (m_EM)
8310 {
8311 m_EM.SetEnergy(m_EM.GetEnergyMax());
8312 }
8313 }
8314
8315 else if (action_id ==
EActions.ADD_HEALTH)
8316 {
8317 AddHealth("","",GetMaxHealth("","Health")/5);
8318 }
8319 else if (action_id ==
EActions.REMOVE_HEALTH)
8320 {
8321 AddHealth("","",-GetMaxHealth("","Health")/5);
8322 }
8323 else if (action_id ==
EActions.DESTROY_HEALTH)
8324 {
8325 SetHealth01("","",0);
8326 }
8327 else if (action_id ==
EActions.WATCH_ITEM)
8328 {
8330 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
8331 #ifdef DEVELOPER
8332 SetDebugDeveloper_item(this);
8333 #endif
8334 }
8335
8336 else if (action_id ==
EActions.ADD_TEMPERATURE)
8337 {
8338 AddTemperature(20);
8339
8340 }
8341
8342 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
8343 {
8344 AddTemperature(-20);
8345
8346 }
8347
8348 else if (action_id ==
EActions.FLIP_FROZEN)
8349 {
8350 SetFrozen(!GetIsFrozen());
8351
8352 }
8353
8354 else if (action_id ==
EActions.ADD_WETNESS)
8355 {
8357
8358 }
8359
8360 else if (action_id ==
EActions.REMOVE_WETNESS)
8361 {
8363
8364 }
8365
8366 else if (action_id ==
EActions.LIQUIDTYPE_UP)
8367 {
8370
8371
8372 }
8373
8374 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
8375 {
8378 }
8379
8380 else if (action_id ==
EActions.MAKE_SPECIAL)
8381 {
8382 auto debugParams = DebugSpawnParams.WithPlayer(player);
8383 OnDebugSpawnEx(debugParams);
8384 }
8385
8386 }
8387
8388
8389 return false;
8390 }
8391
8392
8393
8394
8398
8401
8402
8403
8405 {
8406 return false;
8407 }
8408
8409
8411 {
8412 return true;
8413 }
8414
8415
8417 {
8418 return true;
8419 }
8420
8421
8422
8424 {
8425 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
8427 }
8428
8431 {
8432 return null;
8433 }
8434
8436 {
8437 return false;
8438 }
8439
8441 {
8442 return false;
8443 }
8444
8448
8449
8451 {
8452 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8453 return module_repairing.CanRepair(this, item_repair_kit);
8454 }
8455
8456
8457 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
8458 {
8459 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8460 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
8461 }
8462
8463
8465 {
8466
8467
8468
8469
8470
8471
8472
8473
8474 return 1;
8475 }
8476
8477
8478
8480 {
8482 }
8483
8484
8485
8487 {
8489 }
8490
8491
8500 {
8501 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8502
8503 if (player)
8504 {
8505 player.MessageStatus(text);
8506 }
8507 }
8508
8509
8518 {
8519 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8520
8521 if (player)
8522 {
8523 player.MessageAction(text);
8524 }
8525 }
8526
8527
8536 {
8537 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8538
8539 if (player)
8540 {
8541 player.MessageFriendly(text);
8542 }
8543 }
8544
8545
8554 {
8555 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8556
8557 if (player)
8558 {
8559 player.MessageImportant(text);
8560 }
8561 }
8562
8564 {
8565 return true;
8566 }
8567
8568
8569 override bool KindOf(
string tag)
8570 {
8571 bool found = false;
8572 string item_name = this.
GetType();
8575
8576 int array_size = item_tag_array.Count();
8577 for (int i = 0; i < array_size; i++)
8578 {
8579 if (item_tag_array.Get(i) == tag)
8580 {
8581 found = true;
8582 break;
8583 }
8584 }
8585 return found;
8586 }
8587
8588
8590 {
8591
8592 super.OnRPC(sender, rpc_type,ctx);
8593
8594
8595 switch (rpc_type)
8596 {
8597 #ifndef SERVER
8598 case ERPCs.RPC_SOUND_LOCK_ATTACH:
8599 Param2<bool, string> p = new Param2<bool, string>(false, "");
8600
8602 return;
8603
8604 bool play = p.param1;
8605 string soundSet = p.param2;
8606
8607 if (play)
8608 {
8610 {
8612 {
8614 }
8615 }
8616 else
8617 {
8619 }
8620 }
8621 else
8622 {
8624 }
8625
8626 break;
8627 #endif
8628
8629 }
8630
8632 {
8634 }
8635 }
8636
8637
8638
8639
8641 {
8642 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8643 return plugin.GetID(
name);
8644 }
8645
8647 {
8648 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8649 return plugin.GetName(id);
8650 }
8651
8654 {
8655
8656
8657 int varFlags;
8658 if (!ctx.
Read(varFlags))
8659 return;
8660
8661 if (varFlags & ItemVariableFlags.FLOAT)
8662 {
8664 }
8665 }
8666
8668 {
8669
8670 super.SerializeNumericalVars(floats_out);
8671
8672
8673
8675 {
8677 }
8678
8680 {
8682 }
8683
8685 {
8687 }
8688
8690 {
8695 }
8696
8698 {
8700 }
8701 }
8702
8704 {
8705
8706 super.DeSerializeNumericalVars(floats);
8707
8708
8709 int index = 0;
8710 int mask = Math.Round(floats.Get(index));
8711
8712 index++;
8713
8715 {
8717 {
8719 }
8720 else
8721 {
8722 float quantity = floats.Get(index);
8724 }
8725 index++;
8726 }
8727
8729 {
8730 float wet = floats.Get(index);
8732 index++;
8733 }
8734
8736 {
8737 int liquidtype = Math.Round(floats.Get(index));
8739 index++;
8740 }
8741
8743 {
8745 index++;
8747 index++;
8749 index++;
8751 index++;
8752 }
8753
8755 {
8756 int cleanness = Math.Round(floats.Get(index));
8758 index++;
8759 }
8760 }
8761
8763 {
8764 super.WriteVarsToCTX(ctx);
8765
8766
8768 {
8770 }
8771
8773 {
8775 }
8776
8778 {
8780 }
8781
8783 {
8784 int r,g,b,a;
8790 }
8791
8793 {
8795 }
8796 }
8797
8799 {
8800 if (!super.ReadVarsFromCTX(ctx,version))
8801 return false;
8802
8803 int intValue;
8804 float value;
8805
8806 if (version < 140)
8807 {
8808 if (!ctx.
Read(intValue))
8809 return false;
8810
8811 m_VariablesMask = intValue;
8812 }
8813
8815 {
8816 if (!ctx.
Read(value))
8817 return false;
8818
8820 {
8822 }
8823 else
8824 {
8826 }
8827 }
8828
8829 if (version < 140)
8830 {
8832 {
8833 if (!ctx.
Read(value))
8834 return false;
8835 SetTemperatureDirect(value);
8836 }
8837 }
8838
8840 {
8841 if (!ctx.
Read(value))
8842 return false;
8844 }
8845
8847 {
8848 if (!ctx.
Read(intValue))
8849 return false;
8851 }
8852
8854 {
8855 int r,g,b,a;
8857 return false;
8859 return false;
8861 return false;
8863 return false;
8864
8866 }
8867
8869 {
8870 if (!ctx.
Read(intValue))
8871 return false;
8873 }
8874
8875 if (version >= 138 && version < 140)
8876 {
8878 {
8879 if (!ctx.
Read(intValue))
8880 return false;
8881 SetFrozen(intValue);
8882 }
8883 }
8884
8885 return true;
8886 }
8887
8888
8890 {
8893 {
8895 }
8896
8897 if (!super.OnStoreLoad(ctx, version))
8898 {
8900 return false;
8901 }
8902
8903 if (version >= 114)
8904 {
8905 bool hasQuickBarIndexSaved;
8906
8907 if (!ctx.
Read(hasQuickBarIndexSaved))
8908 {
8910 return false;
8911 }
8912
8913 if (hasQuickBarIndexSaved)
8914 {
8915 int itmQBIndex;
8916
8917
8918 if (!ctx.
Read(itmQBIndex))
8919 {
8921 return false;
8922 }
8923
8924 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
8925 if (itmQBIndex != -1 && parentPlayer)
8926 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
8927 }
8928 }
8929 else
8930 {
8931
8932 PlayerBase player;
8933 int itemQBIndex;
8934 if (version ==
int.
MAX)
8935 {
8936 if (!ctx.
Read(itemQBIndex))
8937 {
8939 return false;
8940 }
8941 }
8942 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
8943 {
8944
8945 if (!ctx.
Read(itemQBIndex))
8946 {
8948 return false;
8949 }
8950 if (itemQBIndex != -1 && player)
8951 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
8952 }
8953 }
8954
8955 if (version < 140)
8956 {
8957
8958 if (!LoadVariables(ctx, version))
8959 {
8961 return false;
8962 }
8963 }
8964
8965
8967 {
8969 return false;
8970 }
8971 if (version >= 132)
8972 {
8974 if (raib)
8975 {
8977 {
8979 return false;
8980 }
8981 }
8982 }
8983
8985 return true;
8986 }
8987
8988
8989
8991 {
8992 super.OnStoreSave(ctx);
8993
8994 PlayerBase player;
8995 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
8996 {
8998
8999 int itemQBIndex = -1;
9000 itemQBIndex = player.FindQuickBarEntityIndex(this);
9001 ctx.
Write(itemQBIndex);
9002 }
9003 else
9004 {
9006 }
9007
9009
9011 if (raib)
9012 {
9014 }
9015 }
9016
9017
9019 {
9020 super.AfterStoreLoad();
9021
9023 {
9025 }
9026
9028 {
9031 }
9032 }
9033
9035 {
9036 super.EEOnAfterLoad();
9037
9039 {
9041 }
9042
9045 }
9046
9048 {
9049 return false;
9050 }
9051
9052
9053
9055 {
9057 {
9058 #ifdef PLATFORM_CONSOLE
9059
9061 {
9063 if (menu)
9064 {
9066 }
9067 }
9068 #endif
9069 }
9070
9072 {
9075 }
9076
9078 {
9079 SetWeightDirty();
9081 }
9083 {
9086 }
9087
9089 {
9092 }
9094 {
9097 }
9098
9099 super.OnVariablesSynchronized();
9100 }
9101
9102
9103
9105 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
9106 {
9107 if (!IsServerCheck(allow_client))
9108 return false;
9109
9111 return false;
9112
9115
9116 if (value <= (min + 0.001))
9117 value = min;
9118
9119 if (value == min)
9120 {
9121 if (destroy_config)
9122 {
9123 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
9124 if (dstr)
9125 {
9127 this.Delete();
9128 return true;
9129 }
9130 }
9131 else if (destroy_forced)
9132 {
9134 this.Delete();
9135 return true;
9136 }
9137
9139 }
9140
9143
9145 {
9147
9148 if (delta)
9150 }
9151
9153
9154 return false;
9155 }
9156
9157
9159 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9160 {
9162 }
9163
9165 {
9168 }
9169
9171 {
9174 }
9175
9177 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9178 {
9179 float value_clamped = Math.Clamp(value, 0, 1);
9181 SetQuantity(result, destroy_config, destroy_forced);
9182 }
9183
9184
9187 {
9189 }
9190
9192 {
9194 }
9195
9196
9197
9198
9199
9200
9201
9202
9203
9204
9206 {
9207 int slot = -1;
9208 if (GetInventory())
9209 {
9210 InventoryLocation il = new InventoryLocation;
9211 GetInventory().GetCurrentInventoryLocation(il);
9213 }
9214
9216 }
9217
9219 {
9220 float quantity_max = 0;
9221
9223 {
9224 if (attSlotID != -1)
9225 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
9226
9227 if (quantity_max <= 0)
9229 }
9230
9231 if (quantity_max <= 0)
9233
9234 return quantity_max;
9235 }
9236
9238 {
9240 }
9241
9243 {
9245 }
9246
9247
9249 {
9251 }
9252
9254 {
9256 }
9257
9259 {
9261 }
9262
9263
9265 {
9266
9267 float weightEx = GetWeightEx();
9268 float special = GetInventoryAndCargoWeight();
9269 return weightEx - special;
9270 }
9271
9272
9274 {
9276 }
9277
9279 {
9281 {
9282 #ifdef DEVELOPER
9283 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9284 {
9285 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
9287 }
9288 #endif
9289
9291 }
9292 else if (HasEnergyManager())
9293 {
9294 #ifdef DEVELOPER
9295 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9296 {
9297 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
9298 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
9299 }
9300 #endif
9301 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
9302 }
9303 else
9304 {
9305 #ifdef DEVELOPER
9306 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9307 {
9308 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
9309 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
9310 }
9311 #endif
9312 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
9313 }
9314 }
9315
9318 {
9319 int item_count = 0;
9321
9322 if (GetInventory().GetCargo() != NULL)
9323 {
9324 item_count = GetInventory().GetCargo().GetItemCount();
9325 }
9326
9327 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
9328 {
9329 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
9330 if (item)
9331 item_count += item.GetNumberOfItems();
9332 }
9333 return item_count;
9334 }
9335
9338 {
9339 float weight = 0;
9340 float wetness = 1;
9341 if (include_wetness)
9344 {
9345 weight = wetness * m_ConfigWeight;
9346 }
9348 {
9349 weight = 1;
9350 }
9351 return weight;
9352 }
9353
9354
9355
9357 {
9358 if ((
GetGame().IsServer() || !
GetGame().IsMultiplayer()) && GetInventory())
9359 {
9360 GameInventory inv = GetInventory();
9361 array<EntityAI> items = new array<EntityAI>;
9363 for (int i = 0; i < items.Count(); i++)
9364 {
9366 if (item)
9367 {
9369 }
9370 }
9371 }
9372 }
9373
9374
9375
9376
9378 {
9379 float energy = 0;
9380 if (HasEnergyManager())
9381 {
9382 energy = GetCompEM().GetEnergy();
9383 }
9384 return energy;
9385 }
9386
9387
9389 {
9390 super.OnEnergyConsumed();
9391
9393 }
9394
9396 {
9397 super.OnEnergyAdded();
9398
9400 }
9401
9402
9404 {
9405 if (
GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
9406 {
9408 {
9409 float energy_0to1 = GetCompEM().GetEnergy0To1();
9411 }
9412 }
9413 }
9414
9415
9417 {
9418 return ConfigGetFloat("heatIsolation");
9419 }
9420
9422 {
9424 }
9425
9427 {
9428 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
9429 if (
GetGame().ConfigIsExisting(paramPath))
9431
9432 return 0.0;
9433 }
9434
9436 {
9437 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
9438 if (
GetGame().ConfigIsExisting(paramPath))
9440
9441 return 0.0;
9442 }
9443
9444 override void SetWet(
float value,
bool allow_client =
false)
9445 {
9446 if (!IsServerCheck(allow_client))
9447 return;
9448
9451
9453
9454 m_VarWet = Math.Clamp(value, min, max);
9455
9457 {
9460 }
9461 }
9462
9463 override void AddWet(
float value)
9464 {
9466 }
9467
9469 {
9471 }
9472
9474 {
9476 }
9477
9479 {
9481 }
9482
9484 {
9486 }
9487
9489 {
9491 }
9492
9494 {
9497 if (newLevel != oldLevel)
9498 {
9500 }
9501 }
9502
9504 {
9505 SetWeightDirty();
9506 }
9507
9509 {
9510 return GetWetLevelInternal(
m_VarWet);
9511 }
9512
9513
9514
9516 {
9518 }
9519
9521 {
9523 }
9524
9526 {
9528 }
9529
9531 {
9533 }
9534
9535
9536
9538 {
9539 if (ConfigIsExisting("itemModelLength"))
9540 {
9541 return ConfigGetFloat("itemModelLength");
9542 }
9543 return 0;
9544 }
9545
9547 {
9548 if (ConfigIsExisting("itemAttachOffset"))
9549 {
9550 return ConfigGetFloat("itemAttachOffset");
9551 }
9552 return 0;
9553 }
9554
9555 override void SetCleanness(
int value,
bool allow_client =
false)
9556 {
9557 if (!IsServerCheck(allow_client))
9558 return;
9559
9561
9563
9566 }
9567
9569 {
9571 }
9572
9574 {
9575 return true;
9576 }
9577
9578
9579
9580
9582 {
9584 }
9585
9587 {
9589 }
9590
9591
9592
9593
9594 override void SetColor(
int r,
int g,
int b,
int a)
9595 {
9601 }
9603 override void GetColor(out
int r,out
int g,out
int b,out
int a)
9604 {
9609 }
9610
9612 {
9614 }
9615
9618 {
9619 int r,g,b,a;
9621 r = r/255;
9622 g = g/255;
9623 b = b/255;
9624 a = a/255;
9625 return MiscGameplayFunctions.GetColorString(r, g, b, a);
9626 }
9627
9628
9629
9630 override void SetLiquidType(
int value,
bool allow_client =
false)
9631 {
9632 if (!IsServerCheck(allow_client))
9633 return;
9634
9639 }
9640
9642 {
9643 return ConfigGetInt("varLiquidTypeInit");
9644 }
9645
9647 {
9649 }
9650
9652 {
9654 SetFrozen(false);
9655 }
9656
9659 {
9660 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9661 }
9662
9663
9666 {
9667 PlayerBase nplayer;
9668 if (PlayerBase.CastTo(nplayer, player))
9669 {
9671
9672 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9673 }
9674 }
9675
9676
9679 {
9680 PlayerBase nplayer;
9681 if (PlayerBase.CastTo(nplayer,player))
9682 {
9683
9684 nplayer.SetEnableQuickBarEntityShortcut(this,false);
9685
9686 }
9687
9688
9689 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
9690
9691
9692 if (HasEnergyManager())
9693 {
9694 GetCompEM().UpdatePlugState();
9695 }
9696 }
9697
9698
9700 {
9701 super.OnPlacementStarted(player);
9702
9704 }
9705
9706 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
9707 {
9709 {
9710 m_AdminLog.OnPlacementComplete(player,
this);
9711 }
9712
9713 super.OnPlacementComplete(player, position, orientation);
9714 }
9715
9716
9717
9718
9719
9721 {
9723 {
9724 return true;
9725 }
9726 else
9727 {
9728 return false;
9729 }
9730 }
9731
9732
9734 {
9736 {
9738 }
9739 }
9740
9741
9743 {
9745 }
9746
9748 {
9750 }
9751
9752 override void InsertAgent(
int agent,
float count = 1)
9753 {
9754 if (count < 1)
9755 return;
9756
9758 }
9759
9762 {
9764 }
9765
9766
9768 {
9770 }
9771
9772
9773
9774
9775
9776
9777
9778
9779
9780
9781
9782
9783
9784
9785
9786
9787
9788
9789
9790
9791
9792
9793
9794
9795
9796
9797
9798
9799
9800
9801
9802
9803
9804
9805
9806
9807
9808
9809
9810
9811
9812
9814 {
9816 return false;
9817 return true;
9818 }
9819
9821 {
9822
9824 }
9825
9826
9829 {
9830 super.CheckForRoofLimited(timeTresholdMS);
9831
9833 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
9834 {
9835 m_PreviousRoofTestTime = time;
9836 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
9837 }
9838 }
9839
9840
9842 {
9844 {
9845 return 0;
9846 }
9847
9848 if (GetInventory().GetAttachmentSlotsCount() != 0)
9849 {
9850 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
9851 if (filter)
9852 return filter.GetProtectionLevel(type, false, system);
9853 else
9854 return 0;
9855 }
9856
9857 string subclassPath, entryName;
9858
9859 switch (type)
9860 {
9862 entryName = "biological";
9863 break;
9865 entryName = "chemical";
9866 break;
9867 default:
9868 entryName = "biological";
9869 break;
9870 }
9871
9872 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
9873
9875 }
9876
9877
9878
9881 {
9882 if (!IsMagazine())
9884
9886 }
9887
9888
9889
9890
9891
9896 {
9897 return true;
9898 }
9899
9901 {
9903 }
9904
9905
9906
9907
9908
9910 {
9911 if (parent)
9912 {
9913 if (parent.IsInherited(DayZInfected))
9914 return true;
9915
9916 if (!parent.IsRuined())
9917 return true;
9918 }
9919
9920 return true;
9921 }
9922
9924 {
9925 if (!super.CanPutAsAttachment(parent))
9926 {
9927 return false;
9928 }
9929
9930 if (!IsRuined() && !parent.IsRuined())
9931 {
9932 return true;
9933 }
9934
9935 return false;
9936 }
9937
9939 {
9940
9941
9942
9943
9944 return super.CanReceiveItemIntoCargo(item);
9945 }
9946
9948 {
9949
9950
9951
9952
9953 GameInventory attachmentInv = attachment.GetInventory();
9955 {
9956 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
9957 return false;
9958 }
9959
9960 InventoryLocation loc = new InventoryLocation();
9961 attachment.GetInventory().GetCurrentInventoryLocation(loc);
9962 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
9963 return false;
9964
9965 return super.CanReceiveAttachment(attachment, slotId);
9966 }
9967
9969 {
9970 if (!super.CanReleaseAttachment(attachment))
9971 return false;
9972
9973 return GetInventory().AreChildrenAccessible();
9974 }
9975
9976
9977
9978
9979
9980
9981
9982
9983
9984
9985
9986
9987
9988
9989
9990
9991
9992
9993
9994
9995
9997 {
9998 int id = muzzle_owner.GetMuzzleID();
9999 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
10000
10001 if (WPOF_array)
10002 {
10003 for (int i = 0; i < WPOF_array.Count(); i++)
10004 {
10005 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
10006
10007 if (WPOF)
10008 {
10009 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
10010 }
10011 }
10012 }
10013 }
10014
10015
10017 {
10018 int id = muzzle_owner.GetMuzzleID();
10020
10021 if (WPOBE_array)
10022 {
10023 for (int i = 0; i < WPOBE_array.Count(); i++)
10024 {
10025 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
10026
10027 if (WPOBE)
10028 {
10029 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10030 }
10031 }
10032 }
10033 }
10034
10035
10037 {
10038 int id = muzzle_owner.GetMuzzleID();
10039 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10040
10041 if (WPOOH_array)
10042 {
10043 for (int i = 0; i < WPOOH_array.Count(); i++)
10044 {
10045 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10046
10047 if (WPOOH)
10048 {
10049 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10050 }
10051 }
10052 }
10053 }
10054
10055
10057 {
10058 int id = muzzle_owner.GetMuzzleID();
10059 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10060
10061 if (WPOOH_array)
10062 {
10063 for (int i = 0; i < WPOOH_array.Count(); i++)
10064 {
10065 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10066
10067 if (WPOOH)
10068 {
10069 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10070 }
10071 }
10072 }
10073 }
10074
10075
10077 {
10078 int id = muzzle_owner.GetMuzzleID();
10079 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10080
10081 if (WPOOH_array)
10082 {
10083 for (int i = 0; i < WPOOH_array.Count(); i++)
10084 {
10085 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10086
10087 if (WPOOH)
10088 {
10089 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10090 }
10091 }
10092 }
10093 }
10094
10095
10096
10098 {
10100 {
10101 return true;
10102 }
10103
10104 return false;
10105 }
10106
10108 {
10110 {
10111 return true;
10112 }
10113
10114 return false;
10115 }
10116
10118 {
10120 {
10121 return true;
10122 }
10123
10124 return false;
10125 }
10126
10128 {
10129 return false;
10130 }
10131
10134 {
10135 return UATimeSpent.DEFAULT_DEPLOY;
10136 }
10137
10138
10139
10140
10142 {
10144 SetSynchDirty();
10145 }
10146
10148 {
10150 }
10151
10152
10154 {
10155 return false;
10156 }
10157
10160 {
10161 string att_type = "None";
10162
10163 if (ConfigIsExisting("soundAttType"))
10164 {
10165 att_type = ConfigGetString("soundAttType");
10166 }
10167
10169 }
10170
10172 {
10174 }
10175
10176
10177
10178
10179
10185
10187 {
10190
10192 }
10193
10194
10196 {
10198 return;
10199
10201
10204
10207
10208 SoundParameters params = new SoundParameters();
10212 }
10213
10214
10216 {
10218 return;
10219
10221 SetSynchDirty();
10222
10225 }
10226
10227
10229 {
10231 return;
10232
10234 SetSynchDirty();
10235
10238 }
10239
10241 {
10243 }
10244
10246 {
10248 }
10249
10252 {
10253 if (!
GetGame().IsDedicatedServer())
10254 {
10255 if (ConfigIsExisting("attachSoundSet"))
10256 {
10257 string cfg_path = "";
10258 string soundset = "";
10259 string type_name =
GetType();
10260
10263 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
10264 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
10265
10266 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
10267 {
10268 for (int i = 0; i < cfg_soundset_array.Count(); i++)
10269 {
10270 if (cfg_slot_array[i] == slot_type)
10271 {
10272 soundset = cfg_soundset_array[i];
10273 break;
10274 }
10275 }
10276 }
10277
10278 if (soundset != "")
10279 {
10280 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
10282 }
10283 }
10284 }
10285 }
10286
10288 {
10289
10290 }
10291
10292 void OnApply(PlayerBase player);
10293
10295 {
10296 return 1.0;
10297 };
10298
10300 {
10302 }
10303
10305 {
10307 }
10308
10310
10312 {
10313 SetDynamicPhysicsLifeTime(0.01);
10315 }
10316
10318 {
10319 array<string> zone_names = new array<string>;
10320 GetDamageZones(zone_names);
10321 for (int i = 0; i < zone_names.Count(); i++)
10322 {
10323 SetHealthMax(zone_names.Get(i),"Health");
10324 }
10325 SetHealthMax("","Health");
10326 }
10327
10330 {
10331 float global_health = GetHealth01("","Health");
10332 array<string> zones = new array<string>;
10333 GetDamageZones(zones);
10334
10335 for (int i = 0; i < zones.Count(); i++)
10336 {
10337 SetHealth01(zones.Get(i),"Health",global_health);
10338 }
10339 }
10340
10343 {
10344 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
10345 }
10346
10348 {
10349 if (!hasRootAsPlayer)
10350 {
10351 if (refParentIB)
10352 {
10353
10354 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
10355 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
10356
10357 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
10358 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
10359
10362 }
10363 else
10364 {
10365
10368 }
10369 }
10370 }
10371
10373 {
10375 {
10376 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
10377 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
10378 {
10379 float heatPermCoef = 1.0;
10381 while (ent)
10382 {
10383 heatPermCoef *= ent.GetHeatPermeabilityCoef();
10384 ent = ent.GetHierarchyParent();
10385 }
10386
10387 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
10388 }
10389 }
10390 }
10391
10393 {
10394
10395 EntityAI parent = GetHierarchyParent();
10396 if (!parent)
10397 {
10398 hasParent = false;
10399 hasRootAsPlayer = false;
10400 }
10401 else
10402 {
10403 hasParent = true;
10404 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
10405 refParentIB =
ItemBase.Cast(parent);
10406 }
10407 }
10408
10409 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
10410 {
10411
10412 }
10413
10415 {
10416
10417 return false;
10418 }
10419
10421 {
10422
10423
10424 return false;
10425 }
10426
10428 {
10429
10430 return false;
10431 }
10432
10435 {
10436 return !GetIsFrozen() &&
IsOpen();
10437 }
10438
10440 {
10441 bool hasParent = false, hasRootAsPlayer = false;
10443
10444 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
10445 bool foodDecay =
g_Game.IsFoodDecayEnabled();
10446
10447 if (wwtu || foodDecay)
10448 {
10452
10453 if (processWetness || processTemperature || processDecay)
10454 {
10456
10457 if (processWetness)
10458 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
10459
10460 if (processTemperature)
10462
10463 if (processDecay)
10464 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
10465 }
10466 }
10467 }
10468
10471 {
10473 }
10474
10476 {
10479
10480 return super.GetTemperatureFreezeThreshold();
10481 }
10482
10484 {
10487
10488 return super.GetTemperatureThawThreshold();
10489 }
10490
10492 {
10495
10496 return super.GetItemOverheatThreshold();
10497 }
10498
10500 {
10502 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
10503
10504 return super.GetTemperatureFreezeTime();
10505 }
10506
10508 {
10510 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
10511
10512 return super.GetTemperatureThawTime();
10513 }
10514
10519
10521 {
10522 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
10523 }
10524
10526 {
10527 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
10528 }
10529
10532 {
10534 }
10535
10537 {
10539 }
10540
10542 {
10544 }
10545
10548 {
10549 return null;
10550 }
10551
10554 {
10555 return false;
10556 }
10557
10559 {
10561 {
10564 if (!trg)
10565 {
10567 explosive = this;
10568 }
10569
10570 explosive.PairRemote(trg);
10572
10573 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
10574 trg.SetPersistentPairID(persistentID);
10575 explosive.SetPersistentPairID(persistentID);
10576
10577 return true;
10578 }
10579 return false;
10580 }
10581
10584 {
10585 float ret = 1.0;
10588 ret *= GetHealth01();
10589
10590 return ret;
10591 }
10592
10593 #ifdef DEVELOPER
10594 override void SetDebugItem()
10595 {
10596 super.SetDebugItem();
10597 _itemBase = this;
10598 }
10599
10601 {
10602 string text = super.GetDebugText();
10603
10605 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
10606
10607 return text;
10608 }
10609 #endif
10610
10612 {
10613 return true;
10614 }
10615
10617
10619
10621 {
10624 }
10625
10626
10634
10650}
10651
10653{
10655 if (entity)
10656 {
10657 bool is_item = entity.IsInherited(
ItemBase);
10658 if (is_item && full_quantity)
10659 {
10662 }
10663 }
10664 else
10665 {
10667 return NULL;
10668 }
10669 return entity;
10670}
10671
10673{
10674 if (item)
10675 {
10676 if (health > 0)
10677 item.SetHealth("", "", health);
10678
10679 if (item.CanHaveTemperature())
10680 {
10682 if (item.CanFreeze())
10683 item.SetFrozen(false);
10684 }
10685
10686 if (item.HasEnergyManager())
10687 {
10688 if (quantity >= 0)
10689 {
10690 item.GetCompEM().SetEnergy0To1(quantity);
10691 }
10692 else
10693 {
10695 }
10696 }
10697 else if (item.IsMagazine())
10698 {
10699 Magazine mag = Magazine.Cast(item);
10700 if (quantity >= 0)
10701 {
10702 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
10703 }
10704 else
10705 {
10707 }
10708
10709 }
10710 else
10711 {
10712 if (quantity >= 0)
10713 {
10714 item.SetQuantityNormalized(quantity, false);
10715 }
10716 else
10717 {
10719 }
10720
10721 }
10722 }
10723}
10724
10725#ifdef DEVELOPER
10727#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.