5950{
5952 {
5953 return true;
5954 }
5955};
5956
5958{
5959
5960};
5961
5962
5963
5965{
5969
5971
5974
5975
5976
5977
5978
5987
5993
5998
6003
6024 protected bool m_IsResultOfSplit
6025
6027
6032
6033
6034
6036
6040
6041
6042
6044
6047
6048
6049
6055
6056
6064
6067
6068
6070
6071
6073
6074
6079
6080
6085
6087
6088
6090
6091
6093 {
6098
6099 if (!
g_Game.IsDedicatedServer())
6100 {
6102 {
6104
6106 {
6108 }
6109 }
6110
6113 }
6114
6115 m_OldLocation = null;
6116
6118 {
6120 }
6121
6122 if (ConfigIsExisting("headSelectionsToHide"))
6123 {
6126 }
6127
6129 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
6130 {
6132 }
6133
6135
6136 m_IsResultOfSplit = false;
6137
6139 }
6140
6142 {
6143 super.InitItemVariables();
6144
6150 m_Count = ConfigGetInt(
"count");
6151
6154
6159
6162
6167
6179
6183
6184
6187 if (ConfigIsExisting("canBeSplit"))
6188 {
6191 }
6192
6194 if (ConfigIsExisting("itemBehaviour"))
6196
6197
6200 RegisterNetSyncVariableInt("m_VarLiquidType");
6201 RegisterNetSyncVariableInt("m_Cleanness",0,1);
6202
6203 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
6204 RegisterNetSyncVariableFloat("m_ImpactSpeed");
6205 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
6206
6207 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
6208 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
6209 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
6210 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
6211
6212 RegisterNetSyncVariableBool("m_IsBeingPlaced");
6213 RegisterNetSyncVariableBool("m_IsTakeable");
6214 RegisterNetSyncVariableBool("m_IsHologram");
6215
6218 {
6221 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
6222 }
6223
6225
6227 if (ConfigIsExisting("temperaturePerQuantityWeight"))
6229
6231 }
6232
6234 {
6236 }
6237
6239 {
6242 {
6247 }
6248 }
6249
6250 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
6251 {
6253 {
6256 }
6257
6259 }
6260
6262 {
6268 }
6269
6271
6273 {
6275
6276 if (!action)
6277 {
6278 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
6279 return;
6280 }
6281
6283 if (!ai)
6284 {
6286 return;
6287 }
6288
6290 if (!action_array)
6291 {
6292 action_array = new array<ActionBase_Basic>;
6294 }
6295 if (LogManager.IsActionLogEnable())
6296 {
6297 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
6298 }
6299
6300 if (action_array.Find(action) != -1)
6301 {
6302 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
6303 }
6304 else
6305 {
6306 action_array.Insert(action);
6307 }
6308 }
6309
6311 {
6312 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6313 ActionBase action = player.GetActionManager().GetAction(actionName);
6316
6317 if (action_array)
6318 {
6319 action_array.RemoveItem(action);
6320 }
6321 }
6322
6323
6324
6326 {
6327 ActionOverrideData overrideData = new ActionOverrideData();
6331
6333 if (!actionMap)
6334 {
6337 }
6338
6339 actionMap.Insert(this.
Type(), overrideData);
6340
6341 }
6342
6344
6346
6347
6349 {
6352
6355
6356 string config_to_search = "CfgVehicles";
6357 string muzzle_owner_config;
6358
6360 {
6361 if (IsInherited(Weapon))
6362 config_to_search = "CfgWeapons";
6363
6364 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6365
6366 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
6367
6368 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
6369
6370 if (config_OnFire_subclass_count > 0)
6371 {
6372 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
6373
6374 for (int i = 0; i < config_OnFire_subclass_count; i++)
6375 {
6376 string particle_class = "";
6377 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
6378 string config_OnFire_entry = config_OnFire_class + particle_class;
6379 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
6380 WPOF_array.Insert(WPOF);
6381 }
6382
6383
6385 }
6386 }
6387
6389 {
6390 config_to_search = "CfgWeapons";
6391 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6392
6393 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
6394
6395 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
6396
6397 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
6398 {
6399 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
6400
6401 for (i = 0; i < config_OnBulletCasingEject_count; i++)
6402 {
6403 string particle_class2 = "";
6404 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
6405 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
6406 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
6407 WPOBE_array.Insert(WPOBE);
6408 }
6409
6410
6412 }
6413 }
6414 }
6415
6416
6418 {
6421
6423 {
6424 string config_to_search = "CfgVehicles";
6425
6426 if (IsInherited(Weapon))
6427 config_to_search = "CfgWeapons";
6428
6429 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6430 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
6431
6432 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
6433 {
6434
6436
6438 {
6440 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
6442 return;
6443 }
6444
6447
6448
6449
6450 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
6451 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
6452
6453 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
6454 {
6455 string particle_class = "";
6456 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
6457 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
6458 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
6459
6460 if (entry_type == CT_CLASS)
6461 {
6462 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
6463 WPOOH_array.Insert(WPOF);
6464 }
6465 }
6466
6467
6469 }
6470 }
6471 }
6472
6474 {
6476 }
6477
6479 {
6481 {
6483
6486
6489
6490 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6491 }
6492 }
6493
6495 {
6497 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6498
6500 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6501
6503 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6504
6506 {
6508 }
6509 }
6510
6512 {
6514 }
6515
6517 {
6520 else
6522
6524 {
6527 }
6528 else
6529 {
6532
6535 }
6536
6538 }
6539
6541 {
6543 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6544 }
6545
6547 {
6549 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6551 }
6552
6554 {
6556 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6557 }
6558
6560 {
6563
6564 OverheatingParticle OP = new OverheatingParticle();
6569
6571 }
6572
6574 {
6577
6578 return -1;
6579 }
6580
6582 {
6584 {
6587
6588 for (int i = count; i > 0; --i)
6589 {
6590 int id = i - 1;
6593
6596
6597 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
6598 {
6599 if (p)
6600 {
6603 }
6604 }
6605 }
6606 }
6607 }
6608
6610 {
6612 {
6614 {
6615 int id = i - 1;
6617
6618 if (OP)
6619 {
6621
6622 if (p)
6623 {
6625 }
6626
6627 delete OP;
6628 }
6629 }
6630
6633 }
6634 }
6635
6638 {
6639 return 0.0;
6640 }
6641
6642
6644 {
6645 return 250;
6646 }
6647
6649 {
6650 return 0;
6651 }
6652
6655 {
6657 return true;
6658
6659 return false;
6660 }
6661
6664 {
6667
6669 {
6671 }
6672 else
6673 {
6674
6676 }
6677
6679 }
6680
6687 {
6688 return -1;
6689 }
6690
6691
6692
6693
6695 {
6697 {
6698 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6699 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6700
6701 if (r_index >= 0)
6702 {
6703 InventoryLocation r_il = new InventoryLocation;
6704 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6705
6706 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6709 {
6710 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6711 }
6713 {
6714 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6715 }
6716
6717 }
6718
6719 player.GetHumanInventory().ClearUserReservedLocation(this);
6720 }
6721
6724 }
6725
6726
6727
6728
6730 {
6731 return ItemBase.m_DebugActionsMask;
6732 }
6733
6735 {
6736 return ItemBase.m_DebugActionsMask & mask;
6737 }
6738
6740 {
6741 ItemBase.m_DebugActionsMask = mask;
6742 }
6743
6745 {
6746 ItemBase.m_DebugActionsMask |= mask;
6747 }
6748
6750 {
6751 ItemBase.m_DebugActionsMask &= ~mask;
6752 }
6753
6755 {
6757 {
6759 }
6760 else
6761 {
6763 }
6764 }
6765
6766
6768 {
6769 if (GetEconomyProfile())
6770 {
6771 float q_max = GetEconomyProfile().GetQuantityMax();
6772 if (q_max > 0)
6773 {
6774 float q_min = GetEconomyProfile().GetQuantityMin();
6775 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
6776
6778 {
6779 ComponentEnergyManager comp = GetCompEM();
6781 {
6783 }
6784 }
6786 {
6788
6789 }
6790
6791 }
6792 }
6793 }
6794
6797 {
6798 EntityAI parent = GetHierarchyParent();
6799
6800 if (parent)
6801 {
6802 InventoryLocation inventory_location_to_lock = new InventoryLocation;
6803 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
6804 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
6805 }
6806 }
6807
6810 {
6811 EntityAI parent = GetHierarchyParent();
6812
6813 if (parent)
6814 {
6815 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
6816 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
6817 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
6818 }
6819 }
6820
6822 {
6823
6824
6825
6826
6828
6830 {
6831 if (ScriptInputUserData.CanStoreInputUserData())
6832 {
6833 ScriptInputUserData ctx = new ScriptInputUserData;
6839 ctx.
Write(use_stack_max);
6842
6844 {
6845 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
6846 }
6847 }
6848 }
6849 else if (!
g_Game.IsMultiplayer())
6850 {
6852 }
6853 }
6854
6856 {
6858 }
6859
6861 {
6863 }
6864
6866 {
6868 }
6869
6871 {
6872
6873 return false;
6874 }
6875
6877 {
6878 return false;
6879 }
6880
6884 {
6885 return false;
6886 }
6887
6889 {
6890 return "";
6891 }
6892
6894
6896 {
6897 return false;
6898 }
6899
6901 {
6902 return true;
6903 }
6904
6905
6906
6908 {
6909 return true;
6910 }
6911
6913 {
6914 return true;
6915 }
6916
6918 {
6919 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6921 }
6922
6924 {
6926 }
6927
6929 {
6931 if (!is_being_placed)
6933 SetSynchDirty();
6934 }
6935
6936
6938
6940 {
6942 }
6943
6945 {
6947 }
6948
6950 {
6951 return 1;
6952 }
6953
6955 {
6956 return false;
6957 }
6958
6960 {
6962 SetSynchDirty();
6963 }
6964
6965
6966
6967
6968
6969
6970
6971
6972
6973
6974
6975
6976
6977
6978
6979
6980
6981
6982
6983
6984
6985
6986
6987
6988
6989
6990
6991
6992
6993
6994
6995
6996
6997
6998
7000 {
7001 super.OnMovedInsideCargo(container);
7002
7003 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7004 }
7005
7006 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
7007 {
7008 super.EEItemLocationChanged(oldLoc, newLoc);
7009
7010 PlayerBase newPlayer = null;
7011 PlayerBase oldPlayer = null;
7012
7013 if (newLoc.GetParent())
7014 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
7015
7016 if (oldLoc.GetParent())
7017 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
7018
7020 {
7021 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
7022
7023 if (rIndex >= 0)
7024 {
7025 InventoryLocation rIl = new InventoryLocation;
7026 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
7027
7028 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
7031 {
7032 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
7033 }
7035 {
7037 }
7038
7039 }
7040 }
7041
7043 {
7044 if (newPlayer)
7045 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
7046
7047 if (newPlayer == oldPlayer)
7048 {
7049 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
7050 {
7052 {
7053 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
7054 {
7055 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7056 }
7057 }
7058 else
7059 {
7060 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7061 }
7062 }
7063
7064 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
7065 {
7066 int type = oldLoc.GetType();
7068 {
7069 oldLoc.GetParent().GetOnSetLock().Invoke(this);
7070 }
7072 {
7073 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
7074 }
7075 }
7076 if (!m_OldLocation)
7077 {
7078 m_OldLocation = new InventoryLocation;
7079 }
7080 m_OldLocation.Copy(oldLoc);
7081 }
7082 else
7083 {
7084 if (m_OldLocation)
7085 {
7086 m_OldLocation.Reset();
7087 }
7088 }
7089
7090 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
7091 }
7092 else
7093 {
7094 if (newPlayer)
7095 {
7096 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
7097 if (resIndex >= 0)
7098 {
7099 InventoryLocation il = new InventoryLocation;
7100 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
7102 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
7105 {
7106 il.
GetParent().GetOnReleaseLock().Invoke(it);
7107 }
7109 {
7111 }
7112
7113 }
7114 }
7116 {
7117
7119 }
7120
7121 if (m_OldLocation)
7122 {
7123 m_OldLocation.Reset();
7124 }
7125 }
7126
7128 {
7129 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
7130 }
7131
7133 {
7134 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
7135 }
7136 }
7137
7138 override void EOnContact(IEntity other, Contact extra)
7139 {
7141 {
7142 int liquidType = -1;
7144 if (impactSpeed > 0.0)
7145 {
7147 #ifndef SERVER
7149 #else
7151 SetSynchDirty();
7152 #endif
7154 }
7155 }
7156
7157 #ifdef SERVER
7158 if (GetCompEM() && GetCompEM().IsPlugged())
7159 {
7160 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
7161 GetCompEM().UnplugThis();
7162 }
7163 #endif
7164 }
7165
7167
7169 {
7171 }
7172
7174 {
7175
7176 }
7177
7179 {
7180 super.OnItemLocationChanged(old_owner, new_owner);
7181
7182 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
7183 PlayerBase playerNew = PlayerBase.Cast(new_owner);
7184
7185 if (!relatedPlayer && playerNew)
7186 relatedPlayer = playerNew;
7187
7188 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
7189 {
7191 if (actionMgr)
7192 {
7193 ActionBase currentAction = actionMgr.GetRunningAction();
7194 if (currentAction)
7196 }
7197 }
7198
7199 Man ownerPlayerOld = null;
7200 Man ownerPlayerNew = null;
7201
7202 if (old_owner)
7203 {
7204 if (old_owner.
IsMan())
7205 {
7206 ownerPlayerOld = Man.Cast(old_owner);
7207 }
7208 else
7209 {
7210 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
7211 }
7212 }
7213 else
7214 {
7216 {
7218
7219 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
7220 {
7221 GetCompEM().UnplugThis();
7222 }
7223 }
7224 }
7225
7226 if (new_owner)
7227 {
7228 if (new_owner.
IsMan())
7229 {
7230 ownerPlayerNew = Man.Cast(new_owner);
7231 }
7232 else
7233 {
7234 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
7235 }
7236 }
7237
7238 if (ownerPlayerOld != ownerPlayerNew)
7239 {
7240 if (ownerPlayerOld)
7241 {
7242 array<EntityAI> subItemsExit = new array<EntityAI>;
7244 for (int i = 0; i < subItemsExit.Count(); i++)
7245 {
7248 }
7249 }
7250
7251 if (ownerPlayerNew)
7252 {
7253 array<EntityAI> subItemsEnter = new array<EntityAI>;
7255 for (int j = 0; j < subItemsEnter.Count(); j++)
7256 {
7259 }
7260 }
7261 }
7262 else if (ownerPlayerNew != null)
7263 {
7264 PlayerBase nplayer;
7265 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
7266 {
7267 array<EntityAI> subItemsUpdate = new array<EntityAI>;
7269 for (int k = 0; k < subItemsUpdate.Count(); k++)
7270 {
7272 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
7273 }
7274 }
7275 }
7276
7277 if (old_owner)
7278 old_owner.OnChildItemRemoved(this);
7279 if (new_owner)
7280 new_owner.OnChildItemReceived(this);
7281 }
7282
7283
7285 {
7286 super.EEDelete(parent);
7287 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
7288 if (player)
7289 {
7291
7292 if (player.IsAlive())
7293 {
7294 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7295 if (r_index >= 0)
7296 {
7297 InventoryLocation r_il = new InventoryLocation;
7298 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7299
7300 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7303 {
7304 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7305 }
7307 {
7308 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7309 }
7310
7311 }
7312
7313 player.RemoveQuickBarEntityShortcut(this);
7314 }
7315 }
7316 }
7317
7319 {
7320 super.EEKilled(killer);
7321
7324 {
7325 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
7326 {
7327 if (IsMagazine())
7328 {
7329 if (Magazine.Cast(this).GetAmmoCount() > 0)
7330 {
7332 }
7333 }
7334 else
7335 {
7337 }
7338 }
7339 }
7340 }
7341
7343 {
7344 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7345
7346 super.OnWasAttached(parent, slot_id);
7347
7350
7353 }
7354
7356 {
7357 super.OnWasDetached(parent, slot_id);
7358
7361
7364 }
7365
7367 {
7368 int idx;
7371
7372 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7373 if (inventory_slots.Count() < 1)
7374 {
7375 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
7376 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
7377 }
7378 else
7379 {
7380 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
7381 }
7382
7383 idx = inventory_slots.Find(slot);
7384 if (idx < 0)
7385 return "";
7386
7387 return attach_types.Get(idx);
7388 }
7389
7391 {
7392 int idx = -1;
7393 string slot;
7394
7397
7398 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7399 if (inventory_slots.Count() < 1)
7400 {
7401 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
7402 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7403 }
7404 else
7405 {
7406 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
7407 if (detach_types.Count() < 1)
7408 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7409 }
7410
7411 for (int i = 0; i < inventory_slots.Count(); i++)
7412 {
7413 slot = inventory_slots.Get(i);
7414 }
7415
7416 if (slot != "")
7417 {
7418 if (detach_types.Count() == 1)
7419 idx = 0;
7420 else
7421 idx = inventory_slots.Find(slot);
7422 }
7423 if (idx < 0)
7424 return "";
7425
7426 return detach_types.Get(idx);
7427 }
7428
7430 {
7431
7433
7434
7435 float min_time = 1;
7436 float max_time = 3;
7437 float delay = Math.RandomFloat(min_time, max_time);
7438
7439 explode_timer.Run(delay, this, "DoAmmoExplosion");
7440 }
7441
7443 {
7444 Magazine magazine = Magazine.Cast(this);
7445 int pop_sounds_count = 6;
7446 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
7447
7448
7449 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
7450 string sound_name = pop_sounds[ sound_idx ];
7451 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
7452
7453
7454 magazine.ServerAddAmmoCount(-1);
7455
7456
7457 float min_temp_to_explode = 100;
7458
7459 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
7460 {
7462 }
7463 }
7464
7465
7466 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
7467 {
7468 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
7469
7470 const int CHANCE_DAMAGE_CARGO = 4;
7471 const int CHANCE_DAMAGE_ATTACHMENT = 1;
7472 const int CHANCE_DAMAGE_NOTHING = 2;
7473
7475 {
7476 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
7477 int chances;
7478 int rnd;
7479
7480 if (GetInventory().GetCargo())
7481 {
7482 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7483 rnd = Math.RandomInt(0,chances);
7484
7485 if (rnd < CHANCE_DAMAGE_CARGO)
7486 {
7488 }
7489 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
7490 {
7492 }
7493 }
7494 else
7495 {
7496 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7497 rnd = Math.RandomInt(0,chances);
7498
7499 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
7500 {
7502 }
7503 }
7504 }
7505 }
7506
7508 {
7509 CargoBase cargo = GetInventory().GetCargo();
7510 if (cargo)
7511 {
7513 if (item_count > 0)
7514 {
7515 int random_pick = Math.RandomInt(0, item_count);
7517 if (!item.IsExplosive())
7518 {
7519 item.AddHealth("","",damage);
7520 return true;
7521 }
7522 }
7523 }
7524 return false;
7525 }
7526
7528 {
7529 GameInventory inventory = GetInventory();
7531 if (attachment_count > 0)
7532 {
7533 int random_pick = Math.RandomInt(0, attachment_count);
7535 if (!attachment.IsExplosive())
7536 {
7537 attachment.AddHealth("","",damage);
7538 return true;
7539 }
7540 }
7541 return false;
7542 }
7543
7545 {
7547 }
7548
7550 {
7552 return GetInventory().CanRemoveEntity();
7553
7554 return false;
7555 }
7556
7558 {
7559
7561 return false;
7562
7563
7565 return false;
7566
7567
7568
7570 if (delta == 0)
7571 return false;
7572
7573
7574 return true;
7575 }
7576
7578 {
7580 {
7581 if (ScriptInputUserData.CanStoreInputUserData())
7582 {
7583 ScriptInputUserData ctx = new ScriptInputUserData;
7588 ctx.
Write(destination_entity);
7592 }
7593 }
7594 else if (!
g_Game.IsMultiplayer())
7595 {
7597 }
7598 }
7599
7601 {
7602 float split_quantity_new;
7606 InventoryLocation loc = new InventoryLocation;
7607
7608 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7609 {
7611 split_quantity_new = stack_max;
7612 else
7614
7616 {
7617 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7618 if (new_item)
7619 {
7620 new_item.SetResultOfSplit(true);
7621 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7623 new_item.
SetQuantity(split_quantity_new,
false,
true);
7624 }
7625 }
7626 }
7627 else if (destination_entity && slot_id == -1)
7628 {
7629 if (quantity > stack_max)
7630 split_quantity_new = stack_max;
7631 else
7632 split_quantity_new = quantity;
7633
7635 {
7636 GameInventory destinationInventory = destination_entity.GetInventory();
7638 {
7641 }
7642
7643 if (new_item)
7644 {
7645 new_item.SetResultOfSplit(true);
7646 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7648 new_item.
SetQuantity(split_quantity_new,
false,
true);
7649 }
7650 }
7651 }
7652 else
7653 {
7654 if (stack_max != 0)
7655 {
7657 {
7659 }
7660
7661 if (split_quantity_new == 0)
7662 {
7663 if (!
g_Game.IsMultiplayer())
7664 player.PhysicalPredictiveDropItem(this);
7665 else
7666 player.ServerDropEntity(this);
7667 return;
7668 }
7669
7671 {
7673
7674 if (new_item)
7675 {
7676 new_item.SetResultOfSplit(true);
7677 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7680 new_item.PlaceOnSurface();
7681 }
7682 }
7683 }
7684 }
7685 }
7686
7688 {
7689 float split_quantity_new;
7693 InventoryLocation loc = new InventoryLocation;
7694
7695 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7696 {
7698 split_quantity_new = stack_max;
7699 else
7701
7703 {
7704 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7705 if (new_item)
7706 {
7707 new_item.SetResultOfSplit(true);
7708 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7710 new_item.
SetQuantity(split_quantity_new,
false,
true);
7711 }
7712 }
7713 }
7714 else if (destination_entity && slot_id == -1)
7715 {
7716 if (quantity > stack_max)
7717 split_quantity_new = stack_max;
7718 else
7719 split_quantity_new = quantity;
7720
7722 {
7723 GameInventory destinationInventory = destination_entity.GetInventory();
7725 {
7728 }
7729
7730 if (new_item)
7731 {
7732 new_item.SetResultOfSplit(true);
7733 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7735 new_item.
SetQuantity(split_quantity_new,
false,
true);
7736 }
7737 }
7738 }
7739 else
7740 {
7741 if (stack_max != 0)
7742 {
7744 {
7746 }
7747
7749 {
7751
7752 if (new_item)
7753 {
7754 new_item.SetResultOfSplit(true);
7755 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7758 new_item.PlaceOnSurface();
7759 }
7760 }
7761 }
7762 }
7763 }
7764
7766 {
7768 {
7769 if (ScriptInputUserData.CanStoreInputUserData())
7770 {
7771 ScriptInputUserData ctx = new ScriptInputUserData;
7776 dst.WriteToContext(ctx);
7778 }
7779 }
7780 else if (!
g_Game.IsMultiplayer())
7781 {
7783 }
7784 }
7785
7787 {
7789 {
7790 if (ScriptInputUserData.CanStoreInputUserData())
7791 {
7792 ScriptInputUserData ctx = new ScriptInputUserData;
7797 ctx.
Write(destination_entity);
7803 }
7804 }
7805 else if (!
g_Game.IsMultiplayer())
7806 {
7808 }
7809 }
7810
7812 {
7814 }
7815
7817 {
7819 float split_quantity_new;
7821 if (dst.IsValid())
7822 {
7823 int slot_id = dst.GetSlot();
7825
7826 if (quantity > stack_max)
7827 split_quantity_new = stack_max;
7828 else
7829 split_quantity_new = quantity;
7830
7832 {
7834
7835 if (new_item)
7836 {
7837 new_item.SetResultOfSplit(true);
7838 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7840 new_item.
SetQuantity(split_quantity_new,
false,
true);
7841 }
7842
7843 return new_item;
7844 }
7845 }
7846
7847 return null;
7848 }
7849
7851 {
7853 float split_quantity_new;
7855 if (destination_entity)
7856 {
7858 if (quantity > stackable)
7859 split_quantity_new = stackable;
7860 else
7861 split_quantity_new = quantity;
7862
7864 {
7865 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
7866 if (new_item)
7867 {
7868 new_item.SetResultOfSplit(true);
7869 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7871 new_item.
SetQuantity(split_quantity_new,
false,
true);
7872 }
7873 }
7874 }
7875 }
7876
7878 {
7880 {
7881 if (ScriptInputUserData.CanStoreInputUserData())
7882 {
7883 ScriptInputUserData ctx = new ScriptInputUserData;
7888 ItemBase destination_entity =
this;
7889 ctx.
Write(destination_entity);
7893 }
7894 }
7895 else if (!
g_Game.IsMultiplayer())
7896 {
7898 }
7899 }
7900
7902 {
7904 float split_quantity_new;
7906 if (player)
7907 {
7909 if (quantity > stackable)
7910 split_quantity_new = stackable;
7911 else
7912 split_quantity_new = quantity;
7913
7915 {
7916 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
7917 new_item =
ItemBase.Cast(in_hands);
7918 if (new_item)
7919 {
7920 new_item.SetResultOfSplit(true);
7921 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7923 new_item.SetQuantity(split_quantity_new, false, true);
7924 }
7925 }
7926 }
7927 }
7928
7930 {
7932 float split_quantity_new = Math.Floor(quantity * 0.5);
7933
7935 return;
7936
7938
7939 if (new_item)
7940 {
7941 if (new_item.GetQuantityMax() < split_quantity_new)
7942 {
7943 split_quantity_new = new_item.GetQuantityMax();
7944 }
7945
7946 new_item.SetResultOfSplit(true);
7947 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7948
7950 {
7953 }
7954 else
7955 {
7957 new_item.
SetQuantity(split_quantity_new,
false,
true);
7958 }
7959 }
7960 }
7961
7963 {
7965 float split_quantity_new = Math.Floor(quantity / 2);
7966
7968 return;
7969
7970 InventoryLocation invloc = new InventoryLocation;
7972
7974 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
7975
7976 if (new_item)
7977 {
7978 if (new_item.GetQuantityMax() < split_quantity_new)
7979 {
7980 split_quantity_new = new_item.GetQuantityMax();
7981 }
7983 {
7986 }
7987 else if (split_quantity_new > 1)
7988 {
7990 new_item.
SetQuantity(split_quantity_new,
false,
true);
7991 }
7992 }
7993 }
7994
7997 {
7998 SetWeightDirty();
8000
8001 if (parent)
8002 parent.OnAttachmentQuantityChangedEx(this, delta);
8003
8005 {
8007 {
8009 }
8011 {
8012 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
8014 }
8015 }
8016 }
8017
8020 {
8021
8022 }
8023
8026 {
8028 }
8029
8031 {
8032 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
8033
8035 {
8036 if (newLevel == GameConstants.STATE_RUINED)
8037 {
8039 EntityAI parent = GetHierarchyParent();
8040 if (parent && parent.IsFireplace())
8041 {
8042 CargoBase cargo = GetInventory().GetCargo();
8043 if (cargo)
8044 {
8046 {
8048 }
8049 }
8050 }
8051 }
8052
8054 {
8055
8057 return;
8058 }
8059
8060 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
8061 {
8063 }
8064 }
8065 }
8066
8067
8069 {
8070 super.OnRightClick();
8071
8073 {
8075 {
8076 if (ScriptInputUserData.CanStoreInputUserData())
8077 {
8078 EntityAI root = GetHierarchyRoot();
8079 Man playerOwner = GetHierarchyRootPlayer();
8080 InventoryLocation dst = new InventoryLocation;
8081
8082
8083 if (!playerOwner && root && root == this)
8084 {
8086 }
8087 else
8088 {
8089
8090 GetInventory().GetCurrentInventoryLocation(dst);
8092 {
8093 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8095 {
8097 }
8098 else
8099 {
8101
8102
8103 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
8104 {
8106 }
8107 else
8108 {
8109 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
8110 }
8111 }
8112 }
8113 }
8114
8115 ScriptInputUserData ctx = new ScriptInputUserData;
8123 }
8124 }
8125 else if (!
g_Game.IsMultiplayer())
8126 {
8128 }
8129 }
8130 }
8131
8133 {
8134 if (root)
8135 {
8136 vector m4[4];
8137 root.GetTransform(m4);
8138 dst.SetGround(this, m4);
8139 }
8140 else
8141 {
8142 GetInventory().GetCurrentInventoryLocation(dst);
8143 }
8144 }
8145
8146 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
8147 {
8148
8149 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
8150 return false;
8151
8152 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
8153 return false;
8154
8155
8157 return false;
8158
8159
8160 Magazine mag = Magazine.Cast(this);
8161 if (mag)
8162 {
8163 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
8164 return false;
8165
8166 if (stack_max_limit)
8167 {
8168 Magazine other_mag = Magazine.Cast(other_item);
8169 if (other_item)
8170 {
8171 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
8172 return false;
8173 }
8174
8175 }
8176 }
8177 else
8178 {
8179
8181 return false;
8182
8184 return false;
8185 }
8186
8187 PlayerBase player = null;
8188 if (CastTo(player, GetHierarchyRootPlayer()))
8189 {
8190 if (player.GetInventory().HasAttachment(this))
8191 return false;
8192
8193 if (player.IsItemsToDelete())
8194 return false;
8195 }
8196
8197 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
8198 return false;
8199
8200 int slotID;
8202 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
8203 return false;
8204
8205 return true;
8206 }
8207
8209 {
8211 }
8212
8214 {
8215 return m_IsResultOfSplit;
8216 }
8217
8219 {
8220 m_IsResultOfSplit = value;
8221 }
8222
8224 {
8226 }
8227
8229 {
8230 float other_item_quantity = other_item.GetQuantity();
8231 float this_free_space;
8232
8234
8236
8237 if (other_item_quantity > this_free_space)
8238 {
8239 return this_free_space;
8240 }
8241 else
8242 {
8243 return other_item_quantity;
8244 }
8245 }
8246
8248 {
8250 }
8251
8253 {
8255 return;
8256
8257 if (!IsMagazine() && other_item)
8258 {
8260 if (quantity_used != 0)
8261 {
8262 float hp1 = GetHealth01("","");
8263 float hp2 = other_item.GetHealth01("","");
8264 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
8265 hpResult = hpResult / (
GetQuantity() + quantity_used);
8266
8267 hpResult *= GetMaxHealth();
8268 Math.Round(hpResult);
8269 SetHealth("", "Health", hpResult);
8270
8272 other_item.AddQuantity(-quantity_used);
8273 }
8274 }
8276 }
8277
8279 {
8280 #ifdef SERVER
8281 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
8282 GetHierarchyParent().IncreaseLifetimeUp();
8283 #endif
8284 };
8285
8287 {
8288 PlayerBase p = PlayerBase.Cast(player);
8289
8290 array<int> recipesIds = p.m_Recipes;
8291 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8292 if (moduleRecipesManager)
8293 {
8294 EntityAI itemInHands = player.GetEntityInHands();
8295 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
8296 }
8297
8298 for (int i = 0;i < recipesIds.Count(); i++)
8299 {
8300 int key = recipesIds.Get(i);
8301 string recipeName = moduleRecipesManager.GetRecipeName(key);
8303 }
8304 }
8305
8306
8307 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
8308 {
8309 super.GetDebugActions(outputList);
8310
8311
8317
8318
8323
8328
8329
8333
8334
8336 {
8340 }
8341
8344
8345
8349
8351
8352 InventoryLocation loc = new InventoryLocation();
8353 GetInventory().GetCurrentInventoryLocation(loc);
8355 {
8356 if (Gizmo_IsSupported())
8359 }
8360
8362 }
8363
8364
8365
8366
8368 {
8369 super.OnAction(action_id, player, ctx);
8370
8372 {
8373 switch (action_id)
8374 {
8378 return true;
8382 return true;
8383 }
8384 }
8385
8387 {
8388 switch (action_id)
8389 {
8391 Delete();
8392 return true;
8393 }
8394 }
8395
8396 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
8397 {
8398 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8399 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
8400 PlayerBase p = PlayerBase.Cast(player);
8401 if (
EActions.RECIPES_RANGE_START < 1000)
8402 {
8403 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
8404 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
8405 }
8406 }
8407 #ifndef SERVER
8408 else if (action_id ==
EActions.WATCH_PLAYER)
8409 {
8410 PluginDeveloper.SetDeveloperItemClientEx(player);
8411 }
8412 #endif
8414 {
8415 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
8416 {
8417 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
8418 OnDebugButtonPressServer(id + 1);
8419 }
8420
8421 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
8422 {
8423 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
8425 }
8426
8427 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
8428 {
8429 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
8431 }
8432
8433 else if (action_id ==
EActions.ADD_QUANTITY)
8434 {
8435 if (IsMagazine())
8436 {
8437 Magazine mag = Magazine.Cast(this);
8438 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
8439 }
8440 else
8441 {
8443 }
8444
8445 if (m_EM)
8446 {
8447 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
8448 }
8449
8450 }
8451
8452 else if (action_id ==
EActions.REMOVE_QUANTITY)
8453 {
8454 if (IsMagazine())
8455 {
8456 Magazine mag2 = Magazine.Cast(this);
8457 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
8458 }
8459 else
8460 {
8462 }
8463 if (m_EM)
8464 {
8465 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
8466 }
8467
8468 }
8469
8470 else if (action_id ==
EActions.SET_QUANTITY_0)
8471 {
8473
8474 if (m_EM)
8475 {
8476 m_EM.SetEnergy(0);
8477 }
8478 }
8479
8480 else if (action_id ==
EActions.SET_MAX_QUANTITY)
8481 {
8483
8484 if (m_EM)
8485 {
8486 m_EM.SetEnergy(m_EM.GetEnergyMax());
8487 }
8488 }
8489
8490 else if (action_id ==
EActions.ADD_HEALTH)
8491 {
8492 AddHealth("","",GetMaxHealth("","Health")/5);
8493 }
8494 else if (action_id ==
EActions.REMOVE_HEALTH)
8495 {
8496 AddHealth("","",-GetMaxHealth("","Health")/5);
8497 }
8498 else if (action_id ==
EActions.DESTROY_HEALTH)
8499 {
8500 SetHealth01("","",0);
8501 }
8502 else if (action_id ==
EActions.WATCH_ITEM)
8503 {
8505 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
8506 #ifdef DEVELOPER
8507 SetDebugDeveloper_item(this);
8508 #endif
8509 }
8510
8511 else if (action_id ==
EActions.ADD_TEMPERATURE)
8512 {
8513 AddTemperature(20);
8514
8515 }
8516
8517 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
8518 {
8519 AddTemperature(-20);
8520
8521 }
8522
8523 else if (action_id ==
EActions.FLIP_FROZEN)
8524 {
8525 SetFrozen(!GetIsFrozen());
8526
8527 }
8528
8529 else if (action_id ==
EActions.ADD_WETNESS)
8530 {
8532
8533 }
8534
8535 else if (action_id ==
EActions.REMOVE_WETNESS)
8536 {
8538
8539 }
8540
8541 else if (action_id ==
EActions.LIQUIDTYPE_UP)
8542 {
8545
8546
8547 }
8548
8549 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
8550 {
8553 }
8554
8555 else if (action_id ==
EActions.MAKE_SPECIAL)
8556 {
8557 auto debugParams = DebugSpawnParams.WithPlayer(player);
8558 OnDebugSpawnEx(debugParams);
8559 }
8560
8561 }
8562
8563
8564 return false;
8565 }
8566
8567
8568
8569
8573
8576
8577
8578
8580 {
8581 return false;
8582 }
8583
8584
8586 {
8587 return true;
8588 }
8589
8590
8592 {
8593 return true;
8594 }
8595
8596
8597
8599 {
8600 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
8601 return g_Game.ConfigIsExisting(config_path);
8602 }
8603
8606 {
8607 return null;
8608 }
8609
8611 {
8612 return false;
8613 }
8614
8616 {
8617 return false;
8618 }
8619
8623
8624
8626 {
8627 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8628 return module_repairing.CanRepair(this, item_repair_kit);
8629 }
8630
8631
8632 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
8633 {
8634 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8635 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
8636 }
8637
8638
8640 {
8641
8642
8643
8644
8645
8646
8647
8648
8649 return 1;
8650 }
8651
8652
8653
8655 {
8657 }
8658
8659
8660
8662 {
8664 }
8665
8666
8675 {
8676 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8677
8678 if (player)
8679 {
8680 player.MessageStatus(text);
8681 }
8682 }
8683
8684
8693 {
8694 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8695
8696 if (player)
8697 {
8698 player.MessageAction(text);
8699 }
8700 }
8701
8702
8711 {
8712 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8713
8714 if (player)
8715 {
8716 player.MessageFriendly(text);
8717 }
8718 }
8719
8720
8729 {
8730 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8731
8732 if (player)
8733 {
8734 player.MessageImportant(text);
8735 }
8736 }
8737
8739 {
8740 return true;
8741 }
8742
8743
8744 override bool KindOf(
string tag)
8745 {
8746 bool found = false;
8747 string item_name = this.
GetType();
8749 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
8750
8751 int array_size = item_tag_array.Count();
8752 for (int i = 0; i < array_size; i++)
8753 {
8754 if (item_tag_array.Get(i) == tag)
8755 {
8756 found = true;
8757 break;
8758 }
8759 }
8760 return found;
8761 }
8762
8763
8765 {
8766
8767 super.OnRPC(sender, rpc_type,ctx);
8768
8769
8770 switch (rpc_type)
8771 {
8772 #ifndef SERVER
8773 case ERPCs.RPC_SOUND_LOCK_ATTACH:
8774 Param2<bool, string> p = new Param2<bool, string>(false, "");
8775
8777 return;
8778
8779 bool play = p.param1;
8780 string soundSet = p.param2;
8781
8782 if (play)
8783 {
8785 {
8787 {
8789 }
8790 }
8791 else
8792 {
8794 }
8795 }
8796 else
8797 {
8799 }
8800
8801 break;
8802 #endif
8803
8804 }
8805
8807 {
8809 }
8810 }
8811
8812
8813
8814
8816 {
8817 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8818 return plugin.GetID(
name);
8819 }
8820
8822 {
8823 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8824 return plugin.GetName(id);
8825 }
8826
8829 {
8830
8831
8832 int varFlags;
8833 if (!ctx.
Read(varFlags))
8834 return;
8835
8836 if (varFlags & ItemVariableFlags.FLOAT)
8837 {
8839 }
8840 }
8841
8843 {
8844
8845 super.SerializeNumericalVars(floats_out);
8846
8847
8848
8850 {
8852 }
8853
8855 {
8857 }
8858
8860 {
8862 }
8863
8865 {
8870 }
8871
8873 {
8875 }
8876 }
8877
8879 {
8880
8881 super.DeSerializeNumericalVars(floats);
8882
8883
8884 int index = 0;
8885 int mask = Math.Round(floats.Get(index));
8886
8887 index++;
8888
8890 {
8892 {
8894 }
8895 else
8896 {
8897 float quantity = floats.Get(index);
8899 }
8900 index++;
8901 }
8902
8904 {
8905 float wet = floats.Get(index);
8907 index++;
8908 }
8909
8911 {
8912 int liquidtype = Math.Round(floats.Get(index));
8914 index++;
8915 }
8916
8918 {
8920 index++;
8922 index++;
8924 index++;
8926 index++;
8927 }
8928
8930 {
8931 int cleanness = Math.Round(floats.Get(index));
8933 index++;
8934 }
8935 }
8936
8938 {
8939 super.WriteVarsToCTX(ctx);
8940
8941
8943 {
8945 }
8946
8948 {
8950 }
8951
8953 {
8955 }
8956
8958 {
8959 int r,g,b,a;
8965 }
8966
8968 {
8970 }
8971 }
8972
8974 {
8975 if (!super.ReadVarsFromCTX(ctx,version))
8976 return false;
8977
8978 int intValue;
8979 float value;
8980
8981 if (version < 140)
8982 {
8983 if (!ctx.
Read(intValue))
8984 return false;
8985
8986 m_VariablesMask = intValue;
8987 }
8988
8990 {
8991 if (!ctx.
Read(value))
8992 return false;
8993
8995 {
8997 }
8998 else
8999 {
9001 }
9002 }
9003
9004 if (version < 140)
9005 {
9007 {
9008 if (!ctx.
Read(value))
9009 return false;
9010 SetTemperatureDirect(value);
9011 }
9012 }
9013
9015 {
9016 if (!ctx.
Read(value))
9017 return false;
9019 }
9020
9022 {
9023 if (!ctx.
Read(intValue))
9024 return false;
9026 }
9027
9029 {
9030 int r,g,b,a;
9032 return false;
9034 return false;
9036 return false;
9038 return false;
9039
9041 }
9042
9044 {
9045 if (!ctx.
Read(intValue))
9046 return false;
9048 }
9049
9050 if (version >= 138 && version < 140)
9051 {
9053 {
9054 if (!ctx.
Read(intValue))
9055 return false;
9056 SetFrozen(intValue);
9057 }
9058 }
9059
9060 return true;
9061 }
9062
9063
9065 {
9068 {
9070 }
9071
9072 if (!super.OnStoreLoad(ctx, version))
9073 {
9075 return false;
9076 }
9077
9078 if (version >= 114)
9079 {
9080 bool hasQuickBarIndexSaved;
9081
9082 if (!ctx.
Read(hasQuickBarIndexSaved))
9083 {
9085 return false;
9086 }
9087
9088 if (hasQuickBarIndexSaved)
9089 {
9090 int itmQBIndex;
9091
9092
9093 if (!ctx.
Read(itmQBIndex))
9094 {
9096 return false;
9097 }
9098
9099 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
9100 if (itmQBIndex != -1 && parentPlayer)
9101 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
9102 }
9103 }
9104 else
9105 {
9106
9107 PlayerBase player;
9108 int itemQBIndex;
9109 if (version ==
int.
MAX)
9110 {
9111 if (!ctx.
Read(itemQBIndex))
9112 {
9114 return false;
9115 }
9116 }
9117 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
9118 {
9119
9120 if (!ctx.
Read(itemQBIndex))
9121 {
9123 return false;
9124 }
9125 if (itemQBIndex != -1 && player)
9126 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
9127 }
9128 }
9129
9130 if (version < 140)
9131 {
9132
9133 if (!LoadVariables(ctx, version))
9134 {
9136 return false;
9137 }
9138 }
9139
9140
9142 {
9144 return false;
9145 }
9146 if (version >= 132)
9147 {
9149 if (raib)
9150 {
9152 {
9154 return false;
9155 }
9156 }
9157 }
9158
9160 return true;
9161 }
9162
9163
9164
9166 {
9167 super.OnStoreSave(ctx);
9168
9169 PlayerBase player;
9170 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
9171 {
9173
9174 int itemQBIndex = -1;
9175 itemQBIndex = player.FindQuickBarEntityIndex(this);
9176 ctx.
Write(itemQBIndex);
9177 }
9178 else
9179 {
9181 }
9182
9184
9186 if (raib)
9187 {
9189 }
9190 }
9191
9192
9194 {
9195 super.AfterStoreLoad();
9196
9198 {
9200 }
9201
9203 {
9206 }
9207 }
9208
9210 {
9211 super.EEOnAfterLoad();
9212
9214 {
9216 }
9217
9220 }
9221
9223 {
9224 return false;
9225 }
9226
9227
9228
9230 {
9232 {
9233 #ifdef PLATFORM_CONSOLE
9234
9236 {
9238 if (menu)
9239 {
9241 }
9242 }
9243 #endif
9244 }
9245
9247 {
9250 }
9251
9253 {
9254 SetWeightDirty();
9256 }
9258 {
9261 }
9262
9264 {
9267
9270 }
9272 {
9276 }
9277
9278 super.OnVariablesSynchronized();
9279 }
9280
9281
9282
9284 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
9285 {
9286 if (!IsServerCheck(allow_client))
9287 return false;
9288
9290 return false;
9291
9294
9295 if (value <= (min + 0.001))
9296 value = min;
9297
9298 if (value == min)
9299 {
9300 if (destroy_config)
9301 {
9302 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
9303 if (dstr)
9304 {
9306 this.Delete();
9307 return true;
9308 }
9309 }
9310 else if (destroy_forced)
9311 {
9313 this.Delete();
9314 return true;
9315 }
9316
9318 }
9319
9322
9324 {
9325 EntityAI parent = GetHierarchyRoot();
9326 InventoryLocation iLoc = new InventoryLocation();
9327 GetInventory().GetCurrentInventoryLocation(iLoc);
9329 {
9330 int iLocSlot = iLoc.
GetSlot();
9332 {
9334 }
9336 {
9338 }
9339 }
9340 }
9341
9343 {
9345
9346 if (delta)
9348 }
9349
9351
9352 return false;
9353 }
9354
9355
9357 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9358 {
9360 }
9361
9363 {
9366 }
9367
9369 {
9372 }
9373
9375 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9376 {
9377 float value_clamped = Math.Clamp(value, 0, 1);
9379 SetQuantity(result, destroy_config, destroy_forced);
9380 }
9381
9382
9385 {
9387 }
9388
9390 {
9392 }
9393
9394
9395
9396
9397
9398
9399
9400
9401
9402
9404 {
9405 int slot = -1;
9406 GameInventory inventory = GetInventory();
9407 if (inventory)
9408 {
9409 InventoryLocation il = new InventoryLocation;
9412 }
9413
9415 }
9416
9418 {
9419 float quantity_max = 0;
9420
9422 {
9423 if (attSlotID != -1)
9424 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
9425
9426 if (quantity_max <= 0)
9428 }
9429
9430 if (quantity_max <= 0)
9432
9433 return quantity_max;
9434 }
9435
9437 {
9439 }
9440
9442 {
9444 }
9445
9446
9448 {
9450 }
9451
9453 {
9455 }
9456
9458 {
9460 }
9461
9462
9464 {
9465
9466 float weightEx = GetWeightEx();
9467 float special = GetInventoryAndCargoWeight();
9468 return weightEx - special;
9469 }
9470
9471
9473 {
9475 }
9476
9478 {
9480 {
9481 #ifdef DEVELOPER
9482 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9483 {
9484 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
9486 }
9487 #endif
9488
9490 }
9491 else if (HasEnergyManager())
9492 {
9493 #ifdef DEVELOPER
9494 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9495 {
9496 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
9497 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
9498 }
9499 #endif
9500 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
9501 }
9502 else
9503 {
9504 #ifdef DEVELOPER
9505 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9506 {
9507 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
9508 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
9509 }
9510 #endif
9511 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
9512 }
9513 }
9514
9517 {
9518 int item_count = 0;
9520
9521 GameInventory inventory = GetInventory();
9522 CargoBase cargo = inventory.
GetCargo();
9523 if (cargo != NULL)
9524 {
9526 }
9527
9529 for (int i = 0; i < nAttachments; ++i)
9530 {
9532 if (item)
9533 item_count += item.GetNumberOfItems();
9534 }
9535 return item_count;
9536 }
9537
9540 {
9541 float weight = 0;
9542 float wetness = 1;
9543 if (include_wetness)
9546 {
9547 weight = wetness * m_ConfigWeight;
9548 }
9550 {
9551 weight = 1;
9552 }
9553 return weight;
9554 }
9555
9556
9557
9559 {
9560 GameInventory inventory = GetInventory();
9561 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
9562 {
9563 array<EntityAI> items = new array<EntityAI>;
9565 for (int i = 0; i < items.Count(); ++i)
9566 {
9568 if (item)
9569 {
9570 g_Game.ObjectDelete(item);
9571 }
9572 }
9573 }
9574 }
9575
9576
9577
9578
9580 {
9581 float energy = 0;
9582 if (HasEnergyManager())
9583 {
9584 energy = GetCompEM().GetEnergy();
9585 }
9586 return energy;
9587 }
9588
9589
9591 {
9592 super.OnEnergyConsumed();
9593
9595 }
9596
9598 {
9599 super.OnEnergyAdded();
9600
9602 }
9603
9604
9606 {
9607 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
9608 {
9610 {
9611 float energy_0to1 = GetCompEM().GetEnergy0To1();
9613 }
9614 }
9615 }
9616
9617
9619 {
9620 return ConfigGetFloat("heatIsolation");
9621 }
9622
9624 {
9626 }
9627
9629 {
9630 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
9631 if (
g_Game.ConfigIsExisting(paramPath))
9632 return g_Game.ConfigGetFloat(paramPath);
9633
9634 return 0.0;
9635 }
9636
9638 {
9639 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
9640 if (
g_Game.ConfigIsExisting(paramPath))
9641 return g_Game.ConfigGetFloat(paramPath);
9642
9643 return 0.0;
9644 }
9645
9646 override void SetWet(
float value,
bool allow_client =
false)
9647 {
9648 if (!IsServerCheck(allow_client))
9649 return;
9650
9653
9655
9656 m_VarWet = Math.Clamp(value, min, max);
9657
9659 {
9662 }
9663 }
9664
9665 override void AddWet(
float value)
9666 {
9668 }
9669
9671 {
9673 }
9674
9676 {
9678 }
9679
9681 {
9683 }
9684
9686 {
9688 }
9689
9691 {
9693 }
9694
9696 {
9699 if (newLevel != oldLevel)
9700 {
9702 }
9703 }
9704
9706 {
9707 SetWeightDirty();
9708 }
9709
9711 {
9712 return GetWetLevelInternal(
m_VarWet);
9713 }
9714
9715
9716
9718 {
9720 }
9721
9723 {
9725 }
9726
9728 {
9730 }
9731
9733 {
9735 }
9736
9737
9738
9740 {
9741 if (ConfigIsExisting("itemModelLength"))
9742 {
9743 return ConfigGetFloat("itemModelLength");
9744 }
9745 return 0;
9746 }
9747
9749 {
9750 if (ConfigIsExisting("itemAttachOffset"))
9751 {
9752 return ConfigGetFloat("itemAttachOffset");
9753 }
9754 return 0;
9755 }
9756
9757 override void SetCleanness(
int value,
bool allow_client =
false)
9758 {
9759 if (!IsServerCheck(allow_client))
9760 return;
9761
9763
9765
9768 }
9769
9771 {
9773 }
9774
9776 {
9777 return true;
9778 }
9779
9780
9781
9782
9784 {
9786 }
9787
9789 {
9791 }
9792
9793
9794
9795
9796 override void SetColor(
int r,
int g,
int b,
int a)
9797 {
9803 }
9805 override void GetColor(out
int r,out
int g,out
int b,out
int a)
9806 {
9811 }
9812
9814 {
9816 }
9817
9820 {
9821 int r,g,b,a;
9823 r = r/255;
9824 g = g/255;
9825 b = b/255;
9826 a = a/255;
9827 return MiscGameplayFunctions.GetColorString(r, g, b, a);
9828 }
9829
9830
9831
9832 override void SetLiquidType(
int value,
bool allow_client =
false)
9833 {
9834 if (!IsServerCheck(allow_client))
9835 return;
9836
9841 }
9842
9844 {
9845 return ConfigGetInt("varLiquidTypeInit");
9846 }
9847
9849 {
9851 }
9852
9854 {
9856 SetFrozen(false);
9857 }
9858
9861 {
9862 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9863 }
9864
9865
9868 {
9869 PlayerBase nplayer;
9870 if (PlayerBase.CastTo(nplayer, player))
9871 {
9873 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9874 }
9875 }
9876
9877
9880 {
9881 PlayerBase nplayer;
9882 if (PlayerBase.CastTo(nplayer,player))
9883 {
9884 nplayer.SetEnableQuickBarEntityShortcut(this, false);
9885 }
9886
9887 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
9888
9889 if (HasEnergyManager())
9890 {
9891 GetCompEM().UpdatePlugState();
9892 }
9893 }
9894
9895
9897 {
9898 super.OnPlacementStarted(player);
9899
9901 }
9902
9903 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
9904 {
9906 {
9907 m_AdminLog.OnPlacementComplete(player,
this);
9908 }
9909
9910 super.OnPlacementComplete(player, position, orientation);
9911 }
9912
9913
9914
9915
9916
9918 {
9920 {
9921 return true;
9922 }
9923 else
9924 {
9925 return false;
9926 }
9927 }
9928
9929
9931 {
9933 {
9935 }
9936 }
9937
9938
9940 {
9942 }
9943
9945 {
9947 }
9948
9949 override void InsertAgent(
int agent,
float count = 1)
9950 {
9951 if (count < 1)
9952 return;
9953
9955 }
9956
9959 {
9961 }
9962
9963
9965 {
9967 }
9968
9969
9970
9971
9972
9973
9974
9975
9976
9977
9978
9979
9980
9981
9982
9983
9984
9985
9986
9987
9988
9989
9990
9991
9992
9993
9994
9995
9996
9997
9998
9999
10000
10001
10002
10003
10004
10005
10006
10007
10008
10009
10011 {
10013 return false;
10014 return true;
10015 }
10016
10018 {
10019
10021 }
10022
10023
10026 {
10027 super.CheckForRoofLimited(timeTresholdMS);
10028
10029 float time =
g_Game.GetTime();
10030 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
10031 {
10032 m_PreviousRoofTestTime = time;
10033 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
10034 }
10035 }
10036
10037
10039 {
10041 {
10042 return 0;
10043 }
10044
10045 if (GetInventory().GetAttachmentSlotsCount() != 0)
10046 {
10047 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
10048 if (filter)
10049 return filter.GetProtectionLevel(type, false, system);
10050 else
10051 return 0;
10052 }
10053
10054 string subclassPath, entryName;
10055
10056 switch (type)
10057 {
10059 entryName = "biological";
10060 break;
10062 entryName = "chemical";
10063 break;
10064 default:
10065 entryName = "biological";
10066 break;
10067 }
10068
10069 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
10070
10071 return g_Game.ConfigGetFloat(subclassPath + entryName);
10072 }
10073
10074
10075
10078 {
10079 if (!IsMagazine())
10081
10083 }
10084
10085
10086
10087
10088
10093 {
10094 return true;
10095 }
10096
10098 {
10100 }
10101
10102
10103
10104
10105
10107 {
10108 if (parent)
10109 {
10110 if (parent.IsInherited(DayZInfected))
10111 return true;
10112
10113 if (!parent.IsRuined())
10114 return true;
10115 }
10116
10117 return true;
10118 }
10119
10121 {
10122 if (!super.CanPutAsAttachment(parent))
10123 {
10124 return false;
10125 }
10126
10127 if (!IsRuined() && !parent.IsRuined())
10128 {
10129 return true;
10130 }
10131
10132 return false;
10133 }
10134
10136 {
10137
10138
10139
10140
10141 return super.CanReceiveItemIntoCargo(item);
10142 }
10143
10145 {
10146
10147
10148
10149
10150 GameInventory attachmentInv = attachment.GetInventory();
10152 {
10153 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
10154 return false;
10155 }
10156
10157 InventoryLocation loc = new InventoryLocation();
10158 attachment.GetInventory().GetCurrentInventoryLocation(loc);
10159 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
10160 return false;
10161
10162 return super.CanReceiveAttachment(attachment, slotId);
10163 }
10164
10166 {
10167 if (!super.CanReleaseAttachment(attachment))
10168 return false;
10169
10170 return GetInventory().AreChildrenAccessible();
10171 }
10172
10173
10174
10175
10176
10177
10178
10179
10180
10181
10182
10183
10184
10185
10186
10187
10188
10189
10190
10191
10192
10194 {
10195 int id = muzzle_owner.GetMuzzleID();
10196 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
10197
10198 if (WPOF_array)
10199 {
10200 for (int i = 0; i < WPOF_array.Count(); i++)
10201 {
10202 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
10203
10204 if (WPOF)
10205 {
10206 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
10207 }
10208 }
10209 }
10210 }
10211
10212
10214 {
10215 int id = muzzle_owner.GetMuzzleID();
10217
10218 if (WPOBE_array)
10219 {
10220 for (int i = 0; i < WPOBE_array.Count(); i++)
10221 {
10222 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
10223
10224 if (WPOBE)
10225 {
10226 WPOBE.OnActivate(weapon, 0, 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.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10247 }
10248 }
10249 }
10250 }
10251
10252
10254 {
10255 int id = muzzle_owner.GetMuzzleID();
10256 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10257
10258 if (WPOOH_array)
10259 {
10260 for (int i = 0; i < WPOOH_array.Count(); i++)
10261 {
10262 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10263
10264 if (WPOOH)
10265 {
10266 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10267 }
10268 }
10269 }
10270 }
10271
10272
10274 {
10275 int id = muzzle_owner.GetMuzzleID();
10276 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10277
10278 if (WPOOH_array)
10279 {
10280 for (int i = 0; i < WPOOH_array.Count(); i++)
10281 {
10282 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10283
10284 if (WPOOH)
10285 {
10286 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10287 }
10288 }
10289 }
10290 }
10291
10292
10293
10295 {
10297 {
10298 return true;
10299 }
10300
10301 return false;
10302 }
10303
10305 {
10307 {
10308 return true;
10309 }
10310
10311 return false;
10312 }
10313
10315 {
10317 {
10318 return true;
10319 }
10320
10321 return false;
10322 }
10323
10325 {
10326 return false;
10327 }
10328
10331 {
10332 return UATimeSpent.DEFAULT_DEPLOY;
10333 }
10334
10335
10336
10337
10339 {
10341 SetSynchDirty();
10342 }
10343
10345 {
10347 }
10348
10349
10351 {
10352 return false;
10353 }
10354
10357 {
10358 string att_type = "None";
10359
10360 if (ConfigIsExisting("soundAttType"))
10361 {
10362 att_type = ConfigGetString("soundAttType");
10363 }
10364
10366 }
10367
10369 {
10371 }
10372
10373
10374
10375
10376
10382
10384 {
10387
10389 }
10390
10391
10393 {
10395 return;
10396
10398
10401
10404
10405 SoundParameters params = new SoundParameters();
10409 }
10410
10411
10413 {
10415 {
10418
10419 SetSynchDirty();
10420
10423 }
10424 }
10425
10427 {
10429 }
10430
10431
10433 {
10435 return;
10436
10438 SetSynchDirty();
10439
10442 }
10443
10445 {
10448 }
10449
10451 {
10453 }
10454
10455 void OnApply(PlayerBase player);
10456
10458 {
10459 return 1.0;
10460 };
10461
10463 {
10465 }
10466
10468 {
10470 }
10471
10473
10475 {
10476 SetDynamicPhysicsLifeTime(0.01);
10478 }
10479
10481 {
10482 array<string> zone_names = new array<string>;
10483 GetDamageZones(zone_names);
10484 for (int i = 0; i < zone_names.Count(); i++)
10485 {
10486 SetHealthMax(zone_names.Get(i),"Health");
10487 }
10488 SetHealthMax("","Health");
10489 }
10490
10493 {
10494 float global_health = GetHealth01("","Health");
10495 array<string> zones = new array<string>;
10496 GetDamageZones(zones);
10497
10498 for (int i = 0; i < zones.Count(); i++)
10499 {
10500 SetHealth01(zones.Get(i),"Health",global_health);
10501 }
10502 }
10503
10506 {
10507 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
10508 }
10509
10511 {
10512 if (!hasRootAsPlayer)
10513 {
10514 if (refParentIB)
10515 {
10516
10517 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
10518 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
10519
10520 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
10521 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
10522
10525 }
10526 else
10527 {
10528
10531 }
10532 }
10533 }
10534
10536 {
10538 {
10539 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
10540 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
10541 {
10542 float heatPermCoef = 1.0;
10544 while (ent)
10545 {
10546 heatPermCoef *= ent.GetHeatPermeabilityCoef();
10547 ent = ent.GetHierarchyParent();
10548 }
10549
10550 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
10551 }
10552 }
10553 }
10554
10556 {
10557
10558 EntityAI parent = GetHierarchyParent();
10559 if (!parent)
10560 {
10561 hasParent = false;
10562 hasRootAsPlayer = false;
10563 }
10564 else
10565 {
10566 hasParent = true;
10567 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
10568 refParentIB =
ItemBase.Cast(parent);
10569 }
10570 }
10571
10572 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
10573 {
10574
10575 }
10576
10578 {
10579
10580 return false;
10581 }
10582
10584 {
10585
10586
10587 return false;
10588 }
10589
10591 {
10592
10593 return false;
10594 }
10595
10598 {
10599 return !GetIsFrozen() &&
IsOpen();
10600 }
10601
10603 {
10604 bool hasParent = false, hasRootAsPlayer = false;
10606
10607 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
10608 bool foodDecay =
g_Game.IsFoodDecayEnabled();
10609
10610 if (wwtu || foodDecay)
10611 {
10615
10616 if (processWetness || processTemperature || processDecay)
10617 {
10619
10620 if (processWetness)
10621 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
10622
10623 if (processTemperature)
10625
10626 if (processDecay)
10627 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
10628 }
10629 }
10630 }
10631
10634 {
10636 }
10637
10639 {
10642
10643 return super.GetTemperatureFreezeThreshold();
10644 }
10645
10647 {
10650
10651 return super.GetTemperatureThawThreshold();
10652 }
10653
10655 {
10658
10659 return super.GetItemOverheatThreshold();
10660 }
10661
10663 {
10665 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
10666
10667 return super.GetTemperatureFreezeTime();
10668 }
10669
10671 {
10673 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
10674
10675 return super.GetTemperatureThawTime();
10676 }
10677
10682
10684 {
10685 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
10686 }
10687
10689 {
10690 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
10691 }
10692
10695 {
10697 }
10698
10700 {
10702 }
10703
10705 {
10707 }
10708
10711 {
10712 return null;
10713 }
10714
10717 {
10718 return false;
10719 }
10720
10722 {
10724 {
10727 if (!trg)
10728 {
10730 explosive = this;
10731 }
10732
10733 explosive.PairRemote(trg);
10735
10736 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
10737 trg.SetPersistentPairID(persistentID);
10738 explosive.SetPersistentPairID(persistentID);
10739
10740 return true;
10741 }
10742 return false;
10743 }
10744
10747 {
10748 float ret = 1.0;
10751 ret *= GetHealth01();
10752
10753 return ret;
10754 }
10755
10756 #ifdef DEVELOPER
10757 override void SetDebugItem()
10758 {
10759 super.SetDebugItem();
10760 _itemBase = this;
10761 }
10762
10764 {
10765 string text = super.GetDebugText();
10766
10768 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
10769
10770 return text;
10771 }
10772 #endif
10773
10775 {
10776 return true;
10777 }
10778
10780
10782
10784 {
10787 }
10788
10789
10797
10813
10814 [
Obsolete(
"Use ItemSoundHandler instead")]
10817 {
10818 if (!
g_Game.IsDedicatedServer())
10819 {
10820 if (ConfigIsExisting("attachSoundSet"))
10821 {
10822 string cfg_path = "";
10823 string soundset = "";
10824 string type_name =
GetType();
10825
10828 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
10829 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
10830
10831 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
10832 {
10833 for (int i = 0; i < cfg_soundset_array.Count(); i++)
10834 {
10835 if (cfg_slot_array[i] == slot_type)
10836 {
10837 soundset = cfg_soundset_array[i];
10838 break;
10839 }
10840 }
10841 }
10842
10843 if (soundset != "")
10844 {
10845 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
10847 }
10848 }
10849 }
10850 }
10851
10853}
10854
10856{
10858 if (entity)
10859 {
10860 bool is_item = entity.IsInherited(
ItemBase);
10861 if (is_item && full_quantity)
10862 {
10865 }
10866 }
10867 else
10868 {
10870 return NULL;
10871 }
10872 return entity;
10873}
10874
10876{
10877 if (item)
10878 {
10879 if (health > 0)
10880 item.SetHealth("", "", health);
10881
10882 if (item.CanHaveTemperature())
10883 {
10885 if (item.CanFreeze())
10886 item.SetFrozen(false);
10887 }
10888
10889 if (item.HasEnergyManager())
10890 {
10891 if (quantity >= 0)
10892 {
10893 item.GetCompEM().SetEnergy0To1(quantity);
10894 }
10895 else
10896 {
10898 }
10899 }
10900 else if (item.IsMagazine())
10901 {
10902 Magazine mag = Magazine.Cast(item);
10903 if (quantity >= 0)
10904 {
10905 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
10906 }
10907 else
10908 {
10910 }
10911
10912 }
10913 else
10914 {
10915 if (quantity >= 0)
10916 {
10917 item.SetQuantityNormalized(quantity, false);
10918 }
10919 else
10920 {
10922 }
10923
10924 }
10925 }
10926}
10927
10928#ifdef DEVELOPER
10930#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.