5905{
5907 {
5908 return true;
5909 }
5910};
5911
5913{
5914
5915};
5916
5917
5918
5920{
5924
5926
5929
5930
5931
5932
5933
5942
5948
5953
5958
5979 protected bool m_IsResultOfSplit
5980
5982
5987
5988
5989
5991
5995
5996
5997
5999
6002
6003
6004
6010
6011
6019
6022
6023
6025
6026
6028
6029
6034
6035
6040
6042
6043
6045
6046
6048 {
6053
6054 if (!
g_Game.IsDedicatedServer())
6055 {
6057 {
6059
6061 {
6063 }
6064 }
6065
6068 }
6069
6070 m_OldLocation = null;
6071
6073 {
6075 }
6076
6077 if (ConfigIsExisting("headSelectionsToHide"))
6078 {
6081 }
6082
6084 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
6085 {
6087 }
6088
6090
6091 m_IsResultOfSplit = false;
6092
6094 }
6095
6097 {
6098 super.InitItemVariables();
6099
6105 m_Count = ConfigGetInt(
"count");
6106
6109
6114
6117
6122
6134
6138
6139
6142 if (ConfigIsExisting("canBeSplit"))
6143 {
6146 }
6147
6149 if (ConfigIsExisting("itemBehaviour"))
6151
6152
6155 RegisterNetSyncVariableInt("m_VarLiquidType");
6156 RegisterNetSyncVariableInt("m_Cleanness",0,1);
6157
6158 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
6159 RegisterNetSyncVariableFloat("m_ImpactSpeed");
6160 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
6161
6162 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
6163 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
6164 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
6165 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
6166
6167 RegisterNetSyncVariableBool("m_IsBeingPlaced");
6168 RegisterNetSyncVariableBool("m_IsTakeable");
6169 RegisterNetSyncVariableBool("m_IsHologram");
6170
6173 {
6176 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
6177 }
6178
6180
6182 if (ConfigIsExisting("temperaturePerQuantityWeight"))
6184
6186 }
6187
6189 {
6191 }
6192
6194 {
6197 {
6202 }
6203 }
6204
6205 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
6206 {
6208 {
6211 }
6212
6214 }
6215
6217 {
6223 }
6224
6226
6228 {
6230
6231 if (!action)
6232 {
6233 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
6234 return;
6235 }
6236
6238 if (!ai)
6239 {
6241 return;
6242 }
6243
6245 if (!action_array)
6246 {
6247 action_array = new array<ActionBase_Basic>;
6249 }
6250 if (LogManager.IsActionLogEnable())
6251 {
6252 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
6253 }
6254
6255 if (action_array.Find(action) != -1)
6256 {
6257 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
6258 }
6259 else
6260 {
6261 action_array.Insert(action);
6262 }
6263 }
6264
6266 {
6267 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6268 ActionBase action = player.GetActionManager().GetAction(actionName);
6271
6272 if (action_array)
6273 {
6274 action_array.RemoveItem(action);
6275 }
6276 }
6277
6278
6279
6281 {
6282 ActionOverrideData overrideData = new ActionOverrideData();
6286
6288 if (!actionMap)
6289 {
6292 }
6293
6294 actionMap.Insert(this.
Type(), overrideData);
6295
6296 }
6297
6299
6301
6302
6304 {
6307
6310
6311 string config_to_search = "CfgVehicles";
6312 string muzzle_owner_config;
6313
6315 {
6316 if (IsInherited(Weapon))
6317 config_to_search = "CfgWeapons";
6318
6319 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6320
6321 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
6322
6323 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
6324
6325 if (config_OnFire_subclass_count > 0)
6326 {
6327 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
6328
6329 for (int i = 0; i < config_OnFire_subclass_count; i++)
6330 {
6331 string particle_class = "";
6332 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
6333 string config_OnFire_entry = config_OnFire_class + particle_class;
6334 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
6335 WPOF_array.Insert(WPOF);
6336 }
6337
6338
6340 }
6341 }
6342
6344 {
6345 config_to_search = "CfgWeapons";
6346 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6347
6348 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
6349
6350 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
6351
6352 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
6353 {
6354 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
6355
6356 for (i = 0; i < config_OnBulletCasingEject_count; i++)
6357 {
6358 string particle_class2 = "";
6359 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
6360 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
6361 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
6362 WPOBE_array.Insert(WPOBE);
6363 }
6364
6365
6367 }
6368 }
6369 }
6370
6371
6373 {
6376
6378 {
6379 string config_to_search = "CfgVehicles";
6380
6381 if (IsInherited(Weapon))
6382 config_to_search = "CfgWeapons";
6383
6384 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6385 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
6386
6387 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
6388 {
6389
6391
6393 {
6395 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
6397 return;
6398 }
6399
6402
6403
6404
6405 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
6406 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
6407
6408 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
6409 {
6410 string particle_class = "";
6411 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
6412 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
6413 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
6414
6415 if (entry_type == CT_CLASS)
6416 {
6417 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
6418 WPOOH_array.Insert(WPOF);
6419 }
6420 }
6421
6422
6424 }
6425 }
6426 }
6427
6429 {
6431 }
6432
6434 {
6436 {
6438
6441
6444
6445 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6446 }
6447 }
6448
6450 {
6452 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6453
6455 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6456
6458 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6459
6461 {
6463 }
6464 }
6465
6467 {
6469 }
6470
6472 {
6475 else
6477
6479 {
6482 }
6483 else
6484 {
6487
6490 }
6491
6493 }
6494
6496 {
6498 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6499 }
6500
6502 {
6504 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6506 }
6507
6509 {
6511 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6512 }
6513
6515 {
6518
6519 OverheatingParticle OP = new OverheatingParticle();
6524
6526 }
6527
6529 {
6532
6533 return -1;
6534 }
6535
6537 {
6539 {
6542
6543 for (int i = count; i > 0; --i)
6544 {
6545 int id = i - 1;
6548
6551
6552 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
6553 {
6554 if (p)
6555 {
6558 }
6559 }
6560 }
6561 }
6562 }
6563
6565 {
6567 {
6569 {
6570 int id = i - 1;
6572
6573 if (OP)
6574 {
6576
6577 if (p)
6578 {
6580 }
6581
6582 delete OP;
6583 }
6584 }
6585
6588 }
6589 }
6590
6593 {
6594 return 0.0;
6595 }
6596
6597
6599 {
6600 return 250;
6601 }
6602
6604 {
6605 return 0;
6606 }
6607
6610 {
6612 return true;
6613
6614 return false;
6615 }
6616
6619 {
6622
6624 {
6626 }
6627 else
6628 {
6629
6631 }
6632
6634 }
6635
6642 {
6643 return -1;
6644 }
6645
6646
6647
6648
6650 {
6652 {
6653 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6654 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6655
6656 if (r_index >= 0)
6657 {
6658 InventoryLocation r_il = new InventoryLocation;
6659 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6660
6661 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6664 {
6665 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6666 }
6668 {
6669 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6670 }
6671
6672 }
6673
6674 player.GetHumanInventory().ClearUserReservedLocation(this);
6675 }
6676
6679 }
6680
6681
6682
6683
6685 {
6686 return ItemBase.m_DebugActionsMask;
6687 }
6688
6690 {
6691 return ItemBase.m_DebugActionsMask & mask;
6692 }
6693
6695 {
6696 ItemBase.m_DebugActionsMask = mask;
6697 }
6698
6700 {
6701 ItemBase.m_DebugActionsMask |= mask;
6702 }
6703
6705 {
6706 ItemBase.m_DebugActionsMask &= ~mask;
6707 }
6708
6710 {
6712 {
6714 }
6715 else
6716 {
6718 }
6719 }
6720
6721
6723 {
6724 if (GetEconomyProfile())
6725 {
6726 float q_max = GetEconomyProfile().GetQuantityMax();
6727 if (q_max > 0)
6728 {
6729 float q_min = GetEconomyProfile().GetQuantityMin();
6730 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
6731
6733 {
6734 ComponentEnergyManager comp = GetCompEM();
6736 {
6738 }
6739 }
6741 {
6743
6744 }
6745
6746 }
6747 }
6748 }
6749
6752 {
6753 EntityAI parent = GetHierarchyParent();
6754
6755 if (parent)
6756 {
6757 InventoryLocation inventory_location_to_lock = new InventoryLocation;
6758 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
6759 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
6760 }
6761 }
6762
6765 {
6766 EntityAI parent = GetHierarchyParent();
6767
6768 if (parent)
6769 {
6770 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
6771 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
6772 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
6773 }
6774 }
6775
6777 {
6778
6779
6780
6781
6783
6785 {
6786 if (ScriptInputUserData.CanStoreInputUserData())
6787 {
6788 ScriptInputUserData ctx = new ScriptInputUserData;
6794 ctx.
Write(use_stack_max);
6797
6799 {
6800 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
6801 }
6802 }
6803 }
6804 else if (!
g_Game.IsMultiplayer())
6805 {
6807 }
6808 }
6809
6811 {
6813 }
6814
6816 {
6818 }
6819
6821 {
6823 }
6824
6826 {
6827
6828 return false;
6829 }
6830
6832 {
6833 return false;
6834 }
6835
6839 {
6840 return false;
6841 }
6842
6844 {
6845 return "";
6846 }
6847
6849
6851 {
6852 return false;
6853 }
6854
6856 {
6857 return true;
6858 }
6859
6860
6861
6863 {
6864 return true;
6865 }
6866
6868 {
6869 return true;
6870 }
6871
6873 {
6874 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6876 }
6877
6879 {
6881 }
6882
6884 {
6886 if (!is_being_placed)
6888 SetSynchDirty();
6889 }
6890
6891
6893
6895 {
6897 }
6898
6900 {
6902 }
6903
6905 {
6906 return 1;
6907 }
6908
6910 {
6911 return false;
6912 }
6913
6915 {
6917 SetSynchDirty();
6918 }
6919
6920
6921
6922
6923
6924
6925
6926
6927
6928
6929
6930
6931
6932
6933
6934
6935
6936
6937
6938
6939
6940
6941
6942
6943
6944
6945
6946
6947
6948
6949
6950
6951
6952
6953
6955 {
6956 super.OnMovedInsideCargo(container);
6957
6958 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6959 }
6960
6961 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
6962 {
6963 super.EEItemLocationChanged(oldLoc, newLoc);
6964
6965 PlayerBase newPlayer = null;
6966 PlayerBase oldPlayer = null;
6967
6968 if (newLoc.GetParent())
6969 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
6970
6971 if (oldLoc.GetParent())
6972 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
6973
6975 {
6976 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
6977
6978 if (rIndex >= 0)
6979 {
6980 InventoryLocation rIl = new InventoryLocation;
6981 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
6982
6983 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
6986 {
6987 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
6988 }
6990 {
6992 }
6993
6994 }
6995 }
6996
6998 {
6999 if (newPlayer)
7000 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
7001
7002 if (newPlayer == oldPlayer)
7003 {
7004 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
7005 {
7007 {
7008 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
7009 {
7010 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7011 }
7012 }
7013 else
7014 {
7015 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7016 }
7017 }
7018
7019 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
7020 {
7021 int type = oldLoc.GetType();
7023 {
7024 oldLoc.GetParent().GetOnSetLock().Invoke(this);
7025 }
7027 {
7028 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
7029 }
7030 }
7031 if (!m_OldLocation)
7032 {
7033 m_OldLocation = new InventoryLocation;
7034 }
7035 m_OldLocation.Copy(oldLoc);
7036 }
7037 else
7038 {
7039 if (m_OldLocation)
7040 {
7041 m_OldLocation.Reset();
7042 }
7043 }
7044
7045 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
7046 }
7047 else
7048 {
7049 if (newPlayer)
7050 {
7051 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
7052 if (resIndex >= 0)
7053 {
7054 InventoryLocation il = new InventoryLocation;
7055 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
7057 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
7060 {
7061 il.
GetParent().GetOnReleaseLock().Invoke(it);
7062 }
7064 {
7066 }
7067
7068 }
7069 }
7071 {
7072
7074 }
7075
7076 if (m_OldLocation)
7077 {
7078 m_OldLocation.Reset();
7079 }
7080 }
7081
7083 {
7084 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
7085 }
7086
7088 {
7089 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
7090 }
7091 }
7092
7093 override void EOnContact(IEntity other, Contact extra)
7094 {
7096 {
7097 int liquidType = -1;
7099 if (impactSpeed > 0.0)
7100 {
7102 #ifndef SERVER
7104 #else
7106 SetSynchDirty();
7107 #endif
7109 }
7110 }
7111
7112 #ifdef SERVER
7113 if (GetCompEM() && GetCompEM().IsPlugged())
7114 {
7115 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
7116 GetCompEM().UnplugThis();
7117 }
7118 #endif
7119 }
7120
7122
7124 {
7126 }
7127
7129 {
7130
7131 }
7132
7134 {
7135 super.OnItemLocationChanged(old_owner, new_owner);
7136
7137 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
7138 PlayerBase playerNew = PlayerBase.Cast(new_owner);
7139
7140 if (!relatedPlayer && playerNew)
7141 relatedPlayer = playerNew;
7142
7143 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
7144 {
7146 if (actionMgr)
7147 {
7148 ActionBase currentAction = actionMgr.GetRunningAction();
7149 if (currentAction)
7151 }
7152 }
7153
7154 Man ownerPlayerOld = null;
7155 Man ownerPlayerNew = null;
7156
7157 if (old_owner)
7158 {
7159 if (old_owner.
IsMan())
7160 {
7161 ownerPlayerOld = Man.Cast(old_owner);
7162 }
7163 else
7164 {
7165 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
7166 }
7167 }
7168 else
7169 {
7171 {
7173
7174 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
7175 {
7176 GetCompEM().UnplugThis();
7177 }
7178 }
7179 }
7180
7181 if (new_owner)
7182 {
7183 if (new_owner.
IsMan())
7184 {
7185 ownerPlayerNew = Man.Cast(new_owner);
7186 }
7187 else
7188 {
7189 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
7190 }
7191 }
7192
7193 if (ownerPlayerOld != ownerPlayerNew)
7194 {
7195 if (ownerPlayerOld)
7196 {
7197 array<EntityAI> subItemsExit = new array<EntityAI>;
7199 for (int i = 0; i < subItemsExit.Count(); i++)
7200 {
7203 }
7204 }
7205
7206 if (ownerPlayerNew)
7207 {
7208 array<EntityAI> subItemsEnter = new array<EntityAI>;
7210 for (int j = 0; j < subItemsEnter.Count(); j++)
7211 {
7214 }
7215 }
7216 }
7217 else if (ownerPlayerNew != null)
7218 {
7219 PlayerBase nplayer;
7220 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
7221 {
7222 array<EntityAI> subItemsUpdate = new array<EntityAI>;
7224 for (int k = 0; k < subItemsUpdate.Count(); k++)
7225 {
7227 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
7228 }
7229 }
7230 }
7231
7232 if (old_owner)
7233 old_owner.OnChildItemRemoved(this);
7234 if (new_owner)
7235 new_owner.OnChildItemReceived(this);
7236 }
7237
7238
7240 {
7241 super.EEDelete(parent);
7242 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
7243 if (player)
7244 {
7246
7247 if (player.IsAlive())
7248 {
7249 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7250 if (r_index >= 0)
7251 {
7252 InventoryLocation r_il = new InventoryLocation;
7253 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7254
7255 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7258 {
7259 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7260 }
7262 {
7263 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7264 }
7265
7266 }
7267
7268 player.RemoveQuickBarEntityShortcut(this);
7269 }
7270 }
7271 }
7272
7274 {
7275 super.EEKilled(killer);
7276
7279 {
7280 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
7281 {
7282 if (IsMagazine())
7283 {
7284 if (Magazine.Cast(this).GetAmmoCount() > 0)
7285 {
7287 }
7288 }
7289 else
7290 {
7292 }
7293 }
7294 }
7295 }
7296
7298 {
7299 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7300
7301 super.OnWasAttached(parent, slot_id);
7302
7305
7308 }
7309
7311 {
7312 super.OnWasDetached(parent, slot_id);
7313
7316
7319 }
7320
7322 {
7323 int idx;
7326
7327 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7328 if (inventory_slots.Count() < 1)
7329 {
7330 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
7331 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
7332 }
7333 else
7334 {
7335 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
7336 }
7337
7338 idx = inventory_slots.Find(slot);
7339 if (idx < 0)
7340 return "";
7341
7342 return attach_types.Get(idx);
7343 }
7344
7346 {
7347 int idx = -1;
7348 string slot;
7349
7352
7353 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7354 if (inventory_slots.Count() < 1)
7355 {
7356 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
7357 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7358 }
7359 else
7360 {
7361 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
7362 if (detach_types.Count() < 1)
7363 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7364 }
7365
7366 for (int i = 0; i < inventory_slots.Count(); i++)
7367 {
7368 slot = inventory_slots.Get(i);
7369 }
7370
7371 if (slot != "")
7372 {
7373 if (detach_types.Count() == 1)
7374 idx = 0;
7375 else
7376 idx = inventory_slots.Find(slot);
7377 }
7378 if (idx < 0)
7379 return "";
7380
7381 return detach_types.Get(idx);
7382 }
7383
7385 {
7386
7388
7389
7390 float min_time = 1;
7391 float max_time = 3;
7392 float delay = Math.RandomFloat(min_time, max_time);
7393
7394 explode_timer.Run(delay, this, "DoAmmoExplosion");
7395 }
7396
7398 {
7399 Magazine magazine = Magazine.Cast(this);
7400 int pop_sounds_count = 6;
7401 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
7402
7403
7404 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
7405 string sound_name = pop_sounds[ sound_idx ];
7406 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
7407
7408
7409 magazine.ServerAddAmmoCount(-1);
7410
7411
7412 float min_temp_to_explode = 100;
7413
7414 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
7415 {
7417 }
7418 }
7419
7420
7421 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
7422 {
7423 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
7424
7425 const int CHANCE_DAMAGE_CARGO = 4;
7426 const int CHANCE_DAMAGE_ATTACHMENT = 1;
7427 const int CHANCE_DAMAGE_NOTHING = 2;
7428
7430 {
7431 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
7432 int chances;
7433 int rnd;
7434
7435 if (GetInventory().GetCargo())
7436 {
7437 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7438 rnd = Math.RandomInt(0,chances);
7439
7440 if (rnd < CHANCE_DAMAGE_CARGO)
7441 {
7443 }
7444 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
7445 {
7447 }
7448 }
7449 else
7450 {
7451 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7452 rnd = Math.RandomInt(0,chances);
7453
7454 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
7455 {
7457 }
7458 }
7459 }
7460 }
7461
7463 {
7464 CargoBase cargo = GetInventory().GetCargo();
7465 if (cargo)
7466 {
7468 if (item_count > 0)
7469 {
7470 int random_pick = Math.RandomInt(0, item_count);
7472 if (!item.IsExplosive())
7473 {
7474 item.AddHealth("","",damage);
7475 return true;
7476 }
7477 }
7478 }
7479 return false;
7480 }
7481
7483 {
7484 GameInventory inventory = GetInventory();
7486 if (attachment_count > 0)
7487 {
7488 int random_pick = Math.RandomInt(0, attachment_count);
7490 if (!attachment.IsExplosive())
7491 {
7492 attachment.AddHealth("","",damage);
7493 return true;
7494 }
7495 }
7496 return false;
7497 }
7498
7500 {
7502 }
7503
7505 {
7507 return GetInventory().CanRemoveEntity();
7508
7509 return false;
7510 }
7511
7513 {
7514
7516 return false;
7517
7518
7520 return false;
7521
7522
7523
7525 if (delta == 0)
7526 return false;
7527
7528
7529 return true;
7530 }
7531
7533 {
7535 {
7536 if (ScriptInputUserData.CanStoreInputUserData())
7537 {
7538 ScriptInputUserData ctx = new ScriptInputUserData;
7543 ctx.
Write(destination_entity);
7547 }
7548 }
7549 else if (!
g_Game.IsMultiplayer())
7550 {
7552 }
7553 }
7554
7556 {
7557 float split_quantity_new;
7561 InventoryLocation loc = new InventoryLocation;
7562
7563 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7564 {
7566 split_quantity_new = stack_max;
7567 else
7569
7571 {
7572 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7573 if (new_item)
7574 {
7575 new_item.SetResultOfSplit(true);
7576 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7578 new_item.
SetQuantity(split_quantity_new,
false,
true);
7579 }
7580 }
7581 }
7582 else if (destination_entity && slot_id == -1)
7583 {
7584 if (quantity > stack_max)
7585 split_quantity_new = stack_max;
7586 else
7587 split_quantity_new = quantity;
7588
7590 {
7591 GameInventory destinationInventory = destination_entity.GetInventory();
7593 {
7596 }
7597
7598 if (new_item)
7599 {
7600 new_item.SetResultOfSplit(true);
7601 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7603 new_item.
SetQuantity(split_quantity_new,
false,
true);
7604 }
7605 }
7606 }
7607 else
7608 {
7609 if (stack_max != 0)
7610 {
7612 {
7614 }
7615
7616 if (split_quantity_new == 0)
7617 {
7618 if (!
g_Game.IsMultiplayer())
7619 player.PhysicalPredictiveDropItem(this);
7620 else
7621 player.ServerDropEntity(this);
7622 return;
7623 }
7624
7626 {
7628
7629 if (new_item)
7630 {
7631 new_item.SetResultOfSplit(true);
7632 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7635 new_item.PlaceOnSurface();
7636 }
7637 }
7638 }
7639 }
7640 }
7641
7643 {
7644 float split_quantity_new;
7648 InventoryLocation loc = new InventoryLocation;
7649
7650 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7651 {
7653 split_quantity_new = stack_max;
7654 else
7656
7658 {
7659 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7660 if (new_item)
7661 {
7662 new_item.SetResultOfSplit(true);
7663 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7665 new_item.
SetQuantity(split_quantity_new,
false,
true);
7666 }
7667 }
7668 }
7669 else if (destination_entity && slot_id == -1)
7670 {
7671 if (quantity > stack_max)
7672 split_quantity_new = stack_max;
7673 else
7674 split_quantity_new = quantity;
7675
7677 {
7678 GameInventory destinationInventory = destination_entity.GetInventory();
7680 {
7683 }
7684
7685 if (new_item)
7686 {
7687 new_item.SetResultOfSplit(true);
7688 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7690 new_item.
SetQuantity(split_quantity_new,
false,
true);
7691 }
7692 }
7693 }
7694 else
7695 {
7696 if (stack_max != 0)
7697 {
7699 {
7701 }
7702
7704 {
7706
7707 if (new_item)
7708 {
7709 new_item.SetResultOfSplit(true);
7710 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7713 new_item.PlaceOnSurface();
7714 }
7715 }
7716 }
7717 }
7718 }
7719
7721 {
7723 {
7724 if (ScriptInputUserData.CanStoreInputUserData())
7725 {
7726 ScriptInputUserData ctx = new ScriptInputUserData;
7731 dst.WriteToContext(ctx);
7733 }
7734 }
7735 else if (!
g_Game.IsMultiplayer())
7736 {
7738 }
7739 }
7740
7742 {
7744 {
7745 if (ScriptInputUserData.CanStoreInputUserData())
7746 {
7747 ScriptInputUserData ctx = new ScriptInputUserData;
7752 ctx.
Write(destination_entity);
7758 }
7759 }
7760 else if (!
g_Game.IsMultiplayer())
7761 {
7763 }
7764 }
7765
7767 {
7769 }
7770
7772 {
7774 float split_quantity_new;
7776 if (dst.IsValid())
7777 {
7778 int slot_id = dst.GetSlot();
7780
7781 if (quantity > stack_max)
7782 split_quantity_new = stack_max;
7783 else
7784 split_quantity_new = quantity;
7785
7787 {
7789
7790 if (new_item)
7791 {
7792 new_item.SetResultOfSplit(true);
7793 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7795 new_item.
SetQuantity(split_quantity_new,
false,
true);
7796 }
7797
7798 return new_item;
7799 }
7800 }
7801
7802 return null;
7803 }
7804
7806 {
7808 float split_quantity_new;
7810 if (destination_entity)
7811 {
7813 if (quantity > stackable)
7814 split_quantity_new = stackable;
7815 else
7816 split_quantity_new = quantity;
7817
7819 {
7820 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
7821 if (new_item)
7822 {
7823 new_item.SetResultOfSplit(true);
7824 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7826 new_item.
SetQuantity(split_quantity_new,
false,
true);
7827 }
7828 }
7829 }
7830 }
7831
7833 {
7835 {
7836 if (ScriptInputUserData.CanStoreInputUserData())
7837 {
7838 ScriptInputUserData ctx = new ScriptInputUserData;
7843 ItemBase destination_entity =
this;
7844 ctx.
Write(destination_entity);
7848 }
7849 }
7850 else if (!
g_Game.IsMultiplayer())
7851 {
7853 }
7854 }
7855
7857 {
7859 float split_quantity_new;
7861 if (player)
7862 {
7864 if (quantity > stackable)
7865 split_quantity_new = stackable;
7866 else
7867 split_quantity_new = quantity;
7868
7870 {
7871 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
7872 new_item =
ItemBase.Cast(in_hands);
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 float split_quantity_new = Math.Floor(quantity * 0.5);
7888
7890 return;
7891
7893
7894 if (new_item)
7895 {
7896 if (new_item.GetQuantityMax() < split_quantity_new)
7897 {
7898 split_quantity_new = new_item.GetQuantityMax();
7899 }
7900
7901 new_item.SetResultOfSplit(true);
7902 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7903
7905 {
7908 }
7909 else
7910 {
7912 new_item.
SetQuantity(split_quantity_new,
false,
true);
7913 }
7914 }
7915 }
7916
7918 {
7920 float split_quantity_new = Math.Floor(quantity / 2);
7921
7923 return;
7924
7925 InventoryLocation invloc = new InventoryLocation;
7927
7929 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
7930
7931 if (new_item)
7932 {
7933 if (new_item.GetQuantityMax() < split_quantity_new)
7934 {
7935 split_quantity_new = new_item.GetQuantityMax();
7936 }
7938 {
7941 }
7942 else if (split_quantity_new > 1)
7943 {
7945 new_item.
SetQuantity(split_quantity_new,
false,
true);
7946 }
7947 }
7948 }
7949
7952 {
7953 SetWeightDirty();
7955
7956 if (parent)
7957 parent.OnAttachmentQuantityChangedEx(this, delta);
7958
7960 {
7962 {
7964 }
7966 {
7967 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
7969 }
7970 }
7971 }
7972
7975 {
7976
7977 }
7978
7981 {
7983 }
7984
7986 {
7987 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
7988
7990 {
7991 if (newLevel == GameConstants.STATE_RUINED)
7992 {
7994 EntityAI parent = GetHierarchyParent();
7995 if (parent && parent.IsFireplace())
7996 {
7997 CargoBase cargo = GetInventory().GetCargo();
7998 if (cargo)
7999 {
8001 {
8003 }
8004 }
8005 }
8006 }
8007
8009 {
8010
8012 return;
8013 }
8014
8015 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
8016 {
8018 }
8019 }
8020 }
8021
8022
8024 {
8025 super.OnRightClick();
8026
8028 {
8030 {
8031 if (ScriptInputUserData.CanStoreInputUserData())
8032 {
8033 EntityAI root = GetHierarchyRoot();
8034 Man playerOwner = GetHierarchyRootPlayer();
8035 InventoryLocation dst = new InventoryLocation;
8036
8037
8038 if (!playerOwner && root && root == this)
8039 {
8041 }
8042 else
8043 {
8044
8045 GetInventory().GetCurrentInventoryLocation(dst);
8047 {
8048 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8050 {
8052 }
8053 else
8054 {
8056
8057
8058 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
8059 {
8061 }
8062 else
8063 {
8064 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
8065 }
8066 }
8067 }
8068 }
8069
8070 ScriptInputUserData ctx = new ScriptInputUserData;
8078 }
8079 }
8080 else if (!
g_Game.IsMultiplayer())
8081 {
8083 }
8084 }
8085 }
8086
8088 {
8089 if (root)
8090 {
8091 vector m4[4];
8092 root.GetTransform(m4);
8093 dst.SetGround(this, m4);
8094 }
8095 else
8096 {
8097 GetInventory().GetCurrentInventoryLocation(dst);
8098 }
8099 }
8100
8101 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
8102 {
8103
8104 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
8105 return false;
8106
8107 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
8108 return false;
8109
8110
8112 return false;
8113
8114
8115 Magazine mag = Magazine.Cast(this);
8116 if (mag)
8117 {
8118 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
8119 return false;
8120
8121 if (stack_max_limit)
8122 {
8123 Magazine other_mag = Magazine.Cast(other_item);
8124 if (other_item)
8125 {
8126 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
8127 return false;
8128 }
8129
8130 }
8131 }
8132 else
8133 {
8134
8136 return false;
8137
8139 return false;
8140 }
8141
8142 PlayerBase player = null;
8143 if (CastTo(player, GetHierarchyRootPlayer()))
8144 {
8145 if (player.GetInventory().HasAttachment(this))
8146 return false;
8147
8148 if (player.IsItemsToDelete())
8149 return false;
8150 }
8151
8152 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
8153 return false;
8154
8155 int slotID;
8157 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
8158 return false;
8159
8160 return true;
8161 }
8162
8164 {
8166 }
8167
8169 {
8170 return m_IsResultOfSplit;
8171 }
8172
8174 {
8175 m_IsResultOfSplit = value;
8176 }
8177
8179 {
8181 }
8182
8184 {
8185 float other_item_quantity = other_item.GetQuantity();
8186 float this_free_space;
8187
8189
8191
8192 if (other_item_quantity > this_free_space)
8193 {
8194 return this_free_space;
8195 }
8196 else
8197 {
8198 return other_item_quantity;
8199 }
8200 }
8201
8203 {
8205 }
8206
8208 {
8210 return;
8211
8212 if (!IsMagazine() && other_item)
8213 {
8215 if (quantity_used != 0)
8216 {
8217 float hp1 = GetHealth01("","");
8218 float hp2 = other_item.GetHealth01("","");
8219 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
8220 hpResult = hpResult / (
GetQuantity() + quantity_used);
8221
8222 hpResult *= GetMaxHealth();
8223 Math.Round(hpResult);
8224 SetHealth("", "Health", hpResult);
8225
8227 other_item.AddQuantity(-quantity_used);
8228 }
8229 }
8231 }
8232
8234 {
8235 #ifdef SERVER
8236 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
8237 GetHierarchyParent().IncreaseLifetimeUp();
8238 #endif
8239 };
8240
8242 {
8243 PlayerBase p = PlayerBase.Cast(player);
8244
8245 array<int> recipesIds = p.m_Recipes;
8246 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8247 if (moduleRecipesManager)
8248 {
8249 EntityAI itemInHands = player.GetEntityInHands();
8250 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
8251 }
8252
8253 for (int i = 0;i < recipesIds.Count(); i++)
8254 {
8255 int key = recipesIds.Get(i);
8256 string recipeName = moduleRecipesManager.GetRecipeName(key);
8258 }
8259 }
8260
8261
8262 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
8263 {
8264 super.GetDebugActions(outputList);
8265
8266
8272
8273
8278
8283
8284
8288
8289
8291 {
8295 }
8296
8299
8300
8304
8306
8307 InventoryLocation loc = new InventoryLocation();
8308 GetInventory().GetCurrentInventoryLocation(loc);
8310 {
8311 if (Gizmo_IsSupported())
8314 }
8315
8317 }
8318
8319
8320
8321
8323 {
8324 super.OnAction(action_id, player, ctx);
8325
8327 {
8328 switch (action_id)
8329 {
8333 return true;
8337 return true;
8338 }
8339 }
8340
8342 {
8343 switch (action_id)
8344 {
8346 Delete();
8347 return true;
8348 }
8349 }
8350
8351 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
8352 {
8353 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8354 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
8355 PlayerBase p = PlayerBase.Cast(player);
8356 if (
EActions.RECIPES_RANGE_START < 1000)
8357 {
8358 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
8359 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
8360 }
8361 }
8362 #ifndef SERVER
8363 else if (action_id ==
EActions.WATCH_PLAYER)
8364 {
8365 PluginDeveloper.SetDeveloperItemClientEx(player);
8366 }
8367 #endif
8369 {
8370 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
8371 {
8372 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
8373 OnDebugButtonPressServer(id + 1);
8374 }
8375
8376 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
8377 {
8378 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
8380 }
8381
8382 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
8383 {
8384 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
8386 }
8387
8388 else if (action_id ==
EActions.ADD_QUANTITY)
8389 {
8390 if (IsMagazine())
8391 {
8392 Magazine mag = Magazine.Cast(this);
8393 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
8394 }
8395 else
8396 {
8398 }
8399
8400 if (m_EM)
8401 {
8402 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
8403 }
8404
8405 }
8406
8407 else if (action_id ==
EActions.REMOVE_QUANTITY)
8408 {
8409 if (IsMagazine())
8410 {
8411 Magazine mag2 = Magazine.Cast(this);
8412 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
8413 }
8414 else
8415 {
8417 }
8418 if (m_EM)
8419 {
8420 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
8421 }
8422
8423 }
8424
8425 else if (action_id ==
EActions.SET_QUANTITY_0)
8426 {
8428
8429 if (m_EM)
8430 {
8431 m_EM.SetEnergy(0);
8432 }
8433 }
8434
8435 else if (action_id ==
EActions.SET_MAX_QUANTITY)
8436 {
8438
8439 if (m_EM)
8440 {
8441 m_EM.SetEnergy(m_EM.GetEnergyMax());
8442 }
8443 }
8444
8445 else if (action_id ==
EActions.ADD_HEALTH)
8446 {
8447 AddHealth("","",GetMaxHealth("","Health")/5);
8448 }
8449 else if (action_id ==
EActions.REMOVE_HEALTH)
8450 {
8451 AddHealth("","",-GetMaxHealth("","Health")/5);
8452 }
8453 else if (action_id ==
EActions.DESTROY_HEALTH)
8454 {
8455 SetHealth01("","",0);
8456 }
8457 else if (action_id ==
EActions.WATCH_ITEM)
8458 {
8460 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
8461 #ifdef DEVELOPER
8462 SetDebugDeveloper_item(this);
8463 #endif
8464 }
8465
8466 else if (action_id ==
EActions.ADD_TEMPERATURE)
8467 {
8468 AddTemperature(20);
8469
8470 }
8471
8472 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
8473 {
8474 AddTemperature(-20);
8475
8476 }
8477
8478 else if (action_id ==
EActions.FLIP_FROZEN)
8479 {
8480 SetFrozen(!GetIsFrozen());
8481
8482 }
8483
8484 else if (action_id ==
EActions.ADD_WETNESS)
8485 {
8487
8488 }
8489
8490 else if (action_id ==
EActions.REMOVE_WETNESS)
8491 {
8493
8494 }
8495
8496 else if (action_id ==
EActions.LIQUIDTYPE_UP)
8497 {
8500
8501
8502 }
8503
8504 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
8505 {
8508 }
8509
8510 else if (action_id ==
EActions.MAKE_SPECIAL)
8511 {
8512 auto debugParams = DebugSpawnParams.WithPlayer(player);
8513 OnDebugSpawnEx(debugParams);
8514 }
8515
8516 }
8517
8518
8519 return false;
8520 }
8521
8522
8523
8524
8528
8531
8532
8533
8535 {
8536 return false;
8537 }
8538
8539
8541 {
8542 return true;
8543 }
8544
8545
8547 {
8548 return true;
8549 }
8550
8551
8552
8554 {
8555 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
8556 return g_Game.ConfigIsExisting(config_path);
8557 }
8558
8561 {
8562 return null;
8563 }
8564
8566 {
8567 return false;
8568 }
8569
8571 {
8572 return false;
8573 }
8574
8578
8579
8581 {
8582 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8583 return module_repairing.CanRepair(this, item_repair_kit);
8584 }
8585
8586
8587 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
8588 {
8589 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8590 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
8591 }
8592
8593
8595 {
8596
8597
8598
8599
8600
8601
8602
8603
8604 return 1;
8605 }
8606
8607
8608
8610 {
8612 }
8613
8614
8615
8617 {
8619 }
8620
8621
8630 {
8631 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8632
8633 if (player)
8634 {
8635 player.MessageStatus(text);
8636 }
8637 }
8638
8639
8648 {
8649 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8650
8651 if (player)
8652 {
8653 player.MessageAction(text);
8654 }
8655 }
8656
8657
8666 {
8667 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8668
8669 if (player)
8670 {
8671 player.MessageFriendly(text);
8672 }
8673 }
8674
8675
8684 {
8685 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8686
8687 if (player)
8688 {
8689 player.MessageImportant(text);
8690 }
8691 }
8692
8694 {
8695 return true;
8696 }
8697
8698
8699 override bool KindOf(
string tag)
8700 {
8701 bool found = false;
8702 string item_name = this.
GetType();
8704 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
8705
8706 int array_size = item_tag_array.Count();
8707 for (int i = 0; i < array_size; i++)
8708 {
8709 if (item_tag_array.Get(i) == tag)
8710 {
8711 found = true;
8712 break;
8713 }
8714 }
8715 return found;
8716 }
8717
8718
8720 {
8721
8722 super.OnRPC(sender, rpc_type,ctx);
8723
8724
8725 switch (rpc_type)
8726 {
8727 #ifndef SERVER
8728 case ERPCs.RPC_SOUND_LOCK_ATTACH:
8729 Param2<bool, string> p = new Param2<bool, string>(false, "");
8730
8732 return;
8733
8734 bool play = p.param1;
8735 string soundSet = p.param2;
8736
8737 if (play)
8738 {
8740 {
8742 {
8744 }
8745 }
8746 else
8747 {
8749 }
8750 }
8751 else
8752 {
8754 }
8755
8756 break;
8757 #endif
8758
8759 }
8760
8762 {
8764 }
8765 }
8766
8767
8768
8769
8771 {
8772 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8773 return plugin.GetID(
name);
8774 }
8775
8777 {
8778 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8779 return plugin.GetName(id);
8780 }
8781
8784 {
8785
8786
8787 int varFlags;
8788 if (!ctx.
Read(varFlags))
8789 return;
8790
8791 if (varFlags & ItemVariableFlags.FLOAT)
8792 {
8794 }
8795 }
8796
8798 {
8799
8800 super.SerializeNumericalVars(floats_out);
8801
8802
8803
8805 {
8807 }
8808
8810 {
8812 }
8813
8815 {
8817 }
8818
8820 {
8825 }
8826
8828 {
8830 }
8831 }
8832
8834 {
8835
8836 super.DeSerializeNumericalVars(floats);
8837
8838
8839 int index = 0;
8840 int mask = Math.Round(floats.Get(index));
8841
8842 index++;
8843
8845 {
8847 {
8849 }
8850 else
8851 {
8852 float quantity = floats.Get(index);
8854 }
8855 index++;
8856 }
8857
8859 {
8860 float wet = floats.Get(index);
8862 index++;
8863 }
8864
8866 {
8867 int liquidtype = Math.Round(floats.Get(index));
8869 index++;
8870 }
8871
8873 {
8875 index++;
8877 index++;
8879 index++;
8881 index++;
8882 }
8883
8885 {
8886 int cleanness = Math.Round(floats.Get(index));
8888 index++;
8889 }
8890 }
8891
8893 {
8894 super.WriteVarsToCTX(ctx);
8895
8896
8898 {
8900 }
8901
8903 {
8905 }
8906
8908 {
8910 }
8911
8913 {
8914 int r,g,b,a;
8920 }
8921
8923 {
8925 }
8926 }
8927
8929 {
8930 if (!super.ReadVarsFromCTX(ctx,version))
8931 return false;
8932
8933 int intValue;
8934 float value;
8935
8936 if (version < 140)
8937 {
8938 if (!ctx.
Read(intValue))
8939 return false;
8940
8941 m_VariablesMask = intValue;
8942 }
8943
8945 {
8946 if (!ctx.
Read(value))
8947 return false;
8948
8950 {
8952 }
8953 else
8954 {
8956 }
8957 }
8958
8959 if (version < 140)
8960 {
8962 {
8963 if (!ctx.
Read(value))
8964 return false;
8965 SetTemperatureDirect(value);
8966 }
8967 }
8968
8970 {
8971 if (!ctx.
Read(value))
8972 return false;
8974 }
8975
8977 {
8978 if (!ctx.
Read(intValue))
8979 return false;
8981 }
8982
8984 {
8985 int r,g,b,a;
8987 return false;
8989 return false;
8991 return false;
8993 return false;
8994
8996 }
8997
8999 {
9000 if (!ctx.
Read(intValue))
9001 return false;
9003 }
9004
9005 if (version >= 138 && version < 140)
9006 {
9008 {
9009 if (!ctx.
Read(intValue))
9010 return false;
9011 SetFrozen(intValue);
9012 }
9013 }
9014
9015 return true;
9016 }
9017
9018
9020 {
9023 {
9025 }
9026
9027 if (!super.OnStoreLoad(ctx, version))
9028 {
9030 return false;
9031 }
9032
9033 if (version >= 114)
9034 {
9035 bool hasQuickBarIndexSaved;
9036
9037 if (!ctx.
Read(hasQuickBarIndexSaved))
9038 {
9040 return false;
9041 }
9042
9043 if (hasQuickBarIndexSaved)
9044 {
9045 int itmQBIndex;
9046
9047
9048 if (!ctx.
Read(itmQBIndex))
9049 {
9051 return false;
9052 }
9053
9054 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
9055 if (itmQBIndex != -1 && parentPlayer)
9056 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
9057 }
9058 }
9059 else
9060 {
9061
9062 PlayerBase player;
9063 int itemQBIndex;
9064 if (version ==
int.
MAX)
9065 {
9066 if (!ctx.
Read(itemQBIndex))
9067 {
9069 return false;
9070 }
9071 }
9072 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
9073 {
9074
9075 if (!ctx.
Read(itemQBIndex))
9076 {
9078 return false;
9079 }
9080 if (itemQBIndex != -1 && player)
9081 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
9082 }
9083 }
9084
9085 if (version < 140)
9086 {
9087
9088 if (!LoadVariables(ctx, version))
9089 {
9091 return false;
9092 }
9093 }
9094
9095
9097 {
9099 return false;
9100 }
9101 if (version >= 132)
9102 {
9104 if (raib)
9105 {
9107 {
9109 return false;
9110 }
9111 }
9112 }
9113
9115 return true;
9116 }
9117
9118
9119
9121 {
9122 super.OnStoreSave(ctx);
9123
9124 PlayerBase player;
9125 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
9126 {
9128
9129 int itemQBIndex = -1;
9130 itemQBIndex = player.FindQuickBarEntityIndex(this);
9131 ctx.
Write(itemQBIndex);
9132 }
9133 else
9134 {
9136 }
9137
9139
9141 if (raib)
9142 {
9144 }
9145 }
9146
9147
9149 {
9150 super.AfterStoreLoad();
9151
9153 {
9155 }
9156
9158 {
9161 }
9162 }
9163
9165 {
9166 super.EEOnAfterLoad();
9167
9169 {
9171 }
9172
9175 }
9176
9178 {
9179 return false;
9180 }
9181
9182
9183
9185 {
9187 {
9188 #ifdef PLATFORM_CONSOLE
9189
9191 {
9193 if (menu)
9194 {
9196 }
9197 }
9198 #endif
9199 }
9200
9202 {
9205 }
9206
9208 {
9209 SetWeightDirty();
9211 }
9213 {
9216 }
9217
9219 {
9222
9225 }
9227 {
9231 }
9232
9233 super.OnVariablesSynchronized();
9234 }
9235
9236
9237
9239 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
9240 {
9241 if (!IsServerCheck(allow_client))
9242 return false;
9243
9245 return false;
9246
9249
9250 if (value <= (min + 0.001))
9251 value = min;
9252
9253 if (value == min)
9254 {
9255 if (destroy_config)
9256 {
9257 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
9258 if (dstr)
9259 {
9261 this.Delete();
9262 return true;
9263 }
9264 }
9265 else if (destroy_forced)
9266 {
9268 this.Delete();
9269 return true;
9270 }
9271
9273 }
9274
9277
9279 {
9280 EntityAI parent = GetHierarchyRoot();
9281 InventoryLocation iLoc = new InventoryLocation();
9282 GetInventory().GetCurrentInventoryLocation(iLoc);
9284 {
9285 int iLocSlot = iLoc.
GetSlot();
9287 {
9289 }
9291 {
9293 }
9294 }
9295 }
9296
9298 {
9300
9301 if (delta)
9303 }
9304
9306
9307 return false;
9308 }
9309
9310
9312 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9313 {
9315 }
9316
9318 {
9321 }
9322
9324 {
9327 }
9328
9330 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9331 {
9332 float value_clamped = Math.Clamp(value, 0, 1);
9334 SetQuantity(result, destroy_config, destroy_forced);
9335 }
9336
9337
9340 {
9342 }
9343
9345 {
9347 }
9348
9349
9350
9351
9352
9353
9354
9355
9356
9357
9359 {
9360 int slot = -1;
9361 GameInventory inventory = GetInventory();
9362 if (inventory)
9363 {
9364 InventoryLocation il = new InventoryLocation;
9367 }
9368
9370 }
9371
9373 {
9374 float quantity_max = 0;
9375
9377 {
9378 if (attSlotID != -1)
9379 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
9380
9381 if (quantity_max <= 0)
9383 }
9384
9385 if (quantity_max <= 0)
9387
9388 return quantity_max;
9389 }
9390
9392 {
9394 }
9395
9397 {
9399 }
9400
9401
9403 {
9405 }
9406
9408 {
9410 }
9411
9413 {
9415 }
9416
9417
9419 {
9420
9421 float weightEx = GetWeightEx();
9422 float special = GetInventoryAndCargoWeight();
9423 return weightEx - special;
9424 }
9425
9426
9428 {
9430 }
9431
9433 {
9435 {
9436 #ifdef DEVELOPER
9437 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9438 {
9439 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
9441 }
9442 #endif
9443
9445 }
9446 else if (HasEnergyManager())
9447 {
9448 #ifdef DEVELOPER
9449 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9450 {
9451 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
9452 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
9453 }
9454 #endif
9455 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
9456 }
9457 else
9458 {
9459 #ifdef DEVELOPER
9460 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9461 {
9462 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
9463 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
9464 }
9465 #endif
9466 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
9467 }
9468 }
9469
9472 {
9473 int item_count = 0;
9475
9476 GameInventory inventory = GetInventory();
9477 CargoBase cargo = inventory.
GetCargo();
9478 if (cargo != NULL)
9479 {
9481 }
9482
9484 for (int i = 0; i < nAttachments; ++i)
9485 {
9487 if (item)
9488 item_count += item.GetNumberOfItems();
9489 }
9490 return item_count;
9491 }
9492
9495 {
9496 float weight = 0;
9497 float wetness = 1;
9498 if (include_wetness)
9501 {
9502 weight = wetness * m_ConfigWeight;
9503 }
9505 {
9506 weight = 1;
9507 }
9508 return weight;
9509 }
9510
9511
9512
9514 {
9515 GameInventory inventory = GetInventory();
9516 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
9517 {
9518 array<EntityAI> items = new array<EntityAI>;
9520 for (int i = 0; i < items.Count(); ++i)
9521 {
9523 if (item)
9524 {
9525 g_Game.ObjectDelete(item);
9526 }
9527 }
9528 }
9529 }
9530
9531
9532
9533
9535 {
9536 float energy = 0;
9537 if (HasEnergyManager())
9538 {
9539 energy = GetCompEM().GetEnergy();
9540 }
9541 return energy;
9542 }
9543
9544
9546 {
9547 super.OnEnergyConsumed();
9548
9550 }
9551
9553 {
9554 super.OnEnergyAdded();
9555
9557 }
9558
9559
9561 {
9562 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
9563 {
9565 {
9566 float energy_0to1 = GetCompEM().GetEnergy0To1();
9568 }
9569 }
9570 }
9571
9572
9574 {
9575 return ConfigGetFloat("heatIsolation");
9576 }
9577
9579 {
9581 }
9582
9584 {
9585 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
9586 if (
g_Game.ConfigIsExisting(paramPath))
9587 return g_Game.ConfigGetFloat(paramPath);
9588
9589 return 0.0;
9590 }
9591
9593 {
9594 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
9595 if (
g_Game.ConfigIsExisting(paramPath))
9596 return g_Game.ConfigGetFloat(paramPath);
9597
9598 return 0.0;
9599 }
9600
9601 override void SetWet(
float value,
bool allow_client =
false)
9602 {
9603 if (!IsServerCheck(allow_client))
9604 return;
9605
9608
9610
9611 m_VarWet = Math.Clamp(value, min, max);
9612
9614 {
9617 }
9618 }
9619
9620 override void AddWet(
float value)
9621 {
9623 }
9624
9626 {
9628 }
9629
9631 {
9633 }
9634
9636 {
9638 }
9639
9641 {
9643 }
9644
9646 {
9648 }
9649
9651 {
9654 if (newLevel != oldLevel)
9655 {
9657 }
9658 }
9659
9661 {
9662 SetWeightDirty();
9663 }
9664
9666 {
9667 return GetWetLevelInternal(
m_VarWet);
9668 }
9669
9670
9671
9673 {
9675 }
9676
9678 {
9680 }
9681
9683 {
9685 }
9686
9688 {
9690 }
9691
9692
9693
9695 {
9696 if (ConfigIsExisting("itemModelLength"))
9697 {
9698 return ConfigGetFloat("itemModelLength");
9699 }
9700 return 0;
9701 }
9702
9704 {
9705 if (ConfigIsExisting("itemAttachOffset"))
9706 {
9707 return ConfigGetFloat("itemAttachOffset");
9708 }
9709 return 0;
9710 }
9711
9712 override void SetCleanness(
int value,
bool allow_client =
false)
9713 {
9714 if (!IsServerCheck(allow_client))
9715 return;
9716
9718
9720
9723 }
9724
9726 {
9728 }
9729
9731 {
9732 return true;
9733 }
9734
9735
9736
9737
9739 {
9741 }
9742
9744 {
9746 }
9747
9748
9749
9750
9751 override void SetColor(
int r,
int g,
int b,
int a)
9752 {
9758 }
9760 override void GetColor(out
int r,out
int g,out
int b,out
int a)
9761 {
9766 }
9767
9769 {
9771 }
9772
9775 {
9776 int r,g,b,a;
9778 r = r/255;
9779 g = g/255;
9780 b = b/255;
9781 a = a/255;
9782 return MiscGameplayFunctions.GetColorString(r, g, b, a);
9783 }
9784
9785
9786
9787 override void SetLiquidType(
int value,
bool allow_client =
false)
9788 {
9789 if (!IsServerCheck(allow_client))
9790 return;
9791
9796 }
9797
9799 {
9800 return ConfigGetInt("varLiquidTypeInit");
9801 }
9802
9804 {
9806 }
9807
9809 {
9811 SetFrozen(false);
9812 }
9813
9816 {
9817 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9818 }
9819
9820
9823 {
9824 PlayerBase nplayer;
9825 if (PlayerBase.CastTo(nplayer, player))
9826 {
9828 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9829 }
9830 }
9831
9832
9835 {
9836 PlayerBase nplayer;
9837 if (PlayerBase.CastTo(nplayer,player))
9838 {
9839 nplayer.SetEnableQuickBarEntityShortcut(this, false);
9840 }
9841
9842 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
9843
9844 if (HasEnergyManager())
9845 {
9846 GetCompEM().UpdatePlugState();
9847 }
9848 }
9849
9850
9852 {
9853 super.OnPlacementStarted(player);
9854
9856 }
9857
9858 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
9859 {
9861 {
9862 m_AdminLog.OnPlacementComplete(player,
this);
9863 }
9864
9865 super.OnPlacementComplete(player, position, orientation);
9866 }
9867
9868
9869
9870
9871
9873 {
9875 {
9876 return true;
9877 }
9878 else
9879 {
9880 return false;
9881 }
9882 }
9883
9884
9886 {
9888 {
9890 }
9891 }
9892
9893
9895 {
9897 }
9898
9900 {
9902 }
9903
9904 override void InsertAgent(
int agent,
float count = 1)
9905 {
9906 if (count < 1)
9907 return;
9908
9910 }
9911
9914 {
9916 }
9917
9918
9920 {
9922 }
9923
9924
9925
9926
9927
9928
9929
9930
9931
9932
9933
9934
9935
9936
9937
9938
9939
9940
9941
9942
9943
9944
9945
9946
9947
9948
9949
9950
9951
9952
9953
9954
9955
9956
9957
9958
9959
9960
9961
9962
9963
9964
9966 {
9968 return false;
9969 return true;
9970 }
9971
9973 {
9974
9976 }
9977
9978
9981 {
9982 super.CheckForRoofLimited(timeTresholdMS);
9983
9984 float time =
g_Game.GetTime();
9985 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
9986 {
9987 m_PreviousRoofTestTime = time;
9988 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
9989 }
9990 }
9991
9992
9994 {
9996 {
9997 return 0;
9998 }
9999
10000 if (GetInventory().GetAttachmentSlotsCount() != 0)
10001 {
10002 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
10003 if (filter)
10004 return filter.GetProtectionLevel(type, false, system);
10005 else
10006 return 0;
10007 }
10008
10009 string subclassPath, entryName;
10010
10011 switch (type)
10012 {
10014 entryName = "biological";
10015 break;
10017 entryName = "chemical";
10018 break;
10019 default:
10020 entryName = "biological";
10021 break;
10022 }
10023
10024 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
10025
10026 return g_Game.ConfigGetFloat(subclassPath + entryName);
10027 }
10028
10029
10030
10033 {
10034 if (!IsMagazine())
10036
10038 }
10039
10040
10041
10042
10043
10048 {
10049 return true;
10050 }
10051
10053 {
10055 }
10056
10057
10058
10059
10060
10062 {
10063 if (parent)
10064 {
10065 if (parent.IsInherited(DayZInfected))
10066 return true;
10067
10068 if (!parent.IsRuined())
10069 return true;
10070 }
10071
10072 return true;
10073 }
10074
10076 {
10077 if (!super.CanPutAsAttachment(parent))
10078 {
10079 return false;
10080 }
10081
10082 if (!IsRuined() && !parent.IsRuined())
10083 {
10084 return true;
10085 }
10086
10087 return false;
10088 }
10089
10091 {
10092
10093
10094
10095
10096 return super.CanReceiveItemIntoCargo(item);
10097 }
10098
10100 {
10101
10102
10103
10104
10105 GameInventory attachmentInv = attachment.GetInventory();
10107 {
10108 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
10109 return false;
10110 }
10111
10112 InventoryLocation loc = new InventoryLocation();
10113 attachment.GetInventory().GetCurrentInventoryLocation(loc);
10114 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
10115 return false;
10116
10117 return super.CanReceiveAttachment(attachment, slotId);
10118 }
10119
10121 {
10122 if (!super.CanReleaseAttachment(attachment))
10123 return false;
10124
10125 return GetInventory().AreChildrenAccessible();
10126 }
10127
10128
10129
10130
10131
10132
10133
10134
10135
10136
10137
10138
10139
10140
10141
10142
10143
10144
10145
10146
10147
10149 {
10150 int id = muzzle_owner.GetMuzzleID();
10151 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
10152
10153 if (WPOF_array)
10154 {
10155 for (int i = 0; i < WPOF_array.Count(); i++)
10156 {
10157 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
10158
10159 if (WPOF)
10160 {
10161 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
10162 }
10163 }
10164 }
10165 }
10166
10167
10169 {
10170 int id = muzzle_owner.GetMuzzleID();
10172
10173 if (WPOBE_array)
10174 {
10175 for (int i = 0; i < WPOBE_array.Count(); i++)
10176 {
10177 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
10178
10179 if (WPOBE)
10180 {
10181 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10182 }
10183 }
10184 }
10185 }
10186
10187
10189 {
10190 int id = muzzle_owner.GetMuzzleID();
10191 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10192
10193 if (WPOOH_array)
10194 {
10195 for (int i = 0; i < WPOOH_array.Count(); i++)
10196 {
10197 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10198
10199 if (WPOOH)
10200 {
10201 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10202 }
10203 }
10204 }
10205 }
10206
10207
10209 {
10210 int id = muzzle_owner.GetMuzzleID();
10211 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10212
10213 if (WPOOH_array)
10214 {
10215 for (int i = 0; i < WPOOH_array.Count(); i++)
10216 {
10217 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10218
10219 if (WPOOH)
10220 {
10221 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10222 }
10223 }
10224 }
10225 }
10226
10227
10229 {
10230 int id = muzzle_owner.GetMuzzleID();
10231 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10232
10233 if (WPOOH_array)
10234 {
10235 for (int i = 0; i < WPOOH_array.Count(); i++)
10236 {
10237 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10238
10239 if (WPOOH)
10240 {
10241 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10242 }
10243 }
10244 }
10245 }
10246
10247
10248
10250 {
10252 {
10253 return true;
10254 }
10255
10256 return false;
10257 }
10258
10260 {
10262 {
10263 return true;
10264 }
10265
10266 return false;
10267 }
10268
10270 {
10272 {
10273 return true;
10274 }
10275
10276 return false;
10277 }
10278
10280 {
10281 return false;
10282 }
10283
10286 {
10287 return UATimeSpent.DEFAULT_DEPLOY;
10288 }
10289
10290
10291
10292
10294 {
10296 SetSynchDirty();
10297 }
10298
10300 {
10302 }
10303
10304
10306 {
10307 return false;
10308 }
10309
10312 {
10313 string att_type = "None";
10314
10315 if (ConfigIsExisting("soundAttType"))
10316 {
10317 att_type = ConfigGetString("soundAttType");
10318 }
10319
10321 }
10322
10324 {
10326 }
10327
10328
10329
10330
10331
10337
10339 {
10342
10344 }
10345
10346
10348 {
10350 return;
10351
10353
10356
10359
10360 SoundParameters params = new SoundParameters();
10364 }
10365
10366
10368 {
10370 {
10373
10374 SetSynchDirty();
10375
10378 }
10379 }
10380
10382 {
10384 }
10385
10386
10388 {
10390 return;
10391
10393 SetSynchDirty();
10394
10397 }
10398
10400 {
10403 }
10404
10406 {
10408 }
10409
10410 void OnApply(PlayerBase player);
10411
10413 {
10414 return 1.0;
10415 };
10416
10418 {
10420 }
10421
10423 {
10425 }
10426
10428
10430 {
10431 SetDynamicPhysicsLifeTime(0.01);
10433 }
10434
10436 {
10437 array<string> zone_names = new array<string>;
10438 GetDamageZones(zone_names);
10439 for (int i = 0; i < zone_names.Count(); i++)
10440 {
10441 SetHealthMax(zone_names.Get(i),"Health");
10442 }
10443 SetHealthMax("","Health");
10444 }
10445
10448 {
10449 float global_health = GetHealth01("","Health");
10450 array<string> zones = new array<string>;
10451 GetDamageZones(zones);
10452
10453 for (int i = 0; i < zones.Count(); i++)
10454 {
10455 SetHealth01(zones.Get(i),"Health",global_health);
10456 }
10457 }
10458
10461 {
10462 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
10463 }
10464
10466 {
10467 if (!hasRootAsPlayer)
10468 {
10469 if (refParentIB)
10470 {
10471
10472 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
10473 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
10474
10475 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
10476 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
10477
10480 }
10481 else
10482 {
10483
10486 }
10487 }
10488 }
10489
10491 {
10493 {
10494 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
10495 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
10496 {
10497 float heatPermCoef = 1.0;
10499 while (ent)
10500 {
10501 heatPermCoef *= ent.GetHeatPermeabilityCoef();
10502 ent = ent.GetHierarchyParent();
10503 }
10504
10505 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
10506 }
10507 }
10508 }
10509
10511 {
10512
10513 EntityAI parent = GetHierarchyParent();
10514 if (!parent)
10515 {
10516 hasParent = false;
10517 hasRootAsPlayer = false;
10518 }
10519 else
10520 {
10521 hasParent = true;
10522 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
10523 refParentIB =
ItemBase.Cast(parent);
10524 }
10525 }
10526
10527 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
10528 {
10529
10530 }
10531
10533 {
10534
10535 return false;
10536 }
10537
10539 {
10540
10541
10542 return false;
10543 }
10544
10546 {
10547
10548 return false;
10549 }
10550
10553 {
10554 return !GetIsFrozen() &&
IsOpen();
10555 }
10556
10558 {
10559 bool hasParent = false, hasRootAsPlayer = false;
10561
10562 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
10563 bool foodDecay =
g_Game.IsFoodDecayEnabled();
10564
10565 if (wwtu || foodDecay)
10566 {
10570
10571 if (processWetness || processTemperature || processDecay)
10572 {
10574
10575 if (processWetness)
10576 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
10577
10578 if (processTemperature)
10580
10581 if (processDecay)
10582 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
10583 }
10584 }
10585 }
10586
10589 {
10591 }
10592
10594 {
10597
10598 return super.GetTemperatureFreezeThreshold();
10599 }
10600
10602 {
10605
10606 return super.GetTemperatureThawThreshold();
10607 }
10608
10610 {
10613
10614 return super.GetItemOverheatThreshold();
10615 }
10616
10618 {
10620 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
10621
10622 return super.GetTemperatureFreezeTime();
10623 }
10624
10626 {
10628 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
10629
10630 return super.GetTemperatureThawTime();
10631 }
10632
10637
10639 {
10640 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
10641 }
10642
10644 {
10645 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
10646 }
10647
10650 {
10652 }
10653
10655 {
10657 }
10658
10660 {
10662 }
10663
10666 {
10667 return null;
10668 }
10669
10672 {
10673 return false;
10674 }
10675
10677 {
10679 {
10682 if (!trg)
10683 {
10685 explosive = this;
10686 }
10687
10688 explosive.PairRemote(trg);
10690
10691 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
10692 trg.SetPersistentPairID(persistentID);
10693 explosive.SetPersistentPairID(persistentID);
10694
10695 return true;
10696 }
10697 return false;
10698 }
10699
10702 {
10703 float ret = 1.0;
10706 ret *= GetHealth01();
10707
10708 return ret;
10709 }
10710
10711 #ifdef DEVELOPER
10712 override void SetDebugItem()
10713 {
10714 super.SetDebugItem();
10715 _itemBase = this;
10716 }
10717
10719 {
10720 string text = super.GetDebugText();
10721
10723 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
10724
10725 return text;
10726 }
10727 #endif
10728
10730 {
10731 return true;
10732 }
10733
10735
10737
10739 {
10742 }
10743
10744
10752
10768
10769 [
Obsolete(
"Use ItemSoundHandler instead")]
10772 {
10773 if (!
g_Game.IsDedicatedServer())
10774 {
10775 if (ConfigIsExisting("attachSoundSet"))
10776 {
10777 string cfg_path = "";
10778 string soundset = "";
10779 string type_name =
GetType();
10780
10783 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
10784 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
10785
10786 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
10787 {
10788 for (int i = 0; i < cfg_soundset_array.Count(); i++)
10789 {
10790 if (cfg_slot_array[i] == slot_type)
10791 {
10792 soundset = cfg_soundset_array[i];
10793 break;
10794 }
10795 }
10796 }
10797
10798 if (soundset != "")
10799 {
10800 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
10802 }
10803 }
10804 }
10805 }
10806
10808}
10809
10811{
10813 if (entity)
10814 {
10815 bool is_item = entity.IsInherited(
ItemBase);
10816 if (is_item && full_quantity)
10817 {
10820 }
10821 }
10822 else
10823 {
10825 return NULL;
10826 }
10827 return entity;
10828}
10829
10831{
10832 if (item)
10833 {
10834 if (health > 0)
10835 item.SetHealth("", "", health);
10836
10837 if (item.CanHaveTemperature())
10838 {
10840 if (item.CanFreeze())
10841 item.SetFrozen(false);
10842 }
10843
10844 if (item.HasEnergyManager())
10845 {
10846 if (quantity >= 0)
10847 {
10848 item.GetCompEM().SetEnergy0To1(quantity);
10849 }
10850 else
10851 {
10853 }
10854 }
10855 else if (item.IsMagazine())
10856 {
10857 Magazine mag = Magazine.Cast(item);
10858 if (quantity >= 0)
10859 {
10860 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
10861 }
10862 else
10863 {
10865 }
10866
10867 }
10868 else
10869 {
10870 if (quantity >= 0)
10871 {
10872 item.SetQuantityNormalized(quantity, false);
10873 }
10874 else
10875 {
10877 }
10878
10879 }
10880 }
10881}
10882
10883#ifdef DEVELOPER
10885#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.