5957{
5959 {
5960 return true;
5961 }
5962};
5963
5965{
5966
5967};
5968
5969
5970
5972{
5976
5978
5981
5982
5983
5984
5985
5994
6000
6005
6010
6031 protected bool m_IsResultOfSplit
6032
6034
6039
6040
6041
6043
6047
6048
6049
6051
6054
6055
6056
6062
6063
6071
6074
6075
6077
6078
6080
6081
6086
6087
6092
6094
6095
6097
6098
6100 {
6105
6106 if (!
g_Game.IsDedicatedServer())
6107 {
6109 {
6111
6113 {
6115 }
6116 }
6117
6120 }
6121
6122 m_OldLocation = null;
6123
6125 {
6127 }
6128
6129 if (ConfigIsExisting("headSelectionsToHide"))
6130 {
6133 }
6134
6136 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
6137 {
6139 }
6140
6142
6143 m_IsResultOfSplit = false;
6144
6146 }
6147
6149 {
6150 super.InitItemVariables();
6151
6157 m_Count = ConfigGetInt(
"count");
6158
6161
6166
6169
6174
6186
6190
6191
6194 if (ConfigIsExisting("canBeSplit"))
6195 {
6198 }
6199
6201 if (ConfigIsExisting("itemBehaviour"))
6203
6204
6207 RegisterNetSyncVariableInt("m_VarLiquidType");
6208 RegisterNetSyncVariableInt("m_Cleanness",0,1);
6209
6210 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
6211 RegisterNetSyncVariableFloat("m_ImpactSpeed");
6212 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
6213
6214 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
6215 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
6216 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
6217 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
6218
6219 RegisterNetSyncVariableBool("m_IsBeingPlaced");
6220 RegisterNetSyncVariableBool("m_IsTakeable");
6221 RegisterNetSyncVariableBool("m_IsHologram");
6222
6225 {
6228 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
6229 }
6230
6232
6234 if (ConfigIsExisting("temperaturePerQuantityWeight"))
6236
6238 }
6239
6241 {
6243 }
6244
6246 {
6249 {
6254 }
6255 }
6256
6257 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
6258 {
6260 {
6263 }
6264
6266 }
6267
6269 {
6275 }
6276
6278
6280 {
6282
6283 if (!action)
6284 {
6285 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
6286 return;
6287 }
6288
6290 if (!ai)
6291 {
6293 return;
6294 }
6295
6297 if (!action_array)
6298 {
6299 action_array = new array<ActionBase_Basic>;
6301 }
6302 if (LogManager.IsActionLogEnable())
6303 {
6304 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
6305 }
6306
6307 if (action_array.Find(action) != -1)
6308 {
6309 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
6310 }
6311 else
6312 {
6313 action_array.Insert(action);
6314 }
6315 }
6316
6318 {
6319 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6320 ActionBase action = player.GetActionManager().GetAction(actionName);
6323
6324 if (action_array)
6325 {
6326 action_array.RemoveItem(action);
6327 }
6328 }
6329
6330
6331
6333 {
6334 ActionOverrideData overrideData = new ActionOverrideData();
6338
6340 if (!actionMap)
6341 {
6344 }
6345
6346 actionMap.Insert(this.
Type(), overrideData);
6347
6348 }
6349
6351
6353
6354
6356 {
6359
6362
6363 string config_to_search = "CfgVehicles";
6364 string muzzle_owner_config;
6365
6367 {
6368 if (IsInherited(Weapon))
6369 config_to_search = "CfgWeapons";
6370
6371 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6372
6373 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
6374
6375 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
6376
6377 if (config_OnFire_subclass_count > 0)
6378 {
6379 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
6380
6381 for (int i = 0; i < config_OnFire_subclass_count; i++)
6382 {
6383 string particle_class = "";
6384 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
6385 string config_OnFire_entry = config_OnFire_class + particle_class;
6386 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
6387 WPOF_array.Insert(WPOF);
6388 }
6389
6390
6392 }
6393 }
6394
6396 {
6397 config_to_search = "CfgWeapons";
6398 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6399
6400 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
6401
6402 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
6403
6404 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
6405 {
6406 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
6407
6408 for (i = 0; i < config_OnBulletCasingEject_count; i++)
6409 {
6410 string particle_class2 = "";
6411 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
6412 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
6413 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
6414 WPOBE_array.Insert(WPOBE);
6415 }
6416
6417
6419 }
6420 }
6421 }
6422
6423
6425 {
6428
6430 {
6431 string config_to_search = "CfgVehicles";
6432
6433 if (IsInherited(Weapon))
6434 config_to_search = "CfgWeapons";
6435
6436 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6437 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
6438
6439 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
6440 {
6441
6443
6445 {
6447 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
6449 return;
6450 }
6451
6454
6455
6456
6457 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
6458 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
6459
6460 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
6461 {
6462 string particle_class = "";
6463 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
6464 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
6465 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
6466
6467 if (entry_type == CT_CLASS)
6468 {
6469 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
6470 WPOOH_array.Insert(WPOF);
6471 }
6472 }
6473
6474
6476 }
6477 }
6478 }
6479
6481 {
6483 }
6484
6486 {
6488 {
6490
6493
6496
6497 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6498 }
6499 }
6500
6502 {
6504 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6505
6507 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6508
6510 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6511
6513 {
6515 }
6516 }
6517
6519 {
6521 }
6522
6524 {
6527 else
6529
6531 {
6534 }
6535 else
6536 {
6539
6542 }
6543
6545 }
6546
6548 {
6550 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6551 }
6552
6554 {
6556 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6558 }
6559
6561 {
6563 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6564 }
6565
6567 {
6570
6571 OverheatingParticle OP = new OverheatingParticle();
6576
6578 }
6579
6581 {
6584
6585 return -1;
6586 }
6587
6589 {
6591 {
6594
6595 for (int i = count; i > 0; --i)
6596 {
6597 int id = i - 1;
6600
6603
6604 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
6605 {
6606 if (p)
6607 {
6610 }
6611 }
6612 }
6613 }
6614 }
6615
6617 {
6619 {
6621 {
6622 int id = i - 1;
6624
6625 if (OP)
6626 {
6628
6629 if (p)
6630 {
6632 }
6633
6634 delete OP;
6635 }
6636 }
6637
6640 }
6641 }
6642
6645 {
6646 return 0.0;
6647 }
6648
6649
6651 {
6652 return 250;
6653 }
6654
6656 {
6657 return 0;
6658 }
6659
6662 {
6664 return true;
6665
6666 return false;
6667 }
6668
6671 {
6674
6676 {
6678 }
6679 else
6680 {
6681
6683 }
6684
6686 }
6687
6694 {
6695 return -1;
6696 }
6697
6698
6699
6700
6702 {
6704 {
6705 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6706 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6707
6708 if (r_index >= 0)
6709 {
6710 InventoryLocation r_il = new InventoryLocation;
6711 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6712
6713 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6716 {
6717 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6718 }
6720 {
6721 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6722 }
6723
6724 }
6725
6726 player.GetHumanInventory().ClearUserReservedLocation(this);
6727 }
6728
6731 }
6732
6733
6734
6735
6737 {
6738 return ItemBase.m_DebugActionsMask;
6739 }
6740
6742 {
6743 return ItemBase.m_DebugActionsMask & mask;
6744 }
6745
6747 {
6748 ItemBase.m_DebugActionsMask = mask;
6749 }
6750
6752 {
6753 ItemBase.m_DebugActionsMask |= mask;
6754 }
6755
6757 {
6758 ItemBase.m_DebugActionsMask &= ~mask;
6759 }
6760
6762 {
6764 {
6766 }
6767 else
6768 {
6770 }
6771 }
6772
6773
6775 {
6776 if (GetEconomyProfile())
6777 {
6778 float q_max = GetEconomyProfile().GetQuantityMax();
6779 if (q_max > 0)
6780 {
6781 float q_min = GetEconomyProfile().GetQuantityMin();
6782 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
6783
6785 {
6786 ComponentEnergyManager comp = GetCompEM();
6788 {
6790 }
6791 }
6793 {
6795
6796 }
6797
6798 }
6799 }
6800 }
6801
6804 {
6805 EntityAI parent = GetHierarchyParent();
6806
6807 if (parent)
6808 {
6809 InventoryLocation inventory_location_to_lock = new InventoryLocation;
6810 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
6811 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
6812 }
6813 }
6814
6817 {
6818 EntityAI parent = GetHierarchyParent();
6819
6820 if (parent)
6821 {
6822 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
6823 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
6824 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
6825 }
6826 }
6827
6829 {
6830
6831
6832
6833
6835
6837 {
6838 if (ScriptInputUserData.CanStoreInputUserData())
6839 {
6840 ScriptInputUserData ctx = new ScriptInputUserData;
6846 ctx.
Write(use_stack_max);
6849
6851 {
6852 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
6853 }
6854 }
6855 }
6856 else if (!
g_Game.IsMultiplayer())
6857 {
6859 }
6860 }
6861
6863 {
6865 }
6866
6868 {
6870 }
6871
6873 {
6875 }
6876
6878 {
6879
6880 return false;
6881 }
6882
6884 {
6885 return false;
6886 }
6887
6891 {
6892 return false;
6893 }
6894
6896 {
6897 return "";
6898 }
6899
6901
6903 {
6904 return false;
6905 }
6906
6908 {
6909 return true;
6910 }
6911
6912
6913
6915 {
6916 return true;
6917 }
6918
6920 {
6921 return true;
6922 }
6923
6925 {
6926 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6928 }
6929
6931 {
6933 }
6934
6936 {
6938 if (!is_being_placed)
6940 SetSynchDirty();
6941 }
6942
6943
6945
6947 {
6949 }
6950
6952 {
6954 }
6955
6957 {
6958 return 1;
6959 }
6960
6962 {
6963 return false;
6964 }
6965
6967 {
6969 SetSynchDirty();
6970 }
6971
6972
6973
6974
6975
6976
6977
6978
6979
6980
6981
6982
6983
6984
6985
6986
6987
6988
6989
6990
6991
6992
6993
6994
6995
6996
6997
6998
6999
7000
7001
7002
7003
7004
7005
7007 {
7008 super.OnMovedInsideCargo(container);
7009
7010 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7011 }
7012
7013 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
7014 {
7015 super.EEItemLocationChanged(oldLoc, newLoc);
7016
7017 PlayerBase newPlayer = null;
7018 PlayerBase oldPlayer = null;
7019
7020 if (newLoc.GetParent())
7021 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
7022
7023 if (oldLoc.GetParent())
7024 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
7025
7027 {
7028 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
7029
7030 if (rIndex >= 0)
7031 {
7032 InventoryLocation rIl = new InventoryLocation;
7033 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
7034
7035 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
7038 {
7039 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
7040 }
7042 {
7044 }
7045
7046 }
7047 }
7048
7050 {
7051 if (newPlayer)
7052 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
7053
7054 if (newPlayer == oldPlayer)
7055 {
7056 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
7057 {
7059 {
7060 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
7061 {
7062 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7063 }
7064 }
7065 else
7066 {
7067 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7068 }
7069 }
7070
7071 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
7072 {
7073 int type = oldLoc.GetType();
7075 {
7076 oldLoc.GetParent().GetOnSetLock().Invoke(this);
7077 }
7079 {
7080 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
7081 }
7082 }
7083 if (!m_OldLocation)
7084 {
7085 m_OldLocation = new InventoryLocation;
7086 }
7087 m_OldLocation.Copy(oldLoc);
7088 }
7089 else
7090 {
7091 if (m_OldLocation)
7092 {
7093 m_OldLocation.Reset();
7094 }
7095 }
7096
7097 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
7098 }
7099 else
7100 {
7101 if (newPlayer)
7102 {
7103 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
7104 if (resIndex >= 0)
7105 {
7106 InventoryLocation il = new InventoryLocation;
7107 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
7109 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
7112 {
7113 il.
GetParent().GetOnReleaseLock().Invoke(it);
7114 }
7116 {
7118 }
7119
7120 }
7121 }
7123 {
7124
7126 }
7127
7128 if (m_OldLocation)
7129 {
7130 m_OldLocation.Reset();
7131 }
7132 }
7133
7135 {
7136 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
7137 }
7138
7140 {
7141 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
7142 }
7143 }
7144
7145 override void EOnContact(IEntity other, Contact extra)
7146 {
7148 {
7149 int liquidType = -1;
7151 if (impactSpeed > 0.0)
7152 {
7154 #ifndef SERVER
7156 #else
7158 SetSynchDirty();
7159 #endif
7161 }
7162 }
7163
7164 #ifdef SERVER
7165 if (GetCompEM() && GetCompEM().IsPlugged())
7166 {
7167 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
7168 GetCompEM().UnplugThis();
7169 }
7170 #endif
7171 }
7172
7174
7176 {
7178 }
7179
7181 {
7182
7183 }
7184
7186 {
7187 super.OnItemLocationChanged(old_owner, new_owner);
7188
7189 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
7190 PlayerBase playerNew = PlayerBase.Cast(new_owner);
7191
7192 if (!relatedPlayer && playerNew)
7193 relatedPlayer = playerNew;
7194
7195 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
7196 {
7198 if (actionMgr)
7199 {
7200 ActionBase currentAction = actionMgr.GetRunningAction();
7201 if (currentAction)
7203 }
7204 }
7205
7206 Man ownerPlayerOld = null;
7207 Man ownerPlayerNew = null;
7208
7209 if (old_owner)
7210 {
7211 if (old_owner.
IsMan())
7212 {
7213 ownerPlayerOld = Man.Cast(old_owner);
7214 }
7215 else
7216 {
7217 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
7218 }
7219 }
7220 else
7221 {
7223 {
7225
7226 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
7227 {
7228 GetCompEM().UnplugThis();
7229 }
7230 }
7231 }
7232
7233 if (new_owner)
7234 {
7235 if (new_owner.
IsMan())
7236 {
7237 ownerPlayerNew = Man.Cast(new_owner);
7238 }
7239 else
7240 {
7241 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
7242 }
7243 }
7244
7245 if (ownerPlayerOld != ownerPlayerNew)
7246 {
7247 if (ownerPlayerOld)
7248 {
7249 array<EntityAI> subItemsExit = new array<EntityAI>;
7251 for (int i = 0; i < subItemsExit.Count(); i++)
7252 {
7255 }
7256 }
7257
7258 if (ownerPlayerNew)
7259 {
7260 array<EntityAI> subItemsEnter = new array<EntityAI>;
7262 for (int j = 0; j < subItemsEnter.Count(); j++)
7263 {
7266 }
7267 }
7268 }
7269 else if (ownerPlayerNew != null)
7270 {
7271 PlayerBase nplayer;
7272 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
7273 {
7274 array<EntityAI> subItemsUpdate = new array<EntityAI>;
7276 for (int k = 0; k < subItemsUpdate.Count(); k++)
7277 {
7279 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
7280 }
7281 }
7282 }
7283
7284 if (old_owner)
7285 old_owner.OnChildItemRemoved(this);
7286 if (new_owner)
7287 new_owner.OnChildItemReceived(this);
7288 }
7289
7290
7292 {
7293 super.EEDelete(parent);
7294 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
7295 if (player)
7296 {
7298
7299 if (player.IsAlive())
7300 {
7301 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7302 if (r_index >= 0)
7303 {
7304 InventoryLocation r_il = new InventoryLocation;
7305 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7306
7307 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7310 {
7311 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7312 }
7314 {
7315 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7316 }
7317
7318 }
7319
7320 player.RemoveQuickBarEntityShortcut(this);
7321 }
7322 }
7323 }
7324
7326 {
7327 super.EEKilled(killer);
7328
7331 {
7332 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
7333 {
7334 if (IsMagazine())
7335 {
7336 if (Magazine.Cast(this).GetAmmoCount() > 0)
7337 {
7339 }
7340 }
7341 else
7342 {
7344 }
7345 }
7346 }
7347 }
7348
7350 {
7351 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7352
7353 super.OnWasAttached(parent, slot_id);
7354
7357
7360 }
7361
7363 {
7364 super.OnWasDetached(parent, slot_id);
7365
7368
7371 }
7372
7374 {
7375 int idx;
7378
7379 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7380 if (inventory_slots.Count() < 1)
7381 {
7382 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
7383 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
7384 }
7385 else
7386 {
7387 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
7388 }
7389
7390 idx = inventory_slots.Find(slot);
7391 if (idx < 0)
7392 return "";
7393
7394 return attach_types.Get(idx);
7395 }
7396
7398 {
7399 int idx = -1;
7400 string slot;
7401
7404
7405 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7406 if (inventory_slots.Count() < 1)
7407 {
7408 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
7409 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7410 }
7411 else
7412 {
7413 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
7414 if (detach_types.Count() < 1)
7415 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7416 }
7417
7418 for (int i = 0; i < inventory_slots.Count(); i++)
7419 {
7420 slot = inventory_slots.Get(i);
7421 }
7422
7423 if (slot != "")
7424 {
7425 if (detach_types.Count() == 1)
7426 idx = 0;
7427 else
7428 idx = inventory_slots.Find(slot);
7429 }
7430 if (idx < 0)
7431 return "";
7432
7433 return detach_types.Get(idx);
7434 }
7435
7437 {
7438
7440
7441
7442 float min_time = 1;
7443 float max_time = 3;
7444 float delay = Math.RandomFloat(min_time, max_time);
7445
7446 explode_timer.Run(delay, this, "DoAmmoExplosion");
7447 }
7448
7450 {
7451 Magazine magazine = Magazine.Cast(this);
7452 int pop_sounds_count = 6;
7453 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
7454
7455
7456 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
7457 string sound_name = pop_sounds[ sound_idx ];
7458 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
7459
7460
7461 magazine.ServerAddAmmoCount(-1);
7462
7463
7464 float min_temp_to_explode = 100;
7465
7466 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
7467 {
7469 }
7470 }
7471
7472
7473 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
7474 {
7475 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
7476
7477 const int CHANCE_DAMAGE_CARGO = 4;
7478 const int CHANCE_DAMAGE_ATTACHMENT = 1;
7479 const int CHANCE_DAMAGE_NOTHING = 2;
7480
7482 {
7483 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
7484 int chances;
7485 int rnd;
7486
7487 if (GetInventory().GetCargo())
7488 {
7489 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7490 rnd = Math.RandomInt(0,chances);
7491
7492 if (rnd < CHANCE_DAMAGE_CARGO)
7493 {
7495 }
7496 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
7497 {
7499 }
7500 }
7501 else
7502 {
7503 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7504 rnd = Math.RandomInt(0,chances);
7505
7506 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
7507 {
7509 }
7510 }
7511 }
7512 }
7513
7515 {
7516 CargoBase cargo = GetInventory().GetCargo();
7517 if (cargo)
7518 {
7520 if (item_count > 0)
7521 {
7522 int random_pick = Math.RandomInt(0, item_count);
7524 if (!item.IsExplosive())
7525 {
7526 item.AddHealth("","",damage);
7527 return true;
7528 }
7529 }
7530 }
7531 return false;
7532 }
7533
7535 {
7536 GameInventory inventory = GetInventory();
7538 if (attachment_count > 0)
7539 {
7540 int random_pick = Math.RandomInt(0, attachment_count);
7542 if (!attachment.IsExplosive())
7543 {
7544 attachment.AddHealth("","",damage);
7545 return true;
7546 }
7547 }
7548 return false;
7549 }
7550
7552 {
7554 }
7555
7557 {
7559 return GetInventory().CanRemoveEntity();
7560
7561 return false;
7562 }
7563
7565 {
7566
7568 return false;
7569
7570
7572 return false;
7573
7574
7575
7577 if (delta == 0)
7578 return false;
7579
7580
7581 return true;
7582 }
7583
7585 {
7587 {
7588 if (ScriptInputUserData.CanStoreInputUserData())
7589 {
7590 ScriptInputUserData ctx = new ScriptInputUserData;
7595 ctx.
Write(destination_entity);
7599 }
7600 }
7601 else if (!
g_Game.IsMultiplayer())
7602 {
7604 }
7605 }
7606
7608 {
7609 float split_quantity_new;
7613 InventoryLocation loc = new InventoryLocation;
7614
7615 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7616 {
7618 split_quantity_new = stack_max;
7619 else
7621
7623 {
7624 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7625 if (new_item)
7626 {
7627 new_item.SetResultOfSplit(true);
7628 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7630 new_item.
SetQuantity(split_quantity_new,
false,
true);
7631 }
7632 }
7633 }
7634 else if (destination_entity && slot_id == -1)
7635 {
7636 if (quantity > stack_max)
7637 split_quantity_new = stack_max;
7638 else
7639 split_quantity_new = quantity;
7640
7642 {
7643 GameInventory destinationInventory = destination_entity.GetInventory();
7645 {
7648 }
7649
7650 if (new_item)
7651 {
7652 new_item.SetResultOfSplit(true);
7653 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7655 new_item.
SetQuantity(split_quantity_new,
false,
true);
7656 }
7657 }
7658 }
7659 else
7660 {
7661 if (stack_max != 0)
7662 {
7664 {
7666 }
7667
7668 if (split_quantity_new == 0)
7669 {
7670 if (!
g_Game.IsMultiplayer())
7671 player.PhysicalPredictiveDropItem(this);
7672 else
7673 player.ServerDropEntity(this);
7674 return;
7675 }
7676
7678 {
7680
7681 if (new_item)
7682 {
7683 new_item.SetResultOfSplit(true);
7684 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7687 new_item.PlaceOnSurface();
7688 }
7689 }
7690 }
7691 }
7692 }
7693
7695 {
7696 float split_quantity_new;
7700 InventoryLocation loc = new InventoryLocation;
7701
7702 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7703 {
7705 split_quantity_new = stack_max;
7706 else
7708
7710 {
7711 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7712 if (new_item)
7713 {
7714 new_item.SetResultOfSplit(true);
7715 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7717 new_item.
SetQuantity(split_quantity_new,
false,
true);
7718 }
7719 }
7720 }
7721 else if (destination_entity && slot_id == -1)
7722 {
7723 if (quantity > stack_max)
7724 split_quantity_new = stack_max;
7725 else
7726 split_quantity_new = quantity;
7727
7729 {
7730 GameInventory destinationInventory = destination_entity.GetInventory();
7732 {
7735 }
7736
7737 if (new_item)
7738 {
7739 new_item.SetResultOfSplit(true);
7740 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7742 new_item.
SetQuantity(split_quantity_new,
false,
true);
7743 }
7744 }
7745 }
7746 else
7747 {
7748 if (stack_max != 0)
7749 {
7751 {
7753 }
7754
7756 {
7758
7759 if (new_item)
7760 {
7761 new_item.SetResultOfSplit(true);
7762 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7765 new_item.PlaceOnSurface();
7766 }
7767 }
7768 }
7769 }
7770 }
7771
7773 {
7775 {
7776 if (ScriptInputUserData.CanStoreInputUserData())
7777 {
7778 ScriptInputUserData ctx = new ScriptInputUserData;
7783 dst.WriteToContext(ctx);
7785 }
7786 }
7787 else if (!
g_Game.IsMultiplayer())
7788 {
7790 }
7791 }
7792
7794 {
7796 {
7797 if (ScriptInputUserData.CanStoreInputUserData())
7798 {
7799 ScriptInputUserData ctx = new ScriptInputUserData;
7804 ctx.
Write(destination_entity);
7810 }
7811 }
7812 else if (!
g_Game.IsMultiplayer())
7813 {
7815 }
7816 }
7817
7819 {
7821 }
7822
7824 {
7826 float split_quantity_new;
7828 if (dst.IsValid())
7829 {
7830 int slot_id = dst.GetSlot();
7832
7833 if (quantity > stack_max)
7834 split_quantity_new = stack_max;
7835 else
7836 split_quantity_new = quantity;
7837
7839 {
7841
7842 if (new_item)
7843 {
7844 new_item.SetResultOfSplit(true);
7845 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7847 new_item.
SetQuantity(split_quantity_new,
false,
true);
7848 }
7849
7850 return new_item;
7851 }
7852 }
7853
7854 return null;
7855 }
7856
7858 {
7860 float split_quantity_new;
7862 if (destination_entity)
7863 {
7865 if (quantity > stackable)
7866 split_quantity_new = stackable;
7867 else
7868 split_quantity_new = quantity;
7869
7871 {
7872 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
7873 if (new_item)
7874 {
7875 new_item.SetResultOfSplit(true);
7876 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7878 new_item.
SetQuantity(split_quantity_new,
false,
true);
7879 }
7880 }
7881 }
7882 }
7883
7885 {
7887 {
7888 if (ScriptInputUserData.CanStoreInputUserData())
7889 {
7890 ScriptInputUserData ctx = new ScriptInputUserData;
7895 ItemBase destination_entity =
this;
7896 ctx.
Write(destination_entity);
7900 }
7901 }
7902 else if (!
g_Game.IsMultiplayer())
7903 {
7905 }
7906 }
7907
7909 {
7911 float split_quantity_new;
7913 if (player)
7914 {
7916 if (quantity > stackable)
7917 split_quantity_new = stackable;
7918 else
7919 split_quantity_new = quantity;
7920
7922 {
7923 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
7924 new_item =
ItemBase.Cast(in_hands);
7925 if (new_item)
7926 {
7927 new_item.SetResultOfSplit(true);
7928 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7930 new_item.SetQuantity(split_quantity_new, false, true);
7931 }
7932 }
7933 }
7934 }
7935
7937 {
7939 float split_quantity_new = Math.Floor(quantity * 0.5);
7940
7942 return;
7943
7945
7946 if (new_item)
7947 {
7948 if (new_item.GetQuantityMax() < split_quantity_new)
7949 {
7950 split_quantity_new = new_item.GetQuantityMax();
7951 }
7952
7953 new_item.SetResultOfSplit(true);
7954 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7955
7957 {
7960 }
7961 else
7962 {
7964 new_item.
SetQuantity(split_quantity_new,
false,
true);
7965 }
7966 }
7967 }
7968
7970 {
7972 float split_quantity_new = Math.Floor(quantity / 2);
7973
7975 return;
7976
7977 InventoryLocation invloc = new InventoryLocation;
7979
7981 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
7982
7983 if (new_item)
7984 {
7985 if (new_item.GetQuantityMax() < split_quantity_new)
7986 {
7987 split_quantity_new = new_item.GetQuantityMax();
7988 }
7990 {
7993 }
7994 else if (split_quantity_new > 1)
7995 {
7997 new_item.
SetQuantity(split_quantity_new,
false,
true);
7998 }
7999 }
8000 }
8001
8004 {
8005 SetWeightDirty();
8007
8008 if (parent)
8009 parent.OnAttachmentQuantityChangedEx(this, delta);
8010
8012 {
8014 {
8016 }
8018 {
8019 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
8021 }
8022 }
8023 }
8024
8027 {
8028
8029 }
8030
8033 {
8035 }
8036
8038 {
8039 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
8040
8042 {
8043 if (newLevel == GameConstants.STATE_RUINED)
8044 {
8046 EntityAI parent = GetHierarchyParent();
8047 if (parent && parent.IsFireplace())
8048 {
8049 CargoBase cargo = GetInventory().GetCargo();
8050 if (cargo)
8051 {
8053 {
8055 }
8056 }
8057 }
8058 }
8059
8061 {
8062
8064 return;
8065 }
8066
8067 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
8068 {
8070 }
8071 }
8072 }
8073
8074
8076 {
8077 super.OnRightClick();
8078
8080 {
8082 {
8083 if (ScriptInputUserData.CanStoreInputUserData())
8084 {
8085 EntityAI root = GetHierarchyRoot();
8086 Man playerOwner = GetHierarchyRootPlayer();
8087 InventoryLocation dst = new InventoryLocation;
8088
8089
8090 if (!playerOwner && root && root == this)
8091 {
8093 }
8094 else
8095 {
8096
8097 GetInventory().GetCurrentInventoryLocation(dst);
8099 {
8100 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8102 {
8104 }
8105 else
8106 {
8108
8109
8110 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
8111 {
8113 }
8114 else
8115 {
8116 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
8117 }
8118 }
8119 }
8120 }
8121
8122 ScriptInputUserData ctx = new ScriptInputUserData;
8130 }
8131 }
8132 else if (!
g_Game.IsMultiplayer())
8133 {
8135 }
8136 }
8137 }
8138
8140 {
8141 if (root)
8142 {
8143 vector m4[4];
8144 root.GetTransform(m4);
8145 dst.SetGround(this, m4);
8146 }
8147 else
8148 {
8149 GetInventory().GetCurrentInventoryLocation(dst);
8150 }
8151 }
8152
8153 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
8154 {
8155
8156 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
8157 return false;
8158
8159 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
8160 return false;
8161
8162
8164 return false;
8165
8166
8167 Magazine mag = Magazine.Cast(this);
8168 if (mag)
8169 {
8170 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
8171 return false;
8172
8173 if (stack_max_limit)
8174 {
8175 Magazine other_mag = Magazine.Cast(other_item);
8176 if (other_item)
8177 {
8178 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
8179 return false;
8180 }
8181
8182 }
8183 }
8184 else
8185 {
8186
8188 return false;
8189
8191 return false;
8192 }
8193
8194 PlayerBase player = null;
8195 if (CastTo(player, GetHierarchyRootPlayer()))
8196 {
8197 if (player.GetInventory().HasAttachment(this))
8198 return false;
8199
8200 if (player.IsItemsToDelete())
8201 return false;
8202 }
8203
8204 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
8205 return false;
8206
8207 int slotID;
8209 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
8210 return false;
8211
8212 return true;
8213 }
8214
8216 {
8218 }
8219
8221 {
8222 return m_IsResultOfSplit;
8223 }
8224
8226 {
8227 m_IsResultOfSplit = value;
8228 }
8229
8231 {
8233 }
8234
8236 {
8237 float other_item_quantity = other_item.GetQuantity();
8238 float this_free_space;
8239
8241
8243
8244 if (other_item_quantity > this_free_space)
8245 {
8246 return this_free_space;
8247 }
8248 else
8249 {
8250 return other_item_quantity;
8251 }
8252 }
8253
8255 {
8257 }
8258
8260 {
8262 return;
8263
8264 if (!IsMagazine() && other_item)
8265 {
8267 if (quantity_used != 0)
8268 {
8269 float hp1 = GetHealth01("","");
8270 float hp2 = other_item.GetHealth01("","");
8271 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
8272 hpResult = hpResult / (
GetQuantity() + quantity_used);
8273
8274 hpResult *= GetMaxHealth();
8275 Math.Round(hpResult);
8276 SetHealth("", "Health", hpResult);
8277
8279 other_item.AddQuantity(-quantity_used);
8280 }
8281 }
8283 }
8284
8286 {
8287 #ifdef SERVER
8288 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
8289 GetHierarchyParent().IncreaseLifetimeUp();
8290 #endif
8291 };
8292
8294 {
8295 PlayerBase p = PlayerBase.Cast(player);
8296
8297 array<int> recipesIds = p.m_Recipes;
8298 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8299 if (moduleRecipesManager)
8300 {
8301 EntityAI itemInHands = player.GetEntityInHands();
8302 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
8303 }
8304
8305 for (int i = 0;i < recipesIds.Count(); i++)
8306 {
8307 int key = recipesIds.Get(i);
8308 string recipeName = moduleRecipesManager.GetRecipeName(key);
8310 }
8311 }
8312
8313
8314 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
8315 {
8316 super.GetDebugActions(outputList);
8317
8318
8324
8325
8330
8335
8336
8340
8341
8343 {
8347 }
8348
8351
8352
8356
8358
8359 InventoryLocation loc = new InventoryLocation();
8360 GetInventory().GetCurrentInventoryLocation(loc);
8362 {
8363 if (Gizmo_IsSupported())
8366 }
8367
8369 }
8370
8371
8372
8373
8375 {
8376 super.OnAction(action_id, player, ctx);
8377
8379 {
8380 switch (action_id)
8381 {
8385 return true;
8389 return true;
8390 }
8391 }
8392
8394 {
8395 switch (action_id)
8396 {
8398 Delete();
8399 return true;
8400 }
8401 }
8402
8403 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
8404 {
8405 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8406 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
8407 PlayerBase p = PlayerBase.Cast(player);
8408 if (
EActions.RECIPES_RANGE_START < 1000)
8409 {
8410 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
8411 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
8412 }
8413 }
8414 #ifndef SERVER
8415 else if (action_id ==
EActions.WATCH_PLAYER)
8416 {
8417 PluginDeveloper.SetDeveloperItemClientEx(player);
8418 }
8419 #endif
8421 {
8422 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
8423 {
8424 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
8425 OnDebugButtonPressServer(id + 1);
8426 }
8427
8428 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
8429 {
8430 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
8432 }
8433
8434 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
8435 {
8436 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
8438 }
8439
8440 else if (action_id ==
EActions.ADD_QUANTITY)
8441 {
8442 if (IsMagazine())
8443 {
8444 Magazine mag = Magazine.Cast(this);
8445 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
8446 }
8447 else
8448 {
8450 }
8451
8452 if (m_EM)
8453 {
8454 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
8455 }
8456
8457 }
8458
8459 else if (action_id ==
EActions.REMOVE_QUANTITY)
8460 {
8461 if (IsMagazine())
8462 {
8463 Magazine mag2 = Magazine.Cast(this);
8464 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
8465 }
8466 else
8467 {
8469 }
8470 if (m_EM)
8471 {
8472 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
8473 }
8474
8475 }
8476
8477 else if (action_id ==
EActions.SET_QUANTITY_0)
8478 {
8480
8481 if (m_EM)
8482 {
8483 m_EM.SetEnergy(0);
8484 }
8485 }
8486
8487 else if (action_id ==
EActions.SET_MAX_QUANTITY)
8488 {
8490
8491 if (m_EM)
8492 {
8493 m_EM.SetEnergy(m_EM.GetEnergyMax());
8494 }
8495 }
8496
8497 else if (action_id ==
EActions.ADD_HEALTH)
8498 {
8499 AddHealth("","",GetMaxHealth("","Health")/5);
8500 }
8501 else if (action_id ==
EActions.REMOVE_HEALTH)
8502 {
8503 AddHealth("","",-GetMaxHealth("","Health")/5);
8504 }
8505 else if (action_id ==
EActions.DESTROY_HEALTH)
8506 {
8507 SetHealth01("","",0);
8508 }
8509 else if (action_id ==
EActions.WATCH_ITEM)
8510 {
8512 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
8513 #ifdef DEVELOPER
8514 SetDebugDeveloper_item(this);
8515 #endif
8516 }
8517
8518 else if (action_id ==
EActions.ADD_TEMPERATURE)
8519 {
8520 AddTemperature(20);
8521
8522 }
8523
8524 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
8525 {
8526 AddTemperature(-20);
8527
8528 }
8529
8530 else if (action_id ==
EActions.FLIP_FROZEN)
8531 {
8532 SetFrozen(!GetIsFrozen());
8533
8534 }
8535
8536 else if (action_id ==
EActions.ADD_WETNESS)
8537 {
8539
8540 }
8541
8542 else if (action_id ==
EActions.REMOVE_WETNESS)
8543 {
8545
8546 }
8547
8548 else if (action_id ==
EActions.LIQUIDTYPE_UP)
8549 {
8552
8553
8554 }
8555
8556 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
8557 {
8560 }
8561
8562 else if (action_id ==
EActions.MAKE_SPECIAL)
8563 {
8564 auto debugParams = DebugSpawnParams.WithPlayer(player);
8565 OnDebugSpawnEx(debugParams);
8566 }
8567
8568 }
8569
8570
8571 return false;
8572 }
8573
8574
8575
8576
8580
8583
8584
8585
8587 {
8588 return false;
8589 }
8590
8591
8593 {
8594 return true;
8595 }
8596
8597
8599 {
8600 return true;
8601 }
8602
8603
8604
8606 {
8607 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
8608 return g_Game.ConfigIsExisting(config_path);
8609 }
8610
8613 {
8614 return null;
8615 }
8616
8618 {
8619 return false;
8620 }
8621
8623 {
8624 return false;
8625 }
8626
8630
8631
8633 {
8634 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8635 return module_repairing.CanRepair(this, item_repair_kit);
8636 }
8637
8638
8639 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
8640 {
8641 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8642 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
8643 }
8644
8645
8647 {
8648
8649
8650
8651
8652
8653
8654
8655
8656 return 1;
8657 }
8658
8659
8660
8662 {
8664 }
8665
8666
8667
8669 {
8671 }
8672
8673
8682 {
8683 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8684
8685 if (player)
8686 {
8687 player.MessageStatus(text);
8688 }
8689 }
8690
8691
8700 {
8701 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8702
8703 if (player)
8704 {
8705 player.MessageAction(text);
8706 }
8707 }
8708
8709
8718 {
8719 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8720
8721 if (player)
8722 {
8723 player.MessageFriendly(text);
8724 }
8725 }
8726
8727
8736 {
8737 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8738
8739 if (player)
8740 {
8741 player.MessageImportant(text);
8742 }
8743 }
8744
8746 {
8747 return true;
8748 }
8749
8750
8751 override bool KindOf(
string tag)
8752 {
8753 bool found = false;
8754 string item_name = this.
GetType();
8756 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
8757
8758 int array_size = item_tag_array.Count();
8759 for (int i = 0; i < array_size; i++)
8760 {
8761 if (item_tag_array.Get(i) == tag)
8762 {
8763 found = true;
8764 break;
8765 }
8766 }
8767 return found;
8768 }
8769
8770
8772 {
8773
8774 super.OnRPC(sender, rpc_type,ctx);
8775
8776
8777 switch (rpc_type)
8778 {
8779 #ifndef SERVER
8780 case ERPCs.RPC_SOUND_LOCK_ATTACH:
8781 Param2<bool, string> p = new Param2<bool, string>(false, "");
8782
8784 return;
8785
8786 bool play = p.param1;
8787 string soundSet = p.param2;
8788
8789 if (play)
8790 {
8792 {
8794 {
8796 }
8797 }
8798 else
8799 {
8801 }
8802 }
8803 else
8804 {
8806 }
8807
8808 break;
8809 #endif
8810
8811 }
8812
8814 {
8816 }
8817 }
8818
8819
8820
8821
8823 {
8824 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8825 return plugin.GetID(
name);
8826 }
8827
8829 {
8830 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8831 return plugin.GetName(id);
8832 }
8833
8836 {
8837
8838
8839 int varFlags;
8840 if (!ctx.
Read(varFlags))
8841 return;
8842
8843 if (varFlags & ItemVariableFlags.FLOAT)
8844 {
8846 }
8847 }
8848
8850 {
8851
8852 super.SerializeNumericalVars(floats_out);
8853
8854
8855
8857 {
8859 }
8860
8862 {
8864 }
8865
8867 {
8869 }
8870
8872 {
8877 }
8878
8880 {
8882 }
8883 }
8884
8886 {
8887
8888 super.DeSerializeNumericalVars(floats);
8889
8890
8891 int index = 0;
8892 int mask = Math.Round(floats.Get(index));
8893
8894 index++;
8895
8897 {
8899 {
8901 }
8902 else
8903 {
8904 float quantity = floats.Get(index);
8906 }
8907 index++;
8908 }
8909
8911 {
8912 float wet = floats.Get(index);
8914 index++;
8915 }
8916
8918 {
8919 int liquidtype = Math.Round(floats.Get(index));
8921 index++;
8922 }
8923
8925 {
8927 index++;
8929 index++;
8931 index++;
8933 index++;
8934 }
8935
8937 {
8938 int cleanness = Math.Round(floats.Get(index));
8940 index++;
8941 }
8942 }
8943
8945 {
8946 super.WriteVarsToCTX(ctx);
8947
8948
8950 {
8952 }
8953
8955 {
8957 }
8958
8960 {
8962 }
8963
8965 {
8966 int r,g,b,a;
8972 }
8973
8975 {
8977 }
8978 }
8979
8981 {
8982 if (!super.ReadVarsFromCTX(ctx,version))
8983 return false;
8984
8985 int intValue;
8986 float value;
8987
8988 if (version < 140)
8989 {
8990 if (!ctx.
Read(intValue))
8991 return false;
8992
8993 m_VariablesMask = intValue;
8994 }
8995
8997 {
8998 if (!ctx.
Read(value))
8999 return false;
9000
9002 {
9004 }
9005 else
9006 {
9008 }
9009 }
9010
9011 if (version < 140)
9012 {
9014 {
9015 if (!ctx.
Read(value))
9016 return false;
9017 SetTemperatureDirect(value);
9018 }
9019 }
9020
9022 {
9023 if (!ctx.
Read(value))
9024 return false;
9026 }
9027
9029 {
9030 if (!ctx.
Read(intValue))
9031 return false;
9033 }
9034
9036 {
9037 int r,g,b,a;
9039 return false;
9041 return false;
9043 return false;
9045 return false;
9046
9048 }
9049
9051 {
9052 if (!ctx.
Read(intValue))
9053 return false;
9055 }
9056
9057 if (version >= 138 && version < 140)
9058 {
9060 {
9061 if (!ctx.
Read(intValue))
9062 return false;
9063 SetFrozen(intValue);
9064 }
9065 }
9066
9067 return true;
9068 }
9069
9070
9072 {
9075 {
9077 }
9078
9079 if (!super.OnStoreLoad(ctx, version))
9080 {
9082 return false;
9083 }
9084
9085 if (version >= 114)
9086 {
9087 bool hasQuickBarIndexSaved;
9088
9089 if (!ctx.
Read(hasQuickBarIndexSaved))
9090 {
9092 return false;
9093 }
9094
9095 if (hasQuickBarIndexSaved)
9096 {
9097 int itmQBIndex;
9098
9099
9100 if (!ctx.
Read(itmQBIndex))
9101 {
9103 return false;
9104 }
9105
9106 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
9107 if (itmQBIndex != -1 && parentPlayer)
9108 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
9109 }
9110 }
9111 else
9112 {
9113
9114 PlayerBase player;
9115 int itemQBIndex;
9116 if (version ==
int.
MAX)
9117 {
9118 if (!ctx.
Read(itemQBIndex))
9119 {
9121 return false;
9122 }
9123 }
9124 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
9125 {
9126
9127 if (!ctx.
Read(itemQBIndex))
9128 {
9130 return false;
9131 }
9132 if (itemQBIndex != -1 && player)
9133 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
9134 }
9135 }
9136
9137 if (version < 140)
9138 {
9139
9140 if (!LoadVariables(ctx, version))
9141 {
9143 return false;
9144 }
9145 }
9146
9147
9149 {
9151 return false;
9152 }
9153 if (version >= 132)
9154 {
9156 if (raib)
9157 {
9159 {
9161 return false;
9162 }
9163 }
9164 }
9165
9167 return true;
9168 }
9169
9170
9171
9173 {
9174 super.OnStoreSave(ctx);
9175
9176 PlayerBase player;
9177 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
9178 {
9180
9181 int itemQBIndex = -1;
9182 itemQBIndex = player.FindQuickBarEntityIndex(this);
9183 ctx.
Write(itemQBIndex);
9184 }
9185 else
9186 {
9188 }
9189
9191
9193 if (raib)
9194 {
9196 }
9197 }
9198
9199
9201 {
9202 super.AfterStoreLoad();
9203
9205 {
9207 }
9208
9210 {
9213 }
9214 }
9215
9217 {
9218 super.EEOnAfterLoad();
9219
9221 {
9223 }
9224
9227 }
9228
9230 {
9231 return false;
9232 }
9233
9234
9235
9237 {
9239 {
9240 #ifdef PLATFORM_CONSOLE
9241
9243 {
9245 if (menu)
9246 {
9248 }
9249 }
9250 #endif
9251 }
9252
9254 {
9257 }
9258
9260 {
9261 SetWeightDirty();
9263 }
9265 {
9268 }
9269
9271 {
9274
9277 }
9279 {
9283 }
9284
9285 super.OnVariablesSynchronized();
9286 }
9287
9288
9289
9291 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
9292 {
9293 if (!IsServerCheck(allow_client))
9294 return false;
9295
9297 return false;
9298
9301
9302 if (value <= (min + 0.001))
9303 value = min;
9304
9305 if (value == min)
9306 {
9307 if (destroy_config)
9308 {
9309 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
9310 if (dstr)
9311 {
9313 this.Delete();
9314 return true;
9315 }
9316 }
9317 else if (destroy_forced)
9318 {
9320 this.Delete();
9321 return true;
9322 }
9323
9325 }
9326
9329
9331 {
9332 EntityAI parent = GetHierarchyRoot();
9333 InventoryLocation iLoc = new InventoryLocation();
9334 GetInventory().GetCurrentInventoryLocation(iLoc);
9336 {
9337 int iLocSlot = iLoc.
GetSlot();
9339 {
9341 }
9343 {
9345 }
9346 }
9347 }
9348
9350 {
9352
9353 if (delta)
9355 }
9356
9358
9359 return false;
9360 }
9361
9362
9364 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9365 {
9367 }
9368
9370 {
9373 }
9374
9376 {
9379 }
9380
9382 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9383 {
9384 float value_clamped = Math.Clamp(value, 0, 1);
9386 SetQuantity(result, destroy_config, destroy_forced);
9387 }
9388
9389
9392 {
9394 }
9395
9397 {
9399 }
9400
9401
9402
9403
9404
9405
9406
9407
9408
9409
9411 {
9412 int slot = -1;
9413 GameInventory inventory = GetInventory();
9414 if (inventory)
9415 {
9416 InventoryLocation il = new InventoryLocation;
9419 }
9420
9422 }
9423
9425 {
9426 float quantity_max = 0;
9427
9429 {
9430 if (attSlotID != -1)
9431 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
9432
9433 if (quantity_max <= 0)
9435 }
9436
9437 if (quantity_max <= 0)
9439
9440 return quantity_max;
9441 }
9442
9444 {
9446 }
9447
9449 {
9451 }
9452
9453
9455 {
9457 }
9458
9460 {
9462 }
9463
9465 {
9467 }
9468
9469
9471 {
9472
9473 float weightEx = GetWeightEx();
9474 float special = GetInventoryAndCargoWeight();
9475 return weightEx - special;
9476 }
9477
9478
9480 {
9482 }
9483
9485 {
9487 {
9488 #ifdef DEVELOPER
9489 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9490 {
9491 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
9493 }
9494 #endif
9495
9497 }
9498 else if (HasEnergyManager())
9499 {
9500 #ifdef DEVELOPER
9501 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9502 {
9503 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
9504 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
9505 }
9506 #endif
9507 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
9508 }
9509 else
9510 {
9511 #ifdef DEVELOPER
9512 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9513 {
9514 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
9515 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
9516 }
9517 #endif
9518 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
9519 }
9520 }
9521
9524 {
9525 int item_count = 0;
9527
9528 GameInventory inventory = GetInventory();
9529 CargoBase cargo = inventory.
GetCargo();
9530 if (cargo != NULL)
9531 {
9533 }
9534
9536 for (int i = 0; i < nAttachments; ++i)
9537 {
9539 if (item)
9540 item_count += item.GetNumberOfItems();
9541 }
9542 return item_count;
9543 }
9544
9547 {
9548 float weight = 0;
9549 float wetness = 1;
9550 if (include_wetness)
9553 {
9554 weight = wetness * m_ConfigWeight;
9555 }
9557 {
9558 weight = 1;
9559 }
9560 return weight;
9561 }
9562
9563
9564
9566 {
9567 GameInventory inventory = GetInventory();
9568 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
9569 {
9570 array<EntityAI> items = new array<EntityAI>;
9572 for (int i = 0; i < items.Count(); ++i)
9573 {
9575 if (item)
9576 {
9577 g_Game.ObjectDelete(item);
9578 }
9579 }
9580 }
9581 }
9582
9583
9584
9585
9587 {
9588 float energy = 0;
9589 if (HasEnergyManager())
9590 {
9591 energy = GetCompEM().GetEnergy();
9592 }
9593 return energy;
9594 }
9595
9596
9598 {
9599 super.OnEnergyConsumed();
9600
9602 }
9603
9605 {
9606 super.OnEnergyAdded();
9607
9609 }
9610
9611
9613 {
9614 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
9615 {
9617 {
9618 float energy_0to1 = GetCompEM().GetEnergy0To1();
9620 }
9621 }
9622 }
9623
9624
9626 {
9627 return ConfigGetFloat("heatIsolation");
9628 }
9629
9631 {
9633 }
9634
9636 {
9637 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
9638 if (
g_Game.ConfigIsExisting(paramPath))
9639 return g_Game.ConfigGetFloat(paramPath);
9640
9641 return 0.0;
9642 }
9643
9645 {
9646 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
9647 if (
g_Game.ConfigIsExisting(paramPath))
9648 return g_Game.ConfigGetFloat(paramPath);
9649
9650 return 0.0;
9651 }
9652
9653 override void SetWet(
float value,
bool allow_client =
false)
9654 {
9655 if (!IsServerCheck(allow_client))
9656 return;
9657
9660
9662
9663 m_VarWet = Math.Clamp(value, min, max);
9664
9666 {
9669 }
9670 }
9671
9672 override void AddWet(
float value)
9673 {
9675 }
9676
9678 {
9680 }
9681
9683 {
9685 }
9686
9688 {
9690 }
9691
9693 {
9695 }
9696
9698 {
9700 }
9701
9703 {
9706 if (newLevel != oldLevel)
9707 {
9709 }
9710 }
9711
9713 {
9714 SetWeightDirty();
9715 }
9716
9718 {
9719 return GetWetLevelInternal(
m_VarWet);
9720 }
9721
9722
9723
9725 {
9727 }
9728
9730 {
9732 }
9733
9735 {
9737 }
9738
9740 {
9742 }
9743
9744
9745
9747 {
9748 if (ConfigIsExisting("itemModelLength"))
9749 {
9750 return ConfigGetFloat("itemModelLength");
9751 }
9752 return 0;
9753 }
9754
9756 {
9757 if (ConfigIsExisting("itemAttachOffset"))
9758 {
9759 return ConfigGetFloat("itemAttachOffset");
9760 }
9761 return 0;
9762 }
9763
9764 override void SetCleanness(
int value,
bool allow_client =
false)
9765 {
9766 if (!IsServerCheck(allow_client))
9767 return;
9768
9770
9772
9775 }
9776
9778 {
9780 }
9781
9783 {
9784 return true;
9785 }
9786
9787
9788
9789
9791 {
9793 }
9794
9796 {
9798 }
9799
9800
9801
9802
9803 override void SetColor(
int r,
int g,
int b,
int a)
9804 {
9810 }
9812 override void GetColor(out
int r,out
int g,out
int b,out
int a)
9813 {
9818 }
9819
9821 {
9823 }
9824
9827 {
9828 int r,g,b,a;
9830 r = r/255;
9831 g = g/255;
9832 b = b/255;
9833 a = a/255;
9834 return MiscGameplayFunctions.GetColorString(r, g, b, a);
9835 }
9836
9837
9838
9839 override void SetLiquidType(
int value,
bool allow_client =
false)
9840 {
9841 if (!IsServerCheck(allow_client))
9842 return;
9843
9848 }
9849
9851 {
9852 return ConfigGetInt("varLiquidTypeInit");
9853 }
9854
9856 {
9858 }
9859
9861 {
9863 SetFrozen(false);
9864 }
9865
9868 {
9869 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9870 }
9871
9872
9875 {
9876 PlayerBase nplayer;
9877 if (PlayerBase.CastTo(nplayer, player))
9878 {
9880 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9881 }
9882 }
9883
9884
9887 {
9888 PlayerBase nplayer;
9889 if (PlayerBase.CastTo(nplayer,player))
9890 {
9891 nplayer.SetEnableQuickBarEntityShortcut(this, false);
9892 }
9893
9894 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
9895
9896 if (HasEnergyManager())
9897 {
9898 GetCompEM().UpdatePlugState();
9899 }
9900 }
9901
9902
9904 {
9905 super.OnPlacementStarted(player);
9906
9908 }
9909
9910 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
9911 {
9913 {
9914 m_AdminLog.OnPlacementComplete(player,
this);
9915 }
9916
9917 super.OnPlacementComplete(player, position, orientation);
9918 }
9919
9920
9921
9922
9923
9925 {
9927 {
9928 return true;
9929 }
9930 else
9931 {
9932 return false;
9933 }
9934 }
9935
9936
9938 {
9940 {
9942 }
9943 }
9944
9945
9947 {
9949 }
9950
9952 {
9954 }
9955
9956 override void InsertAgent(
int agent,
float count = 1)
9957 {
9958 if (count < 1)
9959 return;
9960
9962 }
9963
9966 {
9968 }
9969
9970
9972 {
9974 }
9975
9976
9977
9978
9979
9980
9981
9982
9983
9984
9985
9986
9987
9988
9989
9990
9991
9992
9993
9994
9995
9996
9997
9998
9999
10000
10001
10002
10003
10004
10005
10006
10007
10008
10009
10010
10011
10012
10013
10014
10015
10016
10018 {
10020 return false;
10021 return true;
10022 }
10023
10025 {
10026
10028 }
10029
10030
10033 {
10034 super.CheckForRoofLimited(timeTresholdMS);
10035
10036 float time =
g_Game.GetTime();
10037 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
10038 {
10039 m_PreviousRoofTestTime = time;
10040 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
10041 }
10042 }
10043
10044
10046 {
10048 {
10049 return 0;
10050 }
10051
10052 if (GetInventory().GetAttachmentSlotsCount() != 0)
10053 {
10054 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
10055 if (filter)
10056 return filter.GetProtectionLevel(type, false, system);
10057 else
10058 return 0;
10059 }
10060
10061 string subclassPath, entryName;
10062
10063 switch (type)
10064 {
10066 entryName = "biological";
10067 break;
10069 entryName = "chemical";
10070 break;
10071 default:
10072 entryName = "biological";
10073 break;
10074 }
10075
10076 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
10077
10078 return g_Game.ConfigGetFloat(subclassPath + entryName);
10079 }
10080
10081
10082
10085 {
10086 if (!IsMagazine())
10088
10090 }
10091
10092
10093
10094
10095
10100 {
10101 return true;
10102 }
10103
10105 {
10107 }
10108
10109
10110
10111
10112
10114 {
10115 if (parent)
10116 {
10117 if (parent.IsInherited(DayZInfected))
10118 return true;
10119
10120 if (!parent.IsRuined())
10121 return true;
10122 }
10123
10124 return true;
10125 }
10126
10128 {
10129 if (!super.CanPutAsAttachment(parent))
10130 {
10131 return false;
10132 }
10133
10134 if (!IsRuined() && !parent.IsRuined())
10135 {
10136 return true;
10137 }
10138
10139 return false;
10140 }
10141
10143 {
10144
10145
10146
10147
10148 return super.CanReceiveItemIntoCargo(item);
10149 }
10150
10152 {
10153
10154
10155
10156
10157 GameInventory attachmentInv = attachment.GetInventory();
10159 {
10160 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
10161 return false;
10162 }
10163
10164 InventoryLocation loc = new InventoryLocation();
10165 attachment.GetInventory().GetCurrentInventoryLocation(loc);
10166 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
10167 return false;
10168
10169 return super.CanReceiveAttachment(attachment, slotId);
10170 }
10171
10173 {
10174 if (!super.CanReleaseAttachment(attachment))
10175 return false;
10176
10177 return GetInventory().AreChildrenAccessible();
10178 }
10179
10180
10181
10182
10183
10184
10185
10186
10187
10188
10189
10190
10191
10192
10193
10194
10195
10196
10197
10198
10199
10201 {
10202 int id = muzzle_owner.GetMuzzleID();
10203 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
10204
10205 if (WPOF_array)
10206 {
10207 for (int i = 0; i < WPOF_array.Count(); i++)
10208 {
10209 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
10210
10211 if (WPOF)
10212 {
10213 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
10214 }
10215 }
10216 }
10217 }
10218
10219
10221 {
10222 int id = muzzle_owner.GetMuzzleID();
10224
10225 if (WPOBE_array)
10226 {
10227 for (int i = 0; i < WPOBE_array.Count(); i++)
10228 {
10229 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
10230
10231 if (WPOBE)
10232 {
10233 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10234 }
10235 }
10236 }
10237 }
10238
10239
10241 {
10242 int id = muzzle_owner.GetMuzzleID();
10243 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10244
10245 if (WPOOH_array)
10246 {
10247 for (int i = 0; i < WPOOH_array.Count(); i++)
10248 {
10249 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10250
10251 if (WPOOH)
10252 {
10253 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10254 }
10255 }
10256 }
10257 }
10258
10259
10261 {
10262 int id = muzzle_owner.GetMuzzleID();
10263 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10264
10265 if (WPOOH_array)
10266 {
10267 for (int i = 0; i < WPOOH_array.Count(); i++)
10268 {
10269 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10270
10271 if (WPOOH)
10272 {
10273 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10274 }
10275 }
10276 }
10277 }
10278
10279
10281 {
10282 int id = muzzle_owner.GetMuzzleID();
10283 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10284
10285 if (WPOOH_array)
10286 {
10287 for (int i = 0; i < WPOOH_array.Count(); i++)
10288 {
10289 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10290
10291 if (WPOOH)
10292 {
10293 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10294 }
10295 }
10296 }
10297 }
10298
10299
10300
10302 {
10304 {
10305 return true;
10306 }
10307
10308 return false;
10309 }
10310
10312 {
10314 {
10315 return true;
10316 }
10317
10318 return false;
10319 }
10320
10322 {
10324 {
10325 return true;
10326 }
10327
10328 return false;
10329 }
10330
10332 {
10333 return false;
10334 }
10335
10338 {
10339 return UATimeSpent.DEFAULT_DEPLOY;
10340 }
10341
10342
10343
10344
10346 {
10348 SetSynchDirty();
10349 }
10350
10352 {
10354 }
10355
10356
10358 {
10359 return false;
10360 }
10361
10364 {
10365 string att_type = "None";
10366
10367 if (ConfigIsExisting("soundAttType"))
10368 {
10369 att_type = ConfigGetString("soundAttType");
10370 }
10371
10373 }
10374
10376 {
10378 }
10379
10380
10381
10382
10383
10389
10391 {
10394
10396 }
10397
10398
10400 {
10402 return;
10403
10405
10408
10411
10412 SoundParameters params = new SoundParameters();
10416 }
10417
10418
10420 {
10422 {
10425
10426 SetSynchDirty();
10427
10430 }
10431 }
10432
10434 {
10436 }
10437
10438
10440 {
10442 return;
10443
10445 SetSynchDirty();
10446
10449 }
10450
10452 {
10455 }
10456
10458 {
10460 }
10461
10462 void OnApply(PlayerBase player);
10463
10465 {
10466 return 1.0;
10467 };
10468
10470 {
10472 }
10473
10475 {
10477 }
10478
10480
10482 {
10483 SetDynamicPhysicsLifeTime(0.01);
10485 }
10486
10488 {
10489 array<string> zone_names = new array<string>;
10490 GetDamageZones(zone_names);
10491 for (int i = 0; i < zone_names.Count(); i++)
10492 {
10493 SetHealthMax(zone_names.Get(i),"Health");
10494 }
10495 SetHealthMax("","Health");
10496 }
10497
10500 {
10501 float global_health = GetHealth01("","Health");
10502 array<string> zones = new array<string>;
10503 GetDamageZones(zones);
10504
10505 for (int i = 0; i < zones.Count(); i++)
10506 {
10507 SetHealth01(zones.Get(i),"Health",global_health);
10508 }
10509 }
10510
10513 {
10514 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
10515 }
10516
10518 {
10519 if (!hasRootAsPlayer)
10520 {
10521 if (refParentIB)
10522 {
10523
10524 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
10525 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
10526
10527 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
10528 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
10529
10532 }
10533 else
10534 {
10535
10538 }
10539 }
10540 }
10541
10543 {
10545 {
10546 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
10547 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
10548 {
10549 float heatPermCoef = 1.0;
10551 while (ent)
10552 {
10553 heatPermCoef *= ent.GetHeatPermeabilityCoef();
10554 ent = ent.GetHierarchyParent();
10555 }
10556
10557 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
10558 }
10559 }
10560 }
10561
10563 {
10564
10565 EntityAI parent = GetHierarchyParent();
10566 if (!parent)
10567 {
10568 hasParent = false;
10569 hasRootAsPlayer = false;
10570 }
10571 else
10572 {
10573 hasParent = true;
10574 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
10575 refParentIB =
ItemBase.Cast(parent);
10576 }
10577 }
10578
10579 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
10580 {
10581
10582 }
10583
10585 {
10586
10587 return false;
10588 }
10589
10591 {
10592
10593
10594 return false;
10595 }
10596
10598 {
10599
10600 return false;
10601 }
10602
10605 {
10606 return !GetIsFrozen() &&
IsOpen();
10607 }
10608
10610 {
10611 bool hasParent = false, hasRootAsPlayer = false;
10613
10614 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
10615 bool foodDecay =
g_Game.IsFoodDecayEnabled();
10616
10617 if (wwtu || foodDecay)
10618 {
10622
10623 if (processWetness || processTemperature || processDecay)
10624 {
10626
10627 if (processWetness)
10628 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
10629
10630 if (processTemperature)
10632
10633 if (processDecay)
10634 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
10635 }
10636 }
10637 }
10638
10641 {
10643 }
10644
10646 {
10649
10650 return super.GetTemperatureFreezeThreshold();
10651 }
10652
10654 {
10657
10658 return super.GetTemperatureThawThreshold();
10659 }
10660
10662 {
10665
10666 return super.GetItemOverheatThreshold();
10667 }
10668
10670 {
10672 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
10673
10674 return super.GetTemperatureFreezeTime();
10675 }
10676
10678 {
10680 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
10681
10682 return super.GetTemperatureThawTime();
10683 }
10684
10689
10691 {
10692 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
10693 }
10694
10696 {
10697 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
10698 }
10699
10702 {
10704 }
10705
10707 {
10709 }
10710
10712 {
10714 }
10715
10718 {
10719 return null;
10720 }
10721
10724 {
10725 return false;
10726 }
10727
10729 {
10731 {
10734 if (!trg)
10735 {
10737 explosive = this;
10738 }
10739
10740 explosive.PairRemote(trg);
10742
10743 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
10744 trg.SetPersistentPairID(persistentID);
10745 explosive.SetPersistentPairID(persistentID);
10746
10747 return true;
10748 }
10749 return false;
10750 }
10751
10754 {
10755 float ret = 1.0;
10758 ret *= GetHealth01();
10759
10760 return ret;
10761 }
10762
10763 #ifdef DEVELOPER
10764 override void SetDebugItem()
10765 {
10766 super.SetDebugItem();
10767 _itemBase = this;
10768 }
10769
10771 {
10772 string text = super.GetDebugText();
10773
10775 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
10776
10777 return text;
10778 }
10779 #endif
10780
10782 {
10783 return true;
10784 }
10785
10787
10789
10791 {
10794 }
10795
10796
10804
10820
10821 [
Obsolete(
"Use ItemSoundHandler instead")]
10824 {
10825 if (!
g_Game.IsDedicatedServer())
10826 {
10827 if (ConfigIsExisting("attachSoundSet"))
10828 {
10829 string cfg_path = "";
10830 string soundset = "";
10831 string type_name =
GetType();
10832
10835 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
10836 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
10837
10838 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
10839 {
10840 for (int i = 0; i < cfg_soundset_array.Count(); i++)
10841 {
10842 if (cfg_slot_array[i] == slot_type)
10843 {
10844 soundset = cfg_soundset_array[i];
10845 break;
10846 }
10847 }
10848 }
10849
10850 if (soundset != "")
10851 {
10852 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
10854 }
10855 }
10856 }
10857 }
10858
10860}
10861
10863{
10865 if (entity)
10866 {
10867 bool is_item = entity.IsInherited(
ItemBase);
10868 if (is_item && full_quantity)
10869 {
10872 }
10873 }
10874 else
10875 {
10877 return NULL;
10878 }
10879 return entity;
10880}
10881
10883{
10884 if (item)
10885 {
10886 if (health > 0)
10887 item.SetHealth("", "", health);
10888
10889 if (item.CanHaveTemperature())
10890 {
10892 if (item.CanFreeze())
10893 item.SetFrozen(false);
10894 }
10895
10896 if (item.HasEnergyManager())
10897 {
10898 if (quantity >= 0)
10899 {
10900 item.GetCompEM().SetEnergy0To1(quantity);
10901 }
10902 else
10903 {
10905 }
10906 }
10907 else if (item.IsMagazine())
10908 {
10909 Magazine mag = Magazine.Cast(item);
10910 if (quantity >= 0)
10911 {
10912 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
10913 }
10914 else
10915 {
10917 }
10918
10919 }
10920 else
10921 {
10922 if (quantity >= 0)
10923 {
10924 item.SetQuantityNormalized(quantity, false);
10925 }
10926 else
10927 {
10929 }
10930
10931 }
10932 }
10933}
10934
10935#ifdef DEVELOPER
10937#endif
Param4< int, int, string, int > TSelectableActionInfoWithColor
Param3 TSelectableActionInfo
bool SetAttachSoundEvent()
bool SetDetachSoundEvent()
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 IsPrepareToDelete()
override bool CanHaveTemperature()
class GP5GasMask extends MaskBase ItemBase
proto GizmoApi GetGizmoApi()
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
void StartItemSoundServer(int id, int slotId)
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)
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()
override int GetLiquidType()
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)
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 EntityAI GetAttachmentFromIndex(int index)
proto native bool GetCurrentInventoryLocation(out notnull InventoryLocation loc)
returns information about current item location
proto native bool EnumerateInventory(InventoryTraversalType tt, out array< EntityAI > items)
enumerate inventory using traversal type and filling items array
proto native CargoBase GetCargo()
cargo
static proto native EntityAI LocationCreateEntity(notnull InventoryLocation inv_loc, string type, int iSetupFlags, int iRotation)
creates new item directly at location
proto native int AttachmentCount()
Returns count of attachments attached to this item.
proto native bool FindFreeLocationFor(notnull EntityAI item, FindInventoryLocationType flags, out notnull InventoryLocation loc)
FindFreeLocationFor.
proto void SelectObject(Object object)
proto void SelectPhysics(Physics physics)
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 bool Write(void value_out)
proto bool Read(void value_in)
proto native float GetDamage(string zoneName, string healthType)
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
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
void Obsolete(string msg="")
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
vector GetPosition()
Get the world position of the Effect.
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.