5797{
5799 {
5800 return true;
5801 }
5802};
5803
5804
5805
5807{
5811
5813
5816
5817
5818
5819
5820
5829
5835
5840
5845
5866 protected bool m_IsResultOfSplit
5867
5869
5874
5875
5876
5878
5882
5883
5884
5886
5889
5890
5891
5897
5898
5906
5909
5910
5912
5913
5915
5916
5921
5922
5927
5928
5930
5931
5933 {
5938
5939 if (!
GetGame().IsDedicatedServer())
5940 {
5942 {
5944
5946 {
5948 }
5949 }
5950
5953 }
5954
5955 m_OldLocation = null;
5956
5958 {
5960 }
5961
5962 if (ConfigIsExisting("headSelectionsToHide"))
5963 {
5966 }
5967
5969 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
5970 {
5972 }
5973
5975
5976 m_IsResultOfSplit = false;
5977
5979 }
5980
5982 {
5983 super.InitItemVariables();
5984
5990 m_Count = ConfigGetInt(
"count");
5991
5994
5999
6002
6007
6019
6023
6024
6027 if (ConfigIsExisting("canBeSplit"))
6028 {
6031 }
6032
6034 if (ConfigIsExisting("itemBehaviour"))
6036
6037
6040 RegisterNetSyncVariableInt("m_VarLiquidType");
6041 RegisterNetSyncVariableInt("m_Cleanness",0,1);
6042
6043 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
6044 RegisterNetSyncVariableFloat("m_ImpactSpeed");
6045 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
6046
6047 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
6048 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
6049 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
6050 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
6051
6052 RegisterNetSyncVariableBool("m_IsBeingPlaced");
6053 RegisterNetSyncVariableBool("m_IsTakeable");
6054 RegisterNetSyncVariableBool("m_IsHologram");
6055
6058 {
6061 }
6062
6064
6066 if (ConfigIsExisting("temperaturePerQuantityWeight"))
6068
6069 }
6070
6072 {
6074 }
6075
6077 {
6080 {
6085 }
6086 }
6087
6088 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
6089 {
6091 {
6094 }
6095
6097 }
6098
6100 {
6106 }
6107
6109
6111 {
6113
6114 if (!action)
6115 {
6116 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
6117 return;
6118 }
6119
6121 if (!ai)
6122 {
6124 return;
6125 }
6126
6128 if (!action_array)
6129 {
6130 action_array = new array<ActionBase_Basic>;
6132 }
6133 if (LogManager.IsActionLogEnable())
6134 {
6135 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
6136 }
6137
6138 if (action_array.Find(action) != -1)
6139 {
6140 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
6141 }
6142 else
6143 {
6144 action_array.Insert(action);
6145 }
6146 }
6147
6149 {
6151 ActionBase action = player.GetActionManager().GetAction(actionName);
6154
6155 if (action_array)
6156 {
6157 action_array.RemoveItem(action);
6158 }
6159 }
6160
6161
6162
6164 {
6165 ActionOverrideData overrideData = new ActionOverrideData();
6169
6171 if (!actionMap)
6172 {
6175 }
6176
6177 actionMap.Insert(this.
Type(), overrideData);
6178
6179 }
6180
6182
6184
6185
6187 {
6190
6193
6194 string config_to_search = "CfgVehicles";
6195 string muzzle_owner_config;
6196
6198 {
6199 if (IsInherited(Weapon))
6200 config_to_search = "CfgWeapons";
6201
6202 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6203
6204 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
6205
6207
6208 if (config_OnFire_subclass_count > 0)
6209 {
6210 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
6211
6212 for (int i = 0; i < config_OnFire_subclass_count; i++)
6213 {
6214 string particle_class = "";
6216 string config_OnFire_entry = config_OnFire_class + particle_class;
6217 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
6218 WPOF_array.Insert(WPOF);
6219 }
6220
6221
6223 }
6224 }
6225
6227 {
6228 config_to_search = "CfgWeapons";
6229 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6230
6231 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
6232
6234
6235 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
6236 {
6237 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
6238
6239 for (i = 0; i < config_OnBulletCasingEject_count; i++)
6240 {
6241 string particle_class2 = "";
6243 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
6244 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
6245 WPOBE_array.Insert(WPOBE);
6246 }
6247
6248
6250 }
6251 }
6252 }
6253
6254
6256 {
6259
6261 {
6262 string config_to_search = "CfgVehicles";
6263
6264 if (IsInherited(Weapon))
6265 config_to_search = "CfgWeapons";
6266
6267 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6268 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
6269
6270 if (
GetGame().ConfigIsExisting(config_OnOverheating_class))
6271 {
6272
6274
6276 {
6278 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
6280 return;
6281 }
6282
6285
6286
6287
6289 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
6290
6291 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
6292 {
6293 string particle_class = "";
6295 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
6297
6298 if (entry_type == CT_CLASS)
6299 {
6300 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
6301 WPOOH_array.Insert(WPOF);
6302 }
6303 }
6304
6305
6307 }
6308 }
6309 }
6310
6312 {
6314 }
6315
6317 {
6319 {
6321
6324
6327
6328 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6329 }
6330 }
6331
6333 {
6335 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6336
6338 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6339
6341 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6342
6344 {
6346 }
6347 }
6348
6350 {
6352 }
6353
6355 {
6358 else
6360
6362 {
6365 }
6366 else
6367 {
6370
6373 }
6374
6376 }
6377
6379 {
6381 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6382 }
6383
6385 {
6387 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6389 }
6390
6392 {
6394 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6395 }
6396
6398 {
6401
6402 OverheatingParticle OP = new OverheatingParticle();
6407
6409 }
6410
6412 {
6415
6416 return -1;
6417 }
6418
6420 {
6422 {
6425
6426 for (int i = count; i > 0; --i)
6427 {
6428 int id = i - 1;
6431
6434
6435 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
6436 {
6437 if (p)
6438 {
6441 }
6442 }
6443 }
6444 }
6445 }
6446
6448 {
6450 {
6452 {
6453 int id = i - 1;
6455
6456 if (OP)
6457 {
6459
6460 if (p)
6461 {
6463 }
6464
6465 delete OP;
6466 }
6467 }
6468
6471 }
6472 }
6473
6476 {
6477 return 0.0;
6478 }
6479
6480
6482 {
6483 return 250;
6484 }
6485
6487 {
6488 return 0;
6489 }
6490
6493 {
6495 return true;
6496
6497 return false;
6498 }
6499
6502 {
6505
6507 {
6509 }
6510 else
6511 {
6512
6514 }
6515
6517 }
6518
6525 {
6526 return -1;
6527 }
6528
6529
6530
6531
6533 {
6535 {
6537 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6538
6539 if (r_index >= 0)
6540 {
6541 InventoryLocation r_il = new InventoryLocation;
6542 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6543
6544 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6547 {
6548 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6549 }
6551 {
6552 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6553 }
6554
6555 }
6556
6557 player.GetHumanInventory().ClearUserReservedLocation(this);
6558 }
6559
6562 }
6563
6564
6565
6566
6568 {
6569 return ItemBase.m_DebugActionsMask;
6570 }
6571
6573 {
6574 return ItemBase.m_DebugActionsMask & mask;
6575 }
6576
6578 {
6579 ItemBase.m_DebugActionsMask = mask;
6580 }
6581
6583 {
6584 ItemBase.m_DebugActionsMask |= mask;
6585 }
6586
6588 {
6589 ItemBase.m_DebugActionsMask &= ~mask;
6590 }
6591
6593 {
6595 {
6597 }
6598 else
6599 {
6601 }
6602 }
6603
6604
6606 {
6607 if (GetEconomyProfile())
6608 {
6609 float q_max = GetEconomyProfile().GetQuantityMax();
6610 if (q_max > 0)
6611 {
6612 float q_min = GetEconomyProfile().GetQuantityMin();
6613 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
6614
6616 {
6617 ComponentEnergyManager comp = GetCompEM();
6619 {
6621 }
6622 }
6624 {
6626
6627 }
6628
6629 }
6630 }
6631 }
6632
6635 {
6636 EntityAI parent = GetHierarchyParent();
6637
6638 if (parent)
6639 {
6640 InventoryLocation inventory_location_to_lock = new InventoryLocation;
6641 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
6642 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
6643 }
6644 }
6645
6648 {
6649 EntityAI parent = GetHierarchyParent();
6650
6651 if (parent)
6652 {
6653 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
6654 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
6655 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
6656 }
6657 }
6658
6660 {
6661
6662
6663
6664
6666
6668 {
6669 if (ScriptInputUserData.CanStoreInputUserData())
6670 {
6671 ScriptInputUserData ctx = new ScriptInputUserData;
6677 ctx.
Write(use_stack_max);
6680
6682 {
6683 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
6684 }
6685 }
6686 }
6687 else if (!
GetGame().IsMultiplayer())
6688 {
6690 }
6691 }
6692
6694 {
6696 }
6697
6699 {
6701 }
6702
6704 {
6706 }
6707
6709 {
6710
6711 return false;
6712 }
6713
6715 {
6716 return false;
6717 }
6718
6722 {
6723 return false;
6724 }
6725
6727 {
6728 return "";
6729 }
6730
6732
6734 {
6735 return false;
6736 }
6737
6739 {
6740 return true;
6741 }
6742
6743
6744
6746 {
6747 return true;
6748 }
6749
6751 {
6752 return true;
6753 }
6754
6756 {
6757 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6759 }
6760
6762 {
6764 }
6765
6767 {
6769 if (!is_being_placed)
6771 SetSynchDirty();
6772 }
6773
6774
6776
6778 {
6780 }
6781
6783 {
6785 }
6786
6788 {
6789 return 1;
6790 }
6791
6793 {
6794 return false;
6795 }
6796
6798 {
6800 SetSynchDirty();
6801 }
6802
6803
6804
6805
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
6838 {
6839 super.OnMovedInsideCargo(container);
6840
6841 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6842 }
6843
6844 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
6845 {
6846 super.EEItemLocationChanged(oldLoc,newLoc);
6847
6848 PlayerBase new_player = null;
6849 PlayerBase old_player = null;
6850
6851 if (newLoc.GetParent())
6852 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
6853
6854 if (oldLoc.GetParent())
6855 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
6856
6858 {
6859 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
6860
6861 if (r_index >= 0)
6862 {
6863 InventoryLocation r_il = new InventoryLocation;
6864 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6865
6866 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6869 {
6870 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6871 }
6873 {
6874 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6875 }
6876
6877 }
6878 }
6879
6881 {
6882 if (new_player)
6883 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
6884
6885 if (new_player == old_player)
6886 {
6887
6888 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
6889 {
6891 {
6892 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
6893 {
6894 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6895 }
6896 }
6897 else
6898 {
6899 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6900 }
6901 }
6902
6903 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
6904 {
6905 int type = oldLoc.GetType();
6907 {
6908 oldLoc.GetParent().GetOnSetLock().Invoke(this);
6909 }
6911 {
6912 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
6913 }
6914 }
6915 if (!m_OldLocation)
6916 {
6917 m_OldLocation = new InventoryLocation;
6918 }
6919 m_OldLocation.Copy(oldLoc);
6920 }
6921 else
6922 {
6923 if (m_OldLocation)
6924 {
6925 m_OldLocation.Reset();
6926 }
6927 }
6928
6930 }
6931 else
6932 {
6933 if (new_player)
6934 {
6935 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
6936 if (res_index >= 0)
6937 {
6938 InventoryLocation il = new InventoryLocation;
6939 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
6941 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
6944 {
6945 il.
GetParent().GetOnReleaseLock().Invoke(it);
6946 }
6948 {
6950 }
6951
6952 }
6953 }
6955 {
6956
6958 }
6959
6960 if (m_OldLocation)
6961 {
6962 m_OldLocation.Reset();
6963 }
6964 }
6965 }
6966
6967 override void EOnContact(IEntity other, Contact extra)
6968 {
6970 {
6971 int liquidType = -1;
6973 if (impactSpeed > 0.0)
6974 {
6976 #ifndef SERVER
6978 #else
6980 SetSynchDirty();
6981 #endif
6983 }
6984 }
6985
6986 #ifdef SERVER
6987 if (GetCompEM() && GetCompEM().IsPlugged())
6988 {
6989 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
6990 GetCompEM().UnplugThis();
6991 }
6992 #endif
6993 }
6994
6996
6998 {
7000 }
7001
7003 {
7004
7005 }
7006
7008 {
7009 super.OnItemLocationChanged(old_owner, new_owner);
7010
7011 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
7012 PlayerBase playerNew = PlayerBase.Cast(new_owner);
7013
7014 if (!relatedPlayer && playerNew)
7015 relatedPlayer = playerNew;
7016
7017 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
7018 {
7020 if (actionMgr)
7021 {
7022 ActionBase currentAction = actionMgr.GetRunningAction();
7023 if (currentAction)
7025 }
7026 }
7027
7028 Man ownerPlayerOld = null;
7029 Man ownerPlayerNew = null;
7030
7031 if (old_owner)
7032 {
7033 if (old_owner.
IsMan())
7034 {
7035 ownerPlayerOld = Man.Cast(old_owner);
7036 }
7037 else
7038 {
7039 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
7040 }
7041 }
7042 else
7043 {
7045 {
7047
7048 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
7049 {
7050 GetCompEM().UnplugThis();
7051 }
7052 }
7053 }
7054
7055 if (new_owner)
7056 {
7057 if (new_owner.
IsMan())
7058 {
7059 ownerPlayerNew = Man.Cast(new_owner);
7060 }
7061 else
7062 {
7063 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
7064 }
7065 }
7066
7067 if (ownerPlayerOld != ownerPlayerNew)
7068 {
7069 if (ownerPlayerOld)
7070 {
7071 array<EntityAI> subItemsExit = new array<EntityAI>;
7073 for (int i = 0; i < subItemsExit.Count(); i++)
7074 {
7077 }
7078 }
7079
7080 if (ownerPlayerNew)
7081 {
7082 array<EntityAI> subItemsEnter = new array<EntityAI>;
7084 for (int j = 0; j < subItemsEnter.Count(); j++)
7085 {
7088 }
7089 }
7090 }
7091 else if (ownerPlayerNew != null)
7092 {
7093 PlayerBase nplayer;
7094 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
7095 {
7096 array<EntityAI> subItemsUpdate = new array<EntityAI>;
7098 for (int k = 0; k < subItemsUpdate.Count(); k++)
7099 {
7101 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
7102 }
7103 }
7104 }
7105
7106 if (old_owner)
7107 old_owner.OnChildItemRemoved(this);
7108 if (new_owner)
7109 new_owner.OnChildItemReceived(this);
7110 }
7111
7112
7114 {
7115 super.EEDelete(parent);
7116 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
7117 if (player)
7118 {
7120
7121 if (player.IsAlive())
7122 {
7123 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7124 if (r_index >= 0)
7125 {
7126 InventoryLocation r_il = new InventoryLocation;
7127 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7128
7129 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7132 {
7133 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7134 }
7136 {
7137 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7138 }
7139
7140 }
7141
7142 player.RemoveQuickBarEntityShortcut(this);
7143 }
7144 }
7145 }
7146
7148 {
7149 super.EEKilled(killer);
7150
7153 {
7154 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
7155 {
7156 if (IsMagazine())
7157 {
7158 if (Magazine.Cast(this).GetAmmoCount() > 0)
7159 {
7161 }
7162 }
7163 else
7164 {
7166 }
7167 }
7168 }
7169 }
7170
7172 {
7173 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7174
7175 super.OnWasAttached(parent, slot_id);
7176
7179
7181 }
7182
7184 {
7185 super.OnWasDetached(parent, slot_id);
7186
7189 }
7190
7192 {
7193 int idx;
7196
7197 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7198 if (inventory_slots.Count() < 1)
7199 {
7200 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
7201 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
7202 }
7203 else
7204 {
7205 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
7206 }
7207
7208 idx = inventory_slots.Find(slot);
7209 if (idx < 0)
7210 return "";
7211
7212 return attach_types.Get(idx);
7213 }
7214
7216 {
7217 int idx = -1;
7218 string slot;
7219
7222
7223 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7224 if (inventory_slots.Count() < 1)
7225 {
7226 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
7227 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7228 }
7229 else
7230 {
7231 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
7232 if (detach_types.Count() < 1)
7233 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7234 }
7235
7236 for (int i = 0; i < inventory_slots.Count(); i++)
7237 {
7238 slot = inventory_slots.Get(i);
7239 }
7240
7241 if (slot != "")
7242 {
7243 if (detach_types.Count() == 1)
7244 idx = 0;
7245 else
7246 idx = inventory_slots.Find(slot);
7247 }
7248 if (idx < 0)
7249 return "";
7250
7251 return detach_types.Get(idx);
7252 }
7253
7255 {
7256
7258
7259
7260 float min_time = 1;
7261 float max_time = 3;
7262 float delay = Math.RandomFloat(min_time, max_time);
7263
7264 explode_timer.Run(delay, this, "DoAmmoExplosion");
7265 }
7266
7268 {
7269 Magazine magazine = Magazine.Cast(this);
7270 int pop_sounds_count = 6;
7271 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
7272
7273
7274 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
7275 string sound_name = pop_sounds[ sound_idx ];
7277
7278
7279 magazine.ServerAddAmmoCount(-1);
7280
7281
7282 float min_temp_to_explode = 100;
7283
7284 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
7285 {
7287 }
7288 }
7289
7290
7291 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
7292 {
7293 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
7294
7295 const int CHANCE_DAMAGE_CARGO = 4;
7296 const int CHANCE_DAMAGE_ATTACHMENT = 1;
7297 const int CHANCE_DAMAGE_NOTHING = 2;
7298
7300 {
7301 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
7302 int chances;
7303 int rnd;
7304
7305 if (GetInventory().GetCargo())
7306 {
7307 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7308 rnd = Math.RandomInt(0,chances);
7309
7310 if (rnd < CHANCE_DAMAGE_CARGO)
7311 {
7313 }
7314 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
7315 {
7317 }
7318 }
7319 else
7320 {
7321 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7322 rnd = Math.RandomInt(0,chances);
7323
7324 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
7325 {
7327 }
7328 }
7329 }
7330 }
7331
7333 {
7334 if (GetInventory().GetCargo())
7335 {
7336 int item_count = GetInventory().GetCargo().GetItemCount();
7337 if (item_count > 0)
7338 {
7339 int random_pick = Math.RandomInt(0, item_count);
7341 if (!item.IsExplosive())
7342 {
7343 item.AddHealth("","",damage);
7344 return true;
7345 }
7346 }
7347 }
7348 return false;
7349 }
7350
7352 {
7353 int attachment_count = GetInventory().AttachmentCount();
7354 if (attachment_count > 0)
7355 {
7356 int random_pick = Math.RandomInt(0, attachment_count);
7357 ItemBase attachment =
ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
7358 if (!attachment.IsExplosive())
7359 {
7360 attachment.AddHealth("","",damage);
7361 return true;
7362 }
7363 }
7364 return false;
7365 }
7366
7368 {
7370 }
7371
7373 {
7375 return GetInventory().CanRemoveEntity();
7376
7377 return false;
7378 }
7379
7381 {
7382
7384 return false;
7385
7386
7388 return false;
7389
7390
7391
7393 if (delta == 0)
7394 return false;
7395
7396
7397 return true;
7398 }
7399
7401 {
7403 {
7404 if (ScriptInputUserData.CanStoreInputUserData())
7405 {
7406 ScriptInputUserData ctx = new ScriptInputUserData;
7411 ctx.
Write(destination_entity);
7415 }
7416 }
7417 else if (!
GetGame().IsMultiplayer())
7418 {
7420 }
7421 }
7422
7424 {
7425 float split_quantity_new;
7429 InventoryLocation loc = new InventoryLocation;
7430
7431 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7432 {
7434 split_quantity_new = stack_max;
7435 else
7437
7439 {
7440 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7441 if (new_item)
7442 {
7443 new_item.SetResultOfSplit(true);
7444 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7446 new_item.
SetQuantity(split_quantity_new,
false,
true);
7447 }
7448 }
7449 }
7450 else if (destination_entity && slot_id == -1)
7451 {
7452 if (quantity > stack_max)
7453 split_quantity_new = stack_max;
7454 else
7455 split_quantity_new = quantity;
7456
7458 {
7460 {
7463 }
7464
7465 if (new_item)
7466 {
7467 new_item.SetResultOfSplit(true);
7468 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7470 new_item.
SetQuantity(split_quantity_new,
false,
true);
7471 }
7472 }
7473 }
7474 else
7475 {
7476 if (stack_max != 0)
7477 {
7479 {
7481 }
7482
7483 if (split_quantity_new == 0)
7484 {
7485 if (!
GetGame().IsMultiplayer())
7486 player.PhysicalPredictiveDropItem(this);
7487 else
7488 player.ServerDropEntity(this);
7489 return;
7490 }
7491
7493 {
7495
7496 if (new_item)
7497 {
7498 new_item.SetResultOfSplit(true);
7499 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7502 new_item.PlaceOnSurface();
7503 }
7504 }
7505 }
7506 }
7507 }
7508
7510 {
7511 float split_quantity_new;
7515 InventoryLocation loc = new InventoryLocation;
7516
7517 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7518 {
7520 split_quantity_new = stack_max;
7521 else
7523
7525 {
7526 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7527 if (new_item)
7528 {
7529 new_item.SetResultOfSplit(true);
7530 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7532 new_item.
SetQuantity(split_quantity_new,
false,
true);
7533 }
7534 }
7535 }
7536 else if (destination_entity && slot_id == -1)
7537 {
7538 if (quantity > stack_max)
7539 split_quantity_new = stack_max;
7540 else
7541 split_quantity_new = quantity;
7542
7544 {
7546 {
7549 }
7550
7551 if (new_item)
7552 {
7553 new_item.SetResultOfSplit(true);
7554 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7556 new_item.
SetQuantity(split_quantity_new,
false,
true);
7557 }
7558 }
7559 }
7560 else
7561 {
7562 if (stack_max != 0)
7563 {
7565 {
7567 }
7568
7570 {
7572
7573 if (new_item)
7574 {
7575 new_item.SetResultOfSplit(true);
7576 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7579 new_item.PlaceOnSurface();
7580 }
7581 }
7582 }
7583 }
7584 }
7585
7587 {
7589 {
7590 if (ScriptInputUserData.CanStoreInputUserData())
7591 {
7592 ScriptInputUserData ctx = new ScriptInputUserData;
7597 dst.WriteToContext(ctx);
7599 }
7600 }
7601 else if (!
GetGame().IsMultiplayer())
7602 {
7604 }
7605 }
7606
7608 {
7610 {
7611 if (ScriptInputUserData.CanStoreInputUserData())
7612 {
7613 ScriptInputUserData ctx = new ScriptInputUserData;
7618 ctx.
Write(destination_entity);
7624 }
7625 }
7626 else if (!
GetGame().IsMultiplayer())
7627 {
7629 }
7630 }
7631
7633 {
7635 }
7636
7638 {
7640 float split_quantity_new;
7642 if (dst.IsValid())
7643 {
7644 int slot_id = dst.GetSlot();
7646
7647 if (quantity > stack_max)
7648 split_quantity_new = stack_max;
7649 else
7650 split_quantity_new = quantity;
7651
7653 {
7655
7656 if (new_item)
7657 {
7658 new_item.SetResultOfSplit(true);
7659 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7661 new_item.
SetQuantity(split_quantity_new,
false,
true);
7662 }
7663
7664 return new_item;
7665 }
7666 }
7667
7668 return null;
7669 }
7670
7672 {
7674 float split_quantity_new;
7676 if (destination_entity)
7677 {
7679 if (quantity > stackable)
7680 split_quantity_new = stackable;
7681 else
7682 split_quantity_new = quantity;
7683
7685 {
7686 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
7687 if (new_item)
7688 {
7689 new_item.SetResultOfSplit(true);
7690 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7692 new_item.
SetQuantity(split_quantity_new,
false,
true);
7693 }
7694 }
7695 }
7696 }
7697
7699 {
7701 {
7702 if (ScriptInputUserData.CanStoreInputUserData())
7703 {
7704 ScriptInputUserData ctx = new ScriptInputUserData;
7709 ItemBase destination_entity =
this;
7710 ctx.
Write(destination_entity);
7714 }
7715 }
7716 else if (!
GetGame().IsMultiplayer())
7717 {
7719 }
7720 }
7721
7723 {
7725 float split_quantity_new;
7727 if (player)
7728 {
7730 if (quantity > stackable)
7731 split_quantity_new = stackable;
7732 else
7733 split_quantity_new = quantity;
7734
7736 {
7737 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
7738 new_item =
ItemBase.Cast(in_hands);
7739 if (new_item)
7740 {
7741 new_item.SetResultOfSplit(true);
7742 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7744 new_item.SetQuantity(split_quantity_new, false, true);
7745 }
7746 }
7747 }
7748 }
7749
7751 {
7753 float split_quantity_new = Math.Floor(quantity * 0.5);
7754
7756 return;
7757
7759
7760 if (new_item)
7761 {
7762 if (new_item.GetQuantityMax() < split_quantity_new)
7763 {
7764 split_quantity_new = new_item.GetQuantityMax();
7765 }
7766
7767 new_item.SetResultOfSplit(true);
7768 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7769
7771 {
7774 }
7775 else
7776 {
7778 new_item.
SetQuantity(split_quantity_new,
false,
true);
7779 }
7780 }
7781 }
7782
7784 {
7786 float split_quantity_new = Math.Floor(quantity / 2);
7787
7789 return;
7790
7791 InventoryLocation invloc = new InventoryLocation;
7793
7795 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
7796
7797 if (new_item)
7798 {
7799 if (new_item.GetQuantityMax() < split_quantity_new)
7800 {
7801 split_quantity_new = new_item.GetQuantityMax();
7802 }
7804 {
7807 }
7808 else if (split_quantity_new > 1)
7809 {
7811 new_item.
SetQuantity(split_quantity_new,
false,
true);
7812 }
7813 }
7814 }
7815
7818 {
7819 SetWeightDirty();
7821
7822 if (parent)
7823 parent.OnAttachmentQuantityChangedEx(this, delta);
7824
7826 {
7828 {
7830 }
7832 {
7833 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
7835 }
7836 }
7837
7838 }
7839
7842 {
7843
7844 }
7845
7848 {
7850 }
7851
7853 {
7854 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
7855
7857 {
7858 if (newLevel == GameConstants.STATE_RUINED)
7859 {
7861 EntityAI parent = GetHierarchyParent();
7862 if (parent && parent.IsFireplace())
7863 {
7864 CargoBase cargo = GetInventory().GetCargo();
7865 if (cargo)
7866 {
7868 {
7870 }
7871 }
7872 }
7873 }
7874
7876 {
7877
7879 return;
7880 }
7881
7882 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
7883 {
7885 }
7886 }
7887 }
7888
7889
7891 {
7892 super.OnRightClick();
7893
7895 {
7897 {
7898 if (ScriptInputUserData.CanStoreInputUserData())
7899 {
7900 EntityAI root = GetHierarchyRoot();
7901 Man playerOwner = GetHierarchyRootPlayer();
7902 InventoryLocation dst = new InventoryLocation;
7903
7904
7905 if (!playerOwner && root && root == this)
7906 {
7908 }
7909 else
7910 {
7911
7912 GetInventory().GetCurrentInventoryLocation(dst);
7914 {
7917 {
7919 }
7920 else
7921 {
7923
7924
7925 if (
GetGame().
GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
7926 {
7928 }
7929 else
7930 {
7931 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
7932 }
7933 }
7934 }
7935 }
7936
7937 ScriptInputUserData ctx = new ScriptInputUserData;
7945 }
7946 }
7947 else if (!
GetGame().IsMultiplayer())
7948 {
7950 }
7951 }
7952 }
7953
7955 {
7956 if (root)
7957 {
7958 vector m4[4];
7959 root.GetTransform(m4);
7960 dst.SetGround(this, m4);
7961 }
7962 else
7963 {
7964 GetInventory().GetCurrentInventoryLocation(dst);
7965 }
7966 }
7967
7968 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
7969 {
7970
7971 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
7972 return false;
7973
7974 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
7975 return false;
7976
7977
7979 return false;
7980
7981
7982 Magazine mag = Magazine.Cast(this);
7983 if (mag)
7984 {
7985 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
7986 return false;
7987
7988 if (stack_max_limit)
7989 {
7990 Magazine other_mag = Magazine.Cast(other_item);
7991 if (other_item)
7992 {
7993 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
7994 return false;
7995 }
7996
7997 }
7998 }
7999 else
8000 {
8001
8003 return false;
8004
8006 return false;
8007 }
8008
8009 PlayerBase player = null;
8010 if (CastTo(player, GetHierarchyRootPlayer()))
8011 {
8012 if (player.GetInventory().HasAttachment(this))
8013 return false;
8014
8015 if (player.IsItemsToDelete())
8016 return false;
8017 }
8018
8019 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
8020 return false;
8021
8022 int slotID;
8024 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
8025 return false;
8026
8027 return true;
8028 }
8029
8031 {
8033 }
8034
8036 {
8037 return m_IsResultOfSplit;
8038 }
8039
8041 {
8042 m_IsResultOfSplit = value;
8043 }
8044
8046 {
8048 }
8049
8051 {
8052 float other_item_quantity = other_item.GetQuantity();
8053 float this_free_space;
8054
8056
8058
8059 if (other_item_quantity > this_free_space)
8060 {
8061 return this_free_space;
8062 }
8063 else
8064 {
8065 return other_item_quantity;
8066 }
8067 }
8068
8070 {
8072 }
8073
8075 {
8077 return;
8078
8079 if (!IsMagazine() && other_item)
8080 {
8082 if (quantity_used != 0)
8083 {
8084 float hp1 = GetHealth01("","");
8085 float hp2 = other_item.GetHealth01("","");
8086 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
8087 hpResult = hpResult / (
GetQuantity() + quantity_used);
8088
8089 hpResult *= GetMaxHealth();
8090 Math.Round(hpResult);
8091 SetHealth("", "Health", hpResult);
8092
8094 other_item.AddQuantity(-quantity_used);
8095 }
8096 }
8098 }
8099
8101 {
8102 #ifdef SERVER
8103 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
8104 GetHierarchyParent().IncreaseLifetimeUp();
8105 #endif
8106 };
8107
8109 {
8110 PlayerBase p = PlayerBase.Cast(player);
8111
8112 array<int> recipesIds = p.m_Recipes;
8113 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8114 if (moduleRecipesManager)
8115 {
8116 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
8117 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
8118 }
8119
8120 for (int i = 0;i < recipesIds.Count(); i++)
8121 {
8122 int key = recipesIds.Get(i);
8123 string recipeName = moduleRecipesManager.GetRecipeName(key);
8125 }
8126 }
8127
8128
8129 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
8130 {
8131 super.GetDebugActions(outputList);
8132
8133
8139
8140
8145
8150
8151
8155
8156
8158 {
8162 }
8163
8166
8167
8171
8173
8174 InventoryLocation loc = new InventoryLocation();
8175 GetInventory().GetCurrentInventoryLocation(loc);
8177 {
8178 if (Gizmo_IsSupported())
8181 }
8182
8184 }
8185
8186
8187
8188
8190 {
8191 super.OnAction(action_id, player, ctx);
8192
8194 {
8195 switch (action_id)
8196 {
8199 return true;
8202 return true;
8203 }
8204 }
8205
8207 {
8208 switch (action_id)
8209 {
8211 Delete();
8212 return true;
8213 }
8214 }
8215
8216 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
8217 {
8218 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8219 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
8220 PlayerBase p = PlayerBase.Cast(player);
8221 if (
EActions.RECIPES_RANGE_START < 1000)
8222 {
8223 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
8224 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
8225 }
8226 }
8227 #ifndef SERVER
8228 else if (action_id ==
EActions.WATCH_PLAYER)
8229 {
8230 PluginDeveloper.SetDeveloperItemClientEx(player);
8231 }
8232 #endif
8234 {
8235 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
8236 {
8237 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
8238 OnDebugButtonPressServer(id + 1);
8239 }
8240
8241 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
8242 {
8243 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
8245 }
8246
8247 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
8248 {
8249 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
8251 }
8252
8253 else if (action_id ==
EActions.ADD_QUANTITY)
8254 {
8255 if (IsMagazine())
8256 {
8257 Magazine mag = Magazine.Cast(this);
8258 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
8259 }
8260 else
8261 {
8263 }
8264
8265 if (m_EM)
8266 {
8267 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
8268 }
8269
8270 }
8271
8272 else if (action_id ==
EActions.REMOVE_QUANTITY)
8273 {
8274 if (IsMagazine())
8275 {
8276 Magazine mag2 = Magazine.Cast(this);
8277 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
8278 }
8279 else
8280 {
8282 }
8283 if (m_EM)
8284 {
8285 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
8286 }
8287
8288 }
8289
8290 else if (action_id ==
EActions.SET_QUANTITY_0)
8291 {
8293
8294 if (m_EM)
8295 {
8296 m_EM.SetEnergy(0);
8297 }
8298 }
8299
8300 else if (action_id ==
EActions.SET_MAX_QUANTITY)
8301 {
8303
8304 if (m_EM)
8305 {
8306 m_EM.SetEnergy(m_EM.GetEnergyMax());
8307 }
8308 }
8309
8310 else if (action_id ==
EActions.ADD_HEALTH)
8311 {
8312 AddHealth("","",GetMaxHealth("","Health")/5);
8313 }
8314 else if (action_id ==
EActions.REMOVE_HEALTH)
8315 {
8316 AddHealth("","",-GetMaxHealth("","Health")/5);
8317 }
8318 else if (action_id ==
EActions.DESTROY_HEALTH)
8319 {
8320 SetHealth01("","",0);
8321 }
8322 else if (action_id ==
EActions.WATCH_ITEM)
8323 {
8325 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
8326 #ifdef DEVELOPER
8327 SetDebugDeveloper_item(this);
8328 #endif
8329 }
8330
8331 else if (action_id ==
EActions.ADD_TEMPERATURE)
8332 {
8333 AddTemperature(20);
8334
8335 }
8336
8337 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
8338 {
8339 AddTemperature(-20);
8340
8341 }
8342
8343 else if (action_id ==
EActions.FLIP_FROZEN)
8344 {
8345 SetFrozen(!GetIsFrozen());
8346
8347 }
8348
8349 else if (action_id ==
EActions.ADD_WETNESS)
8350 {
8352
8353 }
8354
8355 else if (action_id ==
EActions.REMOVE_WETNESS)
8356 {
8358
8359 }
8360
8361 else if (action_id ==
EActions.LIQUIDTYPE_UP)
8362 {
8365
8366
8367 }
8368
8369 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
8370 {
8373 }
8374
8375 else if (action_id ==
EActions.MAKE_SPECIAL)
8376 {
8377 auto debugParams = DebugSpawnParams.WithPlayer(player);
8378 OnDebugSpawnEx(debugParams);
8379 }
8380
8381 }
8382
8383
8384 return false;
8385 }
8386
8387
8388
8389
8393
8396
8397
8398
8400 {
8401 return false;
8402 }
8403
8404
8406 {
8407 return true;
8408 }
8409
8410
8412 {
8413 return true;
8414 }
8415
8416
8417
8419 {
8420 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
8422 }
8423
8426 {
8427 return null;
8428 }
8429
8431 {
8432 return false;
8433 }
8434
8436 {
8437 return false;
8438 }
8439
8443
8444
8446 {
8447 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8448 return module_repairing.CanRepair(this, item_repair_kit);
8449 }
8450
8451
8452 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
8453 {
8454 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8455 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
8456 }
8457
8458
8460 {
8461
8462
8463
8464
8465
8466
8467
8468
8469 return 1;
8470 }
8471
8472
8473
8475 {
8477 }
8478
8479
8480
8482 {
8484 }
8485
8486
8495 {
8496 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8497
8498 if (player)
8499 {
8500 player.MessageStatus(text);
8501 }
8502 }
8503
8504
8513 {
8514 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8515
8516 if (player)
8517 {
8518 player.MessageAction(text);
8519 }
8520 }
8521
8522
8531 {
8532 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8533
8534 if (player)
8535 {
8536 player.MessageFriendly(text);
8537 }
8538 }
8539
8540
8549 {
8550 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8551
8552 if (player)
8553 {
8554 player.MessageImportant(text);
8555 }
8556 }
8557
8559 {
8560 return true;
8561 }
8562
8563
8564 override bool KindOf(
string tag)
8565 {
8566 bool found = false;
8567 string item_name = this.
GetType();
8570
8571 int array_size = item_tag_array.Count();
8572 for (int i = 0; i < array_size; i++)
8573 {
8574 if (item_tag_array.Get(i) == tag)
8575 {
8576 found = true;
8577 break;
8578 }
8579 }
8580 return found;
8581 }
8582
8583
8585 {
8586
8587 super.OnRPC(sender, rpc_type,ctx);
8588
8589
8590 switch (rpc_type)
8591 {
8592 #ifndef SERVER
8593 case ERPCs.RPC_SOUND_LOCK_ATTACH:
8594 Param2<bool, string> p = new Param2<bool, string>(false, "");
8595
8597 return;
8598
8599 bool play = p.param1;
8600 string soundSet = p.param2;
8601
8602 if (play)
8603 {
8605 {
8607 {
8609 }
8610 }
8611 else
8612 {
8614 }
8615 }
8616 else
8617 {
8619 }
8620
8621 break;
8622 #endif
8623
8624 }
8625
8627 {
8629 }
8630 }
8631
8632
8633
8634
8636 {
8637 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8638 return plugin.GetID(
name);
8639 }
8640
8642 {
8643 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8644 return plugin.GetName(id);
8645 }
8646
8649 {
8650
8651
8652 int varFlags;
8653 if (!ctx.
Read(varFlags))
8654 return;
8655
8656 if (varFlags & ItemVariableFlags.FLOAT)
8657 {
8659 }
8660 }
8661
8663 {
8664
8665 super.SerializeNumericalVars(floats_out);
8666
8667
8668
8670 {
8672 }
8673
8675 {
8677 }
8678
8680 {
8682 }
8683
8685 {
8690 }
8691
8693 {
8695 }
8696 }
8697
8699 {
8700
8701 super.DeSerializeNumericalVars(floats);
8702
8703
8704 int index = 0;
8705 int mask = Math.Round(floats.Get(index));
8706
8707 index++;
8708
8710 {
8712 {
8714 }
8715 else
8716 {
8717 float quantity = floats.Get(index);
8719 }
8720 index++;
8721 }
8722
8724 {
8725 float wet = floats.Get(index);
8727 index++;
8728 }
8729
8731 {
8732 int liquidtype = Math.Round(floats.Get(index));
8734 index++;
8735 }
8736
8738 {
8740 index++;
8742 index++;
8744 index++;
8746 index++;
8747 }
8748
8750 {
8751 int cleanness = Math.Round(floats.Get(index));
8753 index++;
8754 }
8755 }
8756
8758 {
8759 super.WriteVarsToCTX(ctx);
8760
8761
8763 {
8765 }
8766
8768 {
8770 }
8771
8773 {
8775 }
8776
8778 {
8779 int r,g,b,a;
8785 }
8786
8788 {
8790 }
8791 }
8792
8794 {
8795 if (!super.ReadVarsFromCTX(ctx,version))
8796 return false;
8797
8798 int intValue;
8799 float value;
8800
8801 if (version < 140)
8802 {
8803 if (!ctx.
Read(intValue))
8804 return false;
8805
8806 m_VariablesMask = intValue;
8807 }
8808
8810 {
8811 if (!ctx.
Read(value))
8812 return false;
8813
8815 {
8817 }
8818 else
8819 {
8821 }
8822 }
8823
8824 if (version < 140)
8825 {
8827 {
8828 if (!ctx.
Read(value))
8829 return false;
8830 SetTemperatureDirect(value);
8831 }
8832 }
8833
8835 {
8836 if (!ctx.
Read(value))
8837 return false;
8839 }
8840
8842 {
8843 if (!ctx.
Read(intValue))
8844 return false;
8846 }
8847
8849 {
8850 int r,g,b,a;
8852 return false;
8854 return false;
8856 return false;
8858 return false;
8859
8861 }
8862
8864 {
8865 if (!ctx.
Read(intValue))
8866 return false;
8868 }
8869
8870 if (version >= 138 && version < 140)
8871 {
8873 {
8874 if (!ctx.
Read(intValue))
8875 return false;
8876 SetFrozen(intValue);
8877 }
8878 }
8879
8880 return true;
8881 }
8882
8883
8885 {
8888 {
8890 }
8891
8892 if (!super.OnStoreLoad(ctx, version))
8893 {
8895 return false;
8896 }
8897
8898 if (version >= 114)
8899 {
8900 bool hasQuickBarIndexSaved;
8901
8902 if (!ctx.
Read(hasQuickBarIndexSaved))
8903 {
8905 return false;
8906 }
8907
8908 if (hasQuickBarIndexSaved)
8909 {
8910 int itmQBIndex;
8911
8912
8913 if (!ctx.
Read(itmQBIndex))
8914 {
8916 return false;
8917 }
8918
8919 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
8920 if (itmQBIndex != -1 && parentPlayer)
8921 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
8922 }
8923 }
8924 else
8925 {
8926
8927 PlayerBase player;
8928 int itemQBIndex;
8929 if (version ==
int.
MAX)
8930 {
8931 if (!ctx.
Read(itemQBIndex))
8932 {
8934 return false;
8935 }
8936 }
8937 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
8938 {
8939
8940 if (!ctx.
Read(itemQBIndex))
8941 {
8943 return false;
8944 }
8945 if (itemQBIndex != -1 && player)
8946 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
8947 }
8948 }
8949
8950 if (version < 140)
8951 {
8952
8953 if (!LoadVariables(ctx, version))
8954 {
8956 return false;
8957 }
8958 }
8959
8960
8962 {
8964 return false;
8965 }
8966 if (version >= 132)
8967 {
8969 if (raib)
8970 {
8972 {
8974 return false;
8975 }
8976 }
8977 }
8978
8980 return true;
8981 }
8982
8983
8984
8986 {
8987 super.OnStoreSave(ctx);
8988
8989 PlayerBase player;
8990 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
8991 {
8993
8994 int itemQBIndex = -1;
8995 itemQBIndex = player.FindQuickBarEntityIndex(this);
8996 ctx.
Write(itemQBIndex);
8997 }
8998 else
8999 {
9001 }
9002
9004
9006 if (raib)
9007 {
9009 }
9010 }
9011
9012
9014 {
9015 super.AfterStoreLoad();
9016
9018 {
9020 }
9021
9023 {
9026 }
9027 }
9028
9030 {
9031 super.EEOnAfterLoad();
9032
9034 {
9036 }
9037
9040 }
9041
9043 {
9044 return false;
9045 }
9046
9047
9048
9050 {
9052 {
9053 #ifdef PLATFORM_CONSOLE
9054
9056 {
9058 if (menu)
9059 {
9061 }
9062 }
9063 #endif
9064 }
9065
9067 {
9070 }
9071
9073 {
9074 SetWeightDirty();
9076 }
9078 {
9081 }
9082
9084 {
9087 }
9089 {
9092 }
9093
9094 super.OnVariablesSynchronized();
9095 }
9096
9097
9098
9100 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
9101 {
9102 if (!IsServerCheck(allow_client))
9103 return false;
9104
9106 return false;
9107
9110
9111 if (value <= (min + 0.001))
9112 value = min;
9113
9114 if (value == min)
9115 {
9116 if (destroy_config)
9117 {
9118 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
9119 if (dstr)
9120 {
9122 this.Delete();
9123 return true;
9124 }
9125 }
9126 else if (destroy_forced)
9127 {
9129 this.Delete();
9130 return true;
9131 }
9132
9134 }
9135
9138
9140 {
9142
9143 if (delta)
9145 }
9146
9148
9149 return false;
9150 }
9151
9152
9154 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9155 {
9157 }
9158
9160 {
9163 }
9164
9166 {
9169 }
9170
9172 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9173 {
9174 float value_clamped = Math.Clamp(value, 0, 1);
9176 SetQuantity(result, destroy_config, destroy_forced);
9177 }
9178
9179
9182 {
9184 }
9185
9187 {
9189 }
9190
9191
9192
9193
9194
9195
9196
9197
9198
9199
9201 {
9202 int slot = -1;
9203 if (GetInventory())
9204 {
9205 InventoryLocation il = new InventoryLocation;
9206 GetInventory().GetCurrentInventoryLocation(il);
9208 }
9209
9211 }
9212
9214 {
9215 float quantity_max = 0;
9216
9218 {
9219 if (attSlotID != -1)
9220 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
9221
9222 if (quantity_max <= 0)
9224 }
9225
9226 if (quantity_max <= 0)
9228
9229 return quantity_max;
9230 }
9231
9233 {
9235 }
9236
9238 {
9240 }
9241
9242
9244 {
9246 }
9247
9249 {
9251 }
9252
9254 {
9256 }
9257
9258
9260 {
9261
9262 float weightEx = GetWeightEx();
9263 float special = GetInventoryAndCargoWeight();
9264 return weightEx - special;
9265 }
9266
9267
9269 {
9271 }
9272
9274 {
9276 {
9277 #ifdef DEVELOPER
9278 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9279 {
9280 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
9282 }
9283 #endif
9284
9286 }
9287 else if (HasEnergyManager())
9288 {
9289 #ifdef DEVELOPER
9290 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9291 {
9292 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
9293 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
9294 }
9295 #endif
9296 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
9297 }
9298 else
9299 {
9300 #ifdef DEVELOPER
9301 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9302 {
9303 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
9304 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
9305 }
9306 #endif
9307 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
9308 }
9309 }
9310
9313 {
9314 int item_count = 0;
9316
9317 if (GetInventory().GetCargo() != NULL)
9318 {
9319 item_count = GetInventory().GetCargo().GetItemCount();
9320 }
9321
9322 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
9323 {
9324 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
9325 if (item)
9326 item_count += item.GetNumberOfItems();
9327 }
9328 return item_count;
9329 }
9330
9333 {
9334 float weight = 0;
9335 float wetness = 1;
9336 if (include_wetness)
9339 {
9340 weight = wetness * m_ConfigWeight;
9341 }
9343 {
9344 weight = 1;
9345 }
9346 return weight;
9347 }
9348
9349
9350
9352 {
9353 if ((
GetGame().IsServer() || !
GetGame().IsMultiplayer()) && GetInventory())
9354 {
9355 GameInventory inv = GetInventory();
9356 array<EntityAI> items = new array<EntityAI>;
9358 for (int i = 0; i < items.Count(); i++)
9359 {
9361 if (item)
9362 {
9364 }
9365 }
9366 }
9367 }
9368
9369
9370
9371
9373 {
9374 float energy = 0;
9375 if (HasEnergyManager())
9376 {
9377 energy = GetCompEM().GetEnergy();
9378 }
9379 return energy;
9380 }
9381
9382
9384 {
9385 super.OnEnergyConsumed();
9386
9388 }
9389
9391 {
9392 super.OnEnergyAdded();
9393
9395 }
9396
9397
9399 {
9400 if (
GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
9401 {
9403 {
9404 float energy_0to1 = GetCompEM().GetEnergy0To1();
9406 }
9407 }
9408 }
9409
9410
9412 {
9413 return ConfigGetFloat("heatIsolation");
9414 }
9415
9417 {
9419 }
9420
9422 {
9423 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
9424 if (
GetGame().ConfigIsExisting(paramPath))
9426
9427 return 0.0;
9428 }
9429
9431 {
9432 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
9433 if (
GetGame().ConfigIsExisting(paramPath))
9435
9436 return 0.0;
9437 }
9438
9439 override void SetWet(
float value,
bool allow_client =
false)
9440 {
9441 if (!IsServerCheck(allow_client))
9442 return;
9443
9446
9448
9449 m_VarWet = Math.Clamp(value, min, max);
9450
9452 {
9455 }
9456 }
9457
9458 override void AddWet(
float value)
9459 {
9461 }
9462
9464 {
9466 }
9467
9469 {
9471 }
9472
9474 {
9476 }
9477
9479 {
9481 }
9482
9484 {
9486 }
9487
9489 {
9492 if (newLevel != oldLevel)
9493 {
9495 }
9496 }
9497
9499 {
9500 SetWeightDirty();
9501 }
9502
9504 {
9505 return GetWetLevelInternal(
m_VarWet);
9506 }
9507
9508
9509
9511 {
9513 }
9514
9516 {
9518 }
9519
9521 {
9523 }
9524
9526 {
9528 }
9529
9530
9531
9533 {
9534 if (ConfigIsExisting("itemModelLength"))
9535 {
9536 return ConfigGetFloat("itemModelLength");
9537 }
9538 return 0;
9539 }
9540
9542 {
9543 if (ConfigIsExisting("itemAttachOffset"))
9544 {
9545 return ConfigGetFloat("itemAttachOffset");
9546 }
9547 return 0;
9548 }
9549
9550 override void SetCleanness(
int value,
bool allow_client =
false)
9551 {
9552 if (!IsServerCheck(allow_client))
9553 return;
9554
9556
9558
9561 }
9562
9564 {
9566 }
9567
9569 {
9570 return true;
9571 }
9572
9573
9574
9575
9577 {
9579 }
9580
9582 {
9584 }
9585
9586
9587
9588
9589 override void SetColor(
int r,
int g,
int b,
int a)
9590 {
9596 }
9598 override void GetColor(out
int r,out
int g,out
int b,out
int a)
9599 {
9604 }
9605
9607 {
9609 }
9610
9613 {
9614 int r,g,b,a;
9616 r = r/255;
9617 g = g/255;
9618 b = b/255;
9619 a = a/255;
9620 return MiscGameplayFunctions.GetColorString(r, g, b, a);
9621 }
9622
9623
9624
9625 override void SetLiquidType(
int value,
bool allow_client =
false)
9626 {
9627 if (!IsServerCheck(allow_client))
9628 return;
9629
9634 }
9635
9637 {
9638 return ConfigGetInt("varLiquidTypeInit");
9639 }
9640
9642 {
9644 }
9645
9647 {
9649 SetFrozen(false);
9650 }
9651
9654 {
9655 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9656 }
9657
9658
9661 {
9662 PlayerBase nplayer;
9663 if (PlayerBase.CastTo(nplayer, player))
9664 {
9666
9667 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9668 }
9669 }
9670
9671
9674 {
9675 PlayerBase nplayer;
9676 if (PlayerBase.CastTo(nplayer,player))
9677 {
9678
9679 nplayer.SetEnableQuickBarEntityShortcut(this,false);
9680
9681 }
9682
9683
9684 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
9685
9686
9687 if (HasEnergyManager())
9688 {
9689 GetCompEM().UpdatePlugState();
9690 }
9691 }
9692
9693
9695 {
9696 super.OnPlacementStarted(player);
9697
9699 }
9700
9701 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
9702 {
9704 {
9705 m_AdminLog.OnPlacementComplete(player,
this);
9706 }
9707
9708 super.OnPlacementComplete(player, position, orientation);
9709 }
9710
9711
9712
9713
9714
9716 {
9718 {
9719 return true;
9720 }
9721 else
9722 {
9723 return false;
9724 }
9725 }
9726
9727
9729 {
9731 {
9733 }
9734 }
9735
9736
9738 {
9740 }
9741
9743 {
9745 }
9746
9747 override void InsertAgent(
int agent,
float count = 1)
9748 {
9749 if (count < 1)
9750 return;
9751
9753 }
9754
9757 {
9759 }
9760
9761
9763 {
9765 }
9766
9767
9768
9769
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
9809 {
9811 return false;
9812 return true;
9813 }
9814
9816 {
9817
9819 }
9820
9821
9824 {
9825 super.CheckForRoofLimited(timeTresholdMS);
9826
9828 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
9829 {
9830 m_PreviousRoofTestTime = time;
9831 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
9832 }
9833 }
9834
9835
9837 {
9839 {
9840 return 0;
9841 }
9842
9843 if (GetInventory().GetAttachmentSlotsCount() != 0)
9844 {
9845 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
9846 if (filter)
9847 return filter.GetProtectionLevel(type, false, system);
9848 else
9849 return 0;
9850 }
9851
9852 string subclassPath, entryName;
9853
9854 switch (type)
9855 {
9857 entryName = "biological";
9858 break;
9860 entryName = "chemical";
9861 break;
9862 default:
9863 entryName = "biological";
9864 break;
9865 }
9866
9867 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
9868
9870 }
9871
9872
9873
9876 {
9877 if (!IsMagazine())
9879
9881 }
9882
9883
9884
9885
9886
9891 {
9892 return true;
9893 }
9894
9896 {
9898 }
9899
9900
9901
9902
9903
9905 {
9906 if (parent)
9907 {
9908 if (parent.IsInherited(DayZInfected))
9909 return true;
9910
9911 if (!parent.IsRuined())
9912 return true;
9913 }
9914
9915 return true;
9916 }
9917
9919 {
9920 if (!super.CanPutAsAttachment(parent))
9921 {
9922 return false;
9923 }
9924
9925 if (!IsRuined() && !parent.IsRuined())
9926 {
9927 return true;
9928 }
9929
9930 return false;
9931 }
9932
9934 {
9935
9936
9937
9938
9939 return super.CanReceiveItemIntoCargo(item);
9940 }
9941
9943 {
9944
9945
9946
9947
9948 GameInventory attachmentInv = attachment.GetInventory();
9950 {
9951 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
9952 return false;
9953 }
9954
9955 InventoryLocation loc = new InventoryLocation();
9956 attachment.GetInventory().GetCurrentInventoryLocation(loc);
9957 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
9958 return false;
9959
9960 return super.CanReceiveAttachment(attachment, slotId);
9961 }
9962
9964 {
9965 if (!super.CanReleaseAttachment(attachment))
9966 return false;
9967
9968 return GetInventory().AreChildrenAccessible();
9969 }
9970
9971
9972
9973
9974
9975
9976
9977
9978
9979
9980
9981
9982
9983
9984
9985
9986
9987
9988
9989
9990
9992 {
9993 int id = muzzle_owner.GetMuzzleID();
9994 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
9995
9996 if (WPOF_array)
9997 {
9998 for (int i = 0; i < WPOF_array.Count(); i++)
9999 {
10000 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
10001
10002 if (WPOF)
10003 {
10004 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
10005 }
10006 }
10007 }
10008 }
10009
10010
10012 {
10013 int id = muzzle_owner.GetMuzzleID();
10015
10016 if (WPOBE_array)
10017 {
10018 for (int i = 0; i < WPOBE_array.Count(); i++)
10019 {
10020 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
10021
10022 if (WPOBE)
10023 {
10024 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10025 }
10026 }
10027 }
10028 }
10029
10030
10032 {
10033 int id = muzzle_owner.GetMuzzleID();
10034 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10035
10036 if (WPOOH_array)
10037 {
10038 for (int i = 0; i < WPOOH_array.Count(); i++)
10039 {
10040 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10041
10042 if (WPOOH)
10043 {
10044 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10045 }
10046 }
10047 }
10048 }
10049
10050
10052 {
10053 int id = muzzle_owner.GetMuzzleID();
10054 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10055
10056 if (WPOOH_array)
10057 {
10058 for (int i = 0; i < WPOOH_array.Count(); i++)
10059 {
10060 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10061
10062 if (WPOOH)
10063 {
10064 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10065 }
10066 }
10067 }
10068 }
10069
10070
10072 {
10073 int id = muzzle_owner.GetMuzzleID();
10074 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10075
10076 if (WPOOH_array)
10077 {
10078 for (int i = 0; i < WPOOH_array.Count(); i++)
10079 {
10080 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10081
10082 if (WPOOH)
10083 {
10084 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10085 }
10086 }
10087 }
10088 }
10089
10090
10091
10093 {
10095 {
10096 return true;
10097 }
10098
10099 return false;
10100 }
10101
10103 {
10105 {
10106 return true;
10107 }
10108
10109 return false;
10110 }
10111
10113 {
10115 {
10116 return true;
10117 }
10118
10119 return false;
10120 }
10121
10123 {
10124 return false;
10125 }
10126
10129 {
10130 return UATimeSpent.DEFAULT_DEPLOY;
10131 }
10132
10133
10134
10135
10137 {
10139 SetSynchDirty();
10140 }
10141
10143 {
10145 }
10146
10147
10149 {
10150 return false;
10151 }
10152
10155 {
10156 string att_type = "None";
10157
10158 if (ConfigIsExisting("soundAttType"))
10159 {
10160 att_type = ConfigGetString("soundAttType");
10161 }
10162
10164 }
10165
10167 {
10169 }
10170
10171
10172
10173
10174
10180
10182 {
10185
10187 }
10188
10189
10191 {
10193 return;
10194
10196
10199
10202
10203 SoundParameters params = new SoundParameters();
10207 }
10208
10209
10211 {
10213 return;
10214
10216 SetSynchDirty();
10217
10220 }
10221
10222
10224 {
10226 return;
10227
10229 SetSynchDirty();
10230
10233 }
10234
10236 {
10238 }
10239
10241 {
10243 }
10244
10247 {
10248 if (!
GetGame().IsDedicatedServer())
10249 {
10250 if (ConfigIsExisting("attachSoundSet"))
10251 {
10252 string cfg_path = "";
10253 string soundset = "";
10254 string type_name =
GetType();
10255
10258 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
10259 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
10260
10261 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
10262 {
10263 for (int i = 0; i < cfg_soundset_array.Count(); i++)
10264 {
10265 if (cfg_slot_array[i] == slot_type)
10266 {
10267 soundset = cfg_soundset_array[i];
10268 break;
10269 }
10270 }
10271 }
10272
10273 if (soundset != "")
10274 {
10275 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
10277 }
10278 }
10279 }
10280 }
10281
10283 {
10284
10285 }
10286
10287 void OnApply(PlayerBase player);
10288
10290 {
10291 return 1.0;
10292 };
10293
10295 {
10297 }
10298
10300 {
10302 }
10303
10305
10307 {
10308 SetDynamicPhysicsLifeTime(0.01);
10310 }
10311
10313 {
10314 array<string> zone_names = new array<string>;
10315 GetDamageZones(zone_names);
10316 for (int i = 0; i < zone_names.Count(); i++)
10317 {
10318 SetHealthMax(zone_names.Get(i),"Health");
10319 }
10320 SetHealthMax("","Health");
10321 }
10322
10325 {
10326 float global_health = GetHealth01("","Health");
10327 array<string> zones = new array<string>;
10328 GetDamageZones(zones);
10329
10330 for (int i = 0; i < zones.Count(); i++)
10331 {
10332 SetHealth01(zones.Get(i),"Health",global_health);
10333 }
10334 }
10335
10338 {
10339 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
10340 }
10341
10343 {
10344 if (!hasRootAsPlayer)
10345 {
10346 if (refParentIB)
10347 {
10348
10349 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
10350 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
10351
10352 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
10353 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
10354
10357 }
10358 else
10359 {
10360
10363 }
10364 }
10365 }
10366
10368 {
10370 {
10371 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
10372 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
10373 {
10374 float heatPermCoef = 1.0;
10376 while (ent)
10377 {
10378 heatPermCoef *= ent.GetHeatPermeabilityCoef();
10379 ent = ent.GetHierarchyParent();
10380 }
10381
10382 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
10383 }
10384 }
10385 }
10386
10388 {
10389
10390 EntityAI parent = GetHierarchyParent();
10391 if (!parent)
10392 {
10393 hasParent = false;
10394 hasRootAsPlayer = false;
10395 }
10396 else
10397 {
10398 hasParent = true;
10399 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
10400 refParentIB =
ItemBase.Cast(parent);
10401 }
10402 }
10403
10404 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
10405 {
10406
10407 }
10408
10410 {
10411
10412 return false;
10413 }
10414
10416 {
10417
10418
10419 return false;
10420 }
10421
10423 {
10424
10425 return false;
10426 }
10427
10430 {
10431 return !GetIsFrozen() &&
IsOpen();
10432 }
10433
10435 {
10436 bool hasParent = false, hasRootAsPlayer = false;
10438
10439 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
10440 bool foodDecay =
g_Game.IsFoodDecayEnabled();
10441
10442 if (wwtu || foodDecay)
10443 {
10447
10448 if (processWetness || processTemperature || processDecay)
10449 {
10451
10452 if (processWetness)
10453 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
10454
10455 if (processTemperature)
10457
10458 if (processDecay)
10459 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
10460 }
10461 }
10462 }
10463
10466 {
10468 }
10469
10471 {
10474
10475 return super.GetTemperatureFreezeThreshold();
10476 }
10477
10479 {
10482
10483 return super.GetTemperatureThawThreshold();
10484 }
10485
10487 {
10490
10491 return super.GetItemOverheatThreshold();
10492 }
10493
10495 {
10497 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
10498
10499 return super.GetTemperatureFreezeTime();
10500 }
10501
10503 {
10505 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
10506
10507 return super.GetTemperatureThawTime();
10508 }
10509
10514
10516 {
10517 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
10518 }
10519
10521 {
10522 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
10523 }
10524
10527 {
10529 }
10530
10532 {
10534 }
10535
10537 {
10539 }
10540
10543 {
10544 return null;
10545 }
10546
10549 {
10550 return false;
10551 }
10552
10554 {
10556 {
10559 if (!trg)
10560 {
10562 explosive = this;
10563 }
10564
10565 explosive.PairRemote(trg);
10567
10568 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
10569 trg.SetPersistentPairID(persistentID);
10570 explosive.SetPersistentPairID(persistentID);
10571
10572 return true;
10573 }
10574 return false;
10575 }
10576
10579 {
10580 float ret = 1.0;
10583 ret *= GetHealth01();
10584
10585 return ret;
10586 }
10587
10588 #ifdef DEVELOPER
10589 override void SetDebugItem()
10590 {
10591 super.SetDebugItem();
10592 _itemBase = this;
10593 }
10594
10596 {
10597 string text = super.GetDebugText();
10598
10600 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
10601
10602 return text;
10603 }
10604 #endif
10605
10607 {
10608 return true;
10609 }
10610
10612
10614
10616 {
10619 }
10620
10621
10629
10645}
10646
10648{
10650 if (entity)
10651 {
10652 bool is_item = entity.IsInherited(
ItemBase);
10653 if (is_item && full_quantity)
10654 {
10657 }
10658 }
10659 else
10660 {
10662 return NULL;
10663 }
10664 return entity;
10665}
10666
10668{
10669 if (item)
10670 {
10671 if (health > 0)
10672 item.SetHealth("", "", health);
10673
10674 if (item.CanHaveTemperature())
10675 {
10677 if (item.CanFreeze())
10678 item.SetFrozen(false);
10679 }
10680
10681 if (item.HasEnergyManager())
10682 {
10683 if (quantity >= 0)
10684 {
10685 item.GetCompEM().SetEnergy0To1(quantity);
10686 }
10687 else
10688 {
10690 }
10691 }
10692 else if (item.IsMagazine())
10693 {
10694 Magazine mag = Magazine.Cast(item);
10695 if (quantity >= 0)
10696 {
10697 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
10698 }
10699 else
10700 {
10702 }
10703
10704 }
10705 else
10706 {
10707 if (quantity >= 0)
10708 {
10709 item.SetQuantityNormalized(quantity, false);
10710 }
10711 else
10712 {
10714 }
10715
10716 }
10717 }
10718}
10719
10720#ifdef DEVELOPER
10722#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.