5889{
5891 {
5892 return true;
5893 }
5894};
5895
5896
5897
5899{
5903
5905
5908
5909
5910
5911
5912
5921
5927
5932
5937
5958 protected bool m_IsResultOfSplit
5959
5961
5966
5967
5968
5970
5974
5975
5976
5978
5981
5982
5983
5989
5990
5998
6001
6002
6004
6005
6007
6008
6013
6014
6019
6020
6022
6023
6025 {
6030
6031 if (!
GetGame().IsDedicatedServer())
6032 {
6034 {
6036
6038 {
6040 }
6041 }
6042
6045 }
6046
6047 m_OldLocation = null;
6048
6050 {
6052 }
6053
6054 if (ConfigIsExisting("headSelectionsToHide"))
6055 {
6058 }
6059
6061 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
6062 {
6064 }
6065
6067
6068 m_IsResultOfSplit = false;
6069
6071 }
6072
6074 {
6075 super.InitItemVariables();
6076
6082 m_Count = ConfigGetInt(
"count");
6083
6086
6091
6094
6099
6111
6115
6116
6119 if (ConfigIsExisting("canBeSplit"))
6120 {
6123 }
6124
6126 if (ConfigIsExisting("itemBehaviour"))
6128
6129
6132 RegisterNetSyncVariableInt("m_VarLiquidType");
6133 RegisterNetSyncVariableInt("m_Cleanness",0,1);
6134
6135 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
6136 RegisterNetSyncVariableFloat("m_ImpactSpeed");
6137 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
6138
6139 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
6140 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
6141 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
6142 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
6143
6144 RegisterNetSyncVariableBool("m_IsBeingPlaced");
6145 RegisterNetSyncVariableBool("m_IsTakeable");
6146 RegisterNetSyncVariableBool("m_IsHologram");
6147
6150 {
6153 }
6154
6156
6158 if (ConfigIsExisting("temperaturePerQuantityWeight"))
6160
6161 }
6162
6164 {
6166 }
6167
6169 {
6172 {
6177 }
6178 }
6179
6180 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
6181 {
6183 {
6186 }
6187
6189 }
6190
6192 {
6198 }
6199
6201
6203 {
6205
6206 if (!action)
6207 {
6208 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
6209 return;
6210 }
6211
6213 if (!ai)
6214 {
6216 return;
6217 }
6218
6220 if (!action_array)
6221 {
6222 action_array = new array<ActionBase_Basic>;
6224 }
6225 if (LogManager.IsActionLogEnable())
6226 {
6227 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
6228 }
6229
6230 if (action_array.Find(action) != -1)
6231 {
6232 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
6233 }
6234 else
6235 {
6236 action_array.Insert(action);
6237 }
6238 }
6239
6241 {
6243 ActionBase action = player.GetActionManager().GetAction(actionName);
6246
6247 if (action_array)
6248 {
6249 action_array.RemoveItem(action);
6250 }
6251 }
6252
6253
6254
6256 {
6257 ActionOverrideData overrideData = new ActionOverrideData();
6261
6263 if (!actionMap)
6264 {
6267 }
6268
6269 actionMap.Insert(this.
Type(), overrideData);
6270
6271 }
6272
6274
6276
6277
6279 {
6282
6285
6286 string config_to_search = "CfgVehicles";
6287 string muzzle_owner_config;
6288
6290 {
6291 if (IsInherited(Weapon))
6292 config_to_search = "CfgWeapons";
6293
6294 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6295
6296 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
6297
6299
6300 if (config_OnFire_subclass_count > 0)
6301 {
6302 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
6303
6304 for (int i = 0; i < config_OnFire_subclass_count; i++)
6305 {
6306 string particle_class = "";
6308 string config_OnFire_entry = config_OnFire_class + particle_class;
6309 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
6310 WPOF_array.Insert(WPOF);
6311 }
6312
6313
6315 }
6316 }
6317
6319 {
6320 config_to_search = "CfgWeapons";
6321 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6322
6323 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
6324
6326
6327 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
6328 {
6329 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
6330
6331 for (i = 0; i < config_OnBulletCasingEject_count; i++)
6332 {
6333 string particle_class2 = "";
6335 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
6336 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
6337 WPOBE_array.Insert(WPOBE);
6338 }
6339
6340
6342 }
6343 }
6344 }
6345
6346
6348 {
6351
6353 {
6354 string config_to_search = "CfgVehicles";
6355
6356 if (IsInherited(Weapon))
6357 config_to_search = "CfgWeapons";
6358
6359 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6360 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
6361
6362 if (
GetGame().ConfigIsExisting(config_OnOverheating_class))
6363 {
6364
6366
6368 {
6370 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
6372 return;
6373 }
6374
6377
6378
6379
6381 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
6382
6383 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
6384 {
6385 string particle_class = "";
6387 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
6389
6390 if (entry_type == CT_CLASS)
6391 {
6392 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
6393 WPOOH_array.Insert(WPOF);
6394 }
6395 }
6396
6397
6399 }
6400 }
6401 }
6402
6404 {
6406 }
6407
6409 {
6411 {
6413
6416
6419
6420 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6421 }
6422 }
6423
6425 {
6427 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6428
6430 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6431
6433 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6434
6436 {
6438 }
6439 }
6440
6442 {
6444 }
6445
6447 {
6450 else
6452
6454 {
6457 }
6458 else
6459 {
6462
6465 }
6466
6468 }
6469
6471 {
6473 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6474 }
6475
6477 {
6479 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6481 }
6482
6484 {
6486 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6487 }
6488
6490 {
6493
6494 OverheatingParticle OP = new OverheatingParticle();
6499
6501 }
6502
6504 {
6507
6508 return -1;
6509 }
6510
6512 {
6514 {
6517
6518 for (int i = count; i > 0; --i)
6519 {
6520 int id = i - 1;
6523
6526
6527 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
6528 {
6529 if (p)
6530 {
6533 }
6534 }
6535 }
6536 }
6537 }
6538
6540 {
6542 {
6544 {
6545 int id = i - 1;
6547
6548 if (OP)
6549 {
6551
6552 if (p)
6553 {
6555 }
6556
6557 delete OP;
6558 }
6559 }
6560
6563 }
6564 }
6565
6568 {
6569 return 0.0;
6570 }
6571
6572
6574 {
6575 return 250;
6576 }
6577
6579 {
6580 return 0;
6581 }
6582
6585 {
6587 return true;
6588
6589 return false;
6590 }
6591
6594 {
6597
6599 {
6601 }
6602 else
6603 {
6604
6606 }
6607
6609 }
6610
6617 {
6618 return -1;
6619 }
6620
6621
6622
6623
6625 {
6627 {
6629 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6630
6631 if (r_index >= 0)
6632 {
6633 InventoryLocation r_il = new InventoryLocation;
6634 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6635
6636 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6639 {
6640 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6641 }
6643 {
6644 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6645 }
6646
6647 }
6648
6649 player.GetHumanInventory().ClearUserReservedLocation(this);
6650 }
6651
6654 }
6655
6656
6657
6658
6660 {
6661 return ItemBase.m_DebugActionsMask;
6662 }
6663
6665 {
6666 return ItemBase.m_DebugActionsMask & mask;
6667 }
6668
6670 {
6671 ItemBase.m_DebugActionsMask = mask;
6672 }
6673
6675 {
6676 ItemBase.m_DebugActionsMask |= mask;
6677 }
6678
6680 {
6681 ItemBase.m_DebugActionsMask &= ~mask;
6682 }
6683
6685 {
6687 {
6689 }
6690 else
6691 {
6693 }
6694 }
6695
6696
6698 {
6699 if (GetEconomyProfile())
6700 {
6701 float q_max = GetEconomyProfile().GetQuantityMax();
6702 if (q_max > 0)
6703 {
6704 float q_min = GetEconomyProfile().GetQuantityMin();
6705 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
6706
6708 {
6709 ComponentEnergyManager comp = GetCompEM();
6711 {
6713 }
6714 }
6716 {
6718
6719 }
6720
6721 }
6722 }
6723 }
6724
6727 {
6728 EntityAI parent = GetHierarchyParent();
6729
6730 if (parent)
6731 {
6732 InventoryLocation inventory_location_to_lock = new InventoryLocation;
6733 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
6734 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
6735 }
6736 }
6737
6740 {
6741 EntityAI parent = GetHierarchyParent();
6742
6743 if (parent)
6744 {
6745 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
6746 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
6747 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
6748 }
6749 }
6750
6752 {
6753
6754
6755
6756
6758
6760 {
6761 if (ScriptInputUserData.CanStoreInputUserData())
6762 {
6763 ScriptInputUserData ctx = new ScriptInputUserData;
6769 ctx.
Write(use_stack_max);
6772
6774 {
6775 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
6776 }
6777 }
6778 }
6779 else if (!
GetGame().IsMultiplayer())
6780 {
6782 }
6783 }
6784
6786 {
6788 }
6789
6791 {
6793 }
6794
6796 {
6798 }
6799
6801 {
6802
6803 return false;
6804 }
6805
6807 {
6808 return false;
6809 }
6810
6814 {
6815 return false;
6816 }
6817
6819 {
6820 return "";
6821 }
6822
6824
6826 {
6827 return false;
6828 }
6829
6831 {
6832 return true;
6833 }
6834
6835
6836
6838 {
6839 return true;
6840 }
6841
6843 {
6844 return true;
6845 }
6846
6848 {
6849 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6851 }
6852
6854 {
6856 }
6857
6859 {
6861 if (!is_being_placed)
6863 SetSynchDirty();
6864 }
6865
6866
6868
6870 {
6872 }
6873
6875 {
6877 }
6878
6880 {
6881 return 1;
6882 }
6883
6885 {
6886 return false;
6887 }
6888
6890 {
6892 SetSynchDirty();
6893 }
6894
6895
6896
6897
6898
6899
6900
6901
6902
6903
6904
6905
6906
6907
6908
6909
6910
6911
6912
6913
6914
6915
6916
6917
6918
6919
6920
6921
6922
6923
6924
6925
6926
6927
6928
6930 {
6931 super.OnMovedInsideCargo(container);
6932
6933 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6934 }
6935
6936 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
6937 {
6938 super.EEItemLocationChanged(oldLoc,newLoc);
6939
6940 PlayerBase new_player = null;
6941 PlayerBase old_player = null;
6942
6943 if (newLoc.GetParent())
6944 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
6945
6946 if (oldLoc.GetParent())
6947 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
6948
6950 {
6951 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
6952
6953 if (r_index >= 0)
6954 {
6955 InventoryLocation r_il = new InventoryLocation;
6956 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6957
6958 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6961 {
6962 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6963 }
6965 {
6966 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6967 }
6968
6969 }
6970 }
6971
6973 {
6974 if (new_player)
6975 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
6976
6977 if (new_player == old_player)
6978 {
6979
6980 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
6981 {
6983 {
6984 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
6985 {
6986 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6987 }
6988 }
6989 else
6990 {
6991 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6992 }
6993 }
6994
6995 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
6996 {
6997 int type = oldLoc.GetType();
6999 {
7000 oldLoc.GetParent().GetOnSetLock().Invoke(this);
7001 }
7003 {
7004 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
7005 }
7006 }
7007 if (!m_OldLocation)
7008 {
7009 m_OldLocation = new InventoryLocation;
7010 }
7011 m_OldLocation.Copy(oldLoc);
7012 }
7013 else
7014 {
7015 if (m_OldLocation)
7016 {
7017 m_OldLocation.Reset();
7018 }
7019 }
7020
7022 }
7023 else
7024 {
7025 if (new_player)
7026 {
7027 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
7028 if (res_index >= 0)
7029 {
7030 InventoryLocation il = new InventoryLocation;
7031 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
7033 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
7036 {
7037 il.
GetParent().GetOnReleaseLock().Invoke(it);
7038 }
7040 {
7042 }
7043
7044 }
7045 }
7047 {
7048
7050 }
7051
7052 if (m_OldLocation)
7053 {
7054 m_OldLocation.Reset();
7055 }
7056 }
7057 }
7058
7059 override void EOnContact(IEntity other, Contact extra)
7060 {
7062 {
7063 int liquidType = -1;
7065 if (impactSpeed > 0.0)
7066 {
7068 #ifndef SERVER
7070 #else
7072 SetSynchDirty();
7073 #endif
7075 }
7076 }
7077
7078 #ifdef SERVER
7079 if (GetCompEM() && GetCompEM().IsPlugged())
7080 {
7081 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
7082 GetCompEM().UnplugThis();
7083 }
7084 #endif
7085 }
7086
7088
7090 {
7092 }
7093
7095 {
7096
7097 }
7098
7100 {
7101 super.OnItemLocationChanged(old_owner, new_owner);
7102
7103 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
7104 PlayerBase playerNew = PlayerBase.Cast(new_owner);
7105
7106 if (!relatedPlayer && playerNew)
7107 relatedPlayer = playerNew;
7108
7109 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
7110 {
7112 if (actionMgr)
7113 {
7114 ActionBase currentAction = actionMgr.GetRunningAction();
7115 if (currentAction)
7117 }
7118 }
7119
7120 Man ownerPlayerOld = null;
7121 Man ownerPlayerNew = null;
7122
7123 if (old_owner)
7124 {
7125 if (old_owner.
IsMan())
7126 {
7127 ownerPlayerOld = Man.Cast(old_owner);
7128 }
7129 else
7130 {
7131 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
7132 }
7133 }
7134 else
7135 {
7137 {
7139
7140 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
7141 {
7142 GetCompEM().UnplugThis();
7143 }
7144 }
7145 }
7146
7147 if (new_owner)
7148 {
7149 if (new_owner.
IsMan())
7150 {
7151 ownerPlayerNew = Man.Cast(new_owner);
7152 }
7153 else
7154 {
7155 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
7156 }
7157 }
7158
7159 if (ownerPlayerOld != ownerPlayerNew)
7160 {
7161 if (ownerPlayerOld)
7162 {
7163 array<EntityAI> subItemsExit = new array<EntityAI>;
7165 for (int i = 0; i < subItemsExit.Count(); i++)
7166 {
7169 }
7170 }
7171
7172 if (ownerPlayerNew)
7173 {
7174 array<EntityAI> subItemsEnter = new array<EntityAI>;
7176 for (int j = 0; j < subItemsEnter.Count(); j++)
7177 {
7180 }
7181 }
7182 }
7183 else if (ownerPlayerNew != null)
7184 {
7185 PlayerBase nplayer;
7186 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
7187 {
7188 array<EntityAI> subItemsUpdate = new array<EntityAI>;
7190 for (int k = 0; k < subItemsUpdate.Count(); k++)
7191 {
7193 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
7194 }
7195 }
7196 }
7197
7198 if (old_owner)
7199 old_owner.OnChildItemRemoved(this);
7200 if (new_owner)
7201 new_owner.OnChildItemReceived(this);
7202 }
7203
7204
7206 {
7207 super.EEDelete(parent);
7208 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
7209 if (player)
7210 {
7212
7213 if (player.IsAlive())
7214 {
7215 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7216 if (r_index >= 0)
7217 {
7218 InventoryLocation r_il = new InventoryLocation;
7219 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7220
7221 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7224 {
7225 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7226 }
7228 {
7229 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7230 }
7231
7232 }
7233
7234 player.RemoveQuickBarEntityShortcut(this);
7235 }
7236 }
7237 }
7238
7240 {
7241 super.EEKilled(killer);
7242
7245 {
7246 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
7247 {
7248 if (IsMagazine())
7249 {
7250 if (Magazine.Cast(this).GetAmmoCount() > 0)
7251 {
7253 }
7254 }
7255 else
7256 {
7258 }
7259 }
7260 }
7261 }
7262
7264 {
7265 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7266
7267 super.OnWasAttached(parent, slot_id);
7268
7271
7273 }
7274
7276 {
7277 super.OnWasDetached(parent, slot_id);
7278
7281 }
7282
7284 {
7285 int idx;
7288
7289 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7290 if (inventory_slots.Count() < 1)
7291 {
7292 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
7293 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
7294 }
7295 else
7296 {
7297 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
7298 }
7299
7300 idx = inventory_slots.Find(slot);
7301 if (idx < 0)
7302 return "";
7303
7304 return attach_types.Get(idx);
7305 }
7306
7308 {
7309 int idx = -1;
7310 string slot;
7311
7314
7315 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7316 if (inventory_slots.Count() < 1)
7317 {
7318 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
7319 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7320 }
7321 else
7322 {
7323 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
7324 if (detach_types.Count() < 1)
7325 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7326 }
7327
7328 for (int i = 0; i < inventory_slots.Count(); i++)
7329 {
7330 slot = inventory_slots.Get(i);
7331 }
7332
7333 if (slot != "")
7334 {
7335 if (detach_types.Count() == 1)
7336 idx = 0;
7337 else
7338 idx = inventory_slots.Find(slot);
7339 }
7340 if (idx < 0)
7341 return "";
7342
7343 return detach_types.Get(idx);
7344 }
7345
7347 {
7348
7350
7351
7352 float min_time = 1;
7353 float max_time = 3;
7354 float delay = Math.RandomFloat(min_time, max_time);
7355
7356 explode_timer.Run(delay, this, "DoAmmoExplosion");
7357 }
7358
7360 {
7361 Magazine magazine = Magazine.Cast(this);
7362 int pop_sounds_count = 6;
7363 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
7364
7365
7366 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
7367 string sound_name = pop_sounds[ sound_idx ];
7369
7370
7371 magazine.ServerAddAmmoCount(-1);
7372
7373
7374 float min_temp_to_explode = 100;
7375
7376 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
7377 {
7379 }
7380 }
7381
7382
7383 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
7384 {
7385 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
7386
7387 const int CHANCE_DAMAGE_CARGO = 4;
7388 const int CHANCE_DAMAGE_ATTACHMENT = 1;
7389 const int CHANCE_DAMAGE_NOTHING = 2;
7390
7392 {
7393 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
7394 int chances;
7395 int rnd;
7396
7397 if (GetInventory().GetCargo())
7398 {
7399 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7400 rnd = Math.RandomInt(0,chances);
7401
7402 if (rnd < CHANCE_DAMAGE_CARGO)
7403 {
7405 }
7406 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
7407 {
7409 }
7410 }
7411 else
7412 {
7413 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7414 rnd = Math.RandomInt(0,chances);
7415
7416 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
7417 {
7419 }
7420 }
7421 }
7422 }
7423
7425 {
7426 if (GetInventory().GetCargo())
7427 {
7428 int item_count = GetInventory().GetCargo().GetItemCount();
7429 if (item_count > 0)
7430 {
7431 int random_pick = Math.RandomInt(0, item_count);
7433 if (!item.IsExplosive())
7434 {
7435 item.AddHealth("","",damage);
7436 return true;
7437 }
7438 }
7439 }
7440 return false;
7441 }
7442
7444 {
7445 int attachment_count = GetInventory().AttachmentCount();
7446 if (attachment_count > 0)
7447 {
7448 int random_pick = Math.RandomInt(0, attachment_count);
7449 ItemBase attachment =
ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
7450 if (!attachment.IsExplosive())
7451 {
7452 attachment.AddHealth("","",damage);
7453 return true;
7454 }
7455 }
7456 return false;
7457 }
7458
7460 {
7462 }
7463
7465 {
7467 return GetInventory().CanRemoveEntity();
7468
7469 return false;
7470 }
7471
7473 {
7474
7476 return false;
7477
7478
7480 return false;
7481
7482
7483
7485 if (delta == 0)
7486 return false;
7487
7488
7489 return true;
7490 }
7491
7493 {
7495 {
7496 if (ScriptInputUserData.CanStoreInputUserData())
7497 {
7498 ScriptInputUserData ctx = new ScriptInputUserData;
7503 ctx.
Write(destination_entity);
7507 }
7508 }
7509 else if (!
GetGame().IsMultiplayer())
7510 {
7512 }
7513 }
7514
7516 {
7517 float split_quantity_new;
7521 InventoryLocation loc = new InventoryLocation;
7522
7523 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7524 {
7526 split_quantity_new = stack_max;
7527 else
7529
7531 {
7532 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7533 if (new_item)
7534 {
7535 new_item.SetResultOfSplit(true);
7536 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7538 new_item.
SetQuantity(split_quantity_new,
false,
true);
7539 }
7540 }
7541 }
7542 else if (destination_entity && slot_id == -1)
7543 {
7544 if (quantity > stack_max)
7545 split_quantity_new = stack_max;
7546 else
7547 split_quantity_new = quantity;
7548
7550 {
7552 {
7555 }
7556
7557 if (new_item)
7558 {
7559 new_item.SetResultOfSplit(true);
7560 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7562 new_item.
SetQuantity(split_quantity_new,
false,
true);
7563 }
7564 }
7565 }
7566 else
7567 {
7568 if (stack_max != 0)
7569 {
7571 {
7573 }
7574
7575 if (split_quantity_new == 0)
7576 {
7577 if (!
GetGame().IsMultiplayer())
7578 player.PhysicalPredictiveDropItem(this);
7579 else
7580 player.ServerDropEntity(this);
7581 return;
7582 }
7583
7585 {
7587
7588 if (new_item)
7589 {
7590 new_item.SetResultOfSplit(true);
7591 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7594 new_item.PlaceOnSurface();
7595 }
7596 }
7597 }
7598 }
7599 }
7600
7602 {
7603 float split_quantity_new;
7607 InventoryLocation loc = new InventoryLocation;
7608
7609 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7610 {
7612 split_quantity_new = stack_max;
7613 else
7615
7617 {
7618 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
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 }
7628 else if (destination_entity && slot_id == -1)
7629 {
7630 if (quantity > stack_max)
7631 split_quantity_new = stack_max;
7632 else
7633 split_quantity_new = quantity;
7634
7636 {
7638 {
7641 }
7642
7643 if (new_item)
7644 {
7645 new_item.SetResultOfSplit(true);
7646 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7648 new_item.
SetQuantity(split_quantity_new,
false,
true);
7649 }
7650 }
7651 }
7652 else
7653 {
7654 if (stack_max != 0)
7655 {
7657 {
7659 }
7660
7662 {
7664
7665 if (new_item)
7666 {
7667 new_item.SetResultOfSplit(true);
7668 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7671 new_item.PlaceOnSurface();
7672 }
7673 }
7674 }
7675 }
7676 }
7677
7679 {
7681 {
7682 if (ScriptInputUserData.CanStoreInputUserData())
7683 {
7684 ScriptInputUserData ctx = new ScriptInputUserData;
7689 dst.WriteToContext(ctx);
7691 }
7692 }
7693 else if (!
GetGame().IsMultiplayer())
7694 {
7696 }
7697 }
7698
7700 {
7702 {
7703 if (ScriptInputUserData.CanStoreInputUserData())
7704 {
7705 ScriptInputUserData ctx = new ScriptInputUserData;
7710 ctx.
Write(destination_entity);
7716 }
7717 }
7718 else if (!
GetGame().IsMultiplayer())
7719 {
7721 }
7722 }
7723
7725 {
7727 }
7728
7730 {
7732 float split_quantity_new;
7734 if (dst.IsValid())
7735 {
7736 int slot_id = dst.GetSlot();
7738
7739 if (quantity > stack_max)
7740 split_quantity_new = stack_max;
7741 else
7742 split_quantity_new = quantity;
7743
7745 {
7747
7748 if (new_item)
7749 {
7750 new_item.SetResultOfSplit(true);
7751 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7753 new_item.
SetQuantity(split_quantity_new,
false,
true);
7754 }
7755
7756 return new_item;
7757 }
7758 }
7759
7760 return null;
7761 }
7762
7764 {
7766 float split_quantity_new;
7768 if (destination_entity)
7769 {
7771 if (quantity > stackable)
7772 split_quantity_new = stackable;
7773 else
7774 split_quantity_new = quantity;
7775
7777 {
7778 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
7779 if (new_item)
7780 {
7781 new_item.SetResultOfSplit(true);
7782 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7784 new_item.
SetQuantity(split_quantity_new,
false,
true);
7785 }
7786 }
7787 }
7788 }
7789
7791 {
7793 {
7794 if (ScriptInputUserData.CanStoreInputUserData())
7795 {
7796 ScriptInputUserData ctx = new ScriptInputUserData;
7801 ItemBase destination_entity =
this;
7802 ctx.
Write(destination_entity);
7806 }
7807 }
7808 else if (!
GetGame().IsMultiplayer())
7809 {
7811 }
7812 }
7813
7815 {
7817 float split_quantity_new;
7819 if (player)
7820 {
7822 if (quantity > stackable)
7823 split_quantity_new = stackable;
7824 else
7825 split_quantity_new = quantity;
7826
7828 {
7829 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
7830 new_item =
ItemBase.Cast(in_hands);
7831 if (new_item)
7832 {
7833 new_item.SetResultOfSplit(true);
7834 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7836 new_item.SetQuantity(split_quantity_new, false, true);
7837 }
7838 }
7839 }
7840 }
7841
7843 {
7845 float split_quantity_new = Math.Floor(quantity * 0.5);
7846
7848 return;
7849
7851
7852 if (new_item)
7853 {
7854 if (new_item.GetQuantityMax() < split_quantity_new)
7855 {
7856 split_quantity_new = new_item.GetQuantityMax();
7857 }
7858
7859 new_item.SetResultOfSplit(true);
7860 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7861
7863 {
7866 }
7867 else
7868 {
7870 new_item.
SetQuantity(split_quantity_new,
false,
true);
7871 }
7872 }
7873 }
7874
7876 {
7878 float split_quantity_new = Math.Floor(quantity / 2);
7879
7881 return;
7882
7883 InventoryLocation invloc = new InventoryLocation;
7885
7887 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
7888
7889 if (new_item)
7890 {
7891 if (new_item.GetQuantityMax() < split_quantity_new)
7892 {
7893 split_quantity_new = new_item.GetQuantityMax();
7894 }
7896 {
7899 }
7900 else if (split_quantity_new > 1)
7901 {
7903 new_item.
SetQuantity(split_quantity_new,
false,
true);
7904 }
7905 }
7906 }
7907
7910 {
7911 SetWeightDirty();
7913
7914 if (parent)
7915 parent.OnAttachmentQuantityChangedEx(this, delta);
7916
7918 {
7920 {
7922 }
7924 {
7925 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
7927 }
7928 }
7929
7930 }
7931
7934 {
7935
7936 }
7937
7940 {
7942 }
7943
7945 {
7946 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
7947
7949 {
7950 if (newLevel == GameConstants.STATE_RUINED)
7951 {
7953 EntityAI parent = GetHierarchyParent();
7954 if (parent && parent.IsFireplace())
7955 {
7956 CargoBase cargo = GetInventory().GetCargo();
7957 if (cargo)
7958 {
7960 {
7962 }
7963 }
7964 }
7965 }
7966
7968 {
7969
7971 return;
7972 }
7973
7974 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
7975 {
7977 }
7978 }
7979 }
7980
7981
7983 {
7984 super.OnRightClick();
7985
7987 {
7989 {
7990 if (ScriptInputUserData.CanStoreInputUserData())
7991 {
7992 EntityAI root = GetHierarchyRoot();
7993 Man playerOwner = GetHierarchyRootPlayer();
7994 InventoryLocation dst = new InventoryLocation;
7995
7996
7997 if (!playerOwner && root && root == this)
7998 {
8000 }
8001 else
8002 {
8003
8004 GetInventory().GetCurrentInventoryLocation(dst);
8006 {
8009 {
8011 }
8012 else
8013 {
8015
8016
8017 if (
GetGame().
GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
8018 {
8020 }
8021 else
8022 {
8023 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
8024 }
8025 }
8026 }
8027 }
8028
8029 ScriptInputUserData ctx = new ScriptInputUserData;
8037 }
8038 }
8039 else if (!
GetGame().IsMultiplayer())
8040 {
8042 }
8043 }
8044 }
8045
8047 {
8048 if (root)
8049 {
8050 vector m4[4];
8051 root.GetTransform(m4);
8052 dst.SetGround(this, m4);
8053 }
8054 else
8055 {
8056 GetInventory().GetCurrentInventoryLocation(dst);
8057 }
8058 }
8059
8060 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
8061 {
8062
8063 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
8064 return false;
8065
8066 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
8067 return false;
8068
8069
8071 return false;
8072
8073
8074 Magazine mag = Magazine.Cast(this);
8075 if (mag)
8076 {
8077 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
8078 return false;
8079
8080 if (stack_max_limit)
8081 {
8082 Magazine other_mag = Magazine.Cast(other_item);
8083 if (other_item)
8084 {
8085 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
8086 return false;
8087 }
8088
8089 }
8090 }
8091 else
8092 {
8093
8095 return false;
8096
8098 return false;
8099 }
8100
8101 PlayerBase player = null;
8102 if (CastTo(player, GetHierarchyRootPlayer()))
8103 {
8104 if (player.GetInventory().HasAttachment(this))
8105 return false;
8106
8107 if (player.IsItemsToDelete())
8108 return false;
8109 }
8110
8111 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
8112 return false;
8113
8114 int slotID;
8116 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
8117 return false;
8118
8119 return true;
8120 }
8121
8123 {
8125 }
8126
8128 {
8129 return m_IsResultOfSplit;
8130 }
8131
8133 {
8134 m_IsResultOfSplit = value;
8135 }
8136
8138 {
8140 }
8141
8143 {
8144 float other_item_quantity = other_item.GetQuantity();
8145 float this_free_space;
8146
8148
8150
8151 if (other_item_quantity > this_free_space)
8152 {
8153 return this_free_space;
8154 }
8155 else
8156 {
8157 return other_item_quantity;
8158 }
8159 }
8160
8162 {
8164 }
8165
8167 {
8169 return;
8170
8171 if (!IsMagazine() && other_item)
8172 {
8174 if (quantity_used != 0)
8175 {
8176 float hp1 = GetHealth01("","");
8177 float hp2 = other_item.GetHealth01("","");
8178 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
8179 hpResult = hpResult / (
GetQuantity() + quantity_used);
8180
8181 hpResult *= GetMaxHealth();
8182 Math.Round(hpResult);
8183 SetHealth("", "Health", hpResult);
8184
8186 other_item.AddQuantity(-quantity_used);
8187 }
8188 }
8190 }
8191
8193 {
8194 #ifdef SERVER
8195 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
8196 GetHierarchyParent().IncreaseLifetimeUp();
8197 #endif
8198 };
8199
8201 {
8202 PlayerBase p = PlayerBase.Cast(player);
8203
8204 array<int> recipesIds = p.m_Recipes;
8205 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8206 if (moduleRecipesManager)
8207 {
8208 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
8209 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
8210 }
8211
8212 for (int i = 0;i < recipesIds.Count(); i++)
8213 {
8214 int key = recipesIds.Get(i);
8215 string recipeName = moduleRecipesManager.GetRecipeName(key);
8217 }
8218 }
8219
8220
8221 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
8222 {
8223 super.GetDebugActions(outputList);
8224
8225
8231
8232
8237
8242
8243
8247
8248
8250 {
8254 }
8255
8258
8259
8263
8265
8266 InventoryLocation loc = new InventoryLocation();
8267 GetInventory().GetCurrentInventoryLocation(loc);
8269 {
8270 if (Gizmo_IsSupported())
8273 }
8274
8276 }
8277
8278
8279
8280
8282 {
8283 super.OnAction(action_id, player, ctx);
8284
8286 {
8287 switch (action_id)
8288 {
8291 return true;
8294 return true;
8295 }
8296 }
8297
8299 {
8300 switch (action_id)
8301 {
8303 Delete();
8304 return true;
8305 }
8306 }
8307
8308 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
8309 {
8310 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8311 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
8312 PlayerBase p = PlayerBase.Cast(player);
8313 if (
EActions.RECIPES_RANGE_START < 1000)
8314 {
8315 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
8316 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
8317 }
8318 }
8319 #ifndef SERVER
8320 else if (action_id ==
EActions.WATCH_PLAYER)
8321 {
8322 PluginDeveloper.SetDeveloperItemClientEx(player);
8323 }
8324 #endif
8326 {
8327 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
8328 {
8329 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
8330 OnDebugButtonPressServer(id + 1);
8331 }
8332
8333 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
8334 {
8335 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
8337 }
8338
8339 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
8340 {
8341 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
8343 }
8344
8345 else if (action_id ==
EActions.ADD_QUANTITY)
8346 {
8347 if (IsMagazine())
8348 {
8349 Magazine mag = Magazine.Cast(this);
8350 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
8351 }
8352 else
8353 {
8355 }
8356
8357 if (m_EM)
8358 {
8359 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
8360 }
8361
8362 }
8363
8364 else if (action_id ==
EActions.REMOVE_QUANTITY)
8365 {
8366 if (IsMagazine())
8367 {
8368 Magazine mag2 = Magazine.Cast(this);
8369 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
8370 }
8371 else
8372 {
8374 }
8375 if (m_EM)
8376 {
8377 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
8378 }
8379
8380 }
8381
8382 else if (action_id ==
EActions.SET_QUANTITY_0)
8383 {
8385
8386 if (m_EM)
8387 {
8388 m_EM.SetEnergy(0);
8389 }
8390 }
8391
8392 else if (action_id ==
EActions.SET_MAX_QUANTITY)
8393 {
8395
8396 if (m_EM)
8397 {
8398 m_EM.SetEnergy(m_EM.GetEnergyMax());
8399 }
8400 }
8401
8402 else if (action_id ==
EActions.ADD_HEALTH)
8403 {
8404 AddHealth("","",GetMaxHealth("","Health")/5);
8405 }
8406 else if (action_id ==
EActions.REMOVE_HEALTH)
8407 {
8408 AddHealth("","",-GetMaxHealth("","Health")/5);
8409 }
8410 else if (action_id ==
EActions.DESTROY_HEALTH)
8411 {
8412 SetHealth01("","",0);
8413 }
8414 else if (action_id ==
EActions.WATCH_ITEM)
8415 {
8417 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
8418 #ifdef DEVELOPER
8419 SetDebugDeveloper_item(this);
8420 #endif
8421 }
8422
8423 else if (action_id ==
EActions.ADD_TEMPERATURE)
8424 {
8425 AddTemperature(20);
8426
8427 }
8428
8429 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
8430 {
8431 AddTemperature(-20);
8432
8433 }
8434
8435 else if (action_id ==
EActions.FLIP_FROZEN)
8436 {
8437 SetFrozen(!GetIsFrozen());
8438
8439 }
8440
8441 else if (action_id ==
EActions.ADD_WETNESS)
8442 {
8444
8445 }
8446
8447 else if (action_id ==
EActions.REMOVE_WETNESS)
8448 {
8450
8451 }
8452
8453 else if (action_id ==
EActions.LIQUIDTYPE_UP)
8454 {
8457
8458
8459 }
8460
8461 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
8462 {
8465 }
8466
8467 else if (action_id ==
EActions.MAKE_SPECIAL)
8468 {
8469 auto debugParams = DebugSpawnParams.WithPlayer(player);
8470 OnDebugSpawnEx(debugParams);
8471 }
8472
8473 }
8474
8475
8476 return false;
8477 }
8478
8479
8480
8481
8485
8488
8489
8490
8492 {
8493 return false;
8494 }
8495
8496
8498 {
8499 return true;
8500 }
8501
8502
8504 {
8505 return true;
8506 }
8507
8508
8509
8511 {
8512 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
8514 }
8515
8518 {
8519 return null;
8520 }
8521
8523 {
8524 return false;
8525 }
8526
8528 {
8529 return false;
8530 }
8531
8535
8536
8538 {
8539 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8540 return module_repairing.CanRepair(this, item_repair_kit);
8541 }
8542
8543
8544 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
8545 {
8546 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8547 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
8548 }
8549
8550
8552 {
8553
8554
8555
8556
8557
8558
8559
8560
8561 return 1;
8562 }
8563
8564
8565
8567 {
8569 }
8570
8571
8572
8574 {
8576 }
8577
8578
8587 {
8588 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8589
8590 if (player)
8591 {
8592 player.MessageStatus(text);
8593 }
8594 }
8595
8596
8605 {
8606 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8607
8608 if (player)
8609 {
8610 player.MessageAction(text);
8611 }
8612 }
8613
8614
8623 {
8624 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8625
8626 if (player)
8627 {
8628 player.MessageFriendly(text);
8629 }
8630 }
8631
8632
8641 {
8642 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8643
8644 if (player)
8645 {
8646 player.MessageImportant(text);
8647 }
8648 }
8649
8651 {
8652 return true;
8653 }
8654
8655
8656 override bool KindOf(
string tag)
8657 {
8658 bool found = false;
8659 string item_name = this.
GetType();
8662
8663 int array_size = item_tag_array.Count();
8664 for (int i = 0; i < array_size; i++)
8665 {
8666 if (item_tag_array.Get(i) == tag)
8667 {
8668 found = true;
8669 break;
8670 }
8671 }
8672 return found;
8673 }
8674
8675
8677 {
8678
8679 super.OnRPC(sender, rpc_type,ctx);
8680
8681
8682 switch (rpc_type)
8683 {
8684 #ifndef SERVER
8685 case ERPCs.RPC_SOUND_LOCK_ATTACH:
8686 Param2<bool, string> p = new Param2<bool, string>(false, "");
8687
8689 return;
8690
8691 bool play = p.param1;
8692 string soundSet = p.param2;
8693
8694 if (play)
8695 {
8697 {
8699 {
8701 }
8702 }
8703 else
8704 {
8706 }
8707 }
8708 else
8709 {
8711 }
8712
8713 break;
8714 #endif
8715
8716 }
8717
8719 {
8721 }
8722 }
8723
8724
8725
8726
8728 {
8729 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8730 return plugin.GetID(
name);
8731 }
8732
8734 {
8735 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8736 return plugin.GetName(id);
8737 }
8738
8741 {
8742
8743
8744 int varFlags;
8745 if (!ctx.
Read(varFlags))
8746 return;
8747
8748 if (varFlags & ItemVariableFlags.FLOAT)
8749 {
8751 }
8752 }
8753
8755 {
8756
8757 super.SerializeNumericalVars(floats_out);
8758
8759
8760
8762 {
8764 }
8765
8767 {
8769 }
8770
8772 {
8774 }
8775
8777 {
8782 }
8783
8785 {
8787 }
8788 }
8789
8791 {
8792
8793 super.DeSerializeNumericalVars(floats);
8794
8795
8796 int index = 0;
8797 int mask = Math.Round(floats.Get(index));
8798
8799 index++;
8800
8802 {
8804 {
8806 }
8807 else
8808 {
8809 float quantity = floats.Get(index);
8811 }
8812 index++;
8813 }
8814
8816 {
8817 float wet = floats.Get(index);
8819 index++;
8820 }
8821
8823 {
8824 int liquidtype = Math.Round(floats.Get(index));
8826 index++;
8827 }
8828
8830 {
8832 index++;
8834 index++;
8836 index++;
8838 index++;
8839 }
8840
8842 {
8843 int cleanness = Math.Round(floats.Get(index));
8845 index++;
8846 }
8847 }
8848
8850 {
8851 super.WriteVarsToCTX(ctx);
8852
8853
8855 {
8857 }
8858
8860 {
8862 }
8863
8865 {
8867 }
8868
8870 {
8871 int r,g,b,a;
8877 }
8878
8880 {
8882 }
8883 }
8884
8886 {
8887 if (!super.ReadVarsFromCTX(ctx,version))
8888 return false;
8889
8890 int intValue;
8891 float value;
8892
8893 if (version < 140)
8894 {
8895 if (!ctx.
Read(intValue))
8896 return false;
8897
8898 m_VariablesMask = intValue;
8899 }
8900
8902 {
8903 if (!ctx.
Read(value))
8904 return false;
8905
8907 {
8909 }
8910 else
8911 {
8913 }
8914 }
8915
8916 if (version < 140)
8917 {
8919 {
8920 if (!ctx.
Read(value))
8921 return false;
8922 SetTemperatureDirect(value);
8923 }
8924 }
8925
8927 {
8928 if (!ctx.
Read(value))
8929 return false;
8931 }
8932
8934 {
8935 if (!ctx.
Read(intValue))
8936 return false;
8938 }
8939
8941 {
8942 int r,g,b,a;
8944 return false;
8946 return false;
8948 return false;
8950 return false;
8951
8953 }
8954
8956 {
8957 if (!ctx.
Read(intValue))
8958 return false;
8960 }
8961
8962 if (version >= 138 && version < 140)
8963 {
8965 {
8966 if (!ctx.
Read(intValue))
8967 return false;
8968 SetFrozen(intValue);
8969 }
8970 }
8971
8972 return true;
8973 }
8974
8975
8977 {
8980 {
8982 }
8983
8984 if (!super.OnStoreLoad(ctx, version))
8985 {
8987 return false;
8988 }
8989
8990 if (version >= 114)
8991 {
8992 bool hasQuickBarIndexSaved;
8993
8994 if (!ctx.
Read(hasQuickBarIndexSaved))
8995 {
8997 return false;
8998 }
8999
9000 if (hasQuickBarIndexSaved)
9001 {
9002 int itmQBIndex;
9003
9004
9005 if (!ctx.
Read(itmQBIndex))
9006 {
9008 return false;
9009 }
9010
9011 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
9012 if (itmQBIndex != -1 && parentPlayer)
9013 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
9014 }
9015 }
9016 else
9017 {
9018
9019 PlayerBase player;
9020 int itemQBIndex;
9021 if (version ==
int.
MAX)
9022 {
9023 if (!ctx.
Read(itemQBIndex))
9024 {
9026 return false;
9027 }
9028 }
9029 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
9030 {
9031
9032 if (!ctx.
Read(itemQBIndex))
9033 {
9035 return false;
9036 }
9037 if (itemQBIndex != -1 && player)
9038 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
9039 }
9040 }
9041
9042 if (version < 140)
9043 {
9044
9045 if (!LoadVariables(ctx, version))
9046 {
9048 return false;
9049 }
9050 }
9051
9052
9054 {
9056 return false;
9057 }
9058 if (version >= 132)
9059 {
9061 if (raib)
9062 {
9064 {
9066 return false;
9067 }
9068 }
9069 }
9070
9072 return true;
9073 }
9074
9075
9076
9078 {
9079 super.OnStoreSave(ctx);
9080
9081 PlayerBase player;
9082 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
9083 {
9085
9086 int itemQBIndex = -1;
9087 itemQBIndex = player.FindQuickBarEntityIndex(this);
9088 ctx.
Write(itemQBIndex);
9089 }
9090 else
9091 {
9093 }
9094
9096
9098 if (raib)
9099 {
9101 }
9102 }
9103
9104
9106 {
9107 super.AfterStoreLoad();
9108
9110 {
9112 }
9113
9115 {
9118 }
9119 }
9120
9122 {
9123 super.EEOnAfterLoad();
9124
9126 {
9128 }
9129
9132 }
9133
9135 {
9136 return false;
9137 }
9138
9139
9140
9142 {
9144 {
9145 #ifdef PLATFORM_CONSOLE
9146
9148 {
9150 if (menu)
9151 {
9153 }
9154 }
9155 #endif
9156 }
9157
9159 {
9162 }
9163
9165 {
9166 SetWeightDirty();
9168 }
9170 {
9173 }
9174
9176 {
9179 }
9181 {
9184 }
9185
9186 super.OnVariablesSynchronized();
9187 }
9188
9189
9190
9192 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
9193 {
9194 if (!IsServerCheck(allow_client))
9195 return false;
9196
9198 return false;
9199
9202
9203 if (value <= (min + 0.001))
9204 value = min;
9205
9206 if (value == min)
9207 {
9208 if (destroy_config)
9209 {
9210 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
9211 if (dstr)
9212 {
9214 this.Delete();
9215 return true;
9216 }
9217 }
9218 else if (destroy_forced)
9219 {
9221 this.Delete();
9222 return true;
9223 }
9224
9226 }
9227
9230
9232 {
9234
9235 if (delta)
9237 }
9238
9240
9241 return false;
9242 }
9243
9244
9246 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9247 {
9249 }
9250
9252 {
9255 }
9256
9258 {
9261 }
9262
9264 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9265 {
9266 float value_clamped = Math.Clamp(value, 0, 1);
9268 SetQuantity(result, destroy_config, destroy_forced);
9269 }
9270
9271
9274 {
9276 }
9277
9279 {
9281 }
9282
9283
9284
9285
9286
9287
9288
9289
9290
9291
9293 {
9294 int slot = -1;
9295 if (GetInventory())
9296 {
9297 InventoryLocation il = new InventoryLocation;
9298 GetInventory().GetCurrentInventoryLocation(il);
9300 }
9301
9303 }
9304
9306 {
9307 float quantity_max = 0;
9308
9310 {
9311 if (attSlotID != -1)
9312 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
9313
9314 if (quantity_max <= 0)
9316 }
9317
9318 if (quantity_max <= 0)
9320
9321 return quantity_max;
9322 }
9323
9325 {
9327 }
9328
9330 {
9332 }
9333
9334
9336 {
9338 }
9339
9341 {
9343 }
9344
9346 {
9348 }
9349
9350
9352 {
9353
9354 float weightEx = GetWeightEx();
9355 float special = GetInventoryAndCargoWeight();
9356 return weightEx - special;
9357 }
9358
9359
9361 {
9363 }
9364
9366 {
9368 {
9369 #ifdef DEVELOPER
9370 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9371 {
9372 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
9374 }
9375 #endif
9376
9378 }
9379 else if (HasEnergyManager())
9380 {
9381 #ifdef DEVELOPER
9382 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9383 {
9384 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
9385 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
9386 }
9387 #endif
9388 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
9389 }
9390 else
9391 {
9392 #ifdef DEVELOPER
9393 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9394 {
9395 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
9396 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
9397 }
9398 #endif
9399 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
9400 }
9401 }
9402
9405 {
9406 int item_count = 0;
9408
9409 if (GetInventory().GetCargo() != NULL)
9410 {
9411 item_count = GetInventory().GetCargo().GetItemCount();
9412 }
9413
9414 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
9415 {
9416 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
9417 if (item)
9418 item_count += item.GetNumberOfItems();
9419 }
9420 return item_count;
9421 }
9422
9425 {
9426 float weight = 0;
9427 float wetness = 1;
9428 if (include_wetness)
9431 {
9432 weight = wetness * m_ConfigWeight;
9433 }
9435 {
9436 weight = 1;
9437 }
9438 return weight;
9439 }
9440
9441
9442
9444 {
9445 if ((
GetGame().IsServer() || !
GetGame().IsMultiplayer()) && GetInventory())
9446 {
9447 GameInventory inv = GetInventory();
9448 array<EntityAI> items = new array<EntityAI>;
9450 for (int i = 0; i < items.Count(); i++)
9451 {
9453 if (item)
9454 {
9456 }
9457 }
9458 }
9459 }
9460
9461
9462
9463
9465 {
9466 float energy = 0;
9467 if (HasEnergyManager())
9468 {
9469 energy = GetCompEM().GetEnergy();
9470 }
9471 return energy;
9472 }
9473
9474
9476 {
9477 super.OnEnergyConsumed();
9478
9480 }
9481
9483 {
9484 super.OnEnergyAdded();
9485
9487 }
9488
9489
9491 {
9492 if (
GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
9493 {
9495 {
9496 float energy_0to1 = GetCompEM().GetEnergy0To1();
9498 }
9499 }
9500 }
9501
9502
9504 {
9505 return ConfigGetFloat("heatIsolation");
9506 }
9507
9509 {
9511 }
9512
9514 {
9515 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
9516 if (
GetGame().ConfigIsExisting(paramPath))
9518
9519 return 0.0;
9520 }
9521
9523 {
9524 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
9525 if (
GetGame().ConfigIsExisting(paramPath))
9527
9528 return 0.0;
9529 }
9530
9531 override void SetWet(
float value,
bool allow_client =
false)
9532 {
9533 if (!IsServerCheck(allow_client))
9534 return;
9535
9538
9540
9541 m_VarWet = Math.Clamp(value, min, max);
9542
9544 {
9547 }
9548 }
9549
9550 override void AddWet(
float value)
9551 {
9553 }
9554
9556 {
9558 }
9559
9561 {
9563 }
9564
9566 {
9568 }
9569
9571 {
9573 }
9574
9576 {
9578 }
9579
9581 {
9584 if (newLevel != oldLevel)
9585 {
9587 }
9588 }
9589
9591 {
9592 SetWeightDirty();
9593 }
9594
9596 {
9597 return GetWetLevelInternal(
m_VarWet);
9598 }
9599
9600
9601
9603 {
9605 }
9606
9608 {
9610 }
9611
9613 {
9615 }
9616
9618 {
9620 }
9621
9622
9623
9625 {
9626 if (ConfigIsExisting("itemModelLength"))
9627 {
9628 return ConfigGetFloat("itemModelLength");
9629 }
9630 return 0;
9631 }
9632
9634 {
9635 if (ConfigIsExisting("itemAttachOffset"))
9636 {
9637 return ConfigGetFloat("itemAttachOffset");
9638 }
9639 return 0;
9640 }
9641
9642 override void SetCleanness(
int value,
bool allow_client =
false)
9643 {
9644 if (!IsServerCheck(allow_client))
9645 return;
9646
9648
9650
9653 }
9654
9656 {
9658 }
9659
9661 {
9662 return true;
9663 }
9664
9665
9666
9667
9669 {
9671 }
9672
9674 {
9676 }
9677
9678
9679
9680
9681 override void SetColor(
int r,
int g,
int b,
int a)
9682 {
9688 }
9690 override void GetColor(out
int r,out
int g,out
int b,out
int a)
9691 {
9696 }
9697
9699 {
9701 }
9702
9705 {
9706 int r,g,b,a;
9708 r = r/255;
9709 g = g/255;
9710 b = b/255;
9711 a = a/255;
9712 return MiscGameplayFunctions.GetColorString(r, g, b, a);
9713 }
9714
9715
9716
9717 override void SetLiquidType(
int value,
bool allow_client =
false)
9718 {
9719 if (!IsServerCheck(allow_client))
9720 return;
9721
9726 }
9727
9729 {
9730 return ConfigGetInt("varLiquidTypeInit");
9731 }
9732
9734 {
9736 }
9737
9739 {
9741 SetFrozen(false);
9742 }
9743
9746 {
9747 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9748 }
9749
9750
9753 {
9754 PlayerBase nplayer;
9755 if (PlayerBase.CastTo(nplayer, player))
9756 {
9758
9759 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9760 }
9761 }
9762
9763
9766 {
9767 PlayerBase nplayer;
9768 if (PlayerBase.CastTo(nplayer,player))
9769 {
9770
9771 nplayer.SetEnableQuickBarEntityShortcut(this,false);
9772
9773 }
9774
9775
9776 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
9777
9778
9779 if (HasEnergyManager())
9780 {
9781 GetCompEM().UpdatePlugState();
9782 }
9783 }
9784
9785
9787 {
9788 super.OnPlacementStarted(player);
9789
9791 }
9792
9793 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
9794 {
9796 {
9797 m_AdminLog.OnPlacementComplete(player,
this);
9798 }
9799
9800 super.OnPlacementComplete(player, position, orientation);
9801 }
9802
9803
9804
9805
9806
9808 {
9810 {
9811 return true;
9812 }
9813 else
9814 {
9815 return false;
9816 }
9817 }
9818
9819
9821 {
9823 {
9825 }
9826 }
9827
9828
9830 {
9832 }
9833
9835 {
9837 }
9838
9839 override void InsertAgent(
int agent,
float count = 1)
9840 {
9841 if (count < 1)
9842 return;
9843
9845 }
9846
9849 {
9851 }
9852
9853
9855 {
9857 }
9858
9859
9860
9861
9862
9863
9864
9865
9866
9867
9868
9869
9870
9871
9872
9873
9874
9875
9876
9877
9878
9879
9880
9881
9882
9883
9884
9885
9886
9887
9888
9889
9890
9891
9892
9893
9894
9895
9896
9897
9898
9899
9901 {
9903 return false;
9904 return true;
9905 }
9906
9908 {
9909
9911 }
9912
9913
9916 {
9917 super.CheckForRoofLimited(timeTresholdMS);
9918
9920 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
9921 {
9922 m_PreviousRoofTestTime = time;
9923 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
9924 }
9925 }
9926
9927
9929 {
9931 {
9932 return 0;
9933 }
9934
9935 if (GetInventory().GetAttachmentSlotsCount() != 0)
9936 {
9937 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
9938 if (filter)
9939 return filter.GetProtectionLevel(type, false, system);
9940 else
9941 return 0;
9942 }
9943
9944 string subclassPath, entryName;
9945
9946 switch (type)
9947 {
9949 entryName = "biological";
9950 break;
9952 entryName = "chemical";
9953 break;
9954 default:
9955 entryName = "biological";
9956 break;
9957 }
9958
9959 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
9960
9962 }
9963
9964
9965
9968 {
9969 if (!IsMagazine())
9971
9973 }
9974
9975
9976
9977
9978
9983 {
9984 return true;
9985 }
9986
9988 {
9990 }
9991
9992
9993
9994
9995
9997 {
9998 if (parent)
9999 {
10000 if (parent.IsInherited(DayZInfected))
10001 return true;
10002
10003 if (!parent.IsRuined())
10004 return true;
10005 }
10006
10007 return true;
10008 }
10009
10011 {
10012 if (!super.CanPutAsAttachment(parent))
10013 {
10014 return false;
10015 }
10016
10017 if (!IsRuined() && !parent.IsRuined())
10018 {
10019 return true;
10020 }
10021
10022 return false;
10023 }
10024
10026 {
10027
10028
10029
10030
10031 return super.CanReceiveItemIntoCargo(item);
10032 }
10033
10035 {
10036
10037
10038
10039
10040 GameInventory attachmentInv = attachment.GetInventory();
10042 {
10043 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
10044 return false;
10045 }
10046
10047 InventoryLocation loc = new InventoryLocation();
10048 attachment.GetInventory().GetCurrentInventoryLocation(loc);
10049 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
10050 return false;
10051
10052 return super.CanReceiveAttachment(attachment, slotId);
10053 }
10054
10056 {
10057 if (!super.CanReleaseAttachment(attachment))
10058 return false;
10059
10060 return GetInventory().AreChildrenAccessible();
10061 }
10062
10063
10064
10065
10066
10067
10068
10069
10070
10071
10072
10073
10074
10075
10076
10077
10078
10079
10080
10081
10082
10084 {
10085 int id = muzzle_owner.GetMuzzleID();
10086 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
10087
10088 if (WPOF_array)
10089 {
10090 for (int i = 0; i < WPOF_array.Count(); i++)
10091 {
10092 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
10093
10094 if (WPOF)
10095 {
10096 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
10097 }
10098 }
10099 }
10100 }
10101
10102
10104 {
10105 int id = muzzle_owner.GetMuzzleID();
10107
10108 if (WPOBE_array)
10109 {
10110 for (int i = 0; i < WPOBE_array.Count(); i++)
10111 {
10112 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
10113
10114 if (WPOBE)
10115 {
10116 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10117 }
10118 }
10119 }
10120 }
10121
10122
10124 {
10125 int id = muzzle_owner.GetMuzzleID();
10126 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10127
10128 if (WPOOH_array)
10129 {
10130 for (int i = 0; i < WPOOH_array.Count(); i++)
10131 {
10132 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10133
10134 if (WPOOH)
10135 {
10136 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10137 }
10138 }
10139 }
10140 }
10141
10142
10144 {
10145 int id = muzzle_owner.GetMuzzleID();
10146 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10147
10148 if (WPOOH_array)
10149 {
10150 for (int i = 0; i < WPOOH_array.Count(); i++)
10151 {
10152 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10153
10154 if (WPOOH)
10155 {
10156 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10157 }
10158 }
10159 }
10160 }
10161
10162
10164 {
10165 int id = muzzle_owner.GetMuzzleID();
10166 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10167
10168 if (WPOOH_array)
10169 {
10170 for (int i = 0; i < WPOOH_array.Count(); i++)
10171 {
10172 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10173
10174 if (WPOOH)
10175 {
10176 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10177 }
10178 }
10179 }
10180 }
10181
10182
10183
10185 {
10187 {
10188 return true;
10189 }
10190
10191 return false;
10192 }
10193
10195 {
10197 {
10198 return true;
10199 }
10200
10201 return false;
10202 }
10203
10205 {
10207 {
10208 return true;
10209 }
10210
10211 return false;
10212 }
10213
10215 {
10216 return false;
10217 }
10218
10221 {
10222 return UATimeSpent.DEFAULT_DEPLOY;
10223 }
10224
10225
10226
10227
10229 {
10231 SetSynchDirty();
10232 }
10233
10235 {
10237 }
10238
10239
10241 {
10242 return false;
10243 }
10244
10247 {
10248 string att_type = "None";
10249
10250 if (ConfigIsExisting("soundAttType"))
10251 {
10252 att_type = ConfigGetString("soundAttType");
10253 }
10254
10256 }
10257
10259 {
10261 }
10262
10263
10264
10265
10266
10272
10274 {
10277
10279 }
10280
10281
10283 {
10285 return;
10286
10288
10291
10294
10295 SoundParameters params = new SoundParameters();
10299 }
10300
10301
10303 {
10305 return;
10306
10308 SetSynchDirty();
10309
10312 }
10313
10314
10316 {
10318 return;
10319
10321 SetSynchDirty();
10322
10325 }
10326
10328 {
10330 }
10331
10333 {
10335 }
10336
10339 {
10340 if (!
GetGame().IsDedicatedServer())
10341 {
10342 if (ConfigIsExisting("attachSoundSet"))
10343 {
10344 string cfg_path = "";
10345 string soundset = "";
10346 string type_name =
GetType();
10347
10350 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
10351 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
10352
10353 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
10354 {
10355 for (int i = 0; i < cfg_soundset_array.Count(); i++)
10356 {
10357 if (cfg_slot_array[i] == slot_type)
10358 {
10359 soundset = cfg_soundset_array[i];
10360 break;
10361 }
10362 }
10363 }
10364
10365 if (soundset != "")
10366 {
10367 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
10369 }
10370 }
10371 }
10372 }
10373
10375 {
10376
10377 }
10378
10379 void OnApply(PlayerBase player);
10380
10382 {
10383 return 1.0;
10384 };
10385
10387 {
10389 }
10390
10392 {
10394 }
10395
10397
10399 {
10400 SetDynamicPhysicsLifeTime(0.01);
10402 }
10403
10405 {
10406 array<string> zone_names = new array<string>;
10407 GetDamageZones(zone_names);
10408 for (int i = 0; i < zone_names.Count(); i++)
10409 {
10410 SetHealthMax(zone_names.Get(i),"Health");
10411 }
10412 SetHealthMax("","Health");
10413 }
10414
10417 {
10418 float global_health = GetHealth01("","Health");
10419 array<string> zones = new array<string>;
10420 GetDamageZones(zones);
10421
10422 for (int i = 0; i < zones.Count(); i++)
10423 {
10424 SetHealth01(zones.Get(i),"Health",global_health);
10425 }
10426 }
10427
10430 {
10431 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
10432 }
10433
10435 {
10436 if (!hasRootAsPlayer)
10437 {
10438 if (refParentIB)
10439 {
10440
10441 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
10442 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
10443
10444 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
10445 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
10446
10449 }
10450 else
10451 {
10452
10455 }
10456 }
10457 }
10458
10460 {
10462 {
10463 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
10464 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
10465 {
10466 float heatPermCoef = 1.0;
10468 while (ent)
10469 {
10470 heatPermCoef *= ent.GetHeatPermeabilityCoef();
10471 ent = ent.GetHierarchyParent();
10472 }
10473
10474 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
10475 }
10476 }
10477 }
10478
10480 {
10481
10482 EntityAI parent = GetHierarchyParent();
10483 if (!parent)
10484 {
10485 hasParent = false;
10486 hasRootAsPlayer = false;
10487 }
10488 else
10489 {
10490 hasParent = true;
10491 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
10492 refParentIB =
ItemBase.Cast(parent);
10493 }
10494 }
10495
10496 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
10497 {
10498
10499 }
10500
10502 {
10503
10504 return false;
10505 }
10506
10508 {
10509
10510
10511 return false;
10512 }
10513
10515 {
10516
10517 return false;
10518 }
10519
10522 {
10523 return !GetIsFrozen() &&
IsOpen();
10524 }
10525
10527 {
10528 bool hasParent = false, hasRootAsPlayer = false;
10530
10531 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
10532 bool foodDecay =
g_Game.IsFoodDecayEnabled();
10533
10534 if (wwtu || foodDecay)
10535 {
10539
10540 if (processWetness || processTemperature || processDecay)
10541 {
10543
10544 if (processWetness)
10545 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
10546
10547 if (processTemperature)
10549
10550 if (processDecay)
10551 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
10552 }
10553 }
10554 }
10555
10558 {
10560 }
10561
10563 {
10566
10567 return super.GetTemperatureFreezeThreshold();
10568 }
10569
10571 {
10574
10575 return super.GetTemperatureThawThreshold();
10576 }
10577
10579 {
10582
10583 return super.GetItemOverheatThreshold();
10584 }
10585
10587 {
10589 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
10590
10591 return super.GetTemperatureFreezeTime();
10592 }
10593
10595 {
10597 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
10598
10599 return super.GetTemperatureThawTime();
10600 }
10601
10606
10608 {
10609 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
10610 }
10611
10613 {
10614 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
10615 }
10616
10619 {
10621 }
10622
10624 {
10626 }
10627
10629 {
10631 }
10632
10635 {
10636 return null;
10637 }
10638
10641 {
10642 return false;
10643 }
10644
10646 {
10648 {
10651 if (!trg)
10652 {
10654 explosive = this;
10655 }
10656
10657 explosive.PairRemote(trg);
10659
10660 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
10661 trg.SetPersistentPairID(persistentID);
10662 explosive.SetPersistentPairID(persistentID);
10663
10664 return true;
10665 }
10666 return false;
10667 }
10668
10671 {
10672 float ret = 1.0;
10675 ret *= GetHealth01();
10676
10677 return ret;
10678 }
10679
10680 #ifdef DEVELOPER
10681 override void SetDebugItem()
10682 {
10683 super.SetDebugItem();
10684 _itemBase = this;
10685 }
10686
10688 {
10689 string text = super.GetDebugText();
10690
10692 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
10693
10694 return text;
10695 }
10696 #endif
10697
10699 {
10700 return true;
10701 }
10702
10704
10706
10708 {
10711 }
10712
10713
10721
10737}
10738
10740{
10742 if (entity)
10743 {
10744 bool is_item = entity.IsInherited(
ItemBase);
10745 if (is_item && full_quantity)
10746 {
10749 }
10750 }
10751 else
10752 {
10754 return NULL;
10755 }
10756 return entity;
10757}
10758
10760{
10761 if (item)
10762 {
10763 if (health > 0)
10764 item.SetHealth("", "", health);
10765
10766 if (item.CanHaveTemperature())
10767 {
10769 if (item.CanFreeze())
10770 item.SetFrozen(false);
10771 }
10772
10773 if (item.HasEnergyManager())
10774 {
10775 if (quantity >= 0)
10776 {
10777 item.GetCompEM().SetEnergy0To1(quantity);
10778 }
10779 else
10780 {
10782 }
10783 }
10784 else if (item.IsMagazine())
10785 {
10786 Magazine mag = Magazine.Cast(item);
10787 if (quantity >= 0)
10788 {
10789 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
10790 }
10791 else
10792 {
10794 }
10795
10796 }
10797 else
10798 {
10799 if (quantity >= 0)
10800 {
10801 item.SetQuantityNormalized(quantity, false);
10802 }
10803 else
10804 {
10806 }
10807
10808 }
10809 }
10810}
10811
10812#ifdef DEVELOPER
10814#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.