5760{
5762 {
5763 return true;
5764 }
5765};
5766
5767
5768
5770{
5774
5776
5779
5780
5781
5782
5783
5792
5798
5803
5808
5829 protected bool m_IsResultOfSplit
5830
5832
5837
5838
5839
5841
5845
5846
5847
5849
5852
5853
5854
5860
5861
5869
5872
5873
5875
5876
5878
5879
5884
5885
5890
5891
5893
5894
5896 {
5901
5902 if (!
GetGame().IsDedicatedServer())
5903 {
5905 {
5907
5909 {
5911 }
5912 }
5913
5916 }
5917
5918 m_OldLocation = null;
5919
5921 {
5923 }
5924
5925 if (ConfigIsExisting("headSelectionsToHide"))
5926 {
5929 }
5930
5932 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
5933 {
5935 }
5936
5938
5939 m_IsResultOfSplit = false;
5940
5942 }
5943
5945 {
5946 super.InitItemVariables();
5947
5953 m_Count = ConfigGetInt(
"count");
5954
5957
5962
5965
5970
5982
5986
5987
5990 if (ConfigIsExisting("canBeSplit"))
5991 {
5994 }
5995
5997 if (ConfigIsExisting("itemBehaviour"))
5999
6000
6003 RegisterNetSyncVariableInt("m_VarLiquidType");
6004 RegisterNetSyncVariableInt("m_Cleanness",0,1);
6005
6006 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
6007 RegisterNetSyncVariableFloat("m_ImpactSpeed");
6008 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
6009
6010 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
6011 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
6012 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
6013 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
6014
6015 RegisterNetSyncVariableBool("m_IsBeingPlaced");
6016 RegisterNetSyncVariableBool("m_IsTakeable");
6017 RegisterNetSyncVariableBool("m_IsHologram");
6018
6021 {
6024 }
6025
6027
6029 if (ConfigIsExisting("temperaturePerQuantityWeight"))
6031
6032 }
6033
6035 {
6037 }
6038
6040 {
6043 {
6048 }
6049 }
6050
6051 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
6052 {
6054 {
6057 }
6058
6060 }
6061
6063 {
6069 }
6070
6072
6074 {
6076
6077 if (!action)
6078 {
6079 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
6080 return;
6081 }
6082
6084 if (!ai)
6085 {
6087 return;
6088 }
6089
6091 if (!action_array)
6092 {
6093 action_array = new array<ActionBase_Basic>;
6095 }
6096 if (LogManager.IsActionLogEnable())
6097 {
6098 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
6099 }
6100
6101 if (action_array.Find(action) != -1)
6102 {
6103 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
6104 }
6105 else
6106 {
6107 action_array.Insert(action);
6108 }
6109 }
6110
6112 {
6114 ActionBase action = player.GetActionManager().GetAction(actionName);
6117
6118 if (action_array)
6119 {
6120 action_array.RemoveItem(action);
6121 }
6122 }
6123
6124
6125
6127 {
6128 ActionOverrideData overrideData = new ActionOverrideData();
6132
6134 if (!actionMap)
6135 {
6138 }
6139
6140 actionMap.Insert(this.
Type(), overrideData);
6141
6142 }
6143
6145
6147
6148
6150 {
6153
6156
6157 string config_to_search = "CfgVehicles";
6158 string muzzle_owner_config;
6159
6161 {
6162 if (IsInherited(Weapon))
6163 config_to_search = "CfgWeapons";
6164
6165 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6166
6167 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
6168
6170
6171 if (config_OnFire_subclass_count > 0)
6172 {
6173 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
6174
6175 for (int i = 0; i < config_OnFire_subclass_count; i++)
6176 {
6177 string particle_class = "";
6179 string config_OnFire_entry = config_OnFire_class + particle_class;
6180 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
6181 WPOF_array.Insert(WPOF);
6182 }
6183
6184
6186 }
6187 }
6188
6190 {
6191 config_to_search = "CfgWeapons";
6192 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6193
6194 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
6195
6197
6198 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
6199 {
6200 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
6201
6202 for (i = 0; i < config_OnBulletCasingEject_count; i++)
6203 {
6204 string particle_class2 = "";
6206 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
6207 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
6208 WPOBE_array.Insert(WPOBE);
6209 }
6210
6211
6213 }
6214 }
6215 }
6216
6217
6219 {
6222
6224 {
6225 string config_to_search = "CfgVehicles";
6226
6227 if (IsInherited(Weapon))
6228 config_to_search = "CfgWeapons";
6229
6230 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6231 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
6232
6233 if (
GetGame().ConfigIsExisting(config_OnOverheating_class))
6234 {
6235
6237
6239 {
6241 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
6243 return;
6244 }
6245
6248
6249
6250
6252 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
6253
6254 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
6255 {
6256 string particle_class = "";
6258 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
6260
6261 if (entry_type == CT_CLASS)
6262 {
6263 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
6264 WPOOH_array.Insert(WPOF);
6265 }
6266 }
6267
6268
6270 }
6271 }
6272 }
6273
6275 {
6277 }
6278
6280 {
6282 {
6284
6287
6290
6291 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6292 }
6293 }
6294
6296 {
6298 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6299
6301 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6302
6304 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6305
6307 {
6309 }
6310 }
6311
6313 {
6315 }
6316
6318 {
6321 else
6323
6325 {
6328 }
6329 else
6330 {
6333
6336 }
6337
6339 }
6340
6342 {
6344 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6345 }
6346
6348 {
6350 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6352 }
6353
6355 {
6357 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6358 }
6359
6361 {
6364
6365 OverheatingParticle OP = new OverheatingParticle();
6370
6372 }
6373
6375 {
6378
6379 return -1;
6380 }
6381
6383 {
6385 {
6388
6389 for (int i = count; i > 0; --i)
6390 {
6391 int id = i - 1;
6394
6397
6398 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
6399 {
6400 if (p)
6401 {
6404 }
6405 }
6406 }
6407 }
6408 }
6409
6411 {
6413 {
6415 {
6416 int id = i - 1;
6418
6419 if (OP)
6420 {
6422
6423 if (p)
6424 {
6426 }
6427
6428 delete OP;
6429 }
6430 }
6431
6434 }
6435 }
6436
6439 {
6440 return 0.0;
6441 }
6442
6443
6445 {
6446 return 250;
6447 }
6448
6450 {
6451 return 0;
6452 }
6453
6456 {
6458 return true;
6459
6460 return false;
6461 }
6462
6465 {
6468
6470 {
6472 }
6473 else
6474 {
6475
6477 }
6478
6480 }
6481
6488 {
6489 return -1;
6490 }
6491
6492
6493
6494
6496 {
6498 {
6500 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6501
6502 if (r_index >= 0)
6503 {
6504 InventoryLocation r_il = new InventoryLocation;
6505 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6506
6507 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6510 {
6511 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6512 }
6514 {
6515 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6516 }
6517
6518 }
6519
6520 player.GetHumanInventory().ClearUserReservedLocation(this);
6521 }
6522
6525 }
6526
6527
6528
6529
6531 {
6532 return ItemBase.m_DebugActionsMask;
6533 }
6534
6536 {
6537 return ItemBase.m_DebugActionsMask & mask;
6538 }
6539
6541 {
6542 ItemBase.m_DebugActionsMask = mask;
6543 }
6544
6546 {
6547 ItemBase.m_DebugActionsMask |= mask;
6548 }
6549
6551 {
6552 ItemBase.m_DebugActionsMask &= ~mask;
6553 }
6554
6556 {
6558 {
6560 }
6561 else
6562 {
6564 }
6565 }
6566
6567
6569 {
6570 if (GetEconomyProfile())
6571 {
6572 float q_max = GetEconomyProfile().GetQuantityMax();
6573 if (q_max > 0)
6574 {
6575 float q_min = GetEconomyProfile().GetQuantityMin();
6576 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
6577
6579 {
6580 ComponentEnergyManager comp = GetCompEM();
6582 {
6584 }
6585 }
6587 {
6589
6590 }
6591
6592 }
6593 }
6594 }
6595
6598 {
6599 EntityAI parent = GetHierarchyParent();
6600
6601 if (parent)
6602 {
6603 InventoryLocation inventory_location_to_lock = new InventoryLocation;
6604 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
6605 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
6606 }
6607 }
6608
6611 {
6612 EntityAI parent = GetHierarchyParent();
6613
6614 if (parent)
6615 {
6616 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
6617 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
6618 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
6619 }
6620 }
6621
6623 {
6624
6625
6626
6627
6629
6631 {
6632 if (ScriptInputUserData.CanStoreInputUserData())
6633 {
6634 ScriptInputUserData ctx = new ScriptInputUserData;
6640 ctx.
Write(use_stack_max);
6643
6645 {
6646 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
6647 }
6648 }
6649 }
6650 else if (!
GetGame().IsMultiplayer())
6651 {
6653 }
6654 }
6655
6657 {
6659 }
6660
6662 {
6664 }
6665
6667 {
6669 }
6670
6672 {
6673
6674 return false;
6675 }
6676
6678 {
6679 return false;
6680 }
6681
6685 {
6686 return false;
6687 }
6688
6690 {
6691 return "";
6692 }
6693
6695
6697 {
6698 return false;
6699 }
6700
6702 {
6703 return true;
6704 }
6705
6706
6707
6709 {
6710 return true;
6711 }
6712
6714 {
6715 return true;
6716 }
6717
6719 {
6720 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6722 }
6723
6725 {
6727 }
6728
6730 {
6732 if (!is_being_placed)
6734 SetSynchDirty();
6735 }
6736
6737
6739
6741 {
6743 }
6744
6746 {
6748 }
6749
6751 {
6752 return 1;
6753 }
6754
6756 {
6757 return false;
6758 }
6759
6761 {
6763 SetSynchDirty();
6764 }
6765
6766
6767
6768
6769
6770
6771
6772
6773
6774
6775
6776
6777
6778
6779
6780
6781
6782
6783
6784
6785
6786
6787
6788
6789
6790
6791
6792
6793
6794
6795
6796
6797
6798
6799
6801 {
6802 super.OnMovedInsideCargo(container);
6803
6804 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6805 }
6806
6807 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
6808 {
6809 super.EEItemLocationChanged(oldLoc,newLoc);
6810
6811 PlayerBase new_player = null;
6812 PlayerBase old_player = null;
6813
6814 if (newLoc.GetParent())
6815 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
6816
6817 if (oldLoc.GetParent())
6818 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
6819
6821 {
6822 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
6823
6824 if (r_index >= 0)
6825 {
6826 InventoryLocation r_il = new InventoryLocation;
6827 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6828
6829 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6832 {
6833 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6834 }
6836 {
6837 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6838 }
6839
6840 }
6841 }
6842
6844 {
6845 if (new_player)
6846 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
6847
6848 if (new_player == old_player)
6849 {
6850
6851 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
6852 {
6854 {
6855 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
6856 {
6857 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6858 }
6859 }
6860 else
6861 {
6862 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6863 }
6864 }
6865
6866 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
6867 {
6868 int type = oldLoc.GetType();
6870 {
6871 oldLoc.GetParent().GetOnSetLock().Invoke(this);
6872 }
6874 {
6875 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
6876 }
6877 }
6878 if (!m_OldLocation)
6879 {
6880 m_OldLocation = new InventoryLocation;
6881 }
6882 m_OldLocation.Copy(oldLoc);
6883 }
6884 else
6885 {
6886 if (m_OldLocation)
6887 {
6888 m_OldLocation.Reset();
6889 }
6890 }
6891
6893 }
6894 else
6895 {
6896 if (new_player)
6897 {
6898 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
6899 if (res_index >= 0)
6900 {
6901 InventoryLocation il = new InventoryLocation;
6902 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
6904 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
6907 {
6908 il.
GetParent().GetOnReleaseLock().Invoke(it);
6909 }
6911 {
6913 }
6914
6915 }
6916 }
6918 {
6919
6921 }
6922
6923 if (m_OldLocation)
6924 {
6925 m_OldLocation.Reset();
6926 }
6927 }
6928 }
6929
6930 override void EOnContact(IEntity other, Contact extra)
6931 {
6933 {
6934 int liquidType = -1;
6936 if (impactSpeed > 0.0)
6937 {
6939 #ifndef SERVER
6941 #else
6943 SetSynchDirty();
6944 #endif
6946 }
6947 }
6948
6949 #ifdef SERVER
6950 if (GetCompEM() && GetCompEM().IsPlugged())
6951 {
6952 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
6953 GetCompEM().UnplugThis();
6954 }
6955 #endif
6956 }
6957
6959
6961 {
6963 }
6964
6966 {
6967
6968 }
6969
6971 {
6972 super.OnItemLocationChanged(old_owner, new_owner);
6973
6974 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
6975 PlayerBase playerNew = PlayerBase.Cast(new_owner);
6976
6977 if (!relatedPlayer && playerNew)
6978 relatedPlayer = playerNew;
6979
6980 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
6981 {
6983 if (actionMgr)
6984 {
6985 ActionBase currentAction = actionMgr.GetRunningAction();
6986 if (currentAction)
6988 }
6989 }
6990
6991 Man ownerPlayerOld = null;
6992 Man ownerPlayerNew = null;
6993
6994 if (old_owner)
6995 {
6996 if (old_owner.
IsMan())
6997 {
6998 ownerPlayerOld = Man.Cast(old_owner);
6999 }
7000 else
7001 {
7002 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
7003 }
7004 }
7005 else
7006 {
7008 {
7010
7011 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
7012 {
7013 GetCompEM().UnplugThis();
7014 }
7015 }
7016 }
7017
7018 if (new_owner)
7019 {
7020 if (new_owner.
IsMan())
7021 {
7022 ownerPlayerNew = Man.Cast(new_owner);
7023 }
7024 else
7025 {
7026 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
7027 }
7028 }
7029
7030 if (ownerPlayerOld != ownerPlayerNew)
7031 {
7032 if (ownerPlayerOld)
7033 {
7034 array<EntityAI> subItemsExit = new array<EntityAI>;
7036 for (int i = 0; i < subItemsExit.Count(); i++)
7037 {
7040 }
7041 }
7042
7043 if (ownerPlayerNew)
7044 {
7045 array<EntityAI> subItemsEnter = new array<EntityAI>;
7047 for (int j = 0; j < subItemsEnter.Count(); j++)
7048 {
7051 }
7052 }
7053 }
7054 else if (ownerPlayerNew != null)
7055 {
7056 PlayerBase nplayer;
7057 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
7058 {
7059 array<EntityAI> subItemsUpdate = new array<EntityAI>;
7061 for (int k = 0; k < subItemsUpdate.Count(); k++)
7062 {
7064 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
7065 }
7066 }
7067 }
7068
7069 if (old_owner)
7070 old_owner.OnChildItemRemoved(this);
7071 if (new_owner)
7072 new_owner.OnChildItemReceived(this);
7073 }
7074
7075
7077 {
7078 super.EEDelete(parent);
7079 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
7080 if (player)
7081 {
7083
7084 if (player.IsAlive())
7085 {
7086 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7087 if (r_index >= 0)
7088 {
7089 InventoryLocation r_il = new InventoryLocation;
7090 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7091
7092 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7095 {
7096 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7097 }
7099 {
7100 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7101 }
7102
7103 }
7104
7105 player.RemoveQuickBarEntityShortcut(this);
7106 }
7107 }
7108 }
7109
7111 {
7112 super.EEKilled(killer);
7113
7116 {
7117 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
7118 {
7119 if (IsMagazine())
7120 {
7121 if (Magazine.Cast(this).GetAmmoCount() > 0)
7122 {
7124 }
7125 }
7126 else
7127 {
7129 }
7130 }
7131 }
7132 }
7133
7135 {
7136 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7137
7138 super.OnWasAttached(parent, slot_id);
7139
7142
7144 }
7145
7147 {
7148 super.OnWasDetached(parent, slot_id);
7149
7152 }
7153
7155 {
7156 int idx;
7159
7160 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7161 if (inventory_slots.Count() < 1)
7162 {
7163 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
7164 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
7165 }
7166 else
7167 {
7168 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
7169 }
7170
7171 idx = inventory_slots.Find(slot);
7172 if (idx < 0)
7173 return "";
7174
7175 return attach_types.Get(idx);
7176 }
7177
7179 {
7180 int idx = -1;
7181 string slot;
7182
7185
7186 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7187 if (inventory_slots.Count() < 1)
7188 {
7189 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
7190 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7191 }
7192 else
7193 {
7194 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
7195 if (detach_types.Count() < 1)
7196 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7197 }
7198
7199 for (int i = 0; i < inventory_slots.Count(); i++)
7200 {
7201 slot = inventory_slots.Get(i);
7202 }
7203
7204 if (slot != "")
7205 {
7206 if (detach_types.Count() == 1)
7207 idx = 0;
7208 else
7209 idx = inventory_slots.Find(slot);
7210 }
7211 if (idx < 0)
7212 return "";
7213
7214 return detach_types.Get(idx);
7215 }
7216
7218 {
7219
7221
7222
7223 float min_time = 1;
7224 float max_time = 3;
7225 float delay = Math.RandomFloat(min_time, max_time);
7226
7227 explode_timer.Run(delay, this, "DoAmmoExplosion");
7228 }
7229
7231 {
7232 Magazine magazine = Magazine.Cast(this);
7233 int pop_sounds_count = 6;
7234 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
7235
7236
7237 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
7238 string sound_name = pop_sounds[ sound_idx ];
7240
7241
7242 magazine.ServerAddAmmoCount(-1);
7243
7244
7245 float min_temp_to_explode = 100;
7246
7247 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
7248 {
7250 }
7251 }
7252
7253
7254 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
7255 {
7256 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
7257
7258 const int CHANCE_DAMAGE_CARGO = 4;
7259 const int CHANCE_DAMAGE_ATTACHMENT = 1;
7260 const int CHANCE_DAMAGE_NOTHING = 2;
7261
7263 {
7264 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
7265 int chances;
7266 int rnd;
7267
7268 if (GetInventory().GetCargo())
7269 {
7270 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7271 rnd = Math.RandomInt(0,chances);
7272
7273 if (rnd < CHANCE_DAMAGE_CARGO)
7274 {
7276 }
7277 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
7278 {
7280 }
7281 }
7282 else
7283 {
7284 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7285 rnd = Math.RandomInt(0,chances);
7286
7287 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
7288 {
7290 }
7291 }
7292 }
7293 }
7294
7296 {
7297 if (GetInventory().GetCargo())
7298 {
7299 int item_count = GetInventory().GetCargo().GetItemCount();
7300 if (item_count > 0)
7301 {
7302 int random_pick = Math.RandomInt(0, item_count);
7304 if (!item.IsExplosive())
7305 {
7306 item.AddHealth("","",damage);
7307 return true;
7308 }
7309 }
7310 }
7311 return false;
7312 }
7313
7315 {
7316 int attachment_count = GetInventory().AttachmentCount();
7317 if (attachment_count > 0)
7318 {
7319 int random_pick = Math.RandomInt(0, attachment_count);
7320 ItemBase attachment =
ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
7321 if (!attachment.IsExplosive())
7322 {
7323 attachment.AddHealth("","",damage);
7324 return true;
7325 }
7326 }
7327 return false;
7328 }
7329
7331 {
7333 }
7334
7336 {
7338 return GetInventory().CanRemoveEntity();
7339
7340 return false;
7341 }
7342
7344 {
7345
7347 return false;
7348
7349
7351 return false;
7352
7353
7354
7356 if (delta == 0)
7357 return false;
7358
7359
7360 return true;
7361 }
7362
7364 {
7366 {
7367 if (ScriptInputUserData.CanStoreInputUserData())
7368 {
7369 ScriptInputUserData ctx = new ScriptInputUserData;
7374 ctx.
Write(destination_entity);
7378 }
7379 }
7380 else if (!
GetGame().IsMultiplayer())
7381 {
7383 }
7384 }
7385
7387 {
7388 float split_quantity_new;
7392 InventoryLocation loc = new InventoryLocation;
7393
7394 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7395 {
7397 split_quantity_new = stack_max;
7398 else
7400
7402 {
7403 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7404 if (new_item)
7405 {
7406 new_item.SetResultOfSplit(true);
7407 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7409 new_item.
SetQuantity(split_quantity_new,
false,
true);
7410 }
7411 }
7412 }
7413 else if (destination_entity && slot_id == -1)
7414 {
7415 if (quantity > stack_max)
7416 split_quantity_new = stack_max;
7417 else
7418 split_quantity_new = quantity;
7419
7421 {
7423 {
7426 }
7427
7428 if (new_item)
7429 {
7430 new_item.SetResultOfSplit(true);
7431 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7433 new_item.
SetQuantity(split_quantity_new,
false,
true);
7434 }
7435 }
7436 }
7437 else
7438 {
7439 if (stack_max != 0)
7440 {
7442 {
7444 }
7445
7446 if (split_quantity_new == 0)
7447 {
7448 if (!
GetGame().IsMultiplayer())
7449 player.PhysicalPredictiveDropItem(this);
7450 else
7451 player.ServerDropEntity(this);
7452 return;
7453 }
7454
7456 {
7458
7459 if (new_item)
7460 {
7461 new_item.SetResultOfSplit(true);
7462 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7465 new_item.PlaceOnSurface();
7466 }
7467 }
7468 }
7469 }
7470 }
7471
7473 {
7474 float split_quantity_new;
7478 InventoryLocation loc = new InventoryLocation;
7479
7480 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7481 {
7483 split_quantity_new = stack_max;
7484 else
7486
7488 {
7489 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7490 if (new_item)
7491 {
7492 new_item.SetResultOfSplit(true);
7493 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7495 new_item.
SetQuantity(split_quantity_new,
false,
true);
7496 }
7497 }
7498 }
7499 else if (destination_entity && slot_id == -1)
7500 {
7501 if (quantity > stack_max)
7502 split_quantity_new = stack_max;
7503 else
7504 split_quantity_new = quantity;
7505
7507 {
7509 {
7512 }
7513
7514 if (new_item)
7515 {
7516 new_item.SetResultOfSplit(true);
7517 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7519 new_item.
SetQuantity(split_quantity_new,
false,
true);
7520 }
7521 }
7522 }
7523 else
7524 {
7525 if (stack_max != 0)
7526 {
7528 {
7530 }
7531
7533 {
7535
7536 if (new_item)
7537 {
7538 new_item.SetResultOfSplit(true);
7539 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7542 new_item.PlaceOnSurface();
7543 }
7544 }
7545 }
7546 }
7547 }
7548
7550 {
7552 {
7553 if (ScriptInputUserData.CanStoreInputUserData())
7554 {
7555 ScriptInputUserData ctx = new ScriptInputUserData;
7560 dst.WriteToContext(ctx);
7562 }
7563 }
7564 else if (!
GetGame().IsMultiplayer())
7565 {
7567 }
7568 }
7569
7571 {
7573 {
7574 if (ScriptInputUserData.CanStoreInputUserData())
7575 {
7576 ScriptInputUserData ctx = new ScriptInputUserData;
7581 ctx.
Write(destination_entity);
7587 }
7588 }
7589 else if (!
GetGame().IsMultiplayer())
7590 {
7592 }
7593 }
7594
7596 {
7598 }
7599
7601 {
7603 float split_quantity_new;
7605 if (dst.IsValid())
7606 {
7607 int slot_id = dst.GetSlot();
7609
7610 if (quantity > stack_max)
7611 split_quantity_new = stack_max;
7612 else
7613 split_quantity_new = quantity;
7614
7616 {
7618
7619 if (new_item)
7620 {
7621 new_item.SetResultOfSplit(true);
7622 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7624 new_item.
SetQuantity(split_quantity_new,
false,
true);
7625 }
7626
7627 return new_item;
7628 }
7629 }
7630
7631 return null;
7632 }
7633
7635 {
7637 float split_quantity_new;
7639 if (destination_entity)
7640 {
7642 if (quantity > stackable)
7643 split_quantity_new = stackable;
7644 else
7645 split_quantity_new = quantity;
7646
7648 {
7649 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
7650 if (new_item)
7651 {
7652 new_item.SetResultOfSplit(true);
7653 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7655 new_item.
SetQuantity(split_quantity_new,
false,
true);
7656 }
7657 }
7658 }
7659 }
7660
7662 {
7664 {
7665 if (ScriptInputUserData.CanStoreInputUserData())
7666 {
7667 ScriptInputUserData ctx = new ScriptInputUserData;
7672 ItemBase destination_entity =
this;
7673 ctx.
Write(destination_entity);
7677 }
7678 }
7679 else if (!
GetGame().IsMultiplayer())
7680 {
7682 }
7683 }
7684
7686 {
7688 float split_quantity_new;
7690 if (player)
7691 {
7693 if (quantity > stackable)
7694 split_quantity_new = stackable;
7695 else
7696 split_quantity_new = quantity;
7697
7699 {
7700 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
7701 new_item =
ItemBase.Cast(in_hands);
7702 if (new_item)
7703 {
7704 new_item.SetResultOfSplit(true);
7705 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7707 new_item.SetQuantity(split_quantity_new, false, true);
7708 }
7709 }
7710 }
7711 }
7712
7714 {
7716 float split_quantity_new = Math.Floor(quantity * 0.5);
7717
7719 return;
7720
7722
7723 if (new_item)
7724 {
7725 if (new_item.GetQuantityMax() < split_quantity_new)
7726 {
7727 split_quantity_new = new_item.GetQuantityMax();
7728 }
7729
7730 new_item.SetResultOfSplit(true);
7731 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7732
7734 {
7737 }
7738 else
7739 {
7741 new_item.
SetQuantity(split_quantity_new,
false,
true);
7742 }
7743 }
7744 }
7745
7747 {
7749 float split_quantity_new = Math.Floor(quantity / 2);
7750
7752 return;
7753
7754 InventoryLocation invloc = new InventoryLocation;
7756
7758 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
7759
7760 if (new_item)
7761 {
7762 if (new_item.GetQuantityMax() < split_quantity_new)
7763 {
7764 split_quantity_new = new_item.GetQuantityMax();
7765 }
7767 {
7770 }
7771 else if (split_quantity_new > 1)
7772 {
7774 new_item.
SetQuantity(split_quantity_new,
false,
true);
7775 }
7776 }
7777 }
7778
7781 {
7782 SetWeightDirty();
7784
7785 if (parent)
7786 parent.OnAttachmentQuantityChangedEx(this, delta);
7787
7789 {
7791 {
7793 }
7795 {
7796 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
7798 }
7799 }
7800
7801 }
7802
7805 {
7806
7807 }
7808
7811 {
7813 }
7814
7816 {
7817 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
7818
7820 {
7821 if (newLevel == GameConstants.STATE_RUINED)
7822 {
7824 EntityAI parent = GetHierarchyParent();
7825 if (parent && parent.IsFireplace())
7826 {
7827 CargoBase cargo = GetInventory().GetCargo();
7828 if (cargo)
7829 {
7831 {
7833 }
7834 }
7835 }
7836 }
7837
7839 {
7840
7842 return;
7843 }
7844
7845 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
7846 {
7848 }
7849 }
7850 }
7851
7852
7854 {
7855 super.OnRightClick();
7856
7858 {
7860 {
7861 if (ScriptInputUserData.CanStoreInputUserData())
7862 {
7863 EntityAI root = GetHierarchyRoot();
7864 Man playerOwner = GetHierarchyRootPlayer();
7865 InventoryLocation dst = new InventoryLocation;
7866
7867
7868 if (!playerOwner && root && root == this)
7869 {
7871 }
7872 else
7873 {
7874
7875 GetInventory().GetCurrentInventoryLocation(dst);
7877 {
7880 {
7882 }
7883 else
7884 {
7886
7887
7888 if (
GetGame().
GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
7889 {
7891 }
7892 else
7893 {
7894 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
7895 }
7896 }
7897 }
7898 }
7899
7900 ScriptInputUserData ctx = new ScriptInputUserData;
7908 }
7909 }
7910 else if (!
GetGame().IsMultiplayer())
7911 {
7913 }
7914 }
7915 }
7916
7918 {
7919 if (root)
7920 {
7921 vector m4[4];
7922 root.GetTransform(m4);
7923 dst.SetGround(this, m4);
7924 }
7925 else
7926 {
7927 GetInventory().GetCurrentInventoryLocation(dst);
7928 }
7929 }
7930
7931 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
7932 {
7933
7934 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
7935 return false;
7936
7937 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
7938 return false;
7939
7940
7942 return false;
7943
7944
7945 Magazine mag = Magazine.Cast(this);
7946 if (mag)
7947 {
7948 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
7949 return false;
7950
7951 if (stack_max_limit)
7952 {
7953 Magazine other_mag = Magazine.Cast(other_item);
7954 if (other_item)
7955 {
7956 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
7957 return false;
7958 }
7959
7960 }
7961 }
7962 else
7963 {
7964
7966 return false;
7967
7969 return false;
7970 }
7971
7972 PlayerBase player = null;
7973 if (CastTo(player, GetHierarchyRootPlayer()))
7974 {
7975 if (player.GetInventory().HasAttachment(this))
7976 return false;
7977
7978 if (player.IsItemsToDelete())
7979 return false;
7980 }
7981
7982 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
7983 return false;
7984
7985 int slotID;
7987 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
7988 return false;
7989
7990 return true;
7991 }
7992
7994 {
7996 }
7997
7999 {
8000 return m_IsResultOfSplit;
8001 }
8002
8004 {
8005 m_IsResultOfSplit = value;
8006 }
8007
8009 {
8011 }
8012
8014 {
8015 float other_item_quantity = other_item.GetQuantity();
8016 float this_free_space;
8017
8019
8021
8022 if (other_item_quantity > this_free_space)
8023 {
8024 return this_free_space;
8025 }
8026 else
8027 {
8028 return other_item_quantity;
8029 }
8030 }
8031
8033 {
8035 }
8036
8038 {
8040 return;
8041
8042 if (!IsMagazine() && other_item)
8043 {
8045 if (quantity_used != 0)
8046 {
8047 float hp1 = GetHealth01("","");
8048 float hp2 = other_item.GetHealth01("","");
8049 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
8050 hpResult = hpResult / (
GetQuantity() + quantity_used);
8051
8052 hpResult *= GetMaxHealth();
8053 Math.Round(hpResult);
8054 SetHealth("", "Health", hpResult);
8055
8057 other_item.AddQuantity(-quantity_used);
8058 }
8059 }
8061 }
8062
8064 {
8065 #ifdef SERVER
8066 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
8067 GetHierarchyParent().IncreaseLifetimeUp();
8068 #endif
8069 };
8070
8072 {
8073 PlayerBase p = PlayerBase.Cast(player);
8074
8075 array<int> recipesIds = p.m_Recipes;
8076 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8077 if (moduleRecipesManager)
8078 {
8079 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
8080 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
8081 }
8082
8083 for (int i = 0;i < recipesIds.Count(); i++)
8084 {
8085 int key = recipesIds.Get(i);
8086 string recipeName = moduleRecipesManager.GetRecipeName(key);
8088 }
8089 }
8090
8091
8092 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
8093 {
8094 super.GetDebugActions(outputList);
8095
8096
8102
8103
8108
8113
8114
8118
8119
8121 {
8125 }
8126
8129
8130
8134
8136
8137 InventoryLocation loc = new InventoryLocation();
8138 GetInventory().GetCurrentInventoryLocation(loc);
8140 {
8141 if (Gizmo_IsSupported())
8144 }
8145
8147 }
8148
8149
8150
8151
8153 {
8154 super.OnAction(action_id, player, ctx);
8155
8157 {
8158 switch (action_id)
8159 {
8162 return true;
8165 return true;
8166 }
8167 }
8168
8170 {
8171 switch (action_id)
8172 {
8174 Delete();
8175 return true;
8176 }
8177 }
8178
8179 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
8180 {
8181 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8182 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
8183 PlayerBase p = PlayerBase.Cast(player);
8184 if (
EActions.RECIPES_RANGE_START < 1000)
8185 {
8186 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
8187 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
8188 }
8189 }
8190 #ifndef SERVER
8191 else if (action_id ==
EActions.WATCH_PLAYER)
8192 {
8193 PluginDeveloper.SetDeveloperItemClientEx(player);
8194 }
8195 #endif
8197 {
8198 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
8199 {
8200 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
8201 OnDebugButtonPressServer(id + 1);
8202 }
8203
8204 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
8205 {
8206 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
8208 }
8209
8210 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
8211 {
8212 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
8214 }
8215
8216 else if (action_id ==
EActions.ADD_QUANTITY)
8217 {
8218 if (IsMagazine())
8219 {
8220 Magazine mag = Magazine.Cast(this);
8221 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
8222 }
8223 else
8224 {
8226 }
8227
8228 if (m_EM)
8229 {
8230 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
8231 }
8232
8233 }
8234
8235 else if (action_id ==
EActions.REMOVE_QUANTITY)
8236 {
8237 if (IsMagazine())
8238 {
8239 Magazine mag2 = Magazine.Cast(this);
8240 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
8241 }
8242 else
8243 {
8245 }
8246 if (m_EM)
8247 {
8248 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
8249 }
8250
8251 }
8252
8253 else if (action_id ==
EActions.SET_QUANTITY_0)
8254 {
8256
8257 if (m_EM)
8258 {
8259 m_EM.SetEnergy(0);
8260 }
8261 }
8262
8263 else if (action_id ==
EActions.SET_MAX_QUANTITY)
8264 {
8266
8267 if (m_EM)
8268 {
8269 m_EM.SetEnergy(m_EM.GetEnergyMax());
8270 }
8271 }
8272
8273 else if (action_id ==
EActions.ADD_HEALTH)
8274 {
8275 AddHealth("","",GetMaxHealth("","Health")/5);
8276 }
8277 else if (action_id ==
EActions.REMOVE_HEALTH)
8278 {
8279 AddHealth("","",-GetMaxHealth("","Health")/5);
8280 }
8281 else if (action_id ==
EActions.DESTROY_HEALTH)
8282 {
8283 SetHealth01("","",0);
8284 }
8285 else if (action_id ==
EActions.WATCH_ITEM)
8286 {
8288 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
8289 #ifdef DEVELOPER
8290 SetDebugDeveloper_item(this);
8291 #endif
8292 }
8293
8294 else if (action_id ==
EActions.ADD_TEMPERATURE)
8295 {
8296 AddTemperature(20);
8297
8298 }
8299
8300 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
8301 {
8302 AddTemperature(-20);
8303
8304 }
8305
8306 else if (action_id ==
EActions.FLIP_FROZEN)
8307 {
8308 SetFrozen(!GetIsFrozen());
8309
8310 }
8311
8312 else if (action_id ==
EActions.ADD_WETNESS)
8313 {
8315
8316 }
8317
8318 else if (action_id ==
EActions.REMOVE_WETNESS)
8319 {
8321
8322 }
8323
8324 else if (action_id ==
EActions.LIQUIDTYPE_UP)
8325 {
8328
8329
8330 }
8331
8332 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
8333 {
8336 }
8337
8338 else if (action_id ==
EActions.MAKE_SPECIAL)
8339 {
8340 auto debugParams = DebugSpawnParams.WithPlayer(player);
8341 OnDebugSpawnEx(debugParams);
8342 }
8343
8344 }
8345
8346
8347 return false;
8348 }
8349
8350
8351
8352
8356
8359
8360
8361
8363 {
8364 return false;
8365 }
8366
8367
8369 {
8370 return true;
8371 }
8372
8373
8375 {
8376 return true;
8377 }
8378
8379
8380
8382 {
8383 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
8385 }
8386
8389 {
8390 return null;
8391 }
8392
8394 {
8395 return false;
8396 }
8397
8399 {
8400 return false;
8401 }
8402
8406
8407
8409 {
8410 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8411 return module_repairing.CanRepair(this, item_repair_kit);
8412 }
8413
8414
8415 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
8416 {
8417 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8418 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
8419 }
8420
8421
8423 {
8424
8425
8426
8427
8428
8429
8430
8431
8432 return 1;
8433 }
8434
8435
8436
8438 {
8440 }
8441
8442
8443
8445 {
8447 }
8448
8449
8458 {
8459 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8460
8461 if (player)
8462 {
8463 player.MessageStatus(text);
8464 }
8465 }
8466
8467
8476 {
8477 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8478
8479 if (player)
8480 {
8481 player.MessageAction(text);
8482 }
8483 }
8484
8485
8494 {
8495 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8496
8497 if (player)
8498 {
8499 player.MessageFriendly(text);
8500 }
8501 }
8502
8503
8512 {
8513 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8514
8515 if (player)
8516 {
8517 player.MessageImportant(text);
8518 }
8519 }
8520
8522 {
8523 return true;
8524 }
8525
8526
8527 override bool KindOf(
string tag)
8528 {
8529 bool found = false;
8530 string item_name = this.
GetType();
8533
8534 int array_size = item_tag_array.Count();
8535 for (int i = 0; i < array_size; i++)
8536 {
8537 if (item_tag_array.Get(i) == tag)
8538 {
8539 found = true;
8540 break;
8541 }
8542 }
8543 return found;
8544 }
8545
8546
8548 {
8549
8550 super.OnRPC(sender, rpc_type,ctx);
8551
8552
8553 switch (rpc_type)
8554 {
8555 #ifndef SERVER
8556 case ERPCs.RPC_SOUND_LOCK_ATTACH:
8557 Param2<bool, string> p = new Param2<bool, string>(false, "");
8558
8560 return;
8561
8562 bool play = p.param1;
8563 string soundSet = p.param2;
8564
8565 if (play)
8566 {
8568 {
8570 {
8572 }
8573 }
8574 else
8575 {
8577 }
8578 }
8579 else
8580 {
8582 }
8583
8584 break;
8585 #endif
8586
8587 }
8588
8590 {
8592 }
8593 }
8594
8595
8596
8597
8599 {
8600 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8601 return plugin.GetID(
name);
8602 }
8603
8605 {
8606 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8607 return plugin.GetName(id);
8608 }
8609
8612 {
8613
8614
8615 int varFlags;
8616 if (!ctx.
Read(varFlags))
8617 return;
8618
8619 if (varFlags & ItemVariableFlags.FLOAT)
8620 {
8622 }
8623 }
8624
8626 {
8627
8628 super.SerializeNumericalVars(floats_out);
8629
8630
8631
8633 {
8635 }
8636
8638 {
8640 }
8641
8643 {
8645 }
8646
8648 {
8653 }
8654
8656 {
8658 }
8659 }
8660
8662 {
8663
8664 super.DeSerializeNumericalVars(floats);
8665
8666
8667 int index = 0;
8668 int mask = Math.Round(floats.Get(index));
8669
8670 index++;
8671
8673 {
8675 {
8677 }
8678 else
8679 {
8680 float quantity = floats.Get(index);
8682 }
8683 index++;
8684 }
8685
8687 {
8688 float wet = floats.Get(index);
8690 index++;
8691 }
8692
8694 {
8695 int liquidtype = Math.Round(floats.Get(index));
8697 index++;
8698 }
8699
8701 {
8703 index++;
8705 index++;
8707 index++;
8709 index++;
8710 }
8711
8713 {
8714 int cleanness = Math.Round(floats.Get(index));
8716 index++;
8717 }
8718 }
8719
8721 {
8722 super.WriteVarsToCTX(ctx);
8723
8724
8726 {
8728 }
8729
8731 {
8733 }
8734
8736 {
8738 }
8739
8741 {
8742 int r,g,b,a;
8748 }
8749
8751 {
8753 }
8754 }
8755
8757 {
8758 if (!super.ReadVarsFromCTX(ctx,version))
8759 return false;
8760
8761 int intValue;
8762 float value;
8763
8764 if (version < 140)
8765 {
8766 if (!ctx.
Read(intValue))
8767 return false;
8768
8769 m_VariablesMask = intValue;
8770 }
8771
8773 {
8774 if (!ctx.
Read(value))
8775 return false;
8776
8778 {
8780 }
8781 else
8782 {
8784 }
8785 }
8786
8787 if (version < 140)
8788 {
8790 {
8791 if (!ctx.
Read(value))
8792 return false;
8793 SetTemperatureDirect(value);
8794 }
8795 }
8796
8798 {
8799 if (!ctx.
Read(value))
8800 return false;
8802 }
8803
8805 {
8806 if (!ctx.
Read(intValue))
8807 return false;
8809 }
8810
8812 {
8813 int r,g,b,a;
8815 return false;
8817 return false;
8819 return false;
8821 return false;
8822
8824 }
8825
8827 {
8828 if (!ctx.
Read(intValue))
8829 return false;
8831 }
8832
8833 if (version >= 138 && version < 140)
8834 {
8836 {
8837 if (!ctx.
Read(intValue))
8838 return false;
8839 SetFrozen(intValue);
8840 }
8841 }
8842
8843 return true;
8844 }
8845
8846
8848 {
8851 {
8853 }
8854
8855 if (!super.OnStoreLoad(ctx, version))
8856 {
8858 return false;
8859 }
8860
8861 if (version >= 114)
8862 {
8863 bool hasQuickBarIndexSaved;
8864
8865 if (!ctx.
Read(hasQuickBarIndexSaved))
8866 {
8868 return false;
8869 }
8870
8871 if (hasQuickBarIndexSaved)
8872 {
8873 int itmQBIndex;
8874
8875
8876 if (!ctx.
Read(itmQBIndex))
8877 {
8879 return false;
8880 }
8881
8882 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
8883 if (itmQBIndex != -1 && parentPlayer)
8884 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
8885 }
8886 }
8887 else
8888 {
8889
8890 PlayerBase player;
8891 int itemQBIndex;
8892 if (version ==
int.
MAX)
8893 {
8894 if (!ctx.
Read(itemQBIndex))
8895 {
8897 return false;
8898 }
8899 }
8900 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
8901 {
8902
8903 if (!ctx.
Read(itemQBIndex))
8904 {
8906 return false;
8907 }
8908 if (itemQBIndex != -1 && player)
8909 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
8910 }
8911 }
8912
8913 if (version < 140)
8914 {
8915
8916 if (!LoadVariables(ctx, version))
8917 {
8919 return false;
8920 }
8921 }
8922
8923
8925 {
8927 return false;
8928 }
8929 if (version >= 132)
8930 {
8932 if (raib)
8933 {
8935 {
8937 return false;
8938 }
8939 }
8940 }
8941
8943 return true;
8944 }
8945
8946
8947
8949 {
8950 super.OnStoreSave(ctx);
8951
8952 PlayerBase player;
8953 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
8954 {
8956
8957 int itemQBIndex = -1;
8958 itemQBIndex = player.FindQuickBarEntityIndex(this);
8959 ctx.
Write(itemQBIndex);
8960 }
8961 else
8962 {
8964 }
8965
8967
8969 if (raib)
8970 {
8972 }
8973 }
8974
8975
8977 {
8978 super.AfterStoreLoad();
8979
8981 {
8983 }
8984
8986 {
8989 }
8990 }
8991
8993 {
8994 super.EEOnAfterLoad();
8995
8997 {
8999 }
9000
9003 }
9004
9006 {
9007 return false;
9008 }
9009
9010
9011
9013 {
9015 {
9016 #ifdef PLATFORM_CONSOLE
9017
9019 {
9021 if (menu)
9022 {
9024 }
9025 }
9026 #endif
9027 }
9028
9030 {
9033 }
9034
9036 {
9037 SetWeightDirty();
9039 }
9041 {
9044 }
9045
9047 {
9050 }
9052 {
9055 }
9056
9057 super.OnVariablesSynchronized();
9058 }
9059
9060
9061
9063 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
9064 {
9065 if (!IsServerCheck(allow_client))
9066 return false;
9067
9069 return false;
9070
9073
9074 if (value <= (min + 0.001))
9075 value = min;
9076
9077 if (value == min)
9078 {
9079 if (destroy_config)
9080 {
9081 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
9082 if (dstr)
9083 {
9085 this.Delete();
9086 return true;
9087 }
9088 }
9089 else if (destroy_forced)
9090 {
9092 this.Delete();
9093 return true;
9094 }
9095
9097 }
9098
9101
9103 {
9105
9106 if (delta)
9108 }
9109
9111
9112 return false;
9113 }
9114
9115
9117 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9118 {
9120 }
9121
9123 {
9126 }
9127
9129 {
9132 }
9133
9135 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9136 {
9137 float value_clamped = Math.Clamp(value, 0, 1);
9139 SetQuantity(result, destroy_config, destroy_forced);
9140 }
9141
9142
9145 {
9147 }
9148
9150 {
9152 }
9153
9154
9155
9156
9157
9158
9159
9160
9161
9162
9164 {
9165 int slot = -1;
9166 if (GetInventory())
9167 {
9168 InventoryLocation il = new InventoryLocation;
9169 GetInventory().GetCurrentInventoryLocation(il);
9171 }
9172
9174 }
9175
9177 {
9178 float quantity_max = 0;
9179
9181 {
9182 if (attSlotID != -1)
9183 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
9184
9185 if (quantity_max <= 0)
9187 }
9188
9189 if (quantity_max <= 0)
9191
9192 return quantity_max;
9193 }
9194
9196 {
9198 }
9199
9201 {
9203 }
9204
9205
9207 {
9209 }
9210
9212 {
9214 }
9215
9217 {
9219 }
9220
9221
9223 {
9224
9225 float weightEx = GetWeightEx();
9226 float special = GetInventoryAndCargoWeight();
9227 return weightEx - special;
9228 }
9229
9230
9232 {
9234 }
9235
9237 {
9239 {
9240 #ifdef DEVELOPER
9241 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9242 {
9243 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
9245 }
9246 #endif
9247
9249 }
9250 else if (HasEnergyManager())
9251 {
9252 #ifdef DEVELOPER
9253 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9254 {
9255 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
9256 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
9257 }
9258 #endif
9259 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
9260 }
9261 else
9262 {
9263 #ifdef DEVELOPER
9264 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9265 {
9266 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
9267 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
9268 }
9269 #endif
9270 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
9271 }
9272 }
9273
9276 {
9277 int item_count = 0;
9279
9280 if (GetInventory().GetCargo() != NULL)
9281 {
9282 item_count = GetInventory().GetCargo().GetItemCount();
9283 }
9284
9285 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
9286 {
9287 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
9288 if (item)
9289 item_count += item.GetNumberOfItems();
9290 }
9291 return item_count;
9292 }
9293
9296 {
9297 float weight = 0;
9298 float wetness = 1;
9299 if (include_wetness)
9302 {
9303 weight = wetness * m_ConfigWeight;
9304 }
9306 {
9307 weight = 1;
9308 }
9309 return weight;
9310 }
9311
9312
9313
9315 {
9316 if ((
GetGame().IsServer() || !
GetGame().IsMultiplayer()) && GetInventory())
9317 {
9318 GameInventory inv = GetInventory();
9319 array<EntityAI> items = new array<EntityAI>;
9321 for (int i = 0; i < items.Count(); i++)
9322 {
9324 if (item)
9325 {
9327 }
9328 }
9329 }
9330 }
9331
9332
9333
9334
9336 {
9337 float energy = 0;
9338 if (HasEnergyManager())
9339 {
9340 energy = GetCompEM().GetEnergy();
9341 }
9342 return energy;
9343 }
9344
9345
9347 {
9348 super.OnEnergyConsumed();
9349
9351 }
9352
9354 {
9355 super.OnEnergyAdded();
9356
9358 }
9359
9360
9362 {
9363 if (
GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
9364 {
9366 {
9367 float energy_0to1 = GetCompEM().GetEnergy0To1();
9369 }
9370 }
9371 }
9372
9373
9375 {
9376 return ConfigGetFloat("heatIsolation");
9377 }
9378
9380 {
9382 }
9383
9385 {
9386 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
9387 if (
GetGame().ConfigIsExisting(paramPath))
9389
9390 return 0.0;
9391 }
9392
9394 {
9395 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
9396 if (
GetGame().ConfigIsExisting(paramPath))
9398
9399 return 0.0;
9400 }
9401
9402 override void SetWet(
float value,
bool allow_client =
false)
9403 {
9404 if (!IsServerCheck(allow_client))
9405 return;
9406
9409
9411
9412 m_VarWet = Math.Clamp(value, min, max);
9413
9415 {
9418 }
9419 }
9420
9421 override void AddWet(
float value)
9422 {
9424 }
9425
9427 {
9429 }
9430
9432 {
9434 }
9435
9437 {
9439 }
9440
9442 {
9444 }
9445
9447 {
9449 }
9450
9452 {
9455 if (newLevel != oldLevel)
9456 {
9458 }
9459 }
9460
9462 {
9463 SetWeightDirty();
9464 }
9465
9467 {
9468 return GetWetLevelInternal(
m_VarWet);
9469 }
9470
9471
9472
9474 {
9476 }
9477
9479 {
9481 }
9482
9484 {
9486 }
9487
9489 {
9491 }
9492
9493
9494
9496 {
9497 if (ConfigIsExisting("itemModelLength"))
9498 {
9499 return ConfigGetFloat("itemModelLength");
9500 }
9501 return 0;
9502 }
9503
9505 {
9506 if (ConfigIsExisting("itemAttachOffset"))
9507 {
9508 return ConfigGetFloat("itemAttachOffset");
9509 }
9510 return 0;
9511 }
9512
9513 override void SetCleanness(
int value,
bool allow_client =
false)
9514 {
9515 if (!IsServerCheck(allow_client))
9516 return;
9517
9519
9521
9524 }
9525
9527 {
9529 }
9530
9532 {
9533 return true;
9534 }
9535
9536
9537
9538
9540 {
9542 }
9543
9545 {
9547 }
9548
9549
9550
9551
9552 override void SetColor(
int r,
int g,
int b,
int a)
9553 {
9559 }
9561 override void GetColor(out
int r,out
int g,out
int b,out
int a)
9562 {
9567 }
9568
9570 {
9572 }
9573
9576 {
9577 int r,g,b,a;
9579 r = r/255;
9580 g = g/255;
9581 b = b/255;
9582 a = a/255;
9583 return MiscGameplayFunctions.GetColorString(r, g, b, a);
9584 }
9585
9586
9587
9588 override void SetLiquidType(
int value,
bool allow_client =
false)
9589 {
9590 if (!IsServerCheck(allow_client))
9591 return;
9592
9597 }
9598
9600 {
9601 return ConfigGetInt("varLiquidTypeInit");
9602 }
9603
9605 {
9607 }
9608
9610 {
9612 SetFrozen(false);
9613 }
9614
9617 {
9618 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9619 }
9620
9621
9624 {
9625 PlayerBase nplayer;
9626 if (PlayerBase.CastTo(nplayer, player))
9627 {
9629
9630 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9631 }
9632 }
9633
9634
9637 {
9638 PlayerBase nplayer;
9639 if (PlayerBase.CastTo(nplayer,player))
9640 {
9641
9642 nplayer.SetEnableQuickBarEntityShortcut(this,false);
9643
9644 }
9645
9646
9647 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
9648
9649
9650 if (HasEnergyManager())
9651 {
9652 GetCompEM().UpdatePlugState();
9653 }
9654 }
9655
9656
9658 {
9659 super.OnPlacementStarted(player);
9660
9662 }
9663
9664 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
9665 {
9667 {
9668 m_AdminLog.OnPlacementComplete(player,
this);
9669 }
9670
9671 super.OnPlacementComplete(player, position, orientation);
9672 }
9673
9674
9675
9676
9677
9679 {
9681 {
9682 return true;
9683 }
9684 else
9685 {
9686 return false;
9687 }
9688 }
9689
9690
9692 {
9694 {
9696 }
9697 }
9698
9699
9701 {
9703 }
9704
9706 {
9708 }
9709
9710 override void InsertAgent(
int agent,
float count = 1)
9711 {
9712 if (count < 1)
9713 return;
9714
9716 }
9717
9720 {
9722 }
9723
9724
9726 {
9728 }
9729
9730
9731
9732
9733
9734
9735
9736
9737
9738
9739
9740
9741
9742
9743
9744
9745
9746
9747
9748
9749
9750
9751
9752
9753
9754
9755
9756
9757
9758
9759
9760
9761
9762
9763
9764
9765
9766
9767
9768
9769
9770
9772 {
9774 return false;
9775 return true;
9776 }
9777
9779 {
9780
9782 }
9783
9784
9787 {
9788 super.CheckForRoofLimited(timeTresholdMS);
9789
9791 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
9792 {
9793 m_PreviousRoofTestTime = time;
9794 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
9795 }
9796 }
9797
9798
9800 {
9802 {
9803 return 0;
9804 }
9805
9806 if (GetInventory().GetAttachmentSlotsCount() != 0)
9807 {
9808 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
9809 if (filter)
9810 return filter.GetProtectionLevel(type, false, system);
9811 else
9812 return 0;
9813 }
9814
9815 string subclassPath, entryName;
9816
9817 switch (type)
9818 {
9820 entryName = "biological";
9821 break;
9823 entryName = "chemical";
9824 break;
9825 default:
9826 entryName = "biological";
9827 break;
9828 }
9829
9830 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
9831
9833 }
9834
9835
9836
9839 {
9840 if (!IsMagazine())
9842
9844 }
9845
9846
9847
9848
9849
9854 {
9855 return true;
9856 }
9857
9859 {
9861 }
9862
9863
9864
9865
9866
9868 {
9869 if (parent)
9870 {
9871 if (parent.IsInherited(DayZInfected))
9872 return true;
9873
9874 if (!parent.IsRuined())
9875 return true;
9876 }
9877
9878 return true;
9879 }
9880
9882 {
9883 if (!super.CanPutAsAttachment(parent))
9884 {
9885 return false;
9886 }
9887
9888 if (!IsRuined() && !parent.IsRuined())
9889 {
9890 return true;
9891 }
9892
9893 return false;
9894 }
9895
9897 {
9898
9899
9900
9901
9902 return super.CanReceiveItemIntoCargo(item);
9903 }
9904
9906 {
9907
9908
9909
9910
9911 GameInventory attachmentInv = attachment.GetInventory();
9913 {
9914 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
9915 return false;
9916 }
9917
9918 InventoryLocation loc = new InventoryLocation();
9919 attachment.GetInventory().GetCurrentInventoryLocation(loc);
9920 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
9921 return false;
9922
9923 return super.CanReceiveAttachment(attachment, slotId);
9924 }
9925
9927 {
9928 if (!super.CanReleaseAttachment(attachment))
9929 return false;
9930
9931 return GetInventory().AreChildrenAccessible();
9932 }
9933
9934
9935
9936
9937
9938
9939
9940
9941
9942
9943
9944
9945
9946
9947
9948
9949
9950
9951
9952
9953
9955 {
9956 int id = muzzle_owner.GetMuzzleID();
9957 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
9958
9959 if (WPOF_array)
9960 {
9961 for (int i = 0; i < WPOF_array.Count(); i++)
9962 {
9963 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
9964
9965 if (WPOF)
9966 {
9967 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
9968 }
9969 }
9970 }
9971 }
9972
9973
9975 {
9976 int id = muzzle_owner.GetMuzzleID();
9978
9979 if (WPOBE_array)
9980 {
9981 for (int i = 0; i < WPOBE_array.Count(); i++)
9982 {
9983 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
9984
9985 if (WPOBE)
9986 {
9987 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
9988 }
9989 }
9990 }
9991 }
9992
9993
9995 {
9996 int id = muzzle_owner.GetMuzzleID();
9997 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9998
9999 if (WPOOH_array)
10000 {
10001 for (int i = 0; i < WPOOH_array.Count(); i++)
10002 {
10003 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10004
10005 if (WPOOH)
10006 {
10007 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10008 }
10009 }
10010 }
10011 }
10012
10013
10015 {
10016 int id = muzzle_owner.GetMuzzleID();
10017 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10018
10019 if (WPOOH_array)
10020 {
10021 for (int i = 0; i < WPOOH_array.Count(); i++)
10022 {
10023 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10024
10025 if (WPOOH)
10026 {
10027 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10028 }
10029 }
10030 }
10031 }
10032
10033
10035 {
10036 int id = muzzle_owner.GetMuzzleID();
10037 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10038
10039 if (WPOOH_array)
10040 {
10041 for (int i = 0; i < WPOOH_array.Count(); i++)
10042 {
10043 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10044
10045 if (WPOOH)
10046 {
10047 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10048 }
10049 }
10050 }
10051 }
10052
10053
10054
10056 {
10058 {
10059 return true;
10060 }
10061
10062 return false;
10063 }
10064
10066 {
10068 {
10069 return true;
10070 }
10071
10072 return false;
10073 }
10074
10076 {
10078 {
10079 return true;
10080 }
10081
10082 return false;
10083 }
10084
10086 {
10087 return false;
10088 }
10089
10092 {
10093 return UATimeSpent.DEFAULT_DEPLOY;
10094 }
10095
10096
10097
10098
10100 {
10102 SetSynchDirty();
10103 }
10104
10106 {
10108 }
10109
10110
10112 {
10113 return false;
10114 }
10115
10118 {
10119 string att_type = "None";
10120
10121 if (ConfigIsExisting("soundAttType"))
10122 {
10123 att_type = ConfigGetString("soundAttType");
10124 }
10125
10127 }
10128
10130 {
10132 }
10133
10134
10135
10136
10137
10143
10145 {
10148
10150 }
10151
10152
10154 {
10156 return;
10157
10159
10162
10165
10166 SoundParameters params = new SoundParameters();
10170 }
10171
10172
10174 {
10176 return;
10177
10179 SetSynchDirty();
10180
10183 }
10184
10185
10187 {
10189 return;
10190
10192 SetSynchDirty();
10193
10196 }
10197
10199 {
10201 }
10202
10204 {
10206 }
10207
10210 {
10211 if (!
GetGame().IsDedicatedServer())
10212 {
10213 if (ConfigIsExisting("attachSoundSet"))
10214 {
10215 string cfg_path = "";
10216 string soundset = "";
10217 string type_name =
GetType();
10218
10221 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
10222 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
10223
10224 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
10225 {
10226 for (int i = 0; i < cfg_soundset_array.Count(); i++)
10227 {
10228 if (cfg_slot_array[i] == slot_type)
10229 {
10230 soundset = cfg_soundset_array[i];
10231 break;
10232 }
10233 }
10234 }
10235
10236 if (soundset != "")
10237 {
10238 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
10240 }
10241 }
10242 }
10243 }
10244
10246 {
10247
10248 }
10249
10250 void OnApply(PlayerBase player);
10251
10253 {
10254 return 1.0;
10255 };
10256
10258 {
10260 }
10261
10263 {
10265 }
10266
10268
10270 {
10271 SetDynamicPhysicsLifeTime(0.01);
10273 }
10274
10276 {
10277 array<string> zone_names = new array<string>;
10278 GetDamageZones(zone_names);
10279 for (int i = 0; i < zone_names.Count(); i++)
10280 {
10281 SetHealthMax(zone_names.Get(i),"Health");
10282 }
10283 SetHealthMax("","Health");
10284 }
10285
10288 {
10289 float global_health = GetHealth01("","Health");
10290 array<string> zones = new array<string>;
10291 GetDamageZones(zones);
10292
10293 for (int i = 0; i < zones.Count(); i++)
10294 {
10295 SetHealth01(zones.Get(i),"Health",global_health);
10296 }
10297 }
10298
10301 {
10302 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
10303 }
10304
10306 {
10307 if (!hasRootAsPlayer)
10308 {
10309 if (refParentIB)
10310 {
10311
10312 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
10313 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
10314
10315 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
10316 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
10317
10320 }
10321 else
10322 {
10323
10326 }
10327 }
10328 }
10329
10331 {
10333 {
10334 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
10335 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
10336 {
10337 float heatPermCoef = 1.0;
10339 while (ent)
10340 {
10341 heatPermCoef *= ent.GetHeatPermeabilityCoef();
10342 ent = ent.GetHierarchyParent();
10343 }
10344
10345 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
10346 }
10347 }
10348 }
10349
10351 {
10352
10353 EntityAI parent = GetHierarchyParent();
10354 if (!parent)
10355 {
10356 hasParent = false;
10357 hasRootAsPlayer = false;
10358 }
10359 else
10360 {
10361 hasParent = true;
10362 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
10363 refParentIB =
ItemBase.Cast(parent);
10364 }
10365 }
10366
10367 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
10368 {
10369
10370 }
10371
10373 {
10374
10375 return false;
10376 }
10377
10379 {
10380
10381
10382 return false;
10383 }
10384
10386 {
10387
10388 return false;
10389 }
10390
10393 {
10394 return !GetIsFrozen() &&
IsOpen();
10395 }
10396
10398 {
10399 bool hasParent = false, hasRootAsPlayer = false;
10401
10402 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
10403 bool foodDecay =
g_Game.IsFoodDecayEnabled();
10404
10405 if (wwtu || foodDecay)
10406 {
10410
10411 if (processWetness || processTemperature || processDecay)
10412 {
10414
10415 if (processWetness)
10416 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
10417
10418 if (processTemperature)
10420
10421 if (processDecay)
10422 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
10423 }
10424 }
10425 }
10426
10429 {
10431 }
10432
10434 {
10437
10438 return super.GetTemperatureFreezeThreshold();
10439 }
10440
10442 {
10445
10446 return super.GetTemperatureThawThreshold();
10447 }
10448
10450 {
10453
10454 return super.GetItemOverheatThreshold();
10455 }
10456
10458 {
10460 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
10461
10462 return super.GetTemperatureFreezeTime();
10463 }
10464
10466 {
10468 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
10469
10470 return super.GetTemperatureThawTime();
10471 }
10472
10477
10479 {
10480 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
10481 }
10482
10484 {
10485 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
10486 }
10487
10490 {
10492 }
10493
10495 {
10497 }
10498
10500 {
10502 }
10503
10506 {
10507 return null;
10508 }
10509
10512 {
10513 return false;
10514 }
10515
10517 {
10519 {
10522 if (!trg)
10523 {
10525 explosive = this;
10526 }
10527
10528 explosive.PairRemote(trg);
10530
10531 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
10532 trg.SetPersistentPairID(persistentID);
10533 explosive.SetPersistentPairID(persistentID);
10534
10535 return true;
10536 }
10537 return false;
10538 }
10539
10542 {
10543 float ret = 1.0;
10546 ret *= GetHealth01();
10547
10548 return ret;
10549 }
10550
10551 #ifdef DEVELOPER
10552 override void SetDebugItem()
10553 {
10554 super.SetDebugItem();
10555 _itemBase = this;
10556 }
10557
10559 {
10560 string text = super.GetDebugText();
10561
10563 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
10564
10565 return text;
10566 }
10567 #endif
10568
10570 {
10571 return true;
10572 }
10573
10575
10577
10579 {
10582 }
10583
10584
10592
10608}
10609
10611{
10613 if (entity)
10614 {
10615 bool is_item = entity.IsInherited(
ItemBase);
10616 if (is_item && full_quantity)
10617 {
10620 }
10621 }
10622 else
10623 {
10625 return NULL;
10626 }
10627 return entity;
10628}
10629
10631{
10632 if (item)
10633 {
10634 if (health > 0)
10635 item.SetHealth("", "", health);
10636
10637 if (item.CanHaveTemperature())
10638 {
10640 if (item.CanFreeze())
10641 item.SetFrozen(false);
10642 }
10643
10644 if (item.HasEnergyManager())
10645 {
10646 if (quantity >= 0)
10647 {
10648 item.GetCompEM().SetEnergy0To1(quantity);
10649 }
10650 else
10651 {
10653 }
10654 }
10655 else if (item.IsMagazine())
10656 {
10657 Magazine mag = Magazine.Cast(item);
10658 if (quantity >= 0)
10659 {
10660 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
10661 }
10662 else
10663 {
10665 }
10666
10667 }
10668 else
10669 {
10670 if (quantity >= 0)
10671 {
10672 item.SetQuantityNormalized(quantity, false);
10673 }
10674 else
10675 {
10677 }
10678
10679 }
10680 }
10681}
10682
10683#ifdef DEVELOPER
10685#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.