6235{
6237 {
6238 return true;
6239 }
6240};
6241
6243{
6244
6245};
6246
6247
6248
6250{
6254
6256
6259
6260
6261
6262
6263
6272
6278
6283
6288
6309 protected bool m_IsResultOfSplit
6310
6312
6317
6318
6319
6321
6325
6326
6327
6329
6332
6333
6334
6340
6341
6349
6352
6353
6355
6356
6358
6359
6364
6365
6370
6372
6373
6375
6376
6378 {
6383
6384 if (!
g_Game.IsDedicatedServer())
6385 {
6387 {
6389
6391 {
6393 }
6394 }
6395
6398 }
6399
6400 m_OldLocation = null;
6401
6403 {
6405 }
6406
6407 if (ConfigIsExisting("headSelectionsToHide"))
6408 {
6411 }
6412
6414 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
6415 {
6417 }
6418
6420
6421 m_IsResultOfSplit = false;
6422
6424 }
6425
6427 {
6428 super.InitItemVariables();
6429
6435 m_Count = ConfigGetInt(
"count");
6436
6439
6444
6447
6452
6464
6468
6469
6472 if (ConfigIsExisting("canBeSplit"))
6473 {
6476 }
6477
6479 if (ConfigIsExisting("itemBehaviour"))
6481
6482
6485 RegisterNetSyncVariableInt("m_VarLiquidType");
6486 RegisterNetSyncVariableInt("m_Cleanness",0,1);
6487
6488 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
6489 RegisterNetSyncVariableFloat("m_ImpactSpeed");
6490 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
6491
6492 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
6493 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
6494 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
6495 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
6496
6497 RegisterNetSyncVariableBool("m_IsBeingPlaced");
6498 RegisterNetSyncVariableBool("m_IsTakeable");
6499 RegisterNetSyncVariableBool("m_IsHologram");
6500
6503 {
6506 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
6507 }
6508
6510
6512 if (ConfigIsExisting("temperaturePerQuantityWeight"))
6514
6516 }
6517
6519 {
6521 }
6522
6524 {
6527 {
6532 }
6533 }
6534
6535 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
6536 {
6538 {
6541 }
6542
6544 }
6545
6547 {
6553 }
6554
6556
6558 {
6560
6561 if (!action)
6562 {
6563 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
6564 return;
6565 }
6566
6568 if (!ai)
6569 {
6571 return;
6572 }
6573
6575 if (!action_array)
6576 {
6577 action_array = new array<ActionBase_Basic>;
6579 }
6580 if (LogManager.IsActionLogEnable())
6581 {
6582 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
6583 }
6584
6585 if (action_array.Find(action) != -1)
6586 {
6587 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
6588 }
6589 else
6590 {
6591 action_array.Insert(action);
6592 }
6593 }
6594
6596 {
6597 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6598 ActionBase action = player.GetActionManager().GetAction(actionName);
6601
6602 if (action_array)
6603 {
6604 action_array.RemoveItem(action);
6605 }
6606 }
6607
6608
6609
6611 {
6612 ActionOverrideData overrideData = new ActionOverrideData();
6616
6618 if (!actionMap)
6619 {
6622 }
6623
6624 actionMap.Insert(this.
Type(), overrideData);
6625
6626 }
6627
6629
6631
6632
6634 {
6637
6640
6641 string config_to_search = "CfgVehicles";
6642 string muzzle_owner_config;
6643
6645 {
6646 if (IsInherited(Weapon))
6647 config_to_search = "CfgWeapons";
6648
6649 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6650
6651 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
6652
6653 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
6654
6655 if (config_OnFire_subclass_count > 0)
6656 {
6657 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
6658
6659 for (int i = 0; i < config_OnFire_subclass_count; i++)
6660 {
6661 string particle_class = "";
6662 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
6663 string config_OnFire_entry = config_OnFire_class + particle_class;
6664 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
6665 WPOF_array.Insert(WPOF);
6666 }
6667
6668
6670 }
6671 }
6672
6674 {
6675 config_to_search = "CfgWeapons";
6676 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6677
6678 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
6679
6680 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
6681
6682 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
6683 {
6684 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
6685
6686 for (i = 0; i < config_OnBulletCasingEject_count; i++)
6687 {
6688 string particle_class2 = "";
6689 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
6690 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
6691 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
6692 WPOBE_array.Insert(WPOBE);
6693 }
6694
6695
6697 }
6698 }
6699 }
6700
6701
6703 {
6706
6708 {
6709 string config_to_search = "CfgVehicles";
6710
6711 if (IsInherited(Weapon))
6712 config_to_search = "CfgWeapons";
6713
6714 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6715 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
6716
6717 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
6718 {
6719
6721
6723 {
6725 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
6727 return;
6728 }
6729
6732
6733
6734
6735 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
6736 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
6737
6738 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
6739 {
6740 string particle_class = "";
6741 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
6742 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
6743 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
6744
6745 if (entry_type == CT_CLASS)
6746 {
6747 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
6748 WPOOH_array.Insert(WPOF);
6749 }
6750 }
6751
6752
6754 }
6755 }
6756 }
6757
6759 {
6761 }
6762
6764 {
6766 {
6768
6771
6774
6775 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6776 }
6777 }
6778
6780 {
6782 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6783
6785 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6786
6788 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6789
6791 {
6793 }
6794 }
6795
6797 {
6799 }
6800
6802 {
6805 else
6807
6809 {
6812 }
6813 else
6814 {
6817
6820 }
6821
6823 }
6824
6826 {
6828 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6829 }
6830
6832 {
6834 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6836 }
6837
6839 {
6841 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6842 }
6843
6845 {
6848
6849 OverheatingParticle OP = new OverheatingParticle();
6854
6856 }
6857
6859 {
6862
6863 return -1;
6864 }
6865
6867 {
6869 {
6872
6873 for (int i = count; i > 0; --i)
6874 {
6875 int id = i - 1;
6878
6881
6882 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
6883 {
6884 if (p)
6885 {
6888 }
6889 }
6890 }
6891 }
6892 }
6893
6895 {
6897 {
6899 {
6900 int id = i - 1;
6902
6903 if (OP)
6904 {
6906
6907 if (p)
6908 {
6910 }
6911
6912 delete OP;
6913 }
6914 }
6915
6918 }
6919 }
6920
6923 {
6924 return 0.0;
6925 }
6926
6927
6929 {
6930 return 250;
6931 }
6932
6934 {
6935 return 0;
6936 }
6937
6940 {
6942 return true;
6943
6944 return false;
6945 }
6946
6949 {
6952
6954 {
6956 }
6957 else
6958 {
6959
6961 }
6962
6964 }
6965
6972 {
6973 return -1;
6974 }
6975
6976
6977
6978
6980 {
6982 {
6983 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6984 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6985
6986 if (r_index >= 0)
6987 {
6988 InventoryLocation r_il = new InventoryLocation;
6989 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6990
6991 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6994 {
6995 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6996 }
6998 {
6999 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7000 }
7001
7002 }
7003
7004 player.GetHumanInventory().ClearUserReservedLocation(this);
7005 }
7006
7009 }
7010
7011
7012
7013
7015 {
7016 return ItemBase.m_DebugActionsMask;
7017 }
7018
7020 {
7021 return ItemBase.m_DebugActionsMask & mask;
7022 }
7023
7025 {
7026 ItemBase.m_DebugActionsMask = mask;
7027 }
7028
7030 {
7031 ItemBase.m_DebugActionsMask |= mask;
7032 }
7033
7035 {
7036 ItemBase.m_DebugActionsMask &= ~mask;
7037 }
7038
7040 {
7042 {
7044 }
7045 else
7046 {
7048 }
7049 }
7050
7051
7053 {
7054 if (GetEconomyProfile())
7055 {
7056 float q_max = GetEconomyProfile().GetQuantityMax();
7057 if (q_max > 0)
7058 {
7059 float q_min = GetEconomyProfile().GetQuantityMin();
7060 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
7061
7063 {
7064 ComponentEnergyManager comp = GetCompEM();
7066 {
7068 }
7069 }
7071 {
7073
7074 }
7075
7076 }
7077 }
7078 }
7079
7082 {
7083 EntityAI parent = GetHierarchyParent();
7084
7085 if (parent)
7086 {
7087 InventoryLocation inventory_location_to_lock = new InventoryLocation;
7088 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
7089 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
7090 }
7091 }
7092
7095 {
7096 EntityAI parent = GetHierarchyParent();
7097
7098 if (parent)
7099 {
7100 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
7101 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
7102 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
7103 }
7104 }
7105
7107 {
7108
7109
7110
7111
7113
7115 {
7116 if (ScriptInputUserData.CanStoreInputUserData())
7117 {
7118 ScriptInputUserData ctx = new ScriptInputUserData;
7124 ctx.
Write(use_stack_max);
7127
7129 {
7130 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
7131 }
7132 }
7133 }
7134 else if (!
g_Game.IsMultiplayer())
7135 {
7137 }
7138 }
7139
7141 {
7143 }
7144
7146 {
7148 }
7149
7151 {
7153 }
7154
7156 {
7157
7158 return false;
7159 }
7160
7162 {
7163 return false;
7164 }
7165
7169 {
7170 return false;
7171 }
7172
7174 {
7175 return "";
7176 }
7177
7179
7181 {
7182 return false;
7183 }
7184
7186 {
7187 return true;
7188 }
7189
7190
7191
7193 {
7194 return true;
7195 }
7196
7198 {
7199 return true;
7200 }
7201
7203 {
7204 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7206 }
7207
7209 {
7211 }
7212
7214 {
7216 if (!is_being_placed)
7218 SetSynchDirty();
7219 }
7220
7221
7223
7225 {
7227 }
7228
7230 {
7232 }
7233
7235 {
7236 return 1;
7237 }
7238
7240 {
7241 return false;
7242 }
7243
7245 {
7247 SetSynchDirty();
7248 }
7249
7250
7251
7252
7253
7254
7255
7256
7257
7258
7259
7260
7261
7262
7263
7264
7265
7266
7267
7268
7269
7270
7271
7272
7273
7274
7275
7276
7277
7278
7279
7280
7281
7282
7283
7285 {
7286 super.OnMovedInsideCargo(container);
7287
7288 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7289 }
7290
7291 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
7292 {
7293 super.EEItemLocationChanged(oldLoc, newLoc);
7294
7295 PlayerBase newPlayer = null;
7296 PlayerBase oldPlayer = null;
7297
7298 if (newLoc.GetParent())
7299 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
7300
7301 if (oldLoc.GetParent())
7302 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
7303
7305 {
7306 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
7307
7308 if (rIndex >= 0)
7309 {
7310 InventoryLocation rIl = new InventoryLocation;
7311 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
7312
7313 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
7316 {
7317 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
7318 }
7320 {
7322 }
7323
7324 }
7325 }
7326
7328 {
7329 if (newPlayer)
7330 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
7331
7332 if (newPlayer == oldPlayer)
7333 {
7334 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
7335 {
7337 {
7338 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
7339 {
7340 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7341 }
7342 }
7343 else
7344 {
7345 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7346 }
7347 }
7348
7349 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
7350 {
7351 int type = oldLoc.GetType();
7353 {
7354 oldLoc.GetParent().GetOnSetLock().Invoke(this);
7355 }
7357 {
7358 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
7359 }
7360 }
7361 if (!m_OldLocation)
7362 {
7363 m_OldLocation = new InventoryLocation;
7364 }
7365 m_OldLocation.Copy(oldLoc);
7366 }
7367 else
7368 {
7369 if (m_OldLocation)
7370 {
7371 m_OldLocation.Reset();
7372 }
7373 }
7374
7375 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
7376 }
7377 else
7378 {
7379 if (newPlayer)
7380 {
7381 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
7382 if (resIndex >= 0)
7383 {
7384 InventoryLocation il = new InventoryLocation;
7385 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
7387 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
7390 {
7391 il.
GetParent().GetOnReleaseLock().Invoke(it);
7392 }
7394 {
7396 }
7397
7398 }
7399 }
7401 {
7402
7404 }
7405
7406 if (m_OldLocation)
7407 {
7408 m_OldLocation.Reset();
7409 }
7410 }
7411
7413 {
7414 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
7415 }
7416
7418 {
7419 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
7420 }
7421 }
7422
7423 override void EOnContact(IEntity other, Contact extra)
7424 {
7426 {
7427 int liquidType = -1;
7429 if (impactSpeed > 0.0)
7430 {
7432 #ifndef SERVER
7434 #else
7436 SetSynchDirty();
7437 #endif
7439 }
7440 }
7441
7442 #ifdef SERVER
7443 if (GetCompEM() && GetCompEM().IsPlugged())
7444 {
7445 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
7446 GetCompEM().UnplugThis();
7447 }
7448 #endif
7449 }
7450
7452
7454 {
7456 }
7457
7459 {
7460
7461 }
7462
7464 {
7465 super.OnItemLocationChanged(old_owner, new_owner);
7466
7467 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
7468 PlayerBase playerNew = PlayerBase.Cast(new_owner);
7469
7470 if (!relatedPlayer && playerNew)
7471 relatedPlayer = playerNew;
7472
7473 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
7474 {
7476 if (actionMgr)
7477 {
7478 ActionBase currentAction = actionMgr.GetRunningAction();
7479 if (currentAction)
7481 }
7482 }
7483
7484 Man ownerPlayerOld = null;
7485 Man ownerPlayerNew = null;
7486
7487 if (old_owner)
7488 {
7489 if (old_owner.
IsMan())
7490 {
7491 ownerPlayerOld = Man.Cast(old_owner);
7492 }
7493 else
7494 {
7495 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
7496 }
7497 }
7498 else
7499 {
7501 {
7503
7504 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
7505 {
7506 GetCompEM().UnplugThis();
7507 }
7508 }
7509 }
7510
7511 if (new_owner)
7512 {
7513 if (new_owner.
IsMan())
7514 {
7515 ownerPlayerNew = Man.Cast(new_owner);
7516 }
7517 else
7518 {
7519 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
7520 }
7521 }
7522
7523 if (ownerPlayerOld != ownerPlayerNew)
7524 {
7525 if (ownerPlayerOld)
7526 {
7527 array<EntityAI> subItemsExit = new array<EntityAI>;
7529 for (int i = 0; i < subItemsExit.Count(); i++)
7530 {
7533 }
7534 }
7535
7536 if (ownerPlayerNew)
7537 {
7538 array<EntityAI> subItemsEnter = new array<EntityAI>;
7540 for (int j = 0; j < subItemsEnter.Count(); j++)
7541 {
7544 }
7545 }
7546 }
7547 else if (ownerPlayerNew != null)
7548 {
7549 PlayerBase nplayer;
7550 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
7551 {
7552 array<EntityAI> subItemsUpdate = new array<EntityAI>;
7554 for (int k = 0; k < subItemsUpdate.Count(); k++)
7555 {
7557 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
7558 }
7559 }
7560 }
7561
7562 if (old_owner)
7563 old_owner.OnChildItemRemoved(this);
7564 if (new_owner)
7565 new_owner.OnChildItemReceived(this);
7566 }
7567
7568
7570 {
7571 super.EEDelete(parent);
7572 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
7573 if (player)
7574 {
7576
7577 if (player.IsAlive())
7578 {
7579 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7580 if (r_index >= 0)
7581 {
7582 InventoryLocation r_il = new InventoryLocation;
7583 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7584
7585 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7588 {
7589 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7590 }
7592 {
7593 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7594 }
7595
7596 }
7597
7598 player.RemoveQuickBarEntityShortcut(this);
7599 }
7600 }
7601 }
7602
7604 {
7605 super.EEKilled(killer);
7606
7609 {
7610 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
7611 {
7612 if (IsMagazine())
7613 {
7614 if (Magazine.Cast(this).GetAmmoCount() > 0)
7615 {
7617 }
7618 }
7619 else
7620 {
7622 }
7623 }
7624 }
7625 }
7626
7628 {
7629 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7630
7631 super.OnWasAttached(parent, slot_id);
7632
7635
7638 }
7639
7641 {
7642 super.OnWasDetached(parent, slot_id);
7643
7646
7649 }
7650
7652 {
7653 int idx;
7656
7657 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7658 if (inventory_slots.Count() < 1)
7659 {
7660 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
7661 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
7662 }
7663 else
7664 {
7665 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
7666 }
7667
7668 idx = inventory_slots.Find(slot);
7669 if (idx < 0)
7670 return "";
7671
7672 return attach_types.Get(idx);
7673 }
7674
7676 {
7677 int idx = -1;
7678 string slot;
7679
7682
7683 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7684 if (inventory_slots.Count() < 1)
7685 {
7686 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
7687 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7688 }
7689 else
7690 {
7691 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
7692 if (detach_types.Count() < 1)
7693 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7694 }
7695
7696 for (int i = 0; i < inventory_slots.Count(); i++)
7697 {
7698 slot = inventory_slots.Get(i);
7699 }
7700
7701 if (slot != "")
7702 {
7703 if (detach_types.Count() == 1)
7704 idx = 0;
7705 else
7706 idx = inventory_slots.Find(slot);
7707 }
7708 if (idx < 0)
7709 return "";
7710
7711 return detach_types.Get(idx);
7712 }
7713
7715 {
7716
7718
7719
7720 float min_time = 1;
7721 float max_time = 3;
7722 float delay = Math.RandomFloat(min_time, max_time);
7723
7724 explode_timer.Run(delay, this, "DoAmmoExplosion");
7725 }
7726
7728 {
7729 Magazine magazine = Magazine.Cast(this);
7730 int pop_sounds_count = 6;
7731 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
7732
7733
7734 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
7735 string sound_name = pop_sounds[ sound_idx ];
7736 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
7737
7738
7739 magazine.ServerAddAmmoCount(-1);
7740
7741
7742 float min_temp_to_explode = 100;
7743
7744 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
7745 {
7747 }
7748 }
7749
7750
7751 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
7752 {
7753 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
7754
7755 const int CHANCE_DAMAGE_CARGO = 4;
7756 const int CHANCE_DAMAGE_ATTACHMENT = 1;
7757 const int CHANCE_DAMAGE_NOTHING = 2;
7758
7760 {
7761 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
7762 int chances;
7763 int rnd;
7764
7765 if (GetInventory().GetCargo())
7766 {
7767 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7768 rnd = Math.RandomInt(0,chances);
7769
7770 if (rnd < CHANCE_DAMAGE_CARGO)
7771 {
7773 }
7774 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
7775 {
7777 }
7778 }
7779 else
7780 {
7781 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7782 rnd = Math.RandomInt(0,chances);
7783
7784 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
7785 {
7787 }
7788 }
7789 }
7790 }
7791
7793 {
7794 CargoBase cargo = GetInventory().GetCargo();
7795 if (cargo)
7796 {
7798 if (item_count > 0)
7799 {
7800 int random_pick = Math.RandomInt(0, item_count);
7802 if (!item.IsExplosive())
7803 {
7804 item.AddHealth("","",damage);
7805 return true;
7806 }
7807 }
7808 }
7809 return false;
7810 }
7811
7813 {
7814 GameInventory inventory = GetInventory();
7816 if (attachment_count > 0)
7817 {
7818 int random_pick = Math.RandomInt(0, attachment_count);
7820 if (!attachment.IsExplosive())
7821 {
7822 attachment.AddHealth("","",damage);
7823 return true;
7824 }
7825 }
7826 return false;
7827 }
7828
7830 {
7832 }
7833
7835 {
7837 return GetInventory().CanRemoveEntity();
7838
7839 return false;
7840 }
7841
7843 {
7844
7846 return false;
7847
7848
7850 return false;
7851
7852
7853
7855 if (delta == 0)
7856 return false;
7857
7858
7859 return true;
7860 }
7861
7863 {
7865 {
7866 if (ScriptInputUserData.CanStoreInputUserData())
7867 {
7868 ScriptInputUserData ctx = new ScriptInputUserData;
7873 ctx.
Write(destination_entity);
7877 }
7878 }
7879 else if (!
g_Game.IsMultiplayer())
7880 {
7882 }
7883 }
7884
7886 {
7887 float split_quantity_new;
7891 InventoryLocation loc = new InventoryLocation;
7892
7893 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7894 {
7896 split_quantity_new = stack_max;
7897 else
7899
7901 {
7902 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7903 if (new_item)
7904 {
7905 new_item.SetResultOfSplit(true);
7906 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7908 new_item.
SetQuantity(split_quantity_new,
false,
true);
7909 }
7910 }
7911 }
7912 else if (destination_entity && slot_id == -1)
7913 {
7914 if (quantity > stack_max)
7915 split_quantity_new = stack_max;
7916 else
7917 split_quantity_new = quantity;
7918
7920 {
7921 GameInventory destinationInventory = destination_entity.GetInventory();
7923 {
7926 }
7927
7928 if (new_item)
7929 {
7930 new_item.SetResultOfSplit(true);
7931 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7933 new_item.
SetQuantity(split_quantity_new,
false,
true);
7934 }
7935 }
7936 }
7937 else
7938 {
7939 if (stack_max != 0)
7940 {
7942 {
7944 }
7945
7946 if (split_quantity_new == 0)
7947 {
7948 if (!
g_Game.IsMultiplayer())
7949 player.PhysicalPredictiveDropItem(this);
7950 else
7951 player.ServerDropEntity(this);
7952 return;
7953 }
7954
7956 {
7958
7959 if (new_item)
7960 {
7961 new_item.SetResultOfSplit(true);
7962 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7965 new_item.PlaceOnSurface();
7966 }
7967 }
7968 }
7969 }
7970 }
7971
7973 {
7974 float split_quantity_new;
7978 InventoryLocation loc = new InventoryLocation;
7979
7980 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7981 {
7983 split_quantity_new = stack_max;
7984 else
7986
7988 {
7989 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7990 if (new_item)
7991 {
7992 new_item.SetResultOfSplit(true);
7993 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7995 new_item.
SetQuantity(split_quantity_new,
false,
true);
7996 }
7997 }
7998 }
7999 else if (destination_entity && slot_id == -1)
8000 {
8001 if (quantity > stack_max)
8002 split_quantity_new = stack_max;
8003 else
8004 split_quantity_new = quantity;
8005
8007 {
8008 GameInventory destinationInventory = destination_entity.GetInventory();
8010 {
8013 }
8014
8015 if (new_item)
8016 {
8017 new_item.SetResultOfSplit(true);
8018 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8020 new_item.
SetQuantity(split_quantity_new,
false,
true);
8021 }
8022 }
8023 }
8024 else
8025 {
8026 if (stack_max != 0)
8027 {
8029 {
8031 }
8032
8034 {
8036
8037 if (new_item)
8038 {
8039 new_item.SetResultOfSplit(true);
8040 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8043 new_item.PlaceOnSurface();
8044 }
8045 }
8046 }
8047 }
8048 }
8049
8051 {
8053 {
8054 if (ScriptInputUserData.CanStoreInputUserData())
8055 {
8056 ScriptInputUserData ctx = new ScriptInputUserData;
8061 dst.WriteToContext(ctx);
8063 }
8064 }
8065 else if (!
g_Game.IsMultiplayer())
8066 {
8068 }
8069 }
8070
8072 {
8074 {
8075 if (ScriptInputUserData.CanStoreInputUserData())
8076 {
8077 ScriptInputUserData ctx = new ScriptInputUserData;
8082 ctx.
Write(destination_entity);
8088 }
8089 }
8090 else if (!
g_Game.IsMultiplayer())
8091 {
8093 }
8094 }
8095
8097 {
8099 }
8100
8102 {
8104 float split_quantity_new;
8106 if (dst.IsValid())
8107 {
8108 int slot_id = dst.GetSlot();
8110
8111 if (quantity > stack_max)
8112 split_quantity_new = stack_max;
8113 else
8114 split_quantity_new = quantity;
8115
8117 {
8119
8120 if (new_item)
8121 {
8122 new_item.SetResultOfSplit(true);
8123 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8125 new_item.
SetQuantity(split_quantity_new,
false,
true);
8126 }
8127
8128 return new_item;
8129 }
8130 }
8131
8132 return null;
8133 }
8134
8136 {
8138 float split_quantity_new;
8140 if (destination_entity)
8141 {
8143 if (quantity > stackable)
8144 split_quantity_new = stackable;
8145 else
8146 split_quantity_new = quantity;
8147
8149 {
8150 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
8151 if (new_item)
8152 {
8153 new_item.SetResultOfSplit(true);
8154 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8156 new_item.
SetQuantity(split_quantity_new,
false,
true);
8157 }
8158 }
8159 }
8160 }
8161
8163 {
8165 {
8166 if (ScriptInputUserData.CanStoreInputUserData())
8167 {
8168 ScriptInputUserData ctx = new ScriptInputUserData;
8173 ItemBase destination_entity =
this;
8174 ctx.
Write(destination_entity);
8178 }
8179 }
8180 else if (!
g_Game.IsMultiplayer())
8181 {
8183 }
8184 }
8185
8187 {
8189 float split_quantity_new;
8191 if (player)
8192 {
8194 if (quantity > stackable)
8195 split_quantity_new = stackable;
8196 else
8197 split_quantity_new = quantity;
8198
8200 {
8201 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
8202 new_item =
ItemBase.Cast(in_hands);
8203 if (new_item)
8204 {
8205 new_item.SetResultOfSplit(true);
8206 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8208 new_item.SetQuantity(split_quantity_new, false, true);
8209 }
8210 }
8211 }
8212 }
8213
8215 {
8217 float split_quantity_new = Math.Floor(quantity * 0.5);
8218
8220 return;
8221
8223
8224 if (new_item)
8225 {
8226 if (new_item.GetQuantityMax() < split_quantity_new)
8227 {
8228 split_quantity_new = new_item.GetQuantityMax();
8229 }
8230
8231 new_item.SetResultOfSplit(true);
8232 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8233
8235 {
8238 }
8239 else
8240 {
8242 new_item.
SetQuantity(split_quantity_new,
false,
true);
8243 }
8244 }
8245 }
8246
8248 {
8250 float split_quantity_new = Math.Floor(quantity / 2);
8251
8253 return;
8254
8255 InventoryLocation invloc = new InventoryLocation;
8257
8259 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
8260
8261 if (new_item)
8262 {
8263 if (new_item.GetQuantityMax() < split_quantity_new)
8264 {
8265 split_quantity_new = new_item.GetQuantityMax();
8266 }
8268 {
8271 }
8272 else if (split_quantity_new > 1)
8273 {
8275 new_item.
SetQuantity(split_quantity_new,
false,
true);
8276 }
8277 }
8278 }
8279
8282 {
8283 SetWeightDirty();
8285
8286 if (parent)
8287 parent.OnAttachmentQuantityChangedEx(this, delta);
8288
8290 {
8292 {
8294 }
8296 {
8297 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
8299 }
8300 }
8301 }
8302
8305 {
8306
8307 }
8308
8311 {
8313 }
8314
8316 {
8317 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
8318
8320 {
8321 if (newLevel == GameConstants.STATE_RUINED)
8322 {
8324 EntityAI parent = GetHierarchyParent();
8325 if (parent && parent.IsFireplace())
8326 {
8327 CargoBase cargo = GetInventory().GetCargo();
8328 if (cargo)
8329 {
8331 {
8333 }
8334 }
8335 }
8336 }
8337
8339 {
8340
8342 return;
8343 }
8344
8345 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
8346 {
8348 }
8349 }
8350 }
8351
8352
8354 {
8355 super.OnRightClick();
8356
8358 {
8360 {
8361 if (ScriptInputUserData.CanStoreInputUserData())
8362 {
8363 EntityAI root = GetHierarchyRoot();
8364 Man playerOwner = GetHierarchyRootPlayer();
8365 InventoryLocation dst = new InventoryLocation;
8366
8367
8368 if (!playerOwner && root && root == this)
8369 {
8371 }
8372 else
8373 {
8374
8375 GetInventory().GetCurrentInventoryLocation(dst);
8377 {
8378 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8380 {
8382 }
8383 else
8384 {
8386
8387
8388 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
8389 {
8391 }
8392 else
8393 {
8394 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
8395 }
8396 }
8397 }
8398 }
8399
8400 ScriptInputUserData ctx = new ScriptInputUserData;
8408 }
8409 }
8410 else if (!
g_Game.IsMultiplayer())
8411 {
8413 }
8414 }
8415 }
8416
8418 {
8419 if (root)
8420 {
8421 vector m4[4];
8422 root.GetTransform(m4);
8423 dst.SetGround(this, m4);
8424 }
8425 else
8426 {
8427 GetInventory().GetCurrentInventoryLocation(dst);
8428 }
8429 }
8430
8431 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
8432 {
8433
8434 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
8435 return false;
8436
8437 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
8438 return false;
8439
8440
8442 return false;
8443
8444
8445 Magazine mag = Magazine.Cast(this);
8446 if (mag)
8447 {
8448 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
8449 return false;
8450
8451 if (stack_max_limit)
8452 {
8453 Magazine other_mag = Magazine.Cast(other_item);
8454 if (other_item)
8455 {
8456 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
8457 return false;
8458 }
8459
8460 }
8461 }
8462 else
8463 {
8464
8466 return false;
8467
8469 return false;
8470 }
8471
8472 PlayerBase player = null;
8473 if (CastTo(player, GetHierarchyRootPlayer()))
8474 {
8475 if (player.GetInventory().HasAttachment(this))
8476 return false;
8477
8478 if (player.IsItemsToDelete())
8479 return false;
8480 }
8481
8482 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
8483 return false;
8484
8485 int slotID;
8487 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
8488 return false;
8489
8490 return true;
8491 }
8492
8494 {
8496 }
8497
8499 {
8500 return m_IsResultOfSplit;
8501 }
8502
8504 {
8505 m_IsResultOfSplit = value;
8506 }
8507
8509 {
8511 }
8512
8514 {
8515 float other_item_quantity = other_item.GetQuantity();
8516 float this_free_space;
8517
8519
8521
8522 if (other_item_quantity > this_free_space)
8523 {
8524 return this_free_space;
8525 }
8526 else
8527 {
8528 return other_item_quantity;
8529 }
8530 }
8531
8533 {
8535 }
8536
8538 {
8540 return;
8541
8542 if (!IsMagazine() && other_item)
8543 {
8545 if (quantity_used != 0)
8546 {
8547 float hp1 = GetHealth01("","");
8548 float hp2 = other_item.GetHealth01("","");
8549 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
8550 hpResult = hpResult / (
GetQuantity() + quantity_used);
8551
8552 hpResult *= GetMaxHealth();
8553 Math.Round(hpResult);
8554 SetHealth("", "Health", hpResult);
8555
8557 other_item.AddQuantity(-quantity_used);
8558 }
8559 }
8561 }
8562
8564 {
8565 #ifdef SERVER
8566 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
8567 GetHierarchyParent().IncreaseLifetimeUp();
8568 #endif
8569 };
8570
8572 {
8573 PlayerBase p = PlayerBase.Cast(player);
8574
8575 array<int> recipesIds = p.m_Recipes;
8576 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8577 if (moduleRecipesManager)
8578 {
8579 EntityAI itemInHands = player.GetEntityInHands();
8580 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
8581 }
8582
8583 for (int i = 0;i < recipesIds.Count(); i++)
8584 {
8585 int key = recipesIds.Get(i);
8586 string recipeName = moduleRecipesManager.GetRecipeName(key);
8588 }
8589 }
8590
8591
8592 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
8593 {
8594 super.GetDebugActions(outputList);
8595
8596
8602
8603
8608
8613
8614
8618
8619
8621 {
8625 }
8626
8629
8630
8634
8636
8637 InventoryLocation loc = new InventoryLocation();
8638 GetInventory().GetCurrentInventoryLocation(loc);
8640 {
8641 if (Gizmo_IsSupported())
8644 }
8645
8647 }
8648
8649
8650
8651
8653 {
8654 super.OnAction(action_id, player, ctx);
8655
8657 {
8658 switch (action_id)
8659 {
8663 return true;
8667 return true;
8668 }
8669 }
8670
8672 {
8673 switch (action_id)
8674 {
8676 Delete();
8677 return true;
8678 }
8679 }
8680
8681 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
8682 {
8683 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8684 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
8685 PlayerBase p = PlayerBase.Cast(player);
8686 if (
EActions.RECIPES_RANGE_START < 1000)
8687 {
8688 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
8689 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
8690 }
8691 }
8692 #ifndef SERVER
8693 else if (action_id ==
EActions.WATCH_PLAYER)
8694 {
8695 PluginDeveloper.SetDeveloperItemClientEx(player);
8696 }
8697 #endif
8699 {
8700 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
8701 {
8702 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
8703 OnDebugButtonPressServer(id + 1);
8704 }
8705
8706 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
8707 {
8708 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
8710 }
8711
8712 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
8713 {
8714 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
8716 }
8717
8718 else if (action_id ==
EActions.ADD_QUANTITY)
8719 {
8720 if (IsMagazine())
8721 {
8722 Magazine mag = Magazine.Cast(this);
8723 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
8724 }
8725 else
8726 {
8728 }
8729
8730 if (m_EM)
8731 {
8732 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
8733 }
8734
8735 }
8736
8737 else if (action_id ==
EActions.REMOVE_QUANTITY)
8738 {
8739 if (IsMagazine())
8740 {
8741 Magazine mag2 = Magazine.Cast(this);
8742 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
8743 }
8744 else
8745 {
8747 }
8748 if (m_EM)
8749 {
8750 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
8751 }
8752
8753 }
8754
8755 else if (action_id ==
EActions.SET_QUANTITY_0)
8756 {
8758
8759 if (m_EM)
8760 {
8761 m_EM.SetEnergy(0);
8762 }
8763 }
8764
8765 else if (action_id ==
EActions.SET_MAX_QUANTITY)
8766 {
8768
8769 if (m_EM)
8770 {
8771 m_EM.SetEnergy(m_EM.GetEnergyMax());
8772 }
8773 }
8774
8775 else if (action_id ==
EActions.ADD_HEALTH)
8776 {
8777 AddHealth("","",GetMaxHealth("","Health")/5);
8778 }
8779 else if (action_id ==
EActions.REMOVE_HEALTH)
8780 {
8781 AddHealth("","",-GetMaxHealth("","Health")/5);
8782 }
8783 else if (action_id ==
EActions.DESTROY_HEALTH)
8784 {
8785 SetHealth01("","",0);
8786 }
8787 else if (action_id ==
EActions.WATCH_ITEM)
8788 {
8790 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
8791 #ifdef DEVELOPER
8792 SetDebugDeveloper_item(this);
8793 #endif
8794 }
8795
8796 else if (action_id ==
EActions.ADD_TEMPERATURE)
8797 {
8798 AddTemperature(20);
8799
8800 }
8801
8802 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
8803 {
8804 AddTemperature(-20);
8805
8806 }
8807
8808 else if (action_id ==
EActions.FLIP_FROZEN)
8809 {
8810 SetFrozen(!GetIsFrozen());
8811
8812 }
8813
8814 else if (action_id ==
EActions.ADD_WETNESS)
8815 {
8817
8818 }
8819
8820 else if (action_id ==
EActions.REMOVE_WETNESS)
8821 {
8823
8824 }
8825
8826 else if (action_id ==
EActions.LIQUIDTYPE_UP)
8827 {
8830
8831
8832 }
8833
8834 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
8835 {
8838 }
8839
8840 else if (action_id ==
EActions.MAKE_SPECIAL)
8841 {
8842 auto debugParams = DebugSpawnParams.WithPlayer(player);
8843 OnDebugSpawnEx(debugParams);
8844 }
8845
8846 }
8847
8848
8849 return false;
8850 }
8851
8852
8853
8854
8858
8861
8862
8863
8865 {
8866 return false;
8867 }
8868
8869
8871 {
8872 return true;
8873 }
8874
8875
8877 {
8878 return true;
8879 }
8880
8881
8882
8884 {
8885 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
8886 return g_Game.ConfigIsExisting(config_path);
8887 }
8888
8891 {
8892 return null;
8893 }
8894
8896 {
8897 return false;
8898 }
8899
8901 {
8902 return false;
8903 }
8904
8908
8909
8911 {
8912 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8913 return module_repairing.CanRepair(this, item_repair_kit);
8914 }
8915
8916
8917 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
8918 {
8919 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8920 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
8921 }
8922
8923
8925 {
8926
8927
8928
8929
8930
8931
8932
8933
8934 return 1;
8935 }
8936
8937
8938
8940 {
8942 }
8943
8944
8945
8947 {
8949 }
8950
8951
8960 {
8961 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8962
8963 if (player)
8964 {
8965 player.MessageStatus(text);
8966 }
8967 }
8968
8969
8978 {
8979 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8980
8981 if (player)
8982 {
8983 player.MessageAction(text);
8984 }
8985 }
8986
8987
8996 {
8997 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8998
8999 if (player)
9000 {
9001 player.MessageFriendly(text);
9002 }
9003 }
9004
9005
9014 {
9015 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9016
9017 if (player)
9018 {
9019 player.MessageImportant(text);
9020 }
9021 }
9022
9024 {
9025 return true;
9026 }
9027
9028
9029 override bool KindOf(
string tag)
9030 {
9031 bool found = false;
9032 string item_name = this.
GetType();
9034 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
9035
9036 int array_size = item_tag_array.Count();
9037 for (int i = 0; i < array_size; i++)
9038 {
9039 if (item_tag_array.Get(i) == tag)
9040 {
9041 found = true;
9042 break;
9043 }
9044 }
9045 return found;
9046 }
9047
9048
9050 {
9051
9052 super.OnRPC(sender, rpc_type,ctx);
9053
9054
9055 switch (rpc_type)
9056 {
9057 #ifndef SERVER
9058 case ERPCs.RPC_SOUND_LOCK_ATTACH:
9059 Param2<bool, string> p = new Param2<bool, string>(false, "");
9060
9062 return;
9063
9064 bool play = p.param1;
9065 string soundSet = p.param2;
9066
9067 if (play)
9068 {
9070 {
9072 {
9074 }
9075 }
9076 else
9077 {
9079 }
9080 }
9081 else
9082 {
9084 }
9085
9086 break;
9087 #endif
9088
9089 }
9090
9092 {
9094 }
9095 }
9096
9097
9098
9099
9101 {
9102 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9103 return plugin.GetID(
name);
9104 }
9105
9107 {
9108 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9109 return plugin.GetName(id);
9110 }
9111
9114 {
9115
9116
9117 int varFlags;
9118 if (!ctx.
Read(varFlags))
9119 return;
9120
9121 if (varFlags & ItemVariableFlags.FLOAT)
9122 {
9124 }
9125 }
9126
9128 {
9129
9130 super.SerializeNumericalVars(floats_out);
9131
9132
9133
9135 {
9137 }
9138
9140 {
9142 }
9143
9145 {
9147 }
9148
9150 {
9155 }
9156
9158 {
9160 }
9161 }
9162
9164 {
9165
9166 super.DeSerializeNumericalVars(floats);
9167
9168
9169 int index = 0;
9170 int mask = Math.Round(floats.Get(index));
9171
9172 index++;
9173
9175 {
9177 {
9179 }
9180 else
9181 {
9182 float quantity = floats.Get(index);
9184 }
9185 index++;
9186 }
9187
9189 {
9190 float wet = floats.Get(index);
9192 index++;
9193 }
9194
9196 {
9197 int liquidtype = Math.Round(floats.Get(index));
9199 index++;
9200 }
9201
9203 {
9205 index++;
9207 index++;
9209 index++;
9211 index++;
9212 }
9213
9215 {
9216 int cleanness = Math.Round(floats.Get(index));
9218 index++;
9219 }
9220 }
9221
9223 {
9224 super.WriteVarsToCTX(ctx);
9225
9226
9228 {
9230 }
9231
9233 {
9235 }
9236
9238 {
9240 }
9241
9243 {
9244 int r,g,b,a;
9250 }
9251
9253 {
9255 }
9256 }
9257
9259 {
9260 if (!super.ReadVarsFromCTX(ctx,version))
9261 return false;
9262
9263 int intValue;
9264 float value;
9265
9266 if (version < 140)
9267 {
9268 if (!ctx.
Read(intValue))
9269 return false;
9270
9271 m_VariablesMask = intValue;
9272 }
9273
9275 {
9276 if (!ctx.
Read(value))
9277 return false;
9278
9280 {
9282 }
9283 else
9284 {
9286 }
9287 }
9288
9289 if (version < 140)
9290 {
9292 {
9293 if (!ctx.
Read(value))
9294 return false;
9295 SetTemperatureDirect(value);
9296 }
9297 }
9298
9300 {
9301 if (!ctx.
Read(value))
9302 return false;
9304 }
9305
9307 {
9308 if (!ctx.
Read(intValue))
9309 return false;
9311 }
9312
9314 {
9315 int r,g,b,a;
9317 return false;
9319 return false;
9321 return false;
9323 return false;
9324
9326 }
9327
9329 {
9330 if (!ctx.
Read(intValue))
9331 return false;
9333 }
9334
9335 if (version >= 138 && version < 140)
9336 {
9338 {
9339 if (!ctx.
Read(intValue))
9340 return false;
9341 SetFrozen(intValue);
9342 }
9343 }
9344
9345 return true;
9346 }
9347
9348
9350 {
9353 {
9355 }
9356
9357 if (!super.OnStoreLoad(ctx, version))
9358 {
9360 return false;
9361 }
9362
9363 if (version >= 114)
9364 {
9365 bool hasQuickBarIndexSaved;
9366
9367 if (!ctx.
Read(hasQuickBarIndexSaved))
9368 {
9370 return false;
9371 }
9372
9373 if (hasQuickBarIndexSaved)
9374 {
9375 int itmQBIndex;
9376
9377
9378 if (!ctx.
Read(itmQBIndex))
9379 {
9381 return false;
9382 }
9383
9384 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
9385 if (itmQBIndex != -1 && parentPlayer)
9386 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
9387 }
9388 }
9389 else
9390 {
9391
9392 PlayerBase player;
9393 int itemQBIndex;
9394 if (version ==
int.
MAX)
9395 {
9396 if (!ctx.
Read(itemQBIndex))
9397 {
9399 return false;
9400 }
9401 }
9402 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
9403 {
9404
9405 if (!ctx.
Read(itemQBIndex))
9406 {
9408 return false;
9409 }
9410 if (itemQBIndex != -1 && player)
9411 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
9412 }
9413 }
9414
9415 if (version < 140)
9416 {
9417
9418 if (!LoadVariables(ctx, version))
9419 {
9421 return false;
9422 }
9423 }
9424
9425
9427 {
9429 return false;
9430 }
9431 if (version >= 132)
9432 {
9434 if (raib)
9435 {
9437 {
9439 return false;
9440 }
9441 }
9442 }
9443
9445 return true;
9446 }
9447
9448
9449
9451 {
9452 super.OnStoreSave(ctx);
9453
9454 PlayerBase player;
9455 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
9456 {
9458
9459 int itemQBIndex = -1;
9460 itemQBIndex = player.FindQuickBarEntityIndex(this);
9461 ctx.
Write(itemQBIndex);
9462 }
9463 else
9464 {
9466 }
9467
9469
9471 if (raib)
9472 {
9474 }
9475 }
9476
9477
9479 {
9480 super.AfterStoreLoad();
9481
9483 {
9485 }
9486
9488 {
9491 }
9492 }
9493
9495 {
9496 super.EEOnAfterLoad();
9497
9499 {
9501 }
9502
9505 }
9506
9508 {
9509 return false;
9510 }
9511
9512
9513
9515 {
9517 {
9518 #ifdef PLATFORM_CONSOLE
9519
9521 {
9523 if (menu)
9524 {
9526 }
9527 }
9528 #endif
9529 }
9530
9532 {
9535 }
9536
9538 {
9539 SetWeightDirty();
9541 }
9543 {
9546 }
9547
9549 {
9552
9555 }
9557 {
9561 }
9562
9563 super.OnVariablesSynchronized();
9564 }
9565
9566
9567
9569 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
9570 {
9571 if (!IsServerCheck(allow_client))
9572 return false;
9573
9575 return false;
9576
9579
9580 if (value <= (min + 0.001))
9581 value = min;
9582
9583 if (value == min)
9584 {
9585 if (destroy_config)
9586 {
9587 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
9588 if (dstr)
9589 {
9591 this.Delete();
9592 return true;
9593 }
9594 }
9595 else if (destroy_forced)
9596 {
9598 this.Delete();
9599 return true;
9600 }
9601
9603 }
9604
9607
9609 {
9610 EntityAI parent = GetHierarchyRoot();
9611 InventoryLocation iLoc = new InventoryLocation();
9612 GetInventory().GetCurrentInventoryLocation(iLoc);
9614 {
9615 int iLocSlot = iLoc.
GetSlot();
9617 {
9619 }
9621 {
9623 }
9624 }
9625 }
9626
9628 {
9630
9631 if (delta)
9633 }
9634
9636
9637 return false;
9638 }
9639
9640
9642 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9643 {
9645 }
9646
9648 {
9651 }
9652
9654 {
9657 }
9658
9660 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9661 {
9662 float value_clamped = Math.Clamp(value, 0, 1);
9664 SetQuantity(result, destroy_config, destroy_forced);
9665 }
9666
9667
9670 {
9672 }
9673
9675 {
9677 }
9678
9679
9680
9681
9682
9683
9684
9685
9686
9687
9689 {
9690 int slot = -1;
9691 GameInventory inventory = GetInventory();
9692 if (inventory)
9693 {
9694 InventoryLocation il = new InventoryLocation;
9697 }
9698
9700 }
9701
9703 {
9704 float quantity_max = 0;
9705
9707 {
9708 if (attSlotID != -1)
9709 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
9710
9711 if (quantity_max <= 0)
9713 }
9714
9715 if (quantity_max <= 0)
9717
9718 return quantity_max;
9719 }
9720
9722 {
9724 }
9725
9727 {
9729 }
9730
9731
9733 {
9735 }
9736
9738 {
9740 }
9741
9743 {
9745 }
9746
9747
9749 {
9750
9751 float weightEx = GetWeightEx();
9752 float special = GetInventoryAndCargoWeight();
9753 return weightEx - special;
9754 }
9755
9756
9758 {
9760 }
9761
9763 {
9765 {
9766 #ifdef DEVELOPER
9767 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9768 {
9769 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
9771 }
9772 #endif
9773
9775 }
9776 else if (HasEnergyManager())
9777 {
9778 #ifdef DEVELOPER
9779 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9780 {
9781 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
9782 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
9783 }
9784 #endif
9785 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
9786 }
9787 else
9788 {
9789 #ifdef DEVELOPER
9790 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9791 {
9792 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
9793 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
9794 }
9795 #endif
9796 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
9797 }
9798 }
9799
9802 {
9803 int item_count = 0;
9805
9806 GameInventory inventory = GetInventory();
9807 CargoBase cargo = inventory.
GetCargo();
9808 if (cargo != NULL)
9809 {
9811 }
9812
9814 for (int i = 0; i < nAttachments; ++i)
9815 {
9817 if (item)
9818 item_count += item.GetNumberOfItems();
9819 }
9820 return item_count;
9821 }
9822
9825 {
9826 float weight = 0;
9827 float wetness = 1;
9828 if (include_wetness)
9831 {
9832 weight = wetness * m_ConfigWeight;
9833 }
9835 {
9836 weight = 1;
9837 }
9838 return weight;
9839 }
9840
9841
9842
9844 {
9845 GameInventory inventory = GetInventory();
9846 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
9847 {
9848 array<EntityAI> items = new array<EntityAI>;
9850 for (int i = 0; i < items.Count(); ++i)
9851 {
9853 if (item)
9854 {
9855 g_Game.ObjectDelete(item);
9856 }
9857 }
9858 }
9859 }
9860
9861
9862
9863
9865 {
9866 float energy = 0;
9867 if (HasEnergyManager())
9868 {
9869 energy = GetCompEM().GetEnergy();
9870 }
9871 return energy;
9872 }
9873
9874
9876 {
9877 super.OnEnergyConsumed();
9878
9880 }
9881
9883 {
9884 super.OnEnergyAdded();
9885
9887 }
9888
9889
9891 {
9892 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
9893 {
9895 {
9896 float energy_0to1 = GetCompEM().GetEnergy0To1();
9898 }
9899 }
9900 }
9901
9902
9904 {
9905 return ConfigGetFloat("heatIsolation");
9906 }
9907
9909 {
9911 }
9912
9914 {
9915 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
9916 if (
g_Game.ConfigIsExisting(paramPath))
9917 return g_Game.ConfigGetFloat(paramPath);
9918
9919 return 0.0;
9920 }
9921
9923 {
9924 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
9925 if (
g_Game.ConfigIsExisting(paramPath))
9926 return g_Game.ConfigGetFloat(paramPath);
9927
9928 return 0.0;
9929 }
9930
9931 override void SetWet(
float value,
bool allow_client =
false)
9932 {
9933 if (!IsServerCheck(allow_client))
9934 return;
9935
9938
9940
9941 m_VarWet = Math.Clamp(value, min, max);
9942
9944 {
9947 }
9948 }
9949
9950 override void AddWet(
float value)
9951 {
9953 }
9954
9956 {
9958 }
9959
9961 {
9963 }
9964
9966 {
9968 }
9969
9971 {
9973 }
9974
9976 {
9978 }
9979
9981 {
9984 if (newLevel != oldLevel)
9985 {
9987 }
9988 }
9989
9991 {
9992 SetWeightDirty();
9993 }
9994
9996 {
9997 return GetWetLevelInternal(
m_VarWet);
9998 }
9999
10000
10001
10003 {
10005 }
10006
10008 {
10010 }
10011
10013 {
10015 }
10016
10018 {
10020 }
10021
10022
10023
10025 {
10026 if (ConfigIsExisting("itemModelLength"))
10027 {
10028 return ConfigGetFloat("itemModelLength");
10029 }
10030 return 0;
10031 }
10032
10034 {
10035 if (ConfigIsExisting("itemAttachOffset"))
10036 {
10037 return ConfigGetFloat("itemAttachOffset");
10038 }
10039 return 0;
10040 }
10041
10042 override void SetCleanness(
int value,
bool allow_client =
false)
10043 {
10044 if (!IsServerCheck(allow_client))
10045 return;
10046
10048
10050
10053 }
10054
10056 {
10058 }
10059
10061 {
10062 return true;
10063 }
10064
10065
10066
10067
10069 {
10071 }
10072
10074 {
10076 }
10077
10078
10079
10080
10081 override void SetColor(
int r,
int g,
int b,
int a)
10082 {
10088 }
10090 override void GetColor(out
int r,out
int g,out
int b,out
int a)
10091 {
10096 }
10097
10099 {
10101 }
10102
10105 {
10106 int r,g,b,a;
10108 r = r/255;
10109 g = g/255;
10110 b = b/255;
10111 a = a/255;
10112 return MiscGameplayFunctions.GetColorString(r, g, b, a);
10113 }
10114
10115
10116
10117 override void SetLiquidType(
int value,
bool allow_client =
false)
10118 {
10119 if (!IsServerCheck(allow_client))
10120 return;
10121
10126 }
10127
10129 {
10130 return ConfigGetInt("varLiquidTypeInit");
10131 }
10132
10134 {
10136 }
10137
10139 {
10141 SetFrozen(false);
10142 }
10143
10146 {
10147 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10148 }
10149
10150
10153 {
10154 PlayerBase nplayer;
10155 if (PlayerBase.CastTo(nplayer, player))
10156 {
10158 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10159 }
10160 }
10161
10162
10165 {
10166 PlayerBase nplayer;
10167 if (PlayerBase.CastTo(nplayer,player))
10168 {
10169 nplayer.SetEnableQuickBarEntityShortcut(this, false);
10170 }
10171
10172 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
10173
10174 if (HasEnergyManager())
10175 {
10176 GetCompEM().UpdatePlugState();
10177 }
10178 }
10179
10180
10182 {
10183 super.OnPlacementStarted(player);
10184
10186 }
10187
10188 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
10189 {
10191 {
10192 m_AdminLog.OnPlacementComplete(player,
this);
10193 }
10194
10195 super.OnPlacementComplete(player, position, orientation);
10196 }
10197
10198
10199
10200
10201
10203 {
10205 {
10206 return true;
10207 }
10208 else
10209 {
10210 return false;
10211 }
10212 }
10213
10214
10216 {
10218 {
10220 }
10221 }
10222
10223
10225 {
10227 }
10228
10230 {
10232 }
10233
10234 override void InsertAgent(
int agent,
float count = 1)
10235 {
10236 if (count < 1)
10237 return;
10238
10240 }
10241
10244 {
10246 }
10247
10248
10250 {
10252 }
10253
10254
10255
10256
10257
10258
10259
10260
10261
10262
10263
10264
10265
10266
10267
10268
10269
10270
10271
10272
10273
10274
10275
10276
10277
10278
10279
10280
10281
10282
10283
10284
10285
10286
10287
10288
10289
10290
10291
10292
10293
10294
10296 {
10298 return false;
10299 return true;
10300 }
10301
10303 {
10304
10306 }
10307
10308
10311 {
10312 super.CheckForRoofLimited(timeTresholdMS);
10313
10314 float time =
g_Game.GetTime();
10315 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
10316 {
10317 m_PreviousRoofTestTime = time;
10318 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
10319 }
10320 }
10321
10322
10324 {
10326 {
10327 return 0;
10328 }
10329
10330 if (GetInventory().GetAttachmentSlotsCount() != 0)
10331 {
10332 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
10333 if (filter)
10334 return filter.GetProtectionLevel(type, false, system);
10335 else
10336 return 0;
10337 }
10338
10339 string subclassPath, entryName;
10340
10341 switch (type)
10342 {
10344 entryName = "biological";
10345 break;
10347 entryName = "chemical";
10348 break;
10349 default:
10350 entryName = "biological";
10351 break;
10352 }
10353
10354 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
10355
10356 return g_Game.ConfigGetFloat(subclassPath + entryName);
10357 }
10358
10359
10360
10363 {
10364 if (!IsMagazine())
10366
10368 }
10369
10370
10371
10372
10373
10378 {
10379 return true;
10380 }
10381
10383 {
10385 }
10386
10387
10388
10389
10390
10392 {
10393 if (parent)
10394 {
10395 if (parent.IsInherited(DayZInfected))
10396 return true;
10397
10398 if (!parent.IsRuined())
10399 return true;
10400 }
10401
10402 return true;
10403 }
10404
10406 {
10407 if (!super.CanPutAsAttachment(parent))
10408 {
10409 return false;
10410 }
10411
10412 if (!IsRuined() && !parent.IsRuined())
10413 {
10414 return true;
10415 }
10416
10417 return false;
10418 }
10419
10421 {
10422
10423
10424
10425
10426 return super.CanReceiveItemIntoCargo(item);
10427 }
10428
10430 {
10431
10432
10433
10434
10435 GameInventory attachmentInv = attachment.GetInventory();
10437 {
10438 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
10439 return false;
10440 }
10441
10442 InventoryLocation loc = new InventoryLocation();
10443 attachment.GetInventory().GetCurrentInventoryLocation(loc);
10444 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
10445 return false;
10446
10447 return super.CanReceiveAttachment(attachment, slotId);
10448 }
10449
10451 {
10452 if (!super.CanReleaseAttachment(attachment))
10453 return false;
10454
10455 return GetInventory().AreChildrenAccessible();
10456 }
10457
10458
10459
10460
10461
10462
10463
10464
10465
10466
10467
10468
10469
10470
10471
10472
10473
10474
10475
10476
10477
10479 {
10480 int id = muzzle_owner.GetMuzzleID();
10481 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
10482
10483 if (WPOF_array)
10484 {
10485 for (int i = 0; i < WPOF_array.Count(); i++)
10486 {
10487 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
10488
10489 if (WPOF)
10490 {
10491 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
10492 }
10493 }
10494 }
10495 }
10496
10497
10499 {
10500 int id = muzzle_owner.GetMuzzleID();
10502
10503 if (WPOBE_array)
10504 {
10505 for (int i = 0; i < WPOBE_array.Count(); i++)
10506 {
10507 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
10508
10509 if (WPOBE)
10510 {
10511 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10512 }
10513 }
10514 }
10515 }
10516
10517
10519 {
10520 int id = muzzle_owner.GetMuzzleID();
10521 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10522
10523 if (WPOOH_array)
10524 {
10525 for (int i = 0; i < WPOOH_array.Count(); i++)
10526 {
10527 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10528
10529 if (WPOOH)
10530 {
10531 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10532 }
10533 }
10534 }
10535 }
10536
10537
10539 {
10540 int id = muzzle_owner.GetMuzzleID();
10541 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10542
10543 if (WPOOH_array)
10544 {
10545 for (int i = 0; i < WPOOH_array.Count(); i++)
10546 {
10547 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10548
10549 if (WPOOH)
10550 {
10551 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10552 }
10553 }
10554 }
10555 }
10556
10557
10559 {
10560 int id = muzzle_owner.GetMuzzleID();
10561 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10562
10563 if (WPOOH_array)
10564 {
10565 for (int i = 0; i < WPOOH_array.Count(); i++)
10566 {
10567 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10568
10569 if (WPOOH)
10570 {
10571 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10572 }
10573 }
10574 }
10575 }
10576
10577
10578
10580 {
10582 {
10583 return true;
10584 }
10585
10586 return false;
10587 }
10588
10590 {
10592 {
10593 return true;
10594 }
10595
10596 return false;
10597 }
10598
10600 {
10602 {
10603 return true;
10604 }
10605
10606 return false;
10607 }
10608
10610 {
10611 return false;
10612 }
10613
10616 {
10617 return UATimeSpent.DEFAULT_DEPLOY;
10618 }
10619
10620
10621
10622
10624 {
10626 SetSynchDirty();
10627 }
10628
10630 {
10632 }
10633
10634
10636 {
10637 return false;
10638 }
10639
10642 {
10643 string att_type = "None";
10644
10645 if (ConfigIsExisting("soundAttType"))
10646 {
10647 att_type = ConfigGetString("soundAttType");
10648 }
10649
10651 }
10652
10654 {
10656 }
10657
10658
10659
10660
10661
10667
10669 {
10672
10674 }
10675
10676
10678 {
10680 return;
10681
10683
10686
10689
10690 SoundParameters params = new SoundParameters();
10694 }
10695
10696
10698 {
10700 {
10703
10704 SetSynchDirty();
10705
10708 }
10709 }
10710
10712 {
10714 }
10715
10716
10718 {
10720 return;
10721
10723 SetSynchDirty();
10724
10727 }
10728
10730 {
10733 }
10734
10736 {
10738 }
10739
10740 void OnApply(PlayerBase player);
10741
10743 {
10744 return 1.0;
10745 };
10746
10748 {
10750 }
10751
10753 {
10755 }
10756
10758
10760 {
10761 SetDynamicPhysicsLifeTime(0.01);
10763 }
10764
10766 {
10767 array<string> zone_names = new array<string>;
10768 GetDamageZones(zone_names);
10769 for (int i = 0; i < zone_names.Count(); i++)
10770 {
10771 SetHealthMax(zone_names.Get(i),"Health");
10772 }
10773 SetHealthMax("","Health");
10774 }
10775
10778 {
10779 float global_health = GetHealth01("","Health");
10780 array<string> zones = new array<string>;
10781 GetDamageZones(zones);
10782
10783 for (int i = 0; i < zones.Count(); i++)
10784 {
10785 SetHealth01(zones.Get(i),"Health",global_health);
10786 }
10787 }
10788
10791 {
10792 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
10793 }
10794
10796 {
10797 if (!hasRootAsPlayer)
10798 {
10799 if (refParentIB)
10800 {
10801
10802 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
10803 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
10804
10805 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
10806 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
10807
10810 }
10811 else
10812 {
10813
10816 }
10817 }
10818 }
10819
10821 {
10823 {
10824 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
10825 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
10826 {
10827 float heatPermCoef = 1.0;
10829 while (ent)
10830 {
10831 heatPermCoef *= ent.GetHeatPermeabilityCoef();
10832 ent = ent.GetHierarchyParent();
10833 }
10834
10835 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
10836 }
10837 }
10838 }
10839
10841 {
10842
10843 EntityAI parent = GetHierarchyParent();
10844 if (!parent)
10845 {
10846 hasParent = false;
10847 hasRootAsPlayer = false;
10848 }
10849 else
10850 {
10851 hasParent = true;
10852 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
10853 refParentIB =
ItemBase.Cast(parent);
10854 }
10855 }
10856
10857 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
10858 {
10859
10860 }
10861
10863 {
10864
10865 return false;
10866 }
10867
10869 {
10870
10871
10872 return false;
10873 }
10874
10876 {
10877
10878 return false;
10879 }
10880
10883 {
10884 return !GetIsFrozen() &&
IsOpen();
10885 }
10886
10888 {
10889 bool hasParent = false, hasRootAsPlayer = false;
10891
10892 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
10893 bool foodDecay =
g_Game.IsFoodDecayEnabled();
10894
10895 if (wwtu || foodDecay)
10896 {
10900
10901 if (processWetness || processTemperature || processDecay)
10902 {
10904
10905 if (processWetness)
10906 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
10907
10908 if (processTemperature)
10910
10911 if (processDecay)
10912 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
10913 }
10914 }
10915 }
10916
10919 {
10921 }
10922
10924 {
10927
10928 return super.GetTemperatureFreezeThreshold();
10929 }
10930
10932 {
10935
10936 return super.GetTemperatureThawThreshold();
10937 }
10938
10940 {
10943
10944 return super.GetItemOverheatThreshold();
10945 }
10946
10948 {
10950 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
10951
10952 return super.GetTemperatureFreezeTime();
10953 }
10954
10956 {
10958 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
10959
10960 return super.GetTemperatureThawTime();
10961 }
10962
10967
10969 {
10970 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
10971 }
10972
10974 {
10975 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
10976 }
10977
10980 {
10982 }
10983
10985 {
10987 }
10988
10990 {
10992 }
10993
10996 {
10997 return null;
10998 }
10999
11002 {
11003 return false;
11004 }
11005
11007 {
11009 {
11012 if (!trg)
11013 {
11015 explosive = this;
11016 }
11017
11018 explosive.PairRemote(trg);
11020
11021 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
11022 trg.SetPersistentPairID(persistentID);
11023 explosive.SetPersistentPairID(persistentID);
11024
11025 return true;
11026 }
11027 return false;
11028 }
11029
11032 {
11033 float ret = 1.0;
11036 ret *= GetHealth01();
11037
11038 return ret;
11039 }
11040
11041 #ifdef DEVELOPER
11042 override void SetDebugItem()
11043 {
11044 super.SetDebugItem();
11045 _itemBase = this;
11046 }
11047
11049 {
11050 string text = super.GetDebugText();
11051
11053 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
11054
11055 return text;
11056 }
11057 #endif
11058
11060 {
11061 return true;
11062 }
11063
11065
11067
11069 {
11072 }
11073
11074
11082
11098
11099 [
Obsolete(
"Use ItemSoundHandler instead")]
11102 {
11103 if (!
g_Game.IsDedicatedServer())
11104 {
11105 if (ConfigIsExisting("attachSoundSet"))
11106 {
11107 string cfg_path = "";
11108 string soundset = "";
11109 string type_name =
GetType();
11110
11113 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
11114 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
11115
11116 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
11117 {
11118 for (int i = 0; i < cfg_soundset_array.Count(); i++)
11119 {
11120 if (cfg_slot_array[i] == slot_type)
11121 {
11122 soundset = cfg_soundset_array[i];
11123 break;
11124 }
11125 }
11126 }
11127
11128 if (soundset != "")
11129 {
11130 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
11132 }
11133 }
11134 }
11135 }
11136
11138}
11139
11141{
11143 if (entity)
11144 {
11145 bool is_item = entity.IsInherited(
ItemBase);
11146 if (is_item && full_quantity)
11147 {
11150 }
11151 }
11152 else
11153 {
11155 return NULL;
11156 }
11157 return entity;
11158}
11159
11161{
11162 if (item)
11163 {
11164 if (health > 0)
11165 item.SetHealth("", "", health);
11166
11167 if (item.CanHaveTemperature())
11168 {
11170 if (item.CanFreeze())
11171 item.SetFrozen(false);
11172 }
11173
11174 if (item.HasEnergyManager())
11175 {
11176 if (quantity >= 0)
11177 {
11178 item.GetCompEM().SetEnergy0To1(quantity);
11179 }
11180 else
11181 {
11183 }
11184 }
11185 else if (item.IsMagazine())
11186 {
11187 Magazine mag = Magazine.Cast(item);
11188 if (quantity >= 0)
11189 {
11190 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
11191 }
11192 else
11193 {
11195 }
11196
11197 }
11198 else
11199 {
11200 if (quantity >= 0)
11201 {
11202 item.SetQuantityNormalized(quantity, false);
11203 }
11204 else
11205 {
11207 }
11208
11209 }
11210 }
11211}
11212
11213#ifdef DEVELOPER
11215#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.