5910{
5912 {
5913 return true;
5914 }
5915};
5916
5918{
5919
5920};
5921
5922
5923
5925{
5929
5931
5934
5935
5936
5937
5938
5947
5953
5958
5963
5984 protected bool m_IsResultOfSplit
5985
5987
5992
5993
5994
5996
6000
6001
6002
6004
6007
6008
6009
6015
6016
6024
6027
6028
6030
6031
6033
6034
6039
6040
6045
6047
6048
6050
6051
6053 {
6058
6059 if (!
g_Game.IsDedicatedServer())
6060 {
6062 {
6064
6066 {
6068 }
6069 }
6070
6073 }
6074
6075 m_OldLocation = null;
6076
6078 {
6080 }
6081
6082 if (ConfigIsExisting("headSelectionsToHide"))
6083 {
6086 }
6087
6089 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
6090 {
6092 }
6093
6095
6096 m_IsResultOfSplit = false;
6097
6099 }
6100
6102 {
6103 super.InitItemVariables();
6104
6110 m_Count = ConfigGetInt(
"count");
6111
6114
6119
6122
6127
6139
6143
6144
6147 if (ConfigIsExisting("canBeSplit"))
6148 {
6151 }
6152
6154 if (ConfigIsExisting("itemBehaviour"))
6156
6157
6160 RegisterNetSyncVariableInt("m_VarLiquidType");
6161 RegisterNetSyncVariableInt("m_Cleanness",0,1);
6162
6163 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
6164 RegisterNetSyncVariableFloat("m_ImpactSpeed");
6165 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
6166
6167 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
6168 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
6169 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
6170 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
6171
6172 RegisterNetSyncVariableBool("m_IsBeingPlaced");
6173 RegisterNetSyncVariableBool("m_IsTakeable");
6174 RegisterNetSyncVariableBool("m_IsHologram");
6175
6178 {
6181 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
6182 }
6183
6185
6187 if (ConfigIsExisting("temperaturePerQuantityWeight"))
6189
6191 }
6192
6194 {
6196 }
6197
6199 {
6202 {
6207 }
6208 }
6209
6210 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
6211 {
6213 {
6216 }
6217
6219 }
6220
6222 {
6228 }
6229
6231
6233 {
6235
6236 if (!action)
6237 {
6238 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
6239 return;
6240 }
6241
6243 if (!ai)
6244 {
6246 return;
6247 }
6248
6250 if (!action_array)
6251 {
6252 action_array = new array<ActionBase_Basic>;
6254 }
6255 if (LogManager.IsActionLogEnable())
6256 {
6257 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
6258 }
6259
6260 if (action_array.Find(action) != -1)
6261 {
6262 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
6263 }
6264 else
6265 {
6266 action_array.Insert(action);
6267 }
6268 }
6269
6271 {
6272 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6273 ActionBase action = player.GetActionManager().GetAction(actionName);
6276
6277 if (action_array)
6278 {
6279 action_array.RemoveItem(action);
6280 }
6281 }
6282
6283
6284
6286 {
6287 ActionOverrideData overrideData = new ActionOverrideData();
6291
6293 if (!actionMap)
6294 {
6297 }
6298
6299 actionMap.Insert(this.
Type(), overrideData);
6300
6301 }
6302
6304
6306
6307
6309 {
6312
6315
6316 string config_to_search = "CfgVehicles";
6317 string muzzle_owner_config;
6318
6320 {
6321 if (IsInherited(Weapon))
6322 config_to_search = "CfgWeapons";
6323
6324 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6325
6326 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
6327
6328 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
6329
6330 if (config_OnFire_subclass_count > 0)
6331 {
6332 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
6333
6334 for (int i = 0; i < config_OnFire_subclass_count; i++)
6335 {
6336 string particle_class = "";
6337 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
6338 string config_OnFire_entry = config_OnFire_class + particle_class;
6339 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
6340 WPOF_array.Insert(WPOF);
6341 }
6342
6343
6345 }
6346 }
6347
6349 {
6350 config_to_search = "CfgWeapons";
6351 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6352
6353 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
6354
6355 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
6356
6357 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
6358 {
6359 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
6360
6361 for (i = 0; i < config_OnBulletCasingEject_count; i++)
6362 {
6363 string particle_class2 = "";
6364 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
6365 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
6366 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
6367 WPOBE_array.Insert(WPOBE);
6368 }
6369
6370
6372 }
6373 }
6374 }
6375
6376
6378 {
6381
6383 {
6384 string config_to_search = "CfgVehicles";
6385
6386 if (IsInherited(Weapon))
6387 config_to_search = "CfgWeapons";
6388
6389 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6390 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
6391
6392 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
6393 {
6394
6396
6398 {
6400 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
6402 return;
6403 }
6404
6407
6408
6409
6410 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
6411 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
6412
6413 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
6414 {
6415 string particle_class = "";
6416 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
6417 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
6418 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
6419
6420 if (entry_type == CT_CLASS)
6421 {
6422 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
6423 WPOOH_array.Insert(WPOF);
6424 }
6425 }
6426
6427
6429 }
6430 }
6431 }
6432
6434 {
6436 }
6437
6439 {
6441 {
6443
6446
6449
6450 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6451 }
6452 }
6453
6455 {
6457 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6458
6460 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6461
6463 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6464
6466 {
6468 }
6469 }
6470
6472 {
6474 }
6475
6477 {
6480 else
6482
6484 {
6487 }
6488 else
6489 {
6492
6495 }
6496
6498 }
6499
6501 {
6503 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6504 }
6505
6507 {
6509 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6511 }
6512
6514 {
6516 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6517 }
6518
6520 {
6523
6524 OverheatingParticle OP = new OverheatingParticle();
6529
6531 }
6532
6534 {
6537
6538 return -1;
6539 }
6540
6542 {
6544 {
6547
6548 for (int i = count; i > 0; --i)
6549 {
6550 int id = i - 1;
6553
6556
6557 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
6558 {
6559 if (p)
6560 {
6563 }
6564 }
6565 }
6566 }
6567 }
6568
6570 {
6572 {
6574 {
6575 int id = i - 1;
6577
6578 if (OP)
6579 {
6581
6582 if (p)
6583 {
6585 }
6586
6587 delete OP;
6588 }
6589 }
6590
6593 }
6594 }
6595
6598 {
6599 return 0.0;
6600 }
6601
6602
6604 {
6605 return 250;
6606 }
6607
6609 {
6610 return 0;
6611 }
6612
6615 {
6617 return true;
6618
6619 return false;
6620 }
6621
6624 {
6627
6629 {
6631 }
6632 else
6633 {
6634
6636 }
6637
6639 }
6640
6647 {
6648 return -1;
6649 }
6650
6651
6652
6653
6655 {
6657 {
6658 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6659 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6660
6661 if (r_index >= 0)
6662 {
6663 InventoryLocation r_il = new InventoryLocation;
6664 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6665
6666 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6669 {
6670 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6671 }
6673 {
6674 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6675 }
6676
6677 }
6678
6679 player.GetHumanInventory().ClearUserReservedLocation(this);
6680 }
6681
6684 }
6685
6686
6687
6688
6690 {
6691 return ItemBase.m_DebugActionsMask;
6692 }
6693
6695 {
6696 return ItemBase.m_DebugActionsMask & mask;
6697 }
6698
6700 {
6701 ItemBase.m_DebugActionsMask = mask;
6702 }
6703
6705 {
6706 ItemBase.m_DebugActionsMask |= mask;
6707 }
6708
6710 {
6711 ItemBase.m_DebugActionsMask &= ~mask;
6712 }
6713
6715 {
6717 {
6719 }
6720 else
6721 {
6723 }
6724 }
6725
6726
6728 {
6729 if (GetEconomyProfile())
6730 {
6731 float q_max = GetEconomyProfile().GetQuantityMax();
6732 if (q_max > 0)
6733 {
6734 float q_min = GetEconomyProfile().GetQuantityMin();
6735 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
6736
6738 {
6739 ComponentEnergyManager comp = GetCompEM();
6741 {
6743 }
6744 }
6746 {
6748
6749 }
6750
6751 }
6752 }
6753 }
6754
6757 {
6758 EntityAI parent = GetHierarchyParent();
6759
6760 if (parent)
6761 {
6762 InventoryLocation inventory_location_to_lock = new InventoryLocation;
6763 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
6764 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
6765 }
6766 }
6767
6770 {
6771 EntityAI parent = GetHierarchyParent();
6772
6773 if (parent)
6774 {
6775 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
6776 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
6777 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
6778 }
6779 }
6780
6782 {
6783
6784
6785
6786
6788
6790 {
6791 if (ScriptInputUserData.CanStoreInputUserData())
6792 {
6793 ScriptInputUserData ctx = new ScriptInputUserData;
6799 ctx.
Write(use_stack_max);
6802
6804 {
6805 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
6806 }
6807 }
6808 }
6809 else if (!
g_Game.IsMultiplayer())
6810 {
6812 }
6813 }
6814
6816 {
6818 }
6819
6821 {
6823 }
6824
6826 {
6828 }
6829
6831 {
6832
6833 return false;
6834 }
6835
6837 {
6838 return false;
6839 }
6840
6844 {
6845 return false;
6846 }
6847
6849 {
6850 return "";
6851 }
6852
6854
6856 {
6857 return false;
6858 }
6859
6861 {
6862 return true;
6863 }
6864
6865
6866
6868 {
6869 return true;
6870 }
6871
6873 {
6874 return true;
6875 }
6876
6878 {
6879 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6881 }
6882
6884 {
6886 }
6887
6889 {
6891 if (!is_being_placed)
6893 SetSynchDirty();
6894 }
6895
6896
6898
6900 {
6902 }
6903
6905 {
6907 }
6908
6910 {
6911 return 1;
6912 }
6913
6915 {
6916 return false;
6917 }
6918
6920 {
6922 SetSynchDirty();
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
6954
6955
6956
6957
6958
6960 {
6961 super.OnMovedInsideCargo(container);
6962
6963 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6964 }
6965
6966 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
6967 {
6968 super.EEItemLocationChanged(oldLoc, newLoc);
6969
6970 PlayerBase newPlayer = null;
6971 PlayerBase oldPlayer = null;
6972
6973 if (newLoc.GetParent())
6974 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
6975
6976 if (oldLoc.GetParent())
6977 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
6978
6980 {
6981 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
6982
6983 if (rIndex >= 0)
6984 {
6985 InventoryLocation rIl = new InventoryLocation;
6986 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
6987
6988 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
6991 {
6992 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
6993 }
6995 {
6997 }
6998
6999 }
7000 }
7001
7003 {
7004 if (newPlayer)
7005 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
7006
7007 if (newPlayer == oldPlayer)
7008 {
7009 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
7010 {
7012 {
7013 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
7014 {
7015 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7016 }
7017 }
7018 else
7019 {
7020 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7021 }
7022 }
7023
7024 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
7025 {
7026 int type = oldLoc.GetType();
7028 {
7029 oldLoc.GetParent().GetOnSetLock().Invoke(this);
7030 }
7032 {
7033 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
7034 }
7035 }
7036 if (!m_OldLocation)
7037 {
7038 m_OldLocation = new InventoryLocation;
7039 }
7040 m_OldLocation.Copy(oldLoc);
7041 }
7042 else
7043 {
7044 if (m_OldLocation)
7045 {
7046 m_OldLocation.Reset();
7047 }
7048 }
7049
7050 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
7051 }
7052 else
7053 {
7054 if (newPlayer)
7055 {
7056 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
7057 if (resIndex >= 0)
7058 {
7059 InventoryLocation il = new InventoryLocation;
7060 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
7062 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
7065 {
7066 il.
GetParent().GetOnReleaseLock().Invoke(it);
7067 }
7069 {
7071 }
7072
7073 }
7074 }
7076 {
7077
7079 }
7080
7081 if (m_OldLocation)
7082 {
7083 m_OldLocation.Reset();
7084 }
7085 }
7086
7088 {
7089 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
7090 }
7091
7093 {
7094 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
7095 }
7096 }
7097
7098 override void EOnContact(IEntity other, Contact extra)
7099 {
7101 {
7102 int liquidType = -1;
7104 if (impactSpeed > 0.0)
7105 {
7107 #ifndef SERVER
7109 #else
7111 SetSynchDirty();
7112 #endif
7114 }
7115 }
7116
7117 #ifdef SERVER
7118 if (GetCompEM() && GetCompEM().IsPlugged())
7119 {
7120 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
7121 GetCompEM().UnplugThis();
7122 }
7123 #endif
7124 }
7125
7127
7129 {
7131 }
7132
7134 {
7135
7136 }
7137
7139 {
7140 super.OnItemLocationChanged(old_owner, new_owner);
7141
7142 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
7143 PlayerBase playerNew = PlayerBase.Cast(new_owner);
7144
7145 if (!relatedPlayer && playerNew)
7146 relatedPlayer = playerNew;
7147
7148 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
7149 {
7151 if (actionMgr)
7152 {
7153 ActionBase currentAction = actionMgr.GetRunningAction();
7154 if (currentAction)
7156 }
7157 }
7158
7159 Man ownerPlayerOld = null;
7160 Man ownerPlayerNew = null;
7161
7162 if (old_owner)
7163 {
7164 if (old_owner.
IsMan())
7165 {
7166 ownerPlayerOld = Man.Cast(old_owner);
7167 }
7168 else
7169 {
7170 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
7171 }
7172 }
7173 else
7174 {
7176 {
7178
7179 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
7180 {
7181 GetCompEM().UnplugThis();
7182 }
7183 }
7184 }
7185
7186 if (new_owner)
7187 {
7188 if (new_owner.
IsMan())
7189 {
7190 ownerPlayerNew = Man.Cast(new_owner);
7191 }
7192 else
7193 {
7194 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
7195 }
7196 }
7197
7198 if (ownerPlayerOld != ownerPlayerNew)
7199 {
7200 if (ownerPlayerOld)
7201 {
7202 array<EntityAI> subItemsExit = new array<EntityAI>;
7204 for (int i = 0; i < subItemsExit.Count(); i++)
7205 {
7208 }
7209 }
7210
7211 if (ownerPlayerNew)
7212 {
7213 array<EntityAI> subItemsEnter = new array<EntityAI>;
7215 for (int j = 0; j < subItemsEnter.Count(); j++)
7216 {
7219 }
7220 }
7221 }
7222 else if (ownerPlayerNew != null)
7223 {
7224 PlayerBase nplayer;
7225 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
7226 {
7227 array<EntityAI> subItemsUpdate = new array<EntityAI>;
7229 for (int k = 0; k < subItemsUpdate.Count(); k++)
7230 {
7232 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
7233 }
7234 }
7235 }
7236
7237 if (old_owner)
7238 old_owner.OnChildItemRemoved(this);
7239 if (new_owner)
7240 new_owner.OnChildItemReceived(this);
7241 }
7242
7243
7245 {
7246 super.EEDelete(parent);
7247 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
7248 if (player)
7249 {
7251
7252 if (player.IsAlive())
7253 {
7254 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7255 if (r_index >= 0)
7256 {
7257 InventoryLocation r_il = new InventoryLocation;
7258 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7259
7260 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7263 {
7264 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7265 }
7267 {
7268 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7269 }
7270
7271 }
7272
7273 player.RemoveQuickBarEntityShortcut(this);
7274 }
7275 }
7276 }
7277
7279 {
7280 super.EEKilled(killer);
7281
7284 {
7285 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
7286 {
7287 if (IsMagazine())
7288 {
7289 if (Magazine.Cast(this).GetAmmoCount() > 0)
7290 {
7292 }
7293 }
7294 else
7295 {
7297 }
7298 }
7299 }
7300 }
7301
7303 {
7304 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7305
7306 super.OnWasAttached(parent, slot_id);
7307
7310
7313 }
7314
7316 {
7317 super.OnWasDetached(parent, slot_id);
7318
7321
7324 }
7325
7327 {
7328 int idx;
7331
7332 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7333 if (inventory_slots.Count() < 1)
7334 {
7335 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
7336 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
7337 }
7338 else
7339 {
7340 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
7341 }
7342
7343 idx = inventory_slots.Find(slot);
7344 if (idx < 0)
7345 return "";
7346
7347 return attach_types.Get(idx);
7348 }
7349
7351 {
7352 int idx = -1;
7353 string slot;
7354
7357
7358 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7359 if (inventory_slots.Count() < 1)
7360 {
7361 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
7362 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7363 }
7364 else
7365 {
7366 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
7367 if (detach_types.Count() < 1)
7368 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7369 }
7370
7371 for (int i = 0; i < inventory_slots.Count(); i++)
7372 {
7373 slot = inventory_slots.Get(i);
7374 }
7375
7376 if (slot != "")
7377 {
7378 if (detach_types.Count() == 1)
7379 idx = 0;
7380 else
7381 idx = inventory_slots.Find(slot);
7382 }
7383 if (idx < 0)
7384 return "";
7385
7386 return detach_types.Get(idx);
7387 }
7388
7390 {
7391
7393
7394
7395 float min_time = 1;
7396 float max_time = 3;
7397 float delay = Math.RandomFloat(min_time, max_time);
7398
7399 explode_timer.Run(delay, this, "DoAmmoExplosion");
7400 }
7401
7403 {
7404 Magazine magazine = Magazine.Cast(this);
7405 int pop_sounds_count = 6;
7406 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
7407
7408
7409 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
7410 string sound_name = pop_sounds[ sound_idx ];
7411 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
7412
7413
7414 magazine.ServerAddAmmoCount(-1);
7415
7416
7417 float min_temp_to_explode = 100;
7418
7419 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
7420 {
7422 }
7423 }
7424
7425
7426 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
7427 {
7428 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
7429
7430 const int CHANCE_DAMAGE_CARGO = 4;
7431 const int CHANCE_DAMAGE_ATTACHMENT = 1;
7432 const int CHANCE_DAMAGE_NOTHING = 2;
7433
7435 {
7436 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
7437 int chances;
7438 int rnd;
7439
7440 if (GetInventory().GetCargo())
7441 {
7442 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7443 rnd = Math.RandomInt(0,chances);
7444
7445 if (rnd < CHANCE_DAMAGE_CARGO)
7446 {
7448 }
7449 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
7450 {
7452 }
7453 }
7454 else
7455 {
7456 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7457 rnd = Math.RandomInt(0,chances);
7458
7459 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
7460 {
7462 }
7463 }
7464 }
7465 }
7466
7468 {
7469 CargoBase cargo = GetInventory().GetCargo();
7470 if (cargo)
7471 {
7473 if (item_count > 0)
7474 {
7475 int random_pick = Math.RandomInt(0, item_count);
7477 if (!item.IsExplosive())
7478 {
7479 item.AddHealth("","",damage);
7480 return true;
7481 }
7482 }
7483 }
7484 return false;
7485 }
7486
7488 {
7489 GameInventory inventory = GetInventory();
7491 if (attachment_count > 0)
7492 {
7493 int random_pick = Math.RandomInt(0, attachment_count);
7495 if (!attachment.IsExplosive())
7496 {
7497 attachment.AddHealth("","",damage);
7498 return true;
7499 }
7500 }
7501 return false;
7502 }
7503
7505 {
7507 }
7508
7510 {
7512 return GetInventory().CanRemoveEntity();
7513
7514 return false;
7515 }
7516
7518 {
7519
7521 return false;
7522
7523
7525 return false;
7526
7527
7528
7530 if (delta == 0)
7531 return false;
7532
7533
7534 return true;
7535 }
7536
7538 {
7540 {
7541 if (ScriptInputUserData.CanStoreInputUserData())
7542 {
7543 ScriptInputUserData ctx = new ScriptInputUserData;
7548 ctx.
Write(destination_entity);
7552 }
7553 }
7554 else if (!
g_Game.IsMultiplayer())
7555 {
7557 }
7558 }
7559
7561 {
7562 float split_quantity_new;
7566 InventoryLocation loc = new InventoryLocation;
7567
7568 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7569 {
7571 split_quantity_new = stack_max;
7572 else
7574
7576 {
7577 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7578 if (new_item)
7579 {
7580 new_item.SetResultOfSplit(true);
7581 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7583 new_item.
SetQuantity(split_quantity_new,
false,
true);
7584 }
7585 }
7586 }
7587 else if (destination_entity && slot_id == -1)
7588 {
7589 if (quantity > stack_max)
7590 split_quantity_new = stack_max;
7591 else
7592 split_quantity_new = quantity;
7593
7595 {
7596 GameInventory destinationInventory = destination_entity.GetInventory();
7598 {
7601 }
7602
7603 if (new_item)
7604 {
7605 new_item.SetResultOfSplit(true);
7606 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7608 new_item.
SetQuantity(split_quantity_new,
false,
true);
7609 }
7610 }
7611 }
7612 else
7613 {
7614 if (stack_max != 0)
7615 {
7617 {
7619 }
7620
7621 if (split_quantity_new == 0)
7622 {
7623 if (!
g_Game.IsMultiplayer())
7624 player.PhysicalPredictiveDropItem(this);
7625 else
7626 player.ServerDropEntity(this);
7627 return;
7628 }
7629
7631 {
7633
7634 if (new_item)
7635 {
7636 new_item.SetResultOfSplit(true);
7637 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7640 new_item.PlaceOnSurface();
7641 }
7642 }
7643 }
7644 }
7645 }
7646
7648 {
7649 float split_quantity_new;
7653 InventoryLocation loc = new InventoryLocation;
7654
7655 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7656 {
7658 split_quantity_new = stack_max;
7659 else
7661
7663 {
7664 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7665 if (new_item)
7666 {
7667 new_item.SetResultOfSplit(true);
7668 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7670 new_item.
SetQuantity(split_quantity_new,
false,
true);
7671 }
7672 }
7673 }
7674 else if (destination_entity && slot_id == -1)
7675 {
7676 if (quantity > stack_max)
7677 split_quantity_new = stack_max;
7678 else
7679 split_quantity_new = quantity;
7680
7682 {
7683 GameInventory destinationInventory = destination_entity.GetInventory();
7685 {
7688 }
7689
7690 if (new_item)
7691 {
7692 new_item.SetResultOfSplit(true);
7693 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7695 new_item.
SetQuantity(split_quantity_new,
false,
true);
7696 }
7697 }
7698 }
7699 else
7700 {
7701 if (stack_max != 0)
7702 {
7704 {
7706 }
7707
7709 {
7711
7712 if (new_item)
7713 {
7714 new_item.SetResultOfSplit(true);
7715 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7718 new_item.PlaceOnSurface();
7719 }
7720 }
7721 }
7722 }
7723 }
7724
7726 {
7728 {
7729 if (ScriptInputUserData.CanStoreInputUserData())
7730 {
7731 ScriptInputUserData ctx = new ScriptInputUserData;
7736 dst.WriteToContext(ctx);
7738 }
7739 }
7740 else if (!
g_Game.IsMultiplayer())
7741 {
7743 }
7744 }
7745
7747 {
7749 {
7750 if (ScriptInputUserData.CanStoreInputUserData())
7751 {
7752 ScriptInputUserData ctx = new ScriptInputUserData;
7757 ctx.
Write(destination_entity);
7763 }
7764 }
7765 else if (!
g_Game.IsMultiplayer())
7766 {
7768 }
7769 }
7770
7772 {
7774 }
7775
7777 {
7779 float split_quantity_new;
7781 if (dst.IsValid())
7782 {
7783 int slot_id = dst.GetSlot();
7785
7786 if (quantity > stack_max)
7787 split_quantity_new = stack_max;
7788 else
7789 split_quantity_new = quantity;
7790
7792 {
7794
7795 if (new_item)
7796 {
7797 new_item.SetResultOfSplit(true);
7798 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7800 new_item.
SetQuantity(split_quantity_new,
false,
true);
7801 }
7802
7803 return new_item;
7804 }
7805 }
7806
7807 return null;
7808 }
7809
7811 {
7813 float split_quantity_new;
7815 if (destination_entity)
7816 {
7818 if (quantity > stackable)
7819 split_quantity_new = stackable;
7820 else
7821 split_quantity_new = quantity;
7822
7824 {
7825 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
7826 if (new_item)
7827 {
7828 new_item.SetResultOfSplit(true);
7829 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7831 new_item.
SetQuantity(split_quantity_new,
false,
true);
7832 }
7833 }
7834 }
7835 }
7836
7838 {
7840 {
7841 if (ScriptInputUserData.CanStoreInputUserData())
7842 {
7843 ScriptInputUserData ctx = new ScriptInputUserData;
7848 ItemBase destination_entity =
this;
7849 ctx.
Write(destination_entity);
7853 }
7854 }
7855 else if (!
g_Game.IsMultiplayer())
7856 {
7858 }
7859 }
7860
7862 {
7864 float split_quantity_new;
7866 if (player)
7867 {
7869 if (quantity > stackable)
7870 split_quantity_new = stackable;
7871 else
7872 split_quantity_new = quantity;
7873
7875 {
7876 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
7877 new_item =
ItemBase.Cast(in_hands);
7878 if (new_item)
7879 {
7880 new_item.SetResultOfSplit(true);
7881 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7883 new_item.SetQuantity(split_quantity_new, false, true);
7884 }
7885 }
7886 }
7887 }
7888
7890 {
7892 float split_quantity_new = Math.Floor(quantity * 0.5);
7893
7895 return;
7896
7898
7899 if (new_item)
7900 {
7901 if (new_item.GetQuantityMax() < split_quantity_new)
7902 {
7903 split_quantity_new = new_item.GetQuantityMax();
7904 }
7905
7906 new_item.SetResultOfSplit(true);
7907 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7908
7910 {
7913 }
7914 else
7915 {
7917 new_item.
SetQuantity(split_quantity_new,
false,
true);
7918 }
7919 }
7920 }
7921
7923 {
7925 float split_quantity_new = Math.Floor(quantity / 2);
7926
7928 return;
7929
7930 InventoryLocation invloc = new InventoryLocation;
7932
7934 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
7935
7936 if (new_item)
7937 {
7938 if (new_item.GetQuantityMax() < split_quantity_new)
7939 {
7940 split_quantity_new = new_item.GetQuantityMax();
7941 }
7943 {
7946 }
7947 else if (split_quantity_new > 1)
7948 {
7950 new_item.
SetQuantity(split_quantity_new,
false,
true);
7951 }
7952 }
7953 }
7954
7957 {
7958 SetWeightDirty();
7960
7961 if (parent)
7962 parent.OnAttachmentQuantityChangedEx(this, delta);
7963
7965 {
7967 {
7969 }
7971 {
7972 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
7974 }
7975 }
7976 }
7977
7980 {
7981
7982 }
7983
7986 {
7988 }
7989
7991 {
7992 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
7993
7995 {
7996 if (newLevel == GameConstants.STATE_RUINED)
7997 {
7999 EntityAI parent = GetHierarchyParent();
8000 if (parent && parent.IsFireplace())
8001 {
8002 CargoBase cargo = GetInventory().GetCargo();
8003 if (cargo)
8004 {
8006 {
8008 }
8009 }
8010 }
8011 }
8012
8014 {
8015
8017 return;
8018 }
8019
8020 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
8021 {
8023 }
8024 }
8025 }
8026
8027
8029 {
8030 super.OnRightClick();
8031
8033 {
8035 {
8036 if (ScriptInputUserData.CanStoreInputUserData())
8037 {
8038 EntityAI root = GetHierarchyRoot();
8039 Man playerOwner = GetHierarchyRootPlayer();
8040 InventoryLocation dst = new InventoryLocation;
8041
8042
8043 if (!playerOwner && root && root == this)
8044 {
8046 }
8047 else
8048 {
8049
8050 GetInventory().GetCurrentInventoryLocation(dst);
8052 {
8053 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8055 {
8057 }
8058 else
8059 {
8061
8062
8063 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
8064 {
8066 }
8067 else
8068 {
8069 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
8070 }
8071 }
8072 }
8073 }
8074
8075 ScriptInputUserData ctx = new ScriptInputUserData;
8083 }
8084 }
8085 else if (!
g_Game.IsMultiplayer())
8086 {
8088 }
8089 }
8090 }
8091
8093 {
8094 if (root)
8095 {
8096 vector m4[4];
8097 root.GetTransform(m4);
8098 dst.SetGround(this, m4);
8099 }
8100 else
8101 {
8102 GetInventory().GetCurrentInventoryLocation(dst);
8103 }
8104 }
8105
8106 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
8107 {
8108
8109 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
8110 return false;
8111
8112 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
8113 return false;
8114
8115
8117 return false;
8118
8119
8120 Magazine mag = Magazine.Cast(this);
8121 if (mag)
8122 {
8123 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
8124 return false;
8125
8126 if (stack_max_limit)
8127 {
8128 Magazine other_mag = Magazine.Cast(other_item);
8129 if (other_item)
8130 {
8131 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
8132 return false;
8133 }
8134
8135 }
8136 }
8137 else
8138 {
8139
8141 return false;
8142
8144 return false;
8145 }
8146
8147 PlayerBase player = null;
8148 if (CastTo(player, GetHierarchyRootPlayer()))
8149 {
8150 if (player.GetInventory().HasAttachment(this))
8151 return false;
8152
8153 if (player.IsItemsToDelete())
8154 return false;
8155 }
8156
8157 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
8158 return false;
8159
8160 int slotID;
8162 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
8163 return false;
8164
8165 return true;
8166 }
8167
8169 {
8171 }
8172
8174 {
8175 return m_IsResultOfSplit;
8176 }
8177
8179 {
8180 m_IsResultOfSplit = value;
8181 }
8182
8184 {
8186 }
8187
8189 {
8190 float other_item_quantity = other_item.GetQuantity();
8191 float this_free_space;
8192
8194
8196
8197 if (other_item_quantity > this_free_space)
8198 {
8199 return this_free_space;
8200 }
8201 else
8202 {
8203 return other_item_quantity;
8204 }
8205 }
8206
8208 {
8210 }
8211
8213 {
8215 return;
8216
8217 if (!IsMagazine() && other_item)
8218 {
8220 if (quantity_used != 0)
8221 {
8222 float hp1 = GetHealth01("","");
8223 float hp2 = other_item.GetHealth01("","");
8224 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
8225 hpResult = hpResult / (
GetQuantity() + quantity_used);
8226
8227 hpResult *= GetMaxHealth();
8228 Math.Round(hpResult);
8229 SetHealth("", "Health", hpResult);
8230
8232 other_item.AddQuantity(-quantity_used);
8233 }
8234 }
8236 }
8237
8239 {
8240 #ifdef SERVER
8241 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
8242 GetHierarchyParent().IncreaseLifetimeUp();
8243 #endif
8244 };
8245
8247 {
8248 PlayerBase p = PlayerBase.Cast(player);
8249
8250 array<int> recipesIds = p.m_Recipes;
8251 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8252 if (moduleRecipesManager)
8253 {
8254 EntityAI itemInHands = player.GetEntityInHands();
8255 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
8256 }
8257
8258 for (int i = 0;i < recipesIds.Count(); i++)
8259 {
8260 int key = recipesIds.Get(i);
8261 string recipeName = moduleRecipesManager.GetRecipeName(key);
8263 }
8264 }
8265
8266
8267 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
8268 {
8269 super.GetDebugActions(outputList);
8270
8271
8277
8278
8283
8288
8289
8293
8294
8296 {
8300 }
8301
8304
8305
8309
8311
8312 InventoryLocation loc = new InventoryLocation();
8313 GetInventory().GetCurrentInventoryLocation(loc);
8315 {
8316 if (Gizmo_IsSupported())
8319 }
8320
8322 }
8323
8324
8325
8326
8328 {
8329 super.OnAction(action_id, player, ctx);
8330
8332 {
8333 switch (action_id)
8334 {
8338 return true;
8342 return true;
8343 }
8344 }
8345
8347 {
8348 switch (action_id)
8349 {
8351 Delete();
8352 return true;
8353 }
8354 }
8355
8356 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
8357 {
8358 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8359 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
8360 PlayerBase p = PlayerBase.Cast(player);
8361 if (
EActions.RECIPES_RANGE_START < 1000)
8362 {
8363 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
8364 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
8365 }
8366 }
8367 #ifndef SERVER
8368 else if (action_id ==
EActions.WATCH_PLAYER)
8369 {
8370 PluginDeveloper.SetDeveloperItemClientEx(player);
8371 }
8372 #endif
8374 {
8375 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
8376 {
8377 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
8378 OnDebugButtonPressServer(id + 1);
8379 }
8380
8381 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
8382 {
8383 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
8385 }
8386
8387 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
8388 {
8389 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
8391 }
8392
8393 else if (action_id ==
EActions.ADD_QUANTITY)
8394 {
8395 if (IsMagazine())
8396 {
8397 Magazine mag = Magazine.Cast(this);
8398 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
8399 }
8400 else
8401 {
8403 }
8404
8405 if (m_EM)
8406 {
8407 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
8408 }
8409
8410 }
8411
8412 else if (action_id ==
EActions.REMOVE_QUANTITY)
8413 {
8414 if (IsMagazine())
8415 {
8416 Magazine mag2 = Magazine.Cast(this);
8417 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
8418 }
8419 else
8420 {
8422 }
8423 if (m_EM)
8424 {
8425 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
8426 }
8427
8428 }
8429
8430 else if (action_id ==
EActions.SET_QUANTITY_0)
8431 {
8433
8434 if (m_EM)
8435 {
8436 m_EM.SetEnergy(0);
8437 }
8438 }
8439
8440 else if (action_id ==
EActions.SET_MAX_QUANTITY)
8441 {
8443
8444 if (m_EM)
8445 {
8446 m_EM.SetEnergy(m_EM.GetEnergyMax());
8447 }
8448 }
8449
8450 else if (action_id ==
EActions.ADD_HEALTH)
8451 {
8452 AddHealth("","",GetMaxHealth("","Health")/5);
8453 }
8454 else if (action_id ==
EActions.REMOVE_HEALTH)
8455 {
8456 AddHealth("","",-GetMaxHealth("","Health")/5);
8457 }
8458 else if (action_id ==
EActions.DESTROY_HEALTH)
8459 {
8460 SetHealth01("","",0);
8461 }
8462 else if (action_id ==
EActions.WATCH_ITEM)
8463 {
8465 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
8466 #ifdef DEVELOPER
8467 SetDebugDeveloper_item(this);
8468 #endif
8469 }
8470
8471 else if (action_id ==
EActions.ADD_TEMPERATURE)
8472 {
8473 AddTemperature(20);
8474
8475 }
8476
8477 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
8478 {
8479 AddTemperature(-20);
8480
8481 }
8482
8483 else if (action_id ==
EActions.FLIP_FROZEN)
8484 {
8485 SetFrozen(!GetIsFrozen());
8486
8487 }
8488
8489 else if (action_id ==
EActions.ADD_WETNESS)
8490 {
8492
8493 }
8494
8495 else if (action_id ==
EActions.REMOVE_WETNESS)
8496 {
8498
8499 }
8500
8501 else if (action_id ==
EActions.LIQUIDTYPE_UP)
8502 {
8505
8506
8507 }
8508
8509 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
8510 {
8513 }
8514
8515 else if (action_id ==
EActions.MAKE_SPECIAL)
8516 {
8517 auto debugParams = DebugSpawnParams.WithPlayer(player);
8518 OnDebugSpawnEx(debugParams);
8519 }
8520
8521 }
8522
8523
8524 return false;
8525 }
8526
8527
8528
8529
8533
8536
8537
8538
8540 {
8541 return false;
8542 }
8543
8544
8546 {
8547 return true;
8548 }
8549
8550
8552 {
8553 return true;
8554 }
8555
8556
8557
8559 {
8560 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
8561 return g_Game.ConfigIsExisting(config_path);
8562 }
8563
8566 {
8567 return null;
8568 }
8569
8571 {
8572 return false;
8573 }
8574
8576 {
8577 return false;
8578 }
8579
8583
8584
8586 {
8587 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8588 return module_repairing.CanRepair(this, item_repair_kit);
8589 }
8590
8591
8592 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
8593 {
8594 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8595 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
8596 }
8597
8598
8600 {
8601
8602
8603
8604
8605
8606
8607
8608
8609 return 1;
8610 }
8611
8612
8613
8615 {
8617 }
8618
8619
8620
8622 {
8624 }
8625
8626
8635 {
8636 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8637
8638 if (player)
8639 {
8640 player.MessageStatus(text);
8641 }
8642 }
8643
8644
8653 {
8654 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8655
8656 if (player)
8657 {
8658 player.MessageAction(text);
8659 }
8660 }
8661
8662
8671 {
8672 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8673
8674 if (player)
8675 {
8676 player.MessageFriendly(text);
8677 }
8678 }
8679
8680
8689 {
8690 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8691
8692 if (player)
8693 {
8694 player.MessageImportant(text);
8695 }
8696 }
8697
8699 {
8700 return true;
8701 }
8702
8703
8704 override bool KindOf(
string tag)
8705 {
8706 bool found = false;
8707 string item_name = this.
GetType();
8709 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
8710
8711 int array_size = item_tag_array.Count();
8712 for (int i = 0; i < array_size; i++)
8713 {
8714 if (item_tag_array.Get(i) == tag)
8715 {
8716 found = true;
8717 break;
8718 }
8719 }
8720 return found;
8721 }
8722
8723
8725 {
8726
8727 super.OnRPC(sender, rpc_type,ctx);
8728
8729
8730 switch (rpc_type)
8731 {
8732 #ifndef SERVER
8733 case ERPCs.RPC_SOUND_LOCK_ATTACH:
8734 Param2<bool, string> p = new Param2<bool, string>(false, "");
8735
8737 return;
8738
8739 bool play = p.param1;
8740 string soundSet = p.param2;
8741
8742 if (play)
8743 {
8745 {
8747 {
8749 }
8750 }
8751 else
8752 {
8754 }
8755 }
8756 else
8757 {
8759 }
8760
8761 break;
8762 #endif
8763
8764 }
8765
8767 {
8769 }
8770 }
8771
8772
8773
8774
8776 {
8777 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8778 return plugin.GetID(
name);
8779 }
8780
8782 {
8783 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8784 return plugin.GetName(id);
8785 }
8786
8789 {
8790
8791
8792 int varFlags;
8793 if (!ctx.
Read(varFlags))
8794 return;
8795
8796 if (varFlags & ItemVariableFlags.FLOAT)
8797 {
8799 }
8800 }
8801
8803 {
8804
8805 super.SerializeNumericalVars(floats_out);
8806
8807
8808
8810 {
8812 }
8813
8815 {
8817 }
8818
8820 {
8822 }
8823
8825 {
8830 }
8831
8833 {
8835 }
8836 }
8837
8839 {
8840
8841 super.DeSerializeNumericalVars(floats);
8842
8843
8844 int index = 0;
8845 int mask = Math.Round(floats.Get(index));
8846
8847 index++;
8848
8850 {
8852 {
8854 }
8855 else
8856 {
8857 float quantity = floats.Get(index);
8859 }
8860 index++;
8861 }
8862
8864 {
8865 float wet = floats.Get(index);
8867 index++;
8868 }
8869
8871 {
8872 int liquidtype = Math.Round(floats.Get(index));
8874 index++;
8875 }
8876
8878 {
8880 index++;
8882 index++;
8884 index++;
8886 index++;
8887 }
8888
8890 {
8891 int cleanness = Math.Round(floats.Get(index));
8893 index++;
8894 }
8895 }
8896
8898 {
8899 super.WriteVarsToCTX(ctx);
8900
8901
8903 {
8905 }
8906
8908 {
8910 }
8911
8913 {
8915 }
8916
8918 {
8919 int r,g,b,a;
8925 }
8926
8928 {
8930 }
8931 }
8932
8934 {
8935 if (!super.ReadVarsFromCTX(ctx,version))
8936 return false;
8937
8938 int intValue;
8939 float value;
8940
8941 if (version < 140)
8942 {
8943 if (!ctx.
Read(intValue))
8944 return false;
8945
8946 m_VariablesMask = intValue;
8947 }
8948
8950 {
8951 if (!ctx.
Read(value))
8952 return false;
8953
8955 {
8957 }
8958 else
8959 {
8961 }
8962 }
8963
8964 if (version < 140)
8965 {
8967 {
8968 if (!ctx.
Read(value))
8969 return false;
8970 SetTemperatureDirect(value);
8971 }
8972 }
8973
8975 {
8976 if (!ctx.
Read(value))
8977 return false;
8979 }
8980
8982 {
8983 if (!ctx.
Read(intValue))
8984 return false;
8986 }
8987
8989 {
8990 int r,g,b,a;
8992 return false;
8994 return false;
8996 return false;
8998 return false;
8999
9001 }
9002
9004 {
9005 if (!ctx.
Read(intValue))
9006 return false;
9008 }
9009
9010 if (version >= 138 && version < 140)
9011 {
9013 {
9014 if (!ctx.
Read(intValue))
9015 return false;
9016 SetFrozen(intValue);
9017 }
9018 }
9019
9020 return true;
9021 }
9022
9023
9025 {
9028 {
9030 }
9031
9032 if (!super.OnStoreLoad(ctx, version))
9033 {
9035 return false;
9036 }
9037
9038 if (version >= 114)
9039 {
9040 bool hasQuickBarIndexSaved;
9041
9042 if (!ctx.
Read(hasQuickBarIndexSaved))
9043 {
9045 return false;
9046 }
9047
9048 if (hasQuickBarIndexSaved)
9049 {
9050 int itmQBIndex;
9051
9052
9053 if (!ctx.
Read(itmQBIndex))
9054 {
9056 return false;
9057 }
9058
9059 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
9060 if (itmQBIndex != -1 && parentPlayer)
9061 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
9062 }
9063 }
9064 else
9065 {
9066
9067 PlayerBase player;
9068 int itemQBIndex;
9069 if (version ==
int.
MAX)
9070 {
9071 if (!ctx.
Read(itemQBIndex))
9072 {
9074 return false;
9075 }
9076 }
9077 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
9078 {
9079
9080 if (!ctx.
Read(itemQBIndex))
9081 {
9083 return false;
9084 }
9085 if (itemQBIndex != -1 && player)
9086 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
9087 }
9088 }
9089
9090 if (version < 140)
9091 {
9092
9093 if (!LoadVariables(ctx, version))
9094 {
9096 return false;
9097 }
9098 }
9099
9100
9102 {
9104 return false;
9105 }
9106 if (version >= 132)
9107 {
9109 if (raib)
9110 {
9112 {
9114 return false;
9115 }
9116 }
9117 }
9118
9120 return true;
9121 }
9122
9123
9124
9126 {
9127 super.OnStoreSave(ctx);
9128
9129 PlayerBase player;
9130 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
9131 {
9133
9134 int itemQBIndex = -1;
9135 itemQBIndex = player.FindQuickBarEntityIndex(this);
9136 ctx.
Write(itemQBIndex);
9137 }
9138 else
9139 {
9141 }
9142
9144
9146 if (raib)
9147 {
9149 }
9150 }
9151
9152
9154 {
9155 super.AfterStoreLoad();
9156
9158 {
9160 }
9161
9163 {
9166 }
9167 }
9168
9170 {
9171 super.EEOnAfterLoad();
9172
9174 {
9176 }
9177
9180 }
9181
9183 {
9184 return false;
9185 }
9186
9187
9188
9190 {
9192 {
9193 #ifdef PLATFORM_CONSOLE
9194
9196 {
9198 if (menu)
9199 {
9201 }
9202 }
9203 #endif
9204 }
9205
9207 {
9210 }
9211
9213 {
9214 SetWeightDirty();
9216 }
9218 {
9221 }
9222
9224 {
9227
9230 }
9232 {
9236 }
9237
9238 super.OnVariablesSynchronized();
9239 }
9240
9241
9242
9244 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
9245 {
9246 if (!IsServerCheck(allow_client))
9247 return false;
9248
9250 return false;
9251
9254
9255 if (value <= (min + 0.001))
9256 value = min;
9257
9258 if (value == min)
9259 {
9260 if (destroy_config)
9261 {
9262 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
9263 if (dstr)
9264 {
9266 this.Delete();
9267 return true;
9268 }
9269 }
9270 else if (destroy_forced)
9271 {
9273 this.Delete();
9274 return true;
9275 }
9276
9278 }
9279
9282
9284 {
9285 EntityAI parent = GetHierarchyRoot();
9286 InventoryLocation iLoc = new InventoryLocation();
9287 GetInventory().GetCurrentInventoryLocation(iLoc);
9289 {
9290 int iLocSlot = iLoc.
GetSlot();
9292 {
9294 }
9296 {
9298 }
9299 }
9300 }
9301
9303 {
9305
9306 if (delta)
9308 }
9309
9311
9312 return false;
9313 }
9314
9315
9317 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9318 {
9320 }
9321
9323 {
9326 }
9327
9329 {
9332 }
9333
9335 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9336 {
9337 float value_clamped = Math.Clamp(value, 0, 1);
9339 SetQuantity(result, destroy_config, destroy_forced);
9340 }
9341
9342
9345 {
9347 }
9348
9350 {
9352 }
9353
9354
9355
9356
9357
9358
9359
9360
9361
9362
9364 {
9365 int slot = -1;
9366 GameInventory inventory = GetInventory();
9367 if (inventory)
9368 {
9369 InventoryLocation il = new InventoryLocation;
9372 }
9373
9375 }
9376
9378 {
9379 float quantity_max = 0;
9380
9382 {
9383 if (attSlotID != -1)
9384 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
9385
9386 if (quantity_max <= 0)
9388 }
9389
9390 if (quantity_max <= 0)
9392
9393 return quantity_max;
9394 }
9395
9397 {
9399 }
9400
9402 {
9404 }
9405
9406
9408 {
9410 }
9411
9413 {
9415 }
9416
9418 {
9420 }
9421
9422
9424 {
9425
9426 float weightEx = GetWeightEx();
9427 float special = GetInventoryAndCargoWeight();
9428 return weightEx - special;
9429 }
9430
9431
9433 {
9435 }
9436
9438 {
9440 {
9441 #ifdef DEVELOPER
9442 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9443 {
9444 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
9446 }
9447 #endif
9448
9450 }
9451 else if (HasEnergyManager())
9452 {
9453 #ifdef DEVELOPER
9454 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9455 {
9456 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
9457 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
9458 }
9459 #endif
9460 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
9461 }
9462 else
9463 {
9464 #ifdef DEVELOPER
9465 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9466 {
9467 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
9468 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
9469 }
9470 #endif
9471 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
9472 }
9473 }
9474
9477 {
9478 int item_count = 0;
9480
9481 GameInventory inventory = GetInventory();
9482 CargoBase cargo = inventory.
GetCargo();
9483 if (cargo != NULL)
9484 {
9486 }
9487
9489 for (int i = 0; i < nAttachments; ++i)
9490 {
9492 if (item)
9493 item_count += item.GetNumberOfItems();
9494 }
9495 return item_count;
9496 }
9497
9500 {
9501 float weight = 0;
9502 float wetness = 1;
9503 if (include_wetness)
9506 {
9507 weight = wetness * m_ConfigWeight;
9508 }
9510 {
9511 weight = 1;
9512 }
9513 return weight;
9514 }
9515
9516
9517
9519 {
9520 GameInventory inventory = GetInventory();
9521 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
9522 {
9523 array<EntityAI> items = new array<EntityAI>;
9525 for (int i = 0; i < items.Count(); ++i)
9526 {
9528 if (item)
9529 {
9530 g_Game.ObjectDelete(item);
9531 }
9532 }
9533 }
9534 }
9535
9536
9537
9538
9540 {
9541 float energy = 0;
9542 if (HasEnergyManager())
9543 {
9544 energy = GetCompEM().GetEnergy();
9545 }
9546 return energy;
9547 }
9548
9549
9551 {
9552 super.OnEnergyConsumed();
9553
9555 }
9556
9558 {
9559 super.OnEnergyAdded();
9560
9562 }
9563
9564
9566 {
9567 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
9568 {
9570 {
9571 float energy_0to1 = GetCompEM().GetEnergy0To1();
9573 }
9574 }
9575 }
9576
9577
9579 {
9580 return ConfigGetFloat("heatIsolation");
9581 }
9582
9584 {
9586 }
9587
9589 {
9590 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
9591 if (
g_Game.ConfigIsExisting(paramPath))
9592 return g_Game.ConfigGetFloat(paramPath);
9593
9594 return 0.0;
9595 }
9596
9598 {
9599 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
9600 if (
g_Game.ConfigIsExisting(paramPath))
9601 return g_Game.ConfigGetFloat(paramPath);
9602
9603 return 0.0;
9604 }
9605
9606 override void SetWet(
float value,
bool allow_client =
false)
9607 {
9608 if (!IsServerCheck(allow_client))
9609 return;
9610
9613
9615
9616 m_VarWet = Math.Clamp(value, min, max);
9617
9619 {
9622 }
9623 }
9624
9625 override void AddWet(
float value)
9626 {
9628 }
9629
9631 {
9633 }
9634
9636 {
9638 }
9639
9641 {
9643 }
9644
9646 {
9648 }
9649
9651 {
9653 }
9654
9656 {
9659 if (newLevel != oldLevel)
9660 {
9662 }
9663 }
9664
9666 {
9667 SetWeightDirty();
9668 }
9669
9671 {
9672 return GetWetLevelInternal(
m_VarWet);
9673 }
9674
9675
9676
9678 {
9680 }
9681
9683 {
9685 }
9686
9688 {
9690 }
9691
9693 {
9695 }
9696
9697
9698
9700 {
9701 if (ConfigIsExisting("itemModelLength"))
9702 {
9703 return ConfigGetFloat("itemModelLength");
9704 }
9705 return 0;
9706 }
9707
9709 {
9710 if (ConfigIsExisting("itemAttachOffset"))
9711 {
9712 return ConfigGetFloat("itemAttachOffset");
9713 }
9714 return 0;
9715 }
9716
9717 override void SetCleanness(
int value,
bool allow_client =
false)
9718 {
9719 if (!IsServerCheck(allow_client))
9720 return;
9721
9723
9725
9728 }
9729
9731 {
9733 }
9734
9736 {
9737 return true;
9738 }
9739
9740
9741
9742
9744 {
9746 }
9747
9749 {
9751 }
9752
9753
9754
9755
9756 override void SetColor(
int r,
int g,
int b,
int a)
9757 {
9763 }
9765 override void GetColor(out
int r,out
int g,out
int b,out
int a)
9766 {
9771 }
9772
9774 {
9776 }
9777
9780 {
9781 int r,g,b,a;
9783 r = r/255;
9784 g = g/255;
9785 b = b/255;
9786 a = a/255;
9787 return MiscGameplayFunctions.GetColorString(r, g, b, a);
9788 }
9789
9790
9791
9792 override void SetLiquidType(
int value,
bool allow_client =
false)
9793 {
9794 if (!IsServerCheck(allow_client))
9795 return;
9796
9801 }
9802
9804 {
9805 return ConfigGetInt("varLiquidTypeInit");
9806 }
9807
9809 {
9811 }
9812
9814 {
9816 SetFrozen(false);
9817 }
9818
9821 {
9822 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9823 }
9824
9825
9828 {
9829 PlayerBase nplayer;
9830 if (PlayerBase.CastTo(nplayer, player))
9831 {
9833 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9834 }
9835 }
9836
9837
9840 {
9841 PlayerBase nplayer;
9842 if (PlayerBase.CastTo(nplayer,player))
9843 {
9844 nplayer.SetEnableQuickBarEntityShortcut(this, false);
9845 }
9846
9847 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
9848
9849 if (HasEnergyManager())
9850 {
9851 GetCompEM().UpdatePlugState();
9852 }
9853 }
9854
9855
9857 {
9858 super.OnPlacementStarted(player);
9859
9861 }
9862
9863 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
9864 {
9866 {
9867 m_AdminLog.OnPlacementComplete(player,
this);
9868 }
9869
9870 super.OnPlacementComplete(player, position, orientation);
9871 }
9872
9873
9874
9875
9876
9878 {
9880 {
9881 return true;
9882 }
9883 else
9884 {
9885 return false;
9886 }
9887 }
9888
9889
9891 {
9893 {
9895 }
9896 }
9897
9898
9900 {
9902 }
9903
9905 {
9907 }
9908
9909 override void InsertAgent(
int agent,
float count = 1)
9910 {
9911 if (count < 1)
9912 return;
9913
9915 }
9916
9919 {
9921 }
9922
9923
9925 {
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
9965
9966
9967
9968
9969
9971 {
9973 return false;
9974 return true;
9975 }
9976
9978 {
9979
9981 }
9982
9983
9986 {
9987 super.CheckForRoofLimited(timeTresholdMS);
9988
9989 float time =
g_Game.GetTime();
9990 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
9991 {
9992 m_PreviousRoofTestTime = time;
9993 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
9994 }
9995 }
9996
9997
9999 {
10001 {
10002 return 0;
10003 }
10004
10005 if (GetInventory().GetAttachmentSlotsCount() != 0)
10006 {
10007 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
10008 if (filter)
10009 return filter.GetProtectionLevel(type, false, system);
10010 else
10011 return 0;
10012 }
10013
10014 string subclassPath, entryName;
10015
10016 switch (type)
10017 {
10019 entryName = "biological";
10020 break;
10022 entryName = "chemical";
10023 break;
10024 default:
10025 entryName = "biological";
10026 break;
10027 }
10028
10029 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
10030
10031 return g_Game.ConfigGetFloat(subclassPath + entryName);
10032 }
10033
10034
10035
10038 {
10039 if (!IsMagazine())
10041
10043 }
10044
10045
10046
10047
10048
10053 {
10054 return true;
10055 }
10056
10058 {
10060 }
10061
10062
10063
10064
10065
10067 {
10068 if (parent)
10069 {
10070 if (parent.IsInherited(DayZInfected))
10071 return true;
10072
10073 if (!parent.IsRuined())
10074 return true;
10075 }
10076
10077 return true;
10078 }
10079
10081 {
10082 if (!super.CanPutAsAttachment(parent))
10083 {
10084 return false;
10085 }
10086
10087 if (!IsRuined() && !parent.IsRuined())
10088 {
10089 return true;
10090 }
10091
10092 return false;
10093 }
10094
10096 {
10097
10098
10099
10100
10101 return super.CanReceiveItemIntoCargo(item);
10102 }
10103
10105 {
10106
10107
10108
10109
10110 GameInventory attachmentInv = attachment.GetInventory();
10112 {
10113 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
10114 return false;
10115 }
10116
10117 InventoryLocation loc = new InventoryLocation();
10118 attachment.GetInventory().GetCurrentInventoryLocation(loc);
10119 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
10120 return false;
10121
10122 return super.CanReceiveAttachment(attachment, slotId);
10123 }
10124
10126 {
10127 if (!super.CanReleaseAttachment(attachment))
10128 return false;
10129
10130 return GetInventory().AreChildrenAccessible();
10131 }
10132
10133
10134
10135
10136
10137
10138
10139
10140
10141
10142
10143
10144
10145
10146
10147
10148
10149
10150
10151
10152
10154 {
10155 int id = muzzle_owner.GetMuzzleID();
10156 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
10157
10158 if (WPOF_array)
10159 {
10160 for (int i = 0; i < WPOF_array.Count(); i++)
10161 {
10162 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
10163
10164 if (WPOF)
10165 {
10166 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
10167 }
10168 }
10169 }
10170 }
10171
10172
10174 {
10175 int id = muzzle_owner.GetMuzzleID();
10177
10178 if (WPOBE_array)
10179 {
10180 for (int i = 0; i < WPOBE_array.Count(); i++)
10181 {
10182 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
10183
10184 if (WPOBE)
10185 {
10186 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10187 }
10188 }
10189 }
10190 }
10191
10192
10194 {
10195 int id = muzzle_owner.GetMuzzleID();
10196 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10197
10198 if (WPOOH_array)
10199 {
10200 for (int i = 0; i < WPOOH_array.Count(); i++)
10201 {
10202 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10203
10204 if (WPOOH)
10205 {
10206 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10207 }
10208 }
10209 }
10210 }
10211
10212
10214 {
10215 int id = muzzle_owner.GetMuzzleID();
10216 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10217
10218 if (WPOOH_array)
10219 {
10220 for (int i = 0; i < WPOOH_array.Count(); i++)
10221 {
10222 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10223
10224 if (WPOOH)
10225 {
10226 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10227 }
10228 }
10229 }
10230 }
10231
10232
10234 {
10235 int id = muzzle_owner.GetMuzzleID();
10236 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10237
10238 if (WPOOH_array)
10239 {
10240 for (int i = 0; i < WPOOH_array.Count(); i++)
10241 {
10242 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10243
10244 if (WPOOH)
10245 {
10246 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10247 }
10248 }
10249 }
10250 }
10251
10252
10253
10255 {
10257 {
10258 return true;
10259 }
10260
10261 return false;
10262 }
10263
10265 {
10267 {
10268 return true;
10269 }
10270
10271 return false;
10272 }
10273
10275 {
10277 {
10278 return true;
10279 }
10280
10281 return false;
10282 }
10283
10285 {
10286 return false;
10287 }
10288
10291 {
10292 return UATimeSpent.DEFAULT_DEPLOY;
10293 }
10294
10295
10296
10297
10299 {
10301 SetSynchDirty();
10302 }
10303
10305 {
10307 }
10308
10309
10311 {
10312 return false;
10313 }
10314
10317 {
10318 string att_type = "None";
10319
10320 if (ConfigIsExisting("soundAttType"))
10321 {
10322 att_type = ConfigGetString("soundAttType");
10323 }
10324
10326 }
10327
10329 {
10331 }
10332
10333
10334
10335
10336
10342
10344 {
10347
10349 }
10350
10351
10353 {
10355 return;
10356
10358
10361
10364
10365 SoundParameters params = new SoundParameters();
10369 }
10370
10371
10373 {
10375 {
10378
10379 SetSynchDirty();
10380
10383 }
10384 }
10385
10387 {
10389 }
10390
10391
10393 {
10395 return;
10396
10398 SetSynchDirty();
10399
10402 }
10403
10405 {
10408 }
10409
10411 {
10413 }
10414
10415 void OnApply(PlayerBase player);
10416
10418 {
10419 return 1.0;
10420 };
10421
10423 {
10425 }
10426
10428 {
10430 }
10431
10433
10435 {
10436 SetDynamicPhysicsLifeTime(0.01);
10438 }
10439
10441 {
10442 array<string> zone_names = new array<string>;
10443 GetDamageZones(zone_names);
10444 for (int i = 0; i < zone_names.Count(); i++)
10445 {
10446 SetHealthMax(zone_names.Get(i),"Health");
10447 }
10448 SetHealthMax("","Health");
10449 }
10450
10453 {
10454 float global_health = GetHealth01("","Health");
10455 array<string> zones = new array<string>;
10456 GetDamageZones(zones);
10457
10458 for (int i = 0; i < zones.Count(); i++)
10459 {
10460 SetHealth01(zones.Get(i),"Health",global_health);
10461 }
10462 }
10463
10466 {
10467 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
10468 }
10469
10471 {
10472 if (!hasRootAsPlayer)
10473 {
10474 if (refParentIB)
10475 {
10476
10477 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
10478 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
10479
10480 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
10481 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
10482
10485 }
10486 else
10487 {
10488
10491 }
10492 }
10493 }
10494
10496 {
10498 {
10499 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
10500 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
10501 {
10502 float heatPermCoef = 1.0;
10504 while (ent)
10505 {
10506 heatPermCoef *= ent.GetHeatPermeabilityCoef();
10507 ent = ent.GetHierarchyParent();
10508 }
10509
10510 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
10511 }
10512 }
10513 }
10514
10516 {
10517
10518 EntityAI parent = GetHierarchyParent();
10519 if (!parent)
10520 {
10521 hasParent = false;
10522 hasRootAsPlayer = false;
10523 }
10524 else
10525 {
10526 hasParent = true;
10527 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
10528 refParentIB =
ItemBase.Cast(parent);
10529 }
10530 }
10531
10532 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
10533 {
10534
10535 }
10536
10538 {
10539
10540 return false;
10541 }
10542
10544 {
10545
10546
10547 return false;
10548 }
10549
10551 {
10552
10553 return false;
10554 }
10555
10558 {
10559 return !GetIsFrozen() &&
IsOpen();
10560 }
10561
10563 {
10564 bool hasParent = false, hasRootAsPlayer = false;
10566
10567 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
10568 bool foodDecay =
g_Game.IsFoodDecayEnabled();
10569
10570 if (wwtu || foodDecay)
10571 {
10575
10576 if (processWetness || processTemperature || processDecay)
10577 {
10579
10580 if (processWetness)
10581 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
10582
10583 if (processTemperature)
10585
10586 if (processDecay)
10587 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
10588 }
10589 }
10590 }
10591
10594 {
10596 }
10597
10599 {
10602
10603 return super.GetTemperatureFreezeThreshold();
10604 }
10605
10607 {
10610
10611 return super.GetTemperatureThawThreshold();
10612 }
10613
10615 {
10618
10619 return super.GetItemOverheatThreshold();
10620 }
10621
10623 {
10625 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
10626
10627 return super.GetTemperatureFreezeTime();
10628 }
10629
10631 {
10633 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
10634
10635 return super.GetTemperatureThawTime();
10636 }
10637
10642
10644 {
10645 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
10646 }
10647
10649 {
10650 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
10651 }
10652
10655 {
10657 }
10658
10660 {
10662 }
10663
10665 {
10667 }
10668
10671 {
10672 return null;
10673 }
10674
10677 {
10678 return false;
10679 }
10680
10682 {
10684 {
10687 if (!trg)
10688 {
10690 explosive = this;
10691 }
10692
10693 explosive.PairRemote(trg);
10695
10696 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
10697 trg.SetPersistentPairID(persistentID);
10698 explosive.SetPersistentPairID(persistentID);
10699
10700 return true;
10701 }
10702 return false;
10703 }
10704
10707 {
10708 float ret = 1.0;
10711 ret *= GetHealth01();
10712
10713 return ret;
10714 }
10715
10716 #ifdef DEVELOPER
10717 override void SetDebugItem()
10718 {
10719 super.SetDebugItem();
10720 _itemBase = this;
10721 }
10722
10724 {
10725 string text = super.GetDebugText();
10726
10728 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
10729
10730 return text;
10731 }
10732 #endif
10733
10735 {
10736 return true;
10737 }
10738
10740
10742
10744 {
10747 }
10748
10749
10757
10773
10774 [
Obsolete(
"Use ItemSoundHandler instead")]
10777 {
10778 if (!
g_Game.IsDedicatedServer())
10779 {
10780 if (ConfigIsExisting("attachSoundSet"))
10781 {
10782 string cfg_path = "";
10783 string soundset = "";
10784 string type_name =
GetType();
10785
10788 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
10789 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
10790
10791 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
10792 {
10793 for (int i = 0; i < cfg_soundset_array.Count(); i++)
10794 {
10795 if (cfg_slot_array[i] == slot_type)
10796 {
10797 soundset = cfg_soundset_array[i];
10798 break;
10799 }
10800 }
10801 }
10802
10803 if (soundset != "")
10804 {
10805 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
10807 }
10808 }
10809 }
10810 }
10811
10813}
10814
10816{
10818 if (entity)
10819 {
10820 bool is_item = entity.IsInherited(
ItemBase);
10821 if (is_item && full_quantity)
10822 {
10825 }
10826 }
10827 else
10828 {
10830 return NULL;
10831 }
10832 return entity;
10833}
10834
10836{
10837 if (item)
10838 {
10839 if (health > 0)
10840 item.SetHealth("", "", health);
10841
10842 if (item.CanHaveTemperature())
10843 {
10845 if (item.CanFreeze())
10846 item.SetFrozen(false);
10847 }
10848
10849 if (item.HasEnergyManager())
10850 {
10851 if (quantity >= 0)
10852 {
10853 item.GetCompEM().SetEnergy0To1(quantity);
10854 }
10855 else
10856 {
10858 }
10859 }
10860 else if (item.IsMagazine())
10861 {
10862 Magazine mag = Magazine.Cast(item);
10863 if (quantity >= 0)
10864 {
10865 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
10866 }
10867 else
10868 {
10870 }
10871
10872 }
10873 else
10874 {
10875 if (quantity >= 0)
10876 {
10877 item.SetQuantityNormalized(quantity, false);
10878 }
10879 else
10880 {
10882 }
10883
10884 }
10885 }
10886}
10887
10888#ifdef DEVELOPER
10890#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.