5839{
5841 {
5842 return true;
5843 }
5844};
5845
5846
5847
5849{
5853
5855
5858
5859
5860
5861
5862
5871
5877
5882
5887
5908 protected bool m_IsResultOfSplit
5909
5911
5916
5917
5918
5920
5924
5925
5926
5928
5931
5932
5933
5939
5940
5948
5951
5952
5954
5955
5957
5958
5963
5964
5969
5970
5972
5973
5975 {
5980
5981 if (!
GetGame().IsDedicatedServer())
5982 {
5984 {
5986
5988 {
5990 }
5991 }
5992
5995 }
5996
5997 m_OldLocation = null;
5998
6000 {
6002 }
6003
6004 if (ConfigIsExisting("headSelectionsToHide"))
6005 {
6008 }
6009
6011 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
6012 {
6014 }
6015
6017
6018 m_IsResultOfSplit = false;
6019
6021 }
6022
6024 {
6025 super.InitItemVariables();
6026
6032 m_Count = ConfigGetInt(
"count");
6033
6036
6041
6044
6049
6061
6065
6066
6069 if (ConfigIsExisting("canBeSplit"))
6070 {
6073 }
6074
6076 if (ConfigIsExisting("itemBehaviour"))
6078
6079
6082 RegisterNetSyncVariableInt("m_VarLiquidType");
6083 RegisterNetSyncVariableInt("m_Cleanness",0,1);
6084
6085 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
6086 RegisterNetSyncVariableFloat("m_ImpactSpeed");
6087 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
6088
6089 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
6090 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
6091 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
6092 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
6093
6094 RegisterNetSyncVariableBool("m_IsBeingPlaced");
6095 RegisterNetSyncVariableBool("m_IsTakeable");
6096 RegisterNetSyncVariableBool("m_IsHologram");
6097
6100 {
6103 }
6104
6106
6108 if (ConfigIsExisting("temperaturePerQuantityWeight"))
6110
6111 }
6112
6114 {
6116 }
6117
6119 {
6122 {
6127 }
6128 }
6129
6130 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
6131 {
6133 {
6136 }
6137
6139 }
6140
6142 {
6148 }
6149
6151
6153 {
6155
6156 if (!action)
6157 {
6158 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
6159 return;
6160 }
6161
6163 if (!ai)
6164 {
6166 return;
6167 }
6168
6170 if (!action_array)
6171 {
6172 action_array = new array<ActionBase_Basic>;
6174 }
6175 if (LogManager.IsActionLogEnable())
6176 {
6177 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
6178 }
6179
6180 if (action_array.Find(action) != -1)
6181 {
6182 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
6183 }
6184 else
6185 {
6186 action_array.Insert(action);
6187 }
6188 }
6189
6191 {
6193 ActionBase action = player.GetActionManager().GetAction(actionName);
6196
6197 if (action_array)
6198 {
6199 action_array.RemoveItem(action);
6200 }
6201 }
6202
6203
6204
6206 {
6207 ActionOverrideData overrideData = new ActionOverrideData();
6211
6213 if (!actionMap)
6214 {
6217 }
6218
6219 actionMap.Insert(this.
Type(), overrideData);
6220
6221 }
6222
6224
6226
6227
6229 {
6232
6235
6236 string config_to_search = "CfgVehicles";
6237 string muzzle_owner_config;
6238
6240 {
6241 if (IsInherited(Weapon))
6242 config_to_search = "CfgWeapons";
6243
6244 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6245
6246 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
6247
6249
6250 if (config_OnFire_subclass_count > 0)
6251 {
6252 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
6253
6254 for (int i = 0; i < config_OnFire_subclass_count; i++)
6255 {
6256 string particle_class = "";
6258 string config_OnFire_entry = config_OnFire_class + particle_class;
6259 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
6260 WPOF_array.Insert(WPOF);
6261 }
6262
6263
6265 }
6266 }
6267
6269 {
6270 config_to_search = "CfgWeapons";
6271 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6272
6273 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
6274
6276
6277 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
6278 {
6279 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
6280
6281 for (i = 0; i < config_OnBulletCasingEject_count; i++)
6282 {
6283 string particle_class2 = "";
6285 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
6286 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
6287 WPOBE_array.Insert(WPOBE);
6288 }
6289
6290
6292 }
6293 }
6294 }
6295
6296
6298 {
6301
6303 {
6304 string config_to_search = "CfgVehicles";
6305
6306 if (IsInherited(Weapon))
6307 config_to_search = "CfgWeapons";
6308
6309 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6310 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
6311
6312 if (
GetGame().ConfigIsExisting(config_OnOverheating_class))
6313 {
6314
6316
6318 {
6320 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
6322 return;
6323 }
6324
6327
6328
6329
6331 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
6332
6333 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
6334 {
6335 string particle_class = "";
6337 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
6339
6340 if (entry_type == CT_CLASS)
6341 {
6342 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
6343 WPOOH_array.Insert(WPOF);
6344 }
6345 }
6346
6347
6349 }
6350 }
6351 }
6352
6354 {
6356 }
6357
6359 {
6361 {
6363
6366
6369
6370 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6371 }
6372 }
6373
6375 {
6377 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6378
6380 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6381
6383 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6384
6386 {
6388 }
6389 }
6390
6392 {
6394 }
6395
6397 {
6400 else
6402
6404 {
6407 }
6408 else
6409 {
6412
6415 }
6416
6418 }
6419
6421 {
6423 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6424 }
6425
6427 {
6429 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6431 }
6432
6434 {
6436 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6437 }
6438
6440 {
6443
6444 OverheatingParticle OP = new OverheatingParticle();
6449
6451 }
6452
6454 {
6457
6458 return -1;
6459 }
6460
6462 {
6464 {
6467
6468 for (int i = count; i > 0; --i)
6469 {
6470 int id = i - 1;
6473
6476
6477 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
6478 {
6479 if (p)
6480 {
6483 }
6484 }
6485 }
6486 }
6487 }
6488
6490 {
6492 {
6494 {
6495 int id = i - 1;
6497
6498 if (OP)
6499 {
6501
6502 if (p)
6503 {
6505 }
6506
6507 delete OP;
6508 }
6509 }
6510
6513 }
6514 }
6515
6518 {
6519 return 0.0;
6520 }
6521
6522
6524 {
6525 return 250;
6526 }
6527
6529 {
6530 return 0;
6531 }
6532
6535 {
6537 return true;
6538
6539 return false;
6540 }
6541
6544 {
6547
6549 {
6551 }
6552 else
6553 {
6554
6556 }
6557
6559 }
6560
6567 {
6568 return -1;
6569 }
6570
6571
6572
6573
6575 {
6577 {
6579 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6580
6581 if (r_index >= 0)
6582 {
6583 InventoryLocation r_il = new InventoryLocation;
6584 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6585
6586 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6589 {
6590 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6591 }
6593 {
6594 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6595 }
6596
6597 }
6598
6599 player.GetHumanInventory().ClearUserReservedLocation(this);
6600 }
6601
6604 }
6605
6606
6607
6608
6610 {
6611 return ItemBase.m_DebugActionsMask;
6612 }
6613
6615 {
6616 return ItemBase.m_DebugActionsMask & mask;
6617 }
6618
6620 {
6621 ItemBase.m_DebugActionsMask = mask;
6622 }
6623
6625 {
6626 ItemBase.m_DebugActionsMask |= mask;
6627 }
6628
6630 {
6631 ItemBase.m_DebugActionsMask &= ~mask;
6632 }
6633
6635 {
6637 {
6639 }
6640 else
6641 {
6643 }
6644 }
6645
6646
6648 {
6649 if (GetEconomyProfile())
6650 {
6651 float q_max = GetEconomyProfile().GetQuantityMax();
6652 if (q_max > 0)
6653 {
6654 float q_min = GetEconomyProfile().GetQuantityMin();
6655 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
6656
6658 {
6659 ComponentEnergyManager comp = GetCompEM();
6661 {
6663 }
6664 }
6666 {
6668
6669 }
6670
6671 }
6672 }
6673 }
6674
6677 {
6678 EntityAI parent = GetHierarchyParent();
6679
6680 if (parent)
6681 {
6682 InventoryLocation inventory_location_to_lock = new InventoryLocation;
6683 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
6684 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
6685 }
6686 }
6687
6690 {
6691 EntityAI parent = GetHierarchyParent();
6692
6693 if (parent)
6694 {
6695 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
6696 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
6697 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
6698 }
6699 }
6700
6702 {
6703
6704
6705
6706
6708
6710 {
6711 if (ScriptInputUserData.CanStoreInputUserData())
6712 {
6713 ScriptInputUserData ctx = new ScriptInputUserData;
6719 ctx.
Write(use_stack_max);
6722
6724 {
6725 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
6726 }
6727 }
6728 }
6729 else if (!
GetGame().IsMultiplayer())
6730 {
6732 }
6733 }
6734
6736 {
6738 }
6739
6741 {
6743 }
6744
6746 {
6748 }
6749
6751 {
6752
6753 return false;
6754 }
6755
6757 {
6758 return false;
6759 }
6760
6764 {
6765 return false;
6766 }
6767
6769 {
6770 return "";
6771 }
6772
6774
6776 {
6777 return false;
6778 }
6779
6781 {
6782 return true;
6783 }
6784
6785
6786
6788 {
6789 return true;
6790 }
6791
6793 {
6794 return true;
6795 }
6796
6798 {
6799 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6801 }
6802
6804 {
6806 }
6807
6809 {
6811 if (!is_being_placed)
6813 SetSynchDirty();
6814 }
6815
6816
6818
6820 {
6822 }
6823
6825 {
6827 }
6828
6830 {
6831 return 1;
6832 }
6833
6835 {
6836 return false;
6837 }
6838
6840 {
6842 SetSynchDirty();
6843 }
6844
6845
6846
6847
6848
6849
6850
6851
6852
6853
6854
6855
6856
6857
6858
6859
6860
6861
6862
6863
6864
6865
6866
6867
6868
6869
6870
6871
6872
6873
6874
6875
6876
6877
6878
6880 {
6881 super.OnMovedInsideCargo(container);
6882
6883 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6884 }
6885
6886 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
6887 {
6888 super.EEItemLocationChanged(oldLoc,newLoc);
6889
6890 PlayerBase new_player = null;
6891 PlayerBase old_player = null;
6892
6893 if (newLoc.GetParent())
6894 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
6895
6896 if (oldLoc.GetParent())
6897 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
6898
6900 {
6901 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
6902
6903 if (r_index >= 0)
6904 {
6905 InventoryLocation r_il = new InventoryLocation;
6906 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6907
6908 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6911 {
6912 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6913 }
6915 {
6916 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6917 }
6918
6919 }
6920 }
6921
6923 {
6924 if (new_player)
6925 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
6926
6927 if (new_player == old_player)
6928 {
6929
6930 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
6931 {
6933 {
6934 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
6935 {
6936 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6937 }
6938 }
6939 else
6940 {
6941 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6942 }
6943 }
6944
6945 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
6946 {
6947 int type = oldLoc.GetType();
6949 {
6950 oldLoc.GetParent().GetOnSetLock().Invoke(this);
6951 }
6953 {
6954 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
6955 }
6956 }
6957 if (!m_OldLocation)
6958 {
6959 m_OldLocation = new InventoryLocation;
6960 }
6961 m_OldLocation.Copy(oldLoc);
6962 }
6963 else
6964 {
6965 if (m_OldLocation)
6966 {
6967 m_OldLocation.Reset();
6968 }
6969 }
6970
6972 }
6973 else
6974 {
6975 if (new_player)
6976 {
6977 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
6978 if (res_index >= 0)
6979 {
6980 InventoryLocation il = new InventoryLocation;
6981 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
6983 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
6986 {
6987 il.
GetParent().GetOnReleaseLock().Invoke(it);
6988 }
6990 {
6992 }
6993
6994 }
6995 }
6997 {
6998
7000 }
7001
7002 if (m_OldLocation)
7003 {
7004 m_OldLocation.Reset();
7005 }
7006 }
7007 }
7008
7009 override void EOnContact(IEntity other, Contact extra)
7010 {
7012 {
7013 int liquidType = -1;
7015 if (impactSpeed > 0.0)
7016 {
7018 #ifndef SERVER
7020 #else
7022 SetSynchDirty();
7023 #endif
7025 }
7026 }
7027
7028 #ifdef SERVER
7029 if (GetCompEM() && GetCompEM().IsPlugged())
7030 {
7031 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
7032 GetCompEM().UnplugThis();
7033 }
7034 #endif
7035 }
7036
7038
7040 {
7042 }
7043
7045 {
7046
7047 }
7048
7050 {
7051 super.OnItemLocationChanged(old_owner, new_owner);
7052
7053 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
7054 PlayerBase playerNew = PlayerBase.Cast(new_owner);
7055
7056 if (!relatedPlayer && playerNew)
7057 relatedPlayer = playerNew;
7058
7059 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
7060 {
7062 if (actionMgr)
7063 {
7064 ActionBase currentAction = actionMgr.GetRunningAction();
7065 if (currentAction)
7067 }
7068 }
7069
7070 Man ownerPlayerOld = null;
7071 Man ownerPlayerNew = null;
7072
7073 if (old_owner)
7074 {
7075 if (old_owner.
IsMan())
7076 {
7077 ownerPlayerOld = Man.Cast(old_owner);
7078 }
7079 else
7080 {
7081 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
7082 }
7083 }
7084 else
7085 {
7087 {
7089
7090 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
7091 {
7092 GetCompEM().UnplugThis();
7093 }
7094 }
7095 }
7096
7097 if (new_owner)
7098 {
7099 if (new_owner.
IsMan())
7100 {
7101 ownerPlayerNew = Man.Cast(new_owner);
7102 }
7103 else
7104 {
7105 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
7106 }
7107 }
7108
7109 if (ownerPlayerOld != ownerPlayerNew)
7110 {
7111 if (ownerPlayerOld)
7112 {
7113 array<EntityAI> subItemsExit = new array<EntityAI>;
7115 for (int i = 0; i < subItemsExit.Count(); i++)
7116 {
7119 }
7120 }
7121
7122 if (ownerPlayerNew)
7123 {
7124 array<EntityAI> subItemsEnter = new array<EntityAI>;
7126 for (int j = 0; j < subItemsEnter.Count(); j++)
7127 {
7130 }
7131 }
7132 }
7133 else if (ownerPlayerNew != null)
7134 {
7135 PlayerBase nplayer;
7136 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
7137 {
7138 array<EntityAI> subItemsUpdate = new array<EntityAI>;
7140 for (int k = 0; k < subItemsUpdate.Count(); k++)
7141 {
7143 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
7144 }
7145 }
7146 }
7147
7148 if (old_owner)
7149 old_owner.OnChildItemRemoved(this);
7150 if (new_owner)
7151 new_owner.OnChildItemReceived(this);
7152 }
7153
7154
7156 {
7157 super.EEDelete(parent);
7158 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
7159 if (player)
7160 {
7162
7163 if (player.IsAlive())
7164 {
7165 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7166 if (r_index >= 0)
7167 {
7168 InventoryLocation r_il = new InventoryLocation;
7169 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7170
7171 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7174 {
7175 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7176 }
7178 {
7179 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7180 }
7181
7182 }
7183
7184 player.RemoveQuickBarEntityShortcut(this);
7185 }
7186 }
7187 }
7188
7190 {
7191 super.EEKilled(killer);
7192
7195 {
7196 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
7197 {
7198 if (IsMagazine())
7199 {
7200 if (Magazine.Cast(this).GetAmmoCount() > 0)
7201 {
7203 }
7204 }
7205 else
7206 {
7208 }
7209 }
7210 }
7211 }
7212
7214 {
7215 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7216
7217 super.OnWasAttached(parent, slot_id);
7218
7221
7223 }
7224
7226 {
7227 super.OnWasDetached(parent, slot_id);
7228
7231 }
7232
7234 {
7235 int idx;
7238
7239 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7240 if (inventory_slots.Count() < 1)
7241 {
7242 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
7243 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
7244 }
7245 else
7246 {
7247 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
7248 }
7249
7250 idx = inventory_slots.Find(slot);
7251 if (idx < 0)
7252 return "";
7253
7254 return attach_types.Get(idx);
7255 }
7256
7258 {
7259 int idx = -1;
7260 string slot;
7261
7264
7265 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7266 if (inventory_slots.Count() < 1)
7267 {
7268 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
7269 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7270 }
7271 else
7272 {
7273 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
7274 if (detach_types.Count() < 1)
7275 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7276 }
7277
7278 for (int i = 0; i < inventory_slots.Count(); i++)
7279 {
7280 slot = inventory_slots.Get(i);
7281 }
7282
7283 if (slot != "")
7284 {
7285 if (detach_types.Count() == 1)
7286 idx = 0;
7287 else
7288 idx = inventory_slots.Find(slot);
7289 }
7290 if (idx < 0)
7291 return "";
7292
7293 return detach_types.Get(idx);
7294 }
7295
7297 {
7298
7300
7301
7302 float min_time = 1;
7303 float max_time = 3;
7304 float delay = Math.RandomFloat(min_time, max_time);
7305
7306 explode_timer.Run(delay, this, "DoAmmoExplosion");
7307 }
7308
7310 {
7311 Magazine magazine = Magazine.Cast(this);
7312 int pop_sounds_count = 6;
7313 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
7314
7315
7316 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
7317 string sound_name = pop_sounds[ sound_idx ];
7319
7320
7321 magazine.ServerAddAmmoCount(-1);
7322
7323
7324 float min_temp_to_explode = 100;
7325
7326 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
7327 {
7329 }
7330 }
7331
7332
7333 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
7334 {
7335 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
7336
7337 const int CHANCE_DAMAGE_CARGO = 4;
7338 const int CHANCE_DAMAGE_ATTACHMENT = 1;
7339 const int CHANCE_DAMAGE_NOTHING = 2;
7340
7342 {
7343 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
7344 int chances;
7345 int rnd;
7346
7347 if (GetInventory().GetCargo())
7348 {
7349 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7350 rnd = Math.RandomInt(0,chances);
7351
7352 if (rnd < CHANCE_DAMAGE_CARGO)
7353 {
7355 }
7356 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
7357 {
7359 }
7360 }
7361 else
7362 {
7363 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7364 rnd = Math.RandomInt(0,chances);
7365
7366 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
7367 {
7369 }
7370 }
7371 }
7372 }
7373
7375 {
7376 if (GetInventory().GetCargo())
7377 {
7378 int item_count = GetInventory().GetCargo().GetItemCount();
7379 if (item_count > 0)
7380 {
7381 int random_pick = Math.RandomInt(0, item_count);
7383 if (!item.IsExplosive())
7384 {
7385 item.AddHealth("","",damage);
7386 return true;
7387 }
7388 }
7389 }
7390 return false;
7391 }
7392
7394 {
7395 int attachment_count = GetInventory().AttachmentCount();
7396 if (attachment_count > 0)
7397 {
7398 int random_pick = Math.RandomInt(0, attachment_count);
7399 ItemBase attachment =
ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
7400 if (!attachment.IsExplosive())
7401 {
7402 attachment.AddHealth("","",damage);
7403 return true;
7404 }
7405 }
7406 return false;
7407 }
7408
7410 {
7412 }
7413
7415 {
7417 return GetInventory().CanRemoveEntity();
7418
7419 return false;
7420 }
7421
7423 {
7424
7426 return false;
7427
7428
7430 return false;
7431
7432
7433
7435 if (delta == 0)
7436 return false;
7437
7438
7439 return true;
7440 }
7441
7443 {
7445 {
7446 if (ScriptInputUserData.CanStoreInputUserData())
7447 {
7448 ScriptInputUserData ctx = new ScriptInputUserData;
7453 ctx.
Write(destination_entity);
7457 }
7458 }
7459 else if (!
GetGame().IsMultiplayer())
7460 {
7462 }
7463 }
7464
7466 {
7467 float split_quantity_new;
7471 InventoryLocation loc = new InventoryLocation;
7472
7473 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7474 {
7476 split_quantity_new = stack_max;
7477 else
7479
7481 {
7482 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7483 if (new_item)
7484 {
7485 new_item.SetResultOfSplit(true);
7486 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7488 new_item.
SetQuantity(split_quantity_new,
false,
true);
7489 }
7490 }
7491 }
7492 else if (destination_entity && slot_id == -1)
7493 {
7494 if (quantity > stack_max)
7495 split_quantity_new = stack_max;
7496 else
7497 split_quantity_new = quantity;
7498
7500 {
7502 {
7505 }
7506
7507 if (new_item)
7508 {
7509 new_item.SetResultOfSplit(true);
7510 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7512 new_item.
SetQuantity(split_quantity_new,
false,
true);
7513 }
7514 }
7515 }
7516 else
7517 {
7518 if (stack_max != 0)
7519 {
7521 {
7523 }
7524
7525 if (split_quantity_new == 0)
7526 {
7527 if (!
GetGame().IsMultiplayer())
7528 player.PhysicalPredictiveDropItem(this);
7529 else
7530 player.ServerDropEntity(this);
7531 return;
7532 }
7533
7535 {
7537
7538 if (new_item)
7539 {
7540 new_item.SetResultOfSplit(true);
7541 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7544 new_item.PlaceOnSurface();
7545 }
7546 }
7547 }
7548 }
7549 }
7550
7552 {
7553 float split_quantity_new;
7557 InventoryLocation loc = new InventoryLocation;
7558
7559 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7560 {
7562 split_quantity_new = stack_max;
7563 else
7565
7567 {
7568 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7569 if (new_item)
7570 {
7571 new_item.SetResultOfSplit(true);
7572 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7574 new_item.
SetQuantity(split_quantity_new,
false,
true);
7575 }
7576 }
7577 }
7578 else if (destination_entity && slot_id == -1)
7579 {
7580 if (quantity > stack_max)
7581 split_quantity_new = stack_max;
7582 else
7583 split_quantity_new = quantity;
7584
7586 {
7588 {
7591 }
7592
7593 if (new_item)
7594 {
7595 new_item.SetResultOfSplit(true);
7596 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7598 new_item.
SetQuantity(split_quantity_new,
false,
true);
7599 }
7600 }
7601 }
7602 else
7603 {
7604 if (stack_max != 0)
7605 {
7607 {
7609 }
7610
7612 {
7614
7615 if (new_item)
7616 {
7617 new_item.SetResultOfSplit(true);
7618 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7621 new_item.PlaceOnSurface();
7622 }
7623 }
7624 }
7625 }
7626 }
7627
7629 {
7631 {
7632 if (ScriptInputUserData.CanStoreInputUserData())
7633 {
7634 ScriptInputUserData ctx = new ScriptInputUserData;
7639 dst.WriteToContext(ctx);
7641 }
7642 }
7643 else if (!
GetGame().IsMultiplayer())
7644 {
7646 }
7647 }
7648
7650 {
7652 {
7653 if (ScriptInputUserData.CanStoreInputUserData())
7654 {
7655 ScriptInputUserData ctx = new ScriptInputUserData;
7660 ctx.
Write(destination_entity);
7666 }
7667 }
7668 else if (!
GetGame().IsMultiplayer())
7669 {
7671 }
7672 }
7673
7675 {
7677 }
7678
7680 {
7682 float split_quantity_new;
7684 if (dst.IsValid())
7685 {
7686 int slot_id = dst.GetSlot();
7688
7689 if (quantity > stack_max)
7690 split_quantity_new = stack_max;
7691 else
7692 split_quantity_new = quantity;
7693
7695 {
7697
7698 if (new_item)
7699 {
7700 new_item.SetResultOfSplit(true);
7701 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7703 new_item.
SetQuantity(split_quantity_new,
false,
true);
7704 }
7705
7706 return new_item;
7707 }
7708 }
7709
7710 return null;
7711 }
7712
7714 {
7716 float split_quantity_new;
7718 if (destination_entity)
7719 {
7721 if (quantity > stackable)
7722 split_quantity_new = stackable;
7723 else
7724 split_quantity_new = quantity;
7725
7727 {
7728 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
7729 if (new_item)
7730 {
7731 new_item.SetResultOfSplit(true);
7732 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7734 new_item.
SetQuantity(split_quantity_new,
false,
true);
7735 }
7736 }
7737 }
7738 }
7739
7741 {
7743 {
7744 if (ScriptInputUserData.CanStoreInputUserData())
7745 {
7746 ScriptInputUserData ctx = new ScriptInputUserData;
7751 ItemBase destination_entity =
this;
7752 ctx.
Write(destination_entity);
7756 }
7757 }
7758 else if (!
GetGame().IsMultiplayer())
7759 {
7761 }
7762 }
7763
7765 {
7767 float split_quantity_new;
7769 if (player)
7770 {
7772 if (quantity > stackable)
7773 split_quantity_new = stackable;
7774 else
7775 split_quantity_new = quantity;
7776
7778 {
7779 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
7780 new_item =
ItemBase.Cast(in_hands);
7781 if (new_item)
7782 {
7783 new_item.SetResultOfSplit(true);
7784 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7786 new_item.SetQuantity(split_quantity_new, false, true);
7787 }
7788 }
7789 }
7790 }
7791
7793 {
7795 float split_quantity_new = Math.Floor(quantity * 0.5);
7796
7798 return;
7799
7801
7802 if (new_item)
7803 {
7804 if (new_item.GetQuantityMax() < split_quantity_new)
7805 {
7806 split_quantity_new = new_item.GetQuantityMax();
7807 }
7808
7809 new_item.SetResultOfSplit(true);
7810 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7811
7813 {
7816 }
7817 else
7818 {
7820 new_item.
SetQuantity(split_quantity_new,
false,
true);
7821 }
7822 }
7823 }
7824
7826 {
7828 float split_quantity_new = Math.Floor(quantity / 2);
7829
7831 return;
7832
7833 InventoryLocation invloc = new InventoryLocation;
7835
7837 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
7838
7839 if (new_item)
7840 {
7841 if (new_item.GetQuantityMax() < split_quantity_new)
7842 {
7843 split_quantity_new = new_item.GetQuantityMax();
7844 }
7846 {
7849 }
7850 else if (split_quantity_new > 1)
7851 {
7853 new_item.
SetQuantity(split_quantity_new,
false,
true);
7854 }
7855 }
7856 }
7857
7860 {
7861 SetWeightDirty();
7863
7864 if (parent)
7865 parent.OnAttachmentQuantityChangedEx(this, delta);
7866
7868 {
7870 {
7872 }
7874 {
7875 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
7877 }
7878 }
7879
7880 }
7881
7884 {
7885
7886 }
7887
7890 {
7892 }
7893
7895 {
7896 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
7897
7899 {
7900 if (newLevel == GameConstants.STATE_RUINED)
7901 {
7903 EntityAI parent = GetHierarchyParent();
7904 if (parent && parent.IsFireplace())
7905 {
7906 CargoBase cargo = GetInventory().GetCargo();
7907 if (cargo)
7908 {
7910 {
7912 }
7913 }
7914 }
7915 }
7916
7918 {
7919
7921 return;
7922 }
7923
7924 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
7925 {
7927 }
7928 }
7929 }
7930
7931
7933 {
7934 super.OnRightClick();
7935
7937 {
7939 {
7940 if (ScriptInputUserData.CanStoreInputUserData())
7941 {
7942 EntityAI root = GetHierarchyRoot();
7943 Man playerOwner = GetHierarchyRootPlayer();
7944 InventoryLocation dst = new InventoryLocation;
7945
7946
7947 if (!playerOwner && root && root == this)
7948 {
7950 }
7951 else
7952 {
7953
7954 GetInventory().GetCurrentInventoryLocation(dst);
7956 {
7959 {
7961 }
7962 else
7963 {
7965
7966
7967 if (
GetGame().
GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
7968 {
7970 }
7971 else
7972 {
7973 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
7974 }
7975 }
7976 }
7977 }
7978
7979 ScriptInputUserData ctx = new ScriptInputUserData;
7987 }
7988 }
7989 else if (!
GetGame().IsMultiplayer())
7990 {
7992 }
7993 }
7994 }
7995
7997 {
7998 if (root)
7999 {
8000 vector m4[4];
8001 root.GetTransform(m4);
8002 dst.SetGround(this, m4);
8003 }
8004 else
8005 {
8006 GetInventory().GetCurrentInventoryLocation(dst);
8007 }
8008 }
8009
8010 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
8011 {
8012
8013 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
8014 return false;
8015
8016 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
8017 return false;
8018
8019
8021 return false;
8022
8023
8024 Magazine mag = Magazine.Cast(this);
8025 if (mag)
8026 {
8027 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
8028 return false;
8029
8030 if (stack_max_limit)
8031 {
8032 Magazine other_mag = Magazine.Cast(other_item);
8033 if (other_item)
8034 {
8035 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
8036 return false;
8037 }
8038
8039 }
8040 }
8041 else
8042 {
8043
8045 return false;
8046
8048 return false;
8049 }
8050
8051 PlayerBase player = null;
8052 if (CastTo(player, GetHierarchyRootPlayer()))
8053 {
8054 if (player.GetInventory().HasAttachment(this))
8055 return false;
8056
8057 if (player.IsItemsToDelete())
8058 return false;
8059 }
8060
8061 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
8062 return false;
8063
8064 int slotID;
8066 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
8067 return false;
8068
8069 return true;
8070 }
8071
8073 {
8075 }
8076
8078 {
8079 return m_IsResultOfSplit;
8080 }
8081
8083 {
8084 m_IsResultOfSplit = value;
8085 }
8086
8088 {
8090 }
8091
8093 {
8094 float other_item_quantity = other_item.GetQuantity();
8095 float this_free_space;
8096
8098
8100
8101 if (other_item_quantity > this_free_space)
8102 {
8103 return this_free_space;
8104 }
8105 else
8106 {
8107 return other_item_quantity;
8108 }
8109 }
8110
8112 {
8114 }
8115
8117 {
8119 return;
8120
8121 if (!IsMagazine() && other_item)
8122 {
8124 if (quantity_used != 0)
8125 {
8126 float hp1 = GetHealth01("","");
8127 float hp2 = other_item.GetHealth01("","");
8128 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
8129 hpResult = hpResult / (
GetQuantity() + quantity_used);
8130
8131 hpResult *= GetMaxHealth();
8132 Math.Round(hpResult);
8133 SetHealth("", "Health", hpResult);
8134
8136 other_item.AddQuantity(-quantity_used);
8137 }
8138 }
8140 }
8141
8143 {
8144 #ifdef SERVER
8145 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
8146 GetHierarchyParent().IncreaseLifetimeUp();
8147 #endif
8148 };
8149
8151 {
8152 PlayerBase p = PlayerBase.Cast(player);
8153
8154 array<int> recipesIds = p.m_Recipes;
8155 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8156 if (moduleRecipesManager)
8157 {
8158 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
8159 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
8160 }
8161
8162 for (int i = 0;i < recipesIds.Count(); i++)
8163 {
8164 int key = recipesIds.Get(i);
8165 string recipeName = moduleRecipesManager.GetRecipeName(key);
8167 }
8168 }
8169
8170
8171 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
8172 {
8173 super.GetDebugActions(outputList);
8174
8175
8181
8182
8187
8192
8193
8197
8198
8200 {
8204 }
8205
8208
8209
8213
8215
8216 InventoryLocation loc = new InventoryLocation();
8217 GetInventory().GetCurrentInventoryLocation(loc);
8219 {
8220 if (Gizmo_IsSupported())
8223 }
8224
8226 }
8227
8228
8229
8230
8232 {
8233 super.OnAction(action_id, player, ctx);
8234
8236 {
8237 switch (action_id)
8238 {
8241 return true;
8244 return true;
8245 }
8246 }
8247
8249 {
8250 switch (action_id)
8251 {
8253 Delete();
8254 return true;
8255 }
8256 }
8257
8258 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
8259 {
8260 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8261 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
8262 PlayerBase p = PlayerBase.Cast(player);
8263 if (
EActions.RECIPES_RANGE_START < 1000)
8264 {
8265 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
8266 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
8267 }
8268 }
8269 #ifndef SERVER
8270 else if (action_id ==
EActions.WATCH_PLAYER)
8271 {
8272 PluginDeveloper.SetDeveloperItemClientEx(player);
8273 }
8274 #endif
8276 {
8277 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
8278 {
8279 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
8280 OnDebugButtonPressServer(id + 1);
8281 }
8282
8283 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
8284 {
8285 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
8287 }
8288
8289 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
8290 {
8291 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
8293 }
8294
8295 else if (action_id ==
EActions.ADD_QUANTITY)
8296 {
8297 if (IsMagazine())
8298 {
8299 Magazine mag = Magazine.Cast(this);
8300 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
8301 }
8302 else
8303 {
8305 }
8306
8307 if (m_EM)
8308 {
8309 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
8310 }
8311
8312 }
8313
8314 else if (action_id ==
EActions.REMOVE_QUANTITY)
8315 {
8316 if (IsMagazine())
8317 {
8318 Magazine mag2 = Magazine.Cast(this);
8319 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
8320 }
8321 else
8322 {
8324 }
8325 if (m_EM)
8326 {
8327 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
8328 }
8329
8330 }
8331
8332 else if (action_id ==
EActions.SET_QUANTITY_0)
8333 {
8335
8336 if (m_EM)
8337 {
8338 m_EM.SetEnergy(0);
8339 }
8340 }
8341
8342 else if (action_id ==
EActions.SET_MAX_QUANTITY)
8343 {
8345
8346 if (m_EM)
8347 {
8348 m_EM.SetEnergy(m_EM.GetEnergyMax());
8349 }
8350 }
8351
8352 else if (action_id ==
EActions.ADD_HEALTH)
8353 {
8354 AddHealth("","",GetMaxHealth("","Health")/5);
8355 }
8356 else if (action_id ==
EActions.REMOVE_HEALTH)
8357 {
8358 AddHealth("","",-GetMaxHealth("","Health")/5);
8359 }
8360 else if (action_id ==
EActions.DESTROY_HEALTH)
8361 {
8362 SetHealth01("","",0);
8363 }
8364 else if (action_id ==
EActions.WATCH_ITEM)
8365 {
8367 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
8368 #ifdef DEVELOPER
8369 SetDebugDeveloper_item(this);
8370 #endif
8371 }
8372
8373 else if (action_id ==
EActions.ADD_TEMPERATURE)
8374 {
8375 AddTemperature(20);
8376
8377 }
8378
8379 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
8380 {
8381 AddTemperature(-20);
8382
8383 }
8384
8385 else if (action_id ==
EActions.FLIP_FROZEN)
8386 {
8387 SetFrozen(!GetIsFrozen());
8388
8389 }
8390
8391 else if (action_id ==
EActions.ADD_WETNESS)
8392 {
8394
8395 }
8396
8397 else if (action_id ==
EActions.REMOVE_WETNESS)
8398 {
8400
8401 }
8402
8403 else if (action_id ==
EActions.LIQUIDTYPE_UP)
8404 {
8407
8408
8409 }
8410
8411 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
8412 {
8415 }
8416
8417 else if (action_id ==
EActions.MAKE_SPECIAL)
8418 {
8419 auto debugParams = DebugSpawnParams.WithPlayer(player);
8420 OnDebugSpawnEx(debugParams);
8421 }
8422
8423 }
8424
8425
8426 return false;
8427 }
8428
8429
8430
8431
8435
8438
8439
8440
8442 {
8443 return false;
8444 }
8445
8446
8448 {
8449 return true;
8450 }
8451
8452
8454 {
8455 return true;
8456 }
8457
8458
8459
8461 {
8462 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
8464 }
8465
8468 {
8469 return null;
8470 }
8471
8473 {
8474 return false;
8475 }
8476
8478 {
8479 return false;
8480 }
8481
8485
8486
8488 {
8489 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8490 return module_repairing.CanRepair(this, item_repair_kit);
8491 }
8492
8493
8494 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
8495 {
8496 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8497 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
8498 }
8499
8500
8502 {
8503
8504
8505
8506
8507
8508
8509
8510
8511 return 1;
8512 }
8513
8514
8515
8517 {
8519 }
8520
8521
8522
8524 {
8526 }
8527
8528
8537 {
8538 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8539
8540 if (player)
8541 {
8542 player.MessageStatus(text);
8543 }
8544 }
8545
8546
8555 {
8556 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8557
8558 if (player)
8559 {
8560 player.MessageAction(text);
8561 }
8562 }
8563
8564
8573 {
8574 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8575
8576 if (player)
8577 {
8578 player.MessageFriendly(text);
8579 }
8580 }
8581
8582
8591 {
8592 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8593
8594 if (player)
8595 {
8596 player.MessageImportant(text);
8597 }
8598 }
8599
8601 {
8602 return true;
8603 }
8604
8605
8606 override bool KindOf(
string tag)
8607 {
8608 bool found = false;
8609 string item_name = this.
GetType();
8612
8613 int array_size = item_tag_array.Count();
8614 for (int i = 0; i < array_size; i++)
8615 {
8616 if (item_tag_array.Get(i) == tag)
8617 {
8618 found = true;
8619 break;
8620 }
8621 }
8622 return found;
8623 }
8624
8625
8627 {
8628
8629 super.OnRPC(sender, rpc_type,ctx);
8630
8631
8632 switch (rpc_type)
8633 {
8634 #ifndef SERVER
8635 case ERPCs.RPC_SOUND_LOCK_ATTACH:
8636 Param2<bool, string> p = new Param2<bool, string>(false, "");
8637
8639 return;
8640
8641 bool play = p.param1;
8642 string soundSet = p.param2;
8643
8644 if (play)
8645 {
8647 {
8649 {
8651 }
8652 }
8653 else
8654 {
8656 }
8657 }
8658 else
8659 {
8661 }
8662
8663 break;
8664 #endif
8665
8666 }
8667
8669 {
8671 }
8672 }
8673
8674
8675
8676
8678 {
8679 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8680 return plugin.GetID(
name);
8681 }
8682
8684 {
8685 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8686 return plugin.GetName(id);
8687 }
8688
8691 {
8692
8693
8694 int varFlags;
8695 if (!ctx.
Read(varFlags))
8696 return;
8697
8698 if (varFlags & ItemVariableFlags.FLOAT)
8699 {
8701 }
8702 }
8703
8705 {
8706
8707 super.SerializeNumericalVars(floats_out);
8708
8709
8710
8712 {
8714 }
8715
8717 {
8719 }
8720
8722 {
8724 }
8725
8727 {
8732 }
8733
8735 {
8737 }
8738 }
8739
8741 {
8742
8743 super.DeSerializeNumericalVars(floats);
8744
8745
8746 int index = 0;
8747 int mask = Math.Round(floats.Get(index));
8748
8749 index++;
8750
8752 {
8754 {
8756 }
8757 else
8758 {
8759 float quantity = floats.Get(index);
8761 }
8762 index++;
8763 }
8764
8766 {
8767 float wet = floats.Get(index);
8769 index++;
8770 }
8771
8773 {
8774 int liquidtype = Math.Round(floats.Get(index));
8776 index++;
8777 }
8778
8780 {
8782 index++;
8784 index++;
8786 index++;
8788 index++;
8789 }
8790
8792 {
8793 int cleanness = Math.Round(floats.Get(index));
8795 index++;
8796 }
8797 }
8798
8800 {
8801 super.WriteVarsToCTX(ctx);
8802
8803
8805 {
8807 }
8808
8810 {
8812 }
8813
8815 {
8817 }
8818
8820 {
8821 int r,g,b,a;
8827 }
8828
8830 {
8832 }
8833 }
8834
8836 {
8837 if (!super.ReadVarsFromCTX(ctx,version))
8838 return false;
8839
8840 int intValue;
8841 float value;
8842
8843 if (version < 140)
8844 {
8845 if (!ctx.
Read(intValue))
8846 return false;
8847
8848 m_VariablesMask = intValue;
8849 }
8850
8852 {
8853 if (!ctx.
Read(value))
8854 return false;
8855
8857 {
8859 }
8860 else
8861 {
8863 }
8864 }
8865
8866 if (version < 140)
8867 {
8869 {
8870 if (!ctx.
Read(value))
8871 return false;
8872 SetTemperatureDirect(value);
8873 }
8874 }
8875
8877 {
8878 if (!ctx.
Read(value))
8879 return false;
8881 }
8882
8884 {
8885 if (!ctx.
Read(intValue))
8886 return false;
8888 }
8889
8891 {
8892 int r,g,b,a;
8894 return false;
8896 return false;
8898 return false;
8900 return false;
8901
8903 }
8904
8906 {
8907 if (!ctx.
Read(intValue))
8908 return false;
8910 }
8911
8912 if (version >= 138 && version < 140)
8913 {
8915 {
8916 if (!ctx.
Read(intValue))
8917 return false;
8918 SetFrozen(intValue);
8919 }
8920 }
8921
8922 return true;
8923 }
8924
8925
8927 {
8930 {
8932 }
8933
8934 if (!super.OnStoreLoad(ctx, version))
8935 {
8937 return false;
8938 }
8939
8940 if (version >= 114)
8941 {
8942 bool hasQuickBarIndexSaved;
8943
8944 if (!ctx.
Read(hasQuickBarIndexSaved))
8945 {
8947 return false;
8948 }
8949
8950 if (hasQuickBarIndexSaved)
8951 {
8952 int itmQBIndex;
8953
8954
8955 if (!ctx.
Read(itmQBIndex))
8956 {
8958 return false;
8959 }
8960
8961 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
8962 if (itmQBIndex != -1 && parentPlayer)
8963 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
8964 }
8965 }
8966 else
8967 {
8968
8969 PlayerBase player;
8970 int itemQBIndex;
8971 if (version ==
int.
MAX)
8972 {
8973 if (!ctx.
Read(itemQBIndex))
8974 {
8976 return false;
8977 }
8978 }
8979 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
8980 {
8981
8982 if (!ctx.
Read(itemQBIndex))
8983 {
8985 return false;
8986 }
8987 if (itemQBIndex != -1 && player)
8988 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
8989 }
8990 }
8991
8992 if (version < 140)
8993 {
8994
8995 if (!LoadVariables(ctx, version))
8996 {
8998 return false;
8999 }
9000 }
9001
9002
9004 {
9006 return false;
9007 }
9008 if (version >= 132)
9009 {
9011 if (raib)
9012 {
9014 {
9016 return false;
9017 }
9018 }
9019 }
9020
9022 return true;
9023 }
9024
9025
9026
9028 {
9029 super.OnStoreSave(ctx);
9030
9031 PlayerBase player;
9032 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
9033 {
9035
9036 int itemQBIndex = -1;
9037 itemQBIndex = player.FindQuickBarEntityIndex(this);
9038 ctx.
Write(itemQBIndex);
9039 }
9040 else
9041 {
9043 }
9044
9046
9048 if (raib)
9049 {
9051 }
9052 }
9053
9054
9056 {
9057 super.AfterStoreLoad();
9058
9060 {
9062 }
9063
9065 {
9068 }
9069 }
9070
9072 {
9073 super.EEOnAfterLoad();
9074
9076 {
9078 }
9079
9082 }
9083
9085 {
9086 return false;
9087 }
9088
9089
9090
9092 {
9094 {
9095 #ifdef PLATFORM_CONSOLE
9096
9098 {
9100 if (menu)
9101 {
9103 }
9104 }
9105 #endif
9106 }
9107
9109 {
9112 }
9113
9115 {
9116 SetWeightDirty();
9118 }
9120 {
9123 }
9124
9126 {
9129 }
9131 {
9134 }
9135
9136 super.OnVariablesSynchronized();
9137 }
9138
9139
9140
9142 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
9143 {
9144 if (!IsServerCheck(allow_client))
9145 return false;
9146
9148 return false;
9149
9152
9153 if (value <= (min + 0.001))
9154 value = min;
9155
9156 if (value == min)
9157 {
9158 if (destroy_config)
9159 {
9160 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
9161 if (dstr)
9162 {
9164 this.Delete();
9165 return true;
9166 }
9167 }
9168 else if (destroy_forced)
9169 {
9171 this.Delete();
9172 return true;
9173 }
9174
9176 }
9177
9180
9182 {
9184
9185 if (delta)
9187 }
9188
9190
9191 return false;
9192 }
9193
9194
9196 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9197 {
9199 }
9200
9202 {
9205 }
9206
9208 {
9211 }
9212
9214 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9215 {
9216 float value_clamped = Math.Clamp(value, 0, 1);
9218 SetQuantity(result, destroy_config, destroy_forced);
9219 }
9220
9221
9224 {
9226 }
9227
9229 {
9231 }
9232
9233
9234
9235
9236
9237
9238
9239
9240
9241
9243 {
9244 int slot = -1;
9245 if (GetInventory())
9246 {
9247 InventoryLocation il = new InventoryLocation;
9248 GetInventory().GetCurrentInventoryLocation(il);
9250 }
9251
9253 }
9254
9256 {
9257 float quantity_max = 0;
9258
9260 {
9261 if (attSlotID != -1)
9262 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
9263
9264 if (quantity_max <= 0)
9266 }
9267
9268 if (quantity_max <= 0)
9270
9271 return quantity_max;
9272 }
9273
9275 {
9277 }
9278
9280 {
9282 }
9283
9284
9286 {
9288 }
9289
9291 {
9293 }
9294
9296 {
9298 }
9299
9300
9302 {
9303
9304 float weightEx = GetWeightEx();
9305 float special = GetInventoryAndCargoWeight();
9306 return weightEx - special;
9307 }
9308
9309
9311 {
9313 }
9314
9316 {
9318 {
9319 #ifdef DEVELOPER
9320 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9321 {
9322 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
9324 }
9325 #endif
9326
9328 }
9329 else if (HasEnergyManager())
9330 {
9331 #ifdef DEVELOPER
9332 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9333 {
9334 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
9335 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
9336 }
9337 #endif
9338 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
9339 }
9340 else
9341 {
9342 #ifdef DEVELOPER
9343 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9344 {
9345 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
9346 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
9347 }
9348 #endif
9349 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
9350 }
9351 }
9352
9355 {
9356 int item_count = 0;
9358
9359 if (GetInventory().GetCargo() != NULL)
9360 {
9361 item_count = GetInventory().GetCargo().GetItemCount();
9362 }
9363
9364 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
9365 {
9366 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
9367 if (item)
9368 item_count += item.GetNumberOfItems();
9369 }
9370 return item_count;
9371 }
9372
9375 {
9376 float weight = 0;
9377 float wetness = 1;
9378 if (include_wetness)
9381 {
9382 weight = wetness * m_ConfigWeight;
9383 }
9385 {
9386 weight = 1;
9387 }
9388 return weight;
9389 }
9390
9391
9392
9394 {
9395 if ((
GetGame().IsServer() || !
GetGame().IsMultiplayer()) && GetInventory())
9396 {
9397 GameInventory inv = GetInventory();
9398 array<EntityAI> items = new array<EntityAI>;
9400 for (int i = 0; i < items.Count(); i++)
9401 {
9403 if (item)
9404 {
9406 }
9407 }
9408 }
9409 }
9410
9411
9412
9413
9415 {
9416 float energy = 0;
9417 if (HasEnergyManager())
9418 {
9419 energy = GetCompEM().GetEnergy();
9420 }
9421 return energy;
9422 }
9423
9424
9426 {
9427 super.OnEnergyConsumed();
9428
9430 }
9431
9433 {
9434 super.OnEnergyAdded();
9435
9437 }
9438
9439
9441 {
9442 if (
GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
9443 {
9445 {
9446 float energy_0to1 = GetCompEM().GetEnergy0To1();
9448 }
9449 }
9450 }
9451
9452
9454 {
9455 return ConfigGetFloat("heatIsolation");
9456 }
9457
9459 {
9461 }
9462
9464 {
9465 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
9466 if (
GetGame().ConfigIsExisting(paramPath))
9468
9469 return 0.0;
9470 }
9471
9473 {
9474 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
9475 if (
GetGame().ConfigIsExisting(paramPath))
9477
9478 return 0.0;
9479 }
9480
9481 override void SetWet(
float value,
bool allow_client =
false)
9482 {
9483 if (!IsServerCheck(allow_client))
9484 return;
9485
9488
9490
9491 m_VarWet = Math.Clamp(value, min, max);
9492
9494 {
9497 }
9498 }
9499
9500 override void AddWet(
float value)
9501 {
9503 }
9504
9506 {
9508 }
9509
9511 {
9513 }
9514
9516 {
9518 }
9519
9521 {
9523 }
9524
9526 {
9528 }
9529
9531 {
9534 if (newLevel != oldLevel)
9535 {
9537 }
9538 }
9539
9541 {
9542 SetWeightDirty();
9543 }
9544
9546 {
9547 return GetWetLevelInternal(
m_VarWet);
9548 }
9549
9550
9551
9553 {
9555 }
9556
9558 {
9560 }
9561
9563 {
9565 }
9566
9568 {
9570 }
9571
9572
9573
9575 {
9576 if (ConfigIsExisting("itemModelLength"))
9577 {
9578 return ConfigGetFloat("itemModelLength");
9579 }
9580 return 0;
9581 }
9582
9584 {
9585 if (ConfigIsExisting("itemAttachOffset"))
9586 {
9587 return ConfigGetFloat("itemAttachOffset");
9588 }
9589 return 0;
9590 }
9591
9592 override void SetCleanness(
int value,
bool allow_client =
false)
9593 {
9594 if (!IsServerCheck(allow_client))
9595 return;
9596
9598
9600
9603 }
9604
9606 {
9608 }
9609
9611 {
9612 return true;
9613 }
9614
9615
9616
9617
9619 {
9621 }
9622
9624 {
9626 }
9627
9628
9629
9630
9631 override void SetColor(
int r,
int g,
int b,
int a)
9632 {
9638 }
9640 override void GetColor(out
int r,out
int g,out
int b,out
int a)
9641 {
9646 }
9647
9649 {
9651 }
9652
9655 {
9656 int r,g,b,a;
9658 r = r/255;
9659 g = g/255;
9660 b = b/255;
9661 a = a/255;
9662 return MiscGameplayFunctions.GetColorString(r, g, b, a);
9663 }
9664
9665
9666
9667 override void SetLiquidType(
int value,
bool allow_client =
false)
9668 {
9669 if (!IsServerCheck(allow_client))
9670 return;
9671
9676 }
9677
9679 {
9680 return ConfigGetInt("varLiquidTypeInit");
9681 }
9682
9684 {
9686 }
9687
9689 {
9691 SetFrozen(false);
9692 }
9693
9696 {
9697 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9698 }
9699
9700
9703 {
9704 PlayerBase nplayer;
9705 if (PlayerBase.CastTo(nplayer, player))
9706 {
9708
9709 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9710 }
9711 }
9712
9713
9716 {
9717 PlayerBase nplayer;
9718 if (PlayerBase.CastTo(nplayer,player))
9719 {
9720
9721 nplayer.SetEnableQuickBarEntityShortcut(this,false);
9722
9723 }
9724
9725
9726 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
9727
9728
9729 if (HasEnergyManager())
9730 {
9731 GetCompEM().UpdatePlugState();
9732 }
9733 }
9734
9735
9737 {
9738 super.OnPlacementStarted(player);
9739
9741 }
9742
9743 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
9744 {
9746 {
9747 m_AdminLog.OnPlacementComplete(player,
this);
9748 }
9749
9750 super.OnPlacementComplete(player, position, orientation);
9751 }
9752
9753
9754
9755
9756
9758 {
9760 {
9761 return true;
9762 }
9763 else
9764 {
9765 return false;
9766 }
9767 }
9768
9769
9771 {
9773 {
9775 }
9776 }
9777
9778
9780 {
9782 }
9783
9785 {
9787 }
9788
9789 override void InsertAgent(
int agent,
float count = 1)
9790 {
9791 if (count < 1)
9792 return;
9793
9795 }
9796
9799 {
9801 }
9802
9803
9805 {
9807 }
9808
9809
9810
9811
9812
9813
9814
9815
9816
9817
9818
9819
9820
9821
9822
9823
9824
9825
9826
9827
9828
9829
9830
9831
9832
9833
9834
9835
9836
9837
9838
9839
9840
9841
9842
9843
9844
9845
9846
9847
9848
9849
9851 {
9853 return false;
9854 return true;
9855 }
9856
9858 {
9859
9861 }
9862
9863
9866 {
9867 super.CheckForRoofLimited(timeTresholdMS);
9868
9870 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
9871 {
9872 m_PreviousRoofTestTime = time;
9873 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
9874 }
9875 }
9876
9877
9879 {
9881 {
9882 return 0;
9883 }
9884
9885 if (GetInventory().GetAttachmentSlotsCount() != 0)
9886 {
9887 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
9888 if (filter)
9889 return filter.GetProtectionLevel(type, false, system);
9890 else
9891 return 0;
9892 }
9893
9894 string subclassPath, entryName;
9895
9896 switch (type)
9897 {
9899 entryName = "biological";
9900 break;
9902 entryName = "chemical";
9903 break;
9904 default:
9905 entryName = "biological";
9906 break;
9907 }
9908
9909 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
9910
9912 }
9913
9914
9915
9918 {
9919 if (!IsMagazine())
9921
9923 }
9924
9925
9926
9927
9928
9933 {
9934 return true;
9935 }
9936
9938 {
9940 }
9941
9942
9943
9944
9945
9947 {
9948 if (parent)
9949 {
9950 if (parent.IsInherited(DayZInfected))
9951 return true;
9952
9953 if (!parent.IsRuined())
9954 return true;
9955 }
9956
9957 return true;
9958 }
9959
9961 {
9962 if (!super.CanPutAsAttachment(parent))
9963 {
9964 return false;
9965 }
9966
9967 if (!IsRuined() && !parent.IsRuined())
9968 {
9969 return true;
9970 }
9971
9972 return false;
9973 }
9974
9976 {
9977
9978
9979
9980
9981 return super.CanReceiveItemIntoCargo(item);
9982 }
9983
9985 {
9986
9987
9988
9989
9990 GameInventory attachmentInv = attachment.GetInventory();
9992 {
9993 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
9994 return false;
9995 }
9996
9997 InventoryLocation loc = new InventoryLocation();
9998 attachment.GetInventory().GetCurrentInventoryLocation(loc);
9999 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
10000 return false;
10001
10002 return super.CanReceiveAttachment(attachment, slotId);
10003 }
10004
10006 {
10007 if (!super.CanReleaseAttachment(attachment))
10008 return false;
10009
10010 return GetInventory().AreChildrenAccessible();
10011 }
10012
10013
10014
10015
10016
10017
10018
10019
10020
10021
10022
10023
10024
10025
10026
10027
10028
10029
10030
10031
10032
10034 {
10035 int id = muzzle_owner.GetMuzzleID();
10036 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
10037
10038 if (WPOF_array)
10039 {
10040 for (int i = 0; i < WPOF_array.Count(); i++)
10041 {
10042 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
10043
10044 if (WPOF)
10045 {
10046 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
10047 }
10048 }
10049 }
10050 }
10051
10052
10054 {
10055 int id = muzzle_owner.GetMuzzleID();
10057
10058 if (WPOBE_array)
10059 {
10060 for (int i = 0; i < WPOBE_array.Count(); i++)
10061 {
10062 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
10063
10064 if (WPOBE)
10065 {
10066 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10067 }
10068 }
10069 }
10070 }
10071
10072
10074 {
10075 int id = muzzle_owner.GetMuzzleID();
10076 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10077
10078 if (WPOOH_array)
10079 {
10080 for (int i = 0; i < WPOOH_array.Count(); i++)
10081 {
10082 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10083
10084 if (WPOOH)
10085 {
10086 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10087 }
10088 }
10089 }
10090 }
10091
10092
10094 {
10095 int id = muzzle_owner.GetMuzzleID();
10096 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10097
10098 if (WPOOH_array)
10099 {
10100 for (int i = 0; i < WPOOH_array.Count(); i++)
10101 {
10102 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10103
10104 if (WPOOH)
10105 {
10106 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10107 }
10108 }
10109 }
10110 }
10111
10112
10114 {
10115 int id = muzzle_owner.GetMuzzleID();
10116 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10117
10118 if (WPOOH_array)
10119 {
10120 for (int i = 0; i < WPOOH_array.Count(); i++)
10121 {
10122 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10123
10124 if (WPOOH)
10125 {
10126 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10127 }
10128 }
10129 }
10130 }
10131
10132
10133
10135 {
10137 {
10138 return true;
10139 }
10140
10141 return false;
10142 }
10143
10145 {
10147 {
10148 return true;
10149 }
10150
10151 return false;
10152 }
10153
10155 {
10157 {
10158 return true;
10159 }
10160
10161 return false;
10162 }
10163
10165 {
10166 return false;
10167 }
10168
10171 {
10172 return UATimeSpent.DEFAULT_DEPLOY;
10173 }
10174
10175
10176
10177
10179 {
10181 SetSynchDirty();
10182 }
10183
10185 {
10187 }
10188
10189
10191 {
10192 return false;
10193 }
10194
10197 {
10198 string att_type = "None";
10199
10200 if (ConfigIsExisting("soundAttType"))
10201 {
10202 att_type = ConfigGetString("soundAttType");
10203 }
10204
10206 }
10207
10209 {
10211 }
10212
10213
10214
10215
10216
10222
10224 {
10227
10229 }
10230
10231
10233 {
10235 return;
10236
10238
10241
10244
10245 SoundParameters params = new SoundParameters();
10249 }
10250
10251
10253 {
10255 return;
10256
10258 SetSynchDirty();
10259
10262 }
10263
10264
10266 {
10268 return;
10269
10271 SetSynchDirty();
10272
10275 }
10276
10278 {
10280 }
10281
10283 {
10285 }
10286
10289 {
10290 if (!
GetGame().IsDedicatedServer())
10291 {
10292 if (ConfigIsExisting("attachSoundSet"))
10293 {
10294 string cfg_path = "";
10295 string soundset = "";
10296 string type_name =
GetType();
10297
10300 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
10301 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
10302
10303 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
10304 {
10305 for (int i = 0; i < cfg_soundset_array.Count(); i++)
10306 {
10307 if (cfg_slot_array[i] == slot_type)
10308 {
10309 soundset = cfg_soundset_array[i];
10310 break;
10311 }
10312 }
10313 }
10314
10315 if (soundset != "")
10316 {
10317 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
10319 }
10320 }
10321 }
10322 }
10323
10325 {
10326
10327 }
10328
10329 void OnApply(PlayerBase player);
10330
10332 {
10333 return 1.0;
10334 };
10335
10337 {
10339 }
10340
10342 {
10344 }
10345
10347
10349 {
10350 SetDynamicPhysicsLifeTime(0.01);
10352 }
10353
10355 {
10356 array<string> zone_names = new array<string>;
10357 GetDamageZones(zone_names);
10358 for (int i = 0; i < zone_names.Count(); i++)
10359 {
10360 SetHealthMax(zone_names.Get(i),"Health");
10361 }
10362 SetHealthMax("","Health");
10363 }
10364
10367 {
10368 float global_health = GetHealth01("","Health");
10369 array<string> zones = new array<string>;
10370 GetDamageZones(zones);
10371
10372 for (int i = 0; i < zones.Count(); i++)
10373 {
10374 SetHealth01(zones.Get(i),"Health",global_health);
10375 }
10376 }
10377
10380 {
10381 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
10382 }
10383
10385 {
10386 if (!hasRootAsPlayer)
10387 {
10388 if (refParentIB)
10389 {
10390
10391 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
10392 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
10393
10394 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
10395 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
10396
10399 }
10400 else
10401 {
10402
10405 }
10406 }
10407 }
10408
10410 {
10412 {
10413 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
10414 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
10415 {
10416 float heatPermCoef = 1.0;
10418 while (ent)
10419 {
10420 heatPermCoef *= ent.GetHeatPermeabilityCoef();
10421 ent = ent.GetHierarchyParent();
10422 }
10423
10424 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
10425 }
10426 }
10427 }
10428
10430 {
10431
10432 EntityAI parent = GetHierarchyParent();
10433 if (!parent)
10434 {
10435 hasParent = false;
10436 hasRootAsPlayer = false;
10437 }
10438 else
10439 {
10440 hasParent = true;
10441 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
10442 refParentIB =
ItemBase.Cast(parent);
10443 }
10444 }
10445
10446 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
10447 {
10448
10449 }
10450
10452 {
10453
10454 return false;
10455 }
10456
10458 {
10459
10460
10461 return false;
10462 }
10463
10465 {
10466
10467 return false;
10468 }
10469
10472 {
10473 return !GetIsFrozen() &&
IsOpen();
10474 }
10475
10477 {
10478 bool hasParent = false, hasRootAsPlayer = false;
10480
10481 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
10482 bool foodDecay =
g_Game.IsFoodDecayEnabled();
10483
10484 if (wwtu || foodDecay)
10485 {
10489
10490 if (processWetness || processTemperature || processDecay)
10491 {
10493
10494 if (processWetness)
10495 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
10496
10497 if (processTemperature)
10499
10500 if (processDecay)
10501 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
10502 }
10503 }
10504 }
10505
10508 {
10510 }
10511
10513 {
10516
10517 return super.GetTemperatureFreezeThreshold();
10518 }
10519
10521 {
10524
10525 return super.GetTemperatureThawThreshold();
10526 }
10527
10529 {
10532
10533 return super.GetItemOverheatThreshold();
10534 }
10535
10537 {
10539 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
10540
10541 return super.GetTemperatureFreezeTime();
10542 }
10543
10545 {
10547 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
10548
10549 return super.GetTemperatureThawTime();
10550 }
10551
10556
10558 {
10559 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
10560 }
10561
10563 {
10564 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
10565 }
10566
10569 {
10571 }
10572
10574 {
10576 }
10577
10579 {
10581 }
10582
10585 {
10586 return null;
10587 }
10588
10591 {
10592 return false;
10593 }
10594
10596 {
10598 {
10601 if (!trg)
10602 {
10604 explosive = this;
10605 }
10606
10607 explosive.PairRemote(trg);
10609
10610 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
10611 trg.SetPersistentPairID(persistentID);
10612 explosive.SetPersistentPairID(persistentID);
10613
10614 return true;
10615 }
10616 return false;
10617 }
10618
10621 {
10622 float ret = 1.0;
10625 ret *= GetHealth01();
10626
10627 return ret;
10628 }
10629
10630 #ifdef DEVELOPER
10631 override void SetDebugItem()
10632 {
10633 super.SetDebugItem();
10634 _itemBase = this;
10635 }
10636
10638 {
10639 string text = super.GetDebugText();
10640
10642 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
10643
10644 return text;
10645 }
10646 #endif
10647
10649 {
10650 return true;
10651 }
10652
10654
10656
10658 {
10661 }
10662
10663
10671
10687}
10688
10690{
10692 if (entity)
10693 {
10694 bool is_item = entity.IsInherited(
ItemBase);
10695 if (is_item && full_quantity)
10696 {
10699 }
10700 }
10701 else
10702 {
10704 return NULL;
10705 }
10706 return entity;
10707}
10708
10710{
10711 if (item)
10712 {
10713 if (health > 0)
10714 item.SetHealth("", "", health);
10715
10716 if (item.CanHaveTemperature())
10717 {
10719 if (item.CanFreeze())
10720 item.SetFrozen(false);
10721 }
10722
10723 if (item.HasEnergyManager())
10724 {
10725 if (quantity >= 0)
10726 {
10727 item.GetCompEM().SetEnergy0To1(quantity);
10728 }
10729 else
10730 {
10732 }
10733 }
10734 else if (item.IsMagazine())
10735 {
10736 Magazine mag = Magazine.Cast(item);
10737 if (quantity >= 0)
10738 {
10739 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
10740 }
10741 else
10742 {
10744 }
10745
10746 }
10747 else
10748 {
10749 if (quantity >= 0)
10750 {
10751 item.SetQuantityNormalized(quantity, false);
10752 }
10753 else
10754 {
10756 }
10757
10758 }
10759 }
10760}
10761
10762#ifdef DEVELOPER
10764#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.