6551{
6553 {
6554 return true;
6555 }
6556};
6557
6559{
6560
6561};
6562
6563
6564
6566{
6570
6572
6575
6576
6577
6578
6579
6588
6594
6599
6604
6625 protected bool m_IsResultOfSplit
6626
6628
6633
6634
6635
6637
6641
6642
6643
6645
6648
6649
6650
6656
6657
6665
6668
6669
6671
6672
6674
6675
6680
6681
6686
6688
6689
6691
6692
6694 {
6699
6700 if (!
g_Game.IsDedicatedServer())
6701 {
6703 {
6705
6707 {
6709 }
6710 }
6711
6714 }
6715
6716 m_OldLocation = null;
6717
6719 {
6721 }
6722
6723 if (ConfigIsExisting("headSelectionsToHide"))
6724 {
6727 }
6728
6730 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
6731 {
6733 }
6734
6736
6737 m_IsResultOfSplit = false;
6738
6740 }
6741
6743 {
6744 super.InitItemVariables();
6745
6751 m_Count = ConfigGetInt(
"count");
6752
6755
6760
6763
6768
6780
6784
6785
6788 if (ConfigIsExisting("canBeSplit"))
6789 {
6792 }
6793
6795 if (ConfigIsExisting("itemBehaviour"))
6797
6798
6801 RegisterNetSyncVariableInt("m_VarLiquidType");
6802 RegisterNetSyncVariableInt("m_Cleanness",0,1);
6803
6804 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
6805 RegisterNetSyncVariableFloat("m_ImpactSpeed");
6806 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
6807
6808 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
6809 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
6810 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
6811 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
6812
6813 RegisterNetSyncVariableBool("m_IsBeingPlaced");
6814 RegisterNetSyncVariableBool("m_IsTakeable");
6815 RegisterNetSyncVariableBool("m_IsHologram");
6816
6819 {
6822 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
6823 }
6824
6826
6828 if (ConfigIsExisting("temperaturePerQuantityWeight"))
6830
6832 }
6833
6835 {
6837 }
6838
6840 {
6843 {
6848 }
6849 }
6850
6851 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
6852 {
6854 {
6857 }
6858
6860 }
6861
6863 {
6869 }
6870
6872
6874 {
6876
6877 if (!action)
6878 {
6879 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
6880 return;
6881 }
6882
6884 if (!ai)
6885 {
6887 return;
6888 }
6889
6891 if (!action_array)
6892 {
6893 action_array = new array<ActionBase_Basic>;
6895 }
6896 if (LogManager.IsActionLogEnable())
6897 {
6898 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
6899 }
6900
6901 if (action_array.Find(action) != -1)
6902 {
6903 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
6904 }
6905 else
6906 {
6907 action_array.Insert(action);
6908 }
6909 }
6910
6912 {
6913 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6914 ActionBase action = player.GetActionManager().GetAction(actionName);
6917
6918 if (action_array)
6919 {
6920 action_array.RemoveItem(action);
6921 }
6922 }
6923
6924
6925
6927 {
6928 ActionOverrideData overrideData = new ActionOverrideData();
6932
6934 if (!actionMap)
6935 {
6938 }
6939
6940 actionMap.Insert(this.
Type(), overrideData);
6941
6942 }
6943
6945
6947
6948
6950 {
6953
6956
6957 string config_to_search = "CfgVehicles";
6958 string muzzle_owner_config;
6959
6961 {
6962 if (IsInherited(Weapon))
6963 config_to_search = "CfgWeapons";
6964
6965 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6966
6967 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
6968
6969 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
6970
6971 if (config_OnFire_subclass_count > 0)
6972 {
6973 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
6974
6975 for (int i = 0; i < config_OnFire_subclass_count; i++)
6976 {
6977 string particle_class = "";
6978 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
6979 string config_OnFire_entry = config_OnFire_class + particle_class;
6980 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
6981 WPOF_array.Insert(WPOF);
6982 }
6983
6984
6986 }
6987 }
6988
6990 {
6991 config_to_search = "CfgWeapons";
6992 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6993
6994 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
6995
6996 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
6997
6998 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
6999 {
7000 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
7001
7002 for (i = 0; i < config_OnBulletCasingEject_count; i++)
7003 {
7004 string particle_class2 = "";
7005 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
7006 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
7007 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
7008 WPOBE_array.Insert(WPOBE);
7009 }
7010
7011
7013 }
7014 }
7015 }
7016
7017
7019 {
7022
7024 {
7025 string config_to_search = "CfgVehicles";
7026
7027 if (IsInherited(Weapon))
7028 config_to_search = "CfgWeapons";
7029
7030 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7031 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
7032
7033 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
7034 {
7035
7037
7039 {
7041 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
7043 return;
7044 }
7045
7048
7049
7050
7051 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
7052 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
7053
7054 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
7055 {
7056 string particle_class = "";
7057 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
7058 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
7059 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
7060
7061 if (entry_type == CT_CLASS)
7062 {
7063 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
7064 WPOOH_array.Insert(WPOF);
7065 }
7066 }
7067
7068
7070 }
7071 }
7072 }
7073
7075 {
7077 }
7078
7080 {
7082 {
7084
7087
7090
7091 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7092 }
7093 }
7094
7096 {
7098 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7099
7101 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7102
7104 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7105
7107 {
7109 }
7110 }
7111
7113 {
7115 }
7116
7118 {
7121 else
7123
7125 {
7128 }
7129 else
7130 {
7133
7136 }
7137
7139 }
7140
7142 {
7144 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7145 }
7146
7148 {
7150 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7152 }
7153
7155 {
7157 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7158 }
7159
7161 {
7164
7165 OverheatingParticle OP = new OverheatingParticle();
7170
7172 }
7173
7175 {
7178
7179 return -1;
7180 }
7181
7183 {
7185 {
7188
7189 for (int i = count; i > 0; --i)
7190 {
7191 int id = i - 1;
7194
7197
7198 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
7199 {
7200 if (p)
7201 {
7204 }
7205 }
7206 }
7207 }
7208 }
7209
7211 {
7213 {
7215 {
7216 int id = i - 1;
7218
7219 if (OP)
7220 {
7222
7223 if (p)
7224 {
7226 }
7227
7228 delete OP;
7229 }
7230 }
7231
7234 }
7235 }
7236
7239 {
7240 return 0.0;
7241 }
7242
7243
7245 {
7246 return 250;
7247 }
7248
7250 {
7251 return 0;
7252 }
7253
7256 {
7258 return true;
7259
7260 return false;
7261 }
7262
7265 {
7268
7270 {
7272 }
7273 else
7274 {
7275
7277 }
7278
7280 }
7281
7288 {
7289 return -1;
7290 }
7291
7292
7293
7294
7296 {
7298 {
7299 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7300 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7301
7302 if (r_index >= 0)
7303 {
7304 InventoryLocation r_il = new InventoryLocation;
7305 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7306
7307 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7310 {
7311 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7312 }
7314 {
7315 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7316 }
7317
7318 }
7319
7320 player.GetHumanInventory().ClearUserReservedLocation(this);
7321 }
7322
7325 }
7326
7327
7328
7329
7331 {
7332 return ItemBase.m_DebugActionsMask;
7333 }
7334
7336 {
7337 return ItemBase.m_DebugActionsMask & mask;
7338 }
7339
7341 {
7342 ItemBase.m_DebugActionsMask = mask;
7343 }
7344
7346 {
7347 ItemBase.m_DebugActionsMask |= mask;
7348 }
7349
7351 {
7352 ItemBase.m_DebugActionsMask &= ~mask;
7353 }
7354
7356 {
7358 {
7360 }
7361 else
7362 {
7364 }
7365 }
7366
7367
7369 {
7370 if (GetEconomyProfile())
7371 {
7372 float q_max = GetEconomyProfile().GetQuantityMax();
7373 if (q_max > 0)
7374 {
7375 float q_min = GetEconomyProfile().GetQuantityMin();
7376 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
7377
7379 {
7380 ComponentEnergyManager comp = GetCompEM();
7382 {
7384 }
7385 }
7387 {
7389
7390 }
7391
7392 }
7393 }
7394 }
7395
7398 {
7399 EntityAI parent = GetHierarchyParent();
7400
7401 if (parent)
7402 {
7403 InventoryLocation inventory_location_to_lock = new InventoryLocation;
7404 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
7405 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
7406 }
7407 }
7408
7411 {
7412 EntityAI parent = GetHierarchyParent();
7413
7414 if (parent)
7415 {
7416 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
7417 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
7418 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
7419 }
7420 }
7421
7423 {
7424
7425
7426
7427
7429
7431 {
7432 if (ScriptInputUserData.CanStoreInputUserData())
7433 {
7434 ScriptInputUserData ctx = new ScriptInputUserData;
7440 ctx.
Write(use_stack_max);
7443
7445 {
7446 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
7447 }
7448 }
7449 }
7450 else if (!
g_Game.IsMultiplayer())
7451 {
7453 }
7454 }
7455
7457 {
7459 }
7460
7462 {
7464 }
7465
7467 {
7469 }
7470
7472 {
7473
7474 return false;
7475 }
7476
7478 {
7479 return false;
7480 }
7481
7485 {
7486 return false;
7487 }
7488
7490 {
7491 return "";
7492 }
7493
7495
7497 {
7498 return false;
7499 }
7500
7502 {
7503 return true;
7504 }
7505
7506
7507
7509 {
7510 return true;
7511 }
7512
7514 {
7515 return true;
7516 }
7517
7519 {
7520 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7522 }
7523
7525 {
7527 }
7528
7530 {
7532 if (!is_being_placed)
7534 SetSynchDirty();
7535 }
7536
7537
7539
7541 {
7543 }
7544
7546 {
7548 }
7549
7551 {
7552 return 1;
7553 }
7554
7556 {
7557 return false;
7558 }
7559
7561 {
7563 SetSynchDirty();
7564 }
7565
7566
7567
7568
7569
7570
7571
7572
7573
7574
7575
7576
7577
7578
7579
7580
7581
7582
7583
7584
7585
7586
7587
7588
7589
7590
7591
7592
7593
7594
7595
7596
7597
7598
7599
7601 {
7602 super.OnMovedInsideCargo(container);
7603
7604 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7605 }
7606
7607 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
7608 {
7609 super.EEItemLocationChanged(oldLoc, newLoc);
7610
7611 PlayerBase newPlayer = null;
7612 PlayerBase oldPlayer = null;
7613
7614 if (newLoc.GetParent())
7615 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
7616
7617 if (oldLoc.GetParent())
7618 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
7619
7621 {
7622 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
7623
7624 if (rIndex >= 0)
7625 {
7626 InventoryLocation rIl = new InventoryLocation;
7627 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
7628
7629 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
7632 {
7633 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
7634 }
7636 {
7638 }
7639
7640 }
7641 }
7642
7644 {
7645 if (newPlayer)
7646 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
7647
7648 if (newPlayer == oldPlayer)
7649 {
7650 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
7651 {
7653 {
7654 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
7655 {
7656 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7657 }
7658 }
7659 else
7660 {
7661 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7662 }
7663 }
7664
7665 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
7666 {
7667 int type = oldLoc.GetType();
7669 {
7670 oldLoc.GetParent().GetOnSetLock().Invoke(this);
7671 }
7673 {
7674 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
7675 }
7676 }
7677 if (!m_OldLocation)
7678 {
7679 m_OldLocation = new InventoryLocation;
7680 }
7681 m_OldLocation.Copy(oldLoc);
7682 }
7683 else
7684 {
7685 if (m_OldLocation)
7686 {
7687 m_OldLocation.Reset();
7688 }
7689 }
7690
7691 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
7692 }
7693 else
7694 {
7695 if (newPlayer)
7696 {
7697 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
7698 if (resIndex >= 0)
7699 {
7700 InventoryLocation il = new InventoryLocation;
7701 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
7703 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
7706 {
7707 il.
GetParent().GetOnReleaseLock().Invoke(it);
7708 }
7710 {
7712 }
7713
7714 }
7715 }
7717 {
7718
7720 }
7721
7722 if (m_OldLocation)
7723 {
7724 m_OldLocation.Reset();
7725 }
7726 }
7727
7729 {
7730 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
7731 }
7732
7734 {
7735 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
7736 }
7737 }
7738
7739 override void EOnContact(IEntity other, Contact extra)
7740 {
7742 {
7743 int liquidType = -1;
7745 if (impactSpeed > 0.0)
7746 {
7748 #ifndef SERVER
7750 #else
7752 SetSynchDirty();
7753 #endif
7755 }
7756 }
7757
7758 #ifdef SERVER
7759 if (GetCompEM() && GetCompEM().IsPlugged())
7760 {
7761 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
7762 GetCompEM().UnplugThis();
7763 }
7764 #endif
7765 }
7766
7768
7770 {
7772 }
7773
7775 {
7776
7777 }
7778
7780 {
7781 super.OnItemLocationChanged(old_owner, new_owner);
7782
7783 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
7784 PlayerBase playerNew = PlayerBase.Cast(new_owner);
7785
7786 if (!relatedPlayer && playerNew)
7787 relatedPlayer = playerNew;
7788
7789 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
7790 {
7792 if (actionMgr)
7793 {
7794 ActionBase currentAction = actionMgr.GetRunningAction();
7795 if (currentAction)
7797 }
7798 }
7799
7800 Man ownerPlayerOld = null;
7801 Man ownerPlayerNew = null;
7802
7803 if (old_owner)
7804 {
7805 if (old_owner.
IsMan())
7806 {
7807 ownerPlayerOld = Man.Cast(old_owner);
7808 }
7809 else
7810 {
7811 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
7812 }
7813 }
7814 else
7815 {
7817 {
7819
7820 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
7821 {
7822 GetCompEM().UnplugThis();
7823 }
7824 }
7825 }
7826
7827 if (new_owner)
7828 {
7829 if (new_owner.
IsMan())
7830 {
7831 ownerPlayerNew = Man.Cast(new_owner);
7832 }
7833 else
7834 {
7835 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
7836 }
7837 }
7838
7839 if (ownerPlayerOld != ownerPlayerNew)
7840 {
7841 if (ownerPlayerOld)
7842 {
7843 array<EntityAI> subItemsExit = new array<EntityAI>;
7845 for (int i = 0; i < subItemsExit.Count(); i++)
7846 {
7849 }
7850 }
7851
7852 if (ownerPlayerNew)
7853 {
7854 array<EntityAI> subItemsEnter = new array<EntityAI>;
7856 for (int j = 0; j < subItemsEnter.Count(); j++)
7857 {
7860 }
7861 }
7862 }
7863 else if (ownerPlayerNew != null)
7864 {
7865 PlayerBase nplayer;
7866 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
7867 {
7868 array<EntityAI> subItemsUpdate = new array<EntityAI>;
7870 for (int k = 0; k < subItemsUpdate.Count(); k++)
7871 {
7873 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
7874 }
7875 }
7876 }
7877
7878 if (old_owner)
7879 old_owner.OnChildItemRemoved(this);
7880 if (new_owner)
7881 new_owner.OnChildItemReceived(this);
7882 }
7883
7884
7886 {
7887 super.EEDelete(parent);
7888 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
7889 if (player)
7890 {
7892
7893 if (player.IsAlive())
7894 {
7895 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7896 if (r_index >= 0)
7897 {
7898 InventoryLocation r_il = new InventoryLocation;
7899 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7900
7901 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7904 {
7905 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7906 }
7908 {
7909 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7910 }
7911
7912 }
7913
7914 player.RemoveQuickBarEntityShortcut(this);
7915 }
7916 }
7917 }
7918
7920 {
7921 super.EEKilled(killer);
7922
7925 {
7926 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
7927 {
7928 if (IsMagazine())
7929 {
7930 if (Magazine.Cast(this).GetAmmoCount() > 0)
7931 {
7933 }
7934 }
7935 else
7936 {
7938 }
7939 }
7940 }
7941 }
7942
7944 {
7945 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7946
7947 super.OnWasAttached(parent, slot_id);
7948
7951
7954 }
7955
7957 {
7958 super.OnWasDetached(parent, slot_id);
7959
7962
7965 }
7966
7968 {
7969 int idx;
7972
7973 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7974 if (inventory_slots.Count() < 1)
7975 {
7976 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
7977 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
7978 }
7979 else
7980 {
7981 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
7982 }
7983
7984 idx = inventory_slots.Find(slot);
7985 if (idx < 0)
7986 return "";
7987
7988 return attach_types.Get(idx);
7989 }
7990
7992 {
7993 int idx = -1;
7994 string slot;
7995
7998
7999 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8000 if (inventory_slots.Count() < 1)
8001 {
8002 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
8003 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8004 }
8005 else
8006 {
8007 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
8008 if (detach_types.Count() < 1)
8009 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8010 }
8011
8012 for (int i = 0; i < inventory_slots.Count(); i++)
8013 {
8014 slot = inventory_slots.Get(i);
8015 }
8016
8017 if (slot != "")
8018 {
8019 if (detach_types.Count() == 1)
8020 idx = 0;
8021 else
8022 idx = inventory_slots.Find(slot);
8023 }
8024 if (idx < 0)
8025 return "";
8026
8027 return detach_types.Get(idx);
8028 }
8029
8031 {
8032
8034
8035
8036 float min_time = 1;
8037 float max_time = 3;
8038 float delay = Math.RandomFloat(min_time, max_time);
8039
8040 explode_timer.Run(delay, this, "DoAmmoExplosion");
8041 }
8042
8044 {
8045 Magazine magazine = Magazine.Cast(this);
8046 int pop_sounds_count = 6;
8047 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
8048
8049
8050 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
8051 string sound_name = pop_sounds[ sound_idx ];
8052 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
8053
8054
8055 magazine.ServerAddAmmoCount(-1);
8056
8057
8058 float min_temp_to_explode = 100;
8059
8060 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
8061 {
8063 }
8064 }
8065
8066
8067 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
8068 {
8069 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
8070
8071 const int CHANCE_DAMAGE_CARGO = 4;
8072 const int CHANCE_DAMAGE_ATTACHMENT = 1;
8073 const int CHANCE_DAMAGE_NOTHING = 2;
8074
8076 {
8077 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
8078 int chances;
8079 int rnd;
8080
8081 if (GetInventory().GetCargo())
8082 {
8083 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8084 rnd = Math.RandomInt(0,chances);
8085
8086 if (rnd < CHANCE_DAMAGE_CARGO)
8087 {
8089 }
8090 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
8091 {
8093 }
8094 }
8095 else
8096 {
8097 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8098 rnd = Math.RandomInt(0,chances);
8099
8100 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
8101 {
8103 }
8104 }
8105 }
8106 }
8107
8109 {
8110 CargoBase cargo = GetInventory().GetCargo();
8111 if (cargo)
8112 {
8114 if (item_count > 0)
8115 {
8116 int random_pick = Math.RandomInt(0, item_count);
8118 if (!item.IsExplosive())
8119 {
8120 item.AddHealth("","",damage);
8121 return true;
8122 }
8123 }
8124 }
8125 return false;
8126 }
8127
8129 {
8130 GameInventory inventory = GetInventory();
8132 if (attachment_count > 0)
8133 {
8134 int random_pick = Math.RandomInt(0, attachment_count);
8136 if (!attachment.IsExplosive())
8137 {
8138 attachment.AddHealth("","",damage);
8139 return true;
8140 }
8141 }
8142 return false;
8143 }
8144
8146 {
8148 }
8149
8151 {
8153 return GetInventory().CanRemoveEntity();
8154
8155 return false;
8156 }
8157
8159 {
8160
8162 return false;
8163
8164
8166 return false;
8167
8168
8169
8171 if (delta == 0)
8172 return false;
8173
8174
8175 return true;
8176 }
8177
8179 {
8181 {
8182 if (ScriptInputUserData.CanStoreInputUserData())
8183 {
8184 ScriptInputUserData ctx = new ScriptInputUserData;
8189 ctx.
Write(destination_entity);
8193 }
8194 }
8195 else if (!
g_Game.IsMultiplayer())
8196 {
8198 }
8199 }
8200
8202 {
8203 float split_quantity_new;
8207 InventoryLocation loc = new InventoryLocation;
8208
8209 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8210 {
8212 split_quantity_new = stack_max;
8213 else
8215
8217 {
8218 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8219 if (new_item)
8220 {
8221 new_item.SetResultOfSplit(true);
8222 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8224 new_item.
SetQuantity(split_quantity_new,
false,
true);
8225 }
8226 }
8227 }
8228 else if (destination_entity && slot_id == -1)
8229 {
8230 if (quantity > stack_max)
8231 split_quantity_new = stack_max;
8232 else
8233 split_quantity_new = quantity;
8234
8236 {
8237 GameInventory destinationInventory = destination_entity.GetInventory();
8239 {
8242 }
8243
8244 if (new_item)
8245 {
8246 new_item.SetResultOfSplit(true);
8247 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8249 new_item.
SetQuantity(split_quantity_new,
false,
true);
8250 }
8251 }
8252 }
8253 else
8254 {
8255 if (stack_max != 0)
8256 {
8258 {
8260 }
8261
8262 if (split_quantity_new == 0)
8263 {
8264 if (!
g_Game.IsMultiplayer())
8265 player.PhysicalPredictiveDropItem(this);
8266 else
8267 player.ServerDropEntity(this);
8268 return;
8269 }
8270
8272 {
8274
8275 if (new_item)
8276 {
8277 new_item.SetResultOfSplit(true);
8278 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8281 new_item.PlaceOnSurface();
8282 }
8283 }
8284 }
8285 }
8286 }
8287
8289 {
8290 float split_quantity_new;
8294 InventoryLocation loc = new InventoryLocation;
8295
8296 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8297 {
8299 split_quantity_new = stack_max;
8300 else
8302
8304 {
8305 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8306 if (new_item)
8307 {
8308 new_item.SetResultOfSplit(true);
8309 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8311 new_item.
SetQuantity(split_quantity_new,
false,
true);
8312 }
8313 }
8314 }
8315 else if (destination_entity && slot_id == -1)
8316 {
8317 if (quantity > stack_max)
8318 split_quantity_new = stack_max;
8319 else
8320 split_quantity_new = quantity;
8321
8323 {
8324 GameInventory destinationInventory = destination_entity.GetInventory();
8326 {
8329 }
8330
8331 if (new_item)
8332 {
8333 new_item.SetResultOfSplit(true);
8334 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8336 new_item.
SetQuantity(split_quantity_new,
false,
true);
8337 }
8338 }
8339 }
8340 else
8341 {
8342 if (stack_max != 0)
8343 {
8345 {
8347 }
8348
8350 {
8352
8353 if (new_item)
8354 {
8355 new_item.SetResultOfSplit(true);
8356 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8359 new_item.PlaceOnSurface();
8360 }
8361 }
8362 }
8363 }
8364 }
8365
8367 {
8369 {
8370 if (ScriptInputUserData.CanStoreInputUserData())
8371 {
8372 ScriptInputUserData ctx = new ScriptInputUserData;
8377 dst.WriteToContext(ctx);
8379 }
8380 }
8381 else if (!
g_Game.IsMultiplayer())
8382 {
8384 }
8385 }
8386
8388 {
8390 {
8391 if (ScriptInputUserData.CanStoreInputUserData())
8392 {
8393 ScriptInputUserData ctx = new ScriptInputUserData;
8398 ctx.
Write(destination_entity);
8404 }
8405 }
8406 else if (!
g_Game.IsMultiplayer())
8407 {
8409 }
8410 }
8411
8413 {
8415 }
8416
8418 {
8420 float split_quantity_new;
8422 if (dst.IsValid())
8423 {
8424 int slot_id = dst.GetSlot();
8426
8427 if (quantity > stack_max)
8428 split_quantity_new = stack_max;
8429 else
8430 split_quantity_new = quantity;
8431
8433 {
8435
8436 if (new_item)
8437 {
8438 new_item.SetResultOfSplit(true);
8439 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8441 new_item.
SetQuantity(split_quantity_new,
false,
true);
8442 }
8443
8444 return new_item;
8445 }
8446 }
8447
8448 return null;
8449 }
8450
8452 {
8454 float split_quantity_new;
8456 if (destination_entity)
8457 {
8459 if (quantity > stackable)
8460 split_quantity_new = stackable;
8461 else
8462 split_quantity_new = quantity;
8463
8465 {
8466 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
8467 if (new_item)
8468 {
8469 new_item.SetResultOfSplit(true);
8470 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8472 new_item.
SetQuantity(split_quantity_new,
false,
true);
8473 }
8474 }
8475 }
8476 }
8477
8479 {
8481 {
8482 if (ScriptInputUserData.CanStoreInputUserData())
8483 {
8484 ScriptInputUserData ctx = new ScriptInputUserData;
8489 ItemBase destination_entity =
this;
8490 ctx.
Write(destination_entity);
8494 }
8495 }
8496 else if (!
g_Game.IsMultiplayer())
8497 {
8499 }
8500 }
8501
8503 {
8505 float split_quantity_new;
8507 if (player)
8508 {
8510 if (quantity > stackable)
8511 split_quantity_new = stackable;
8512 else
8513 split_quantity_new = quantity;
8514
8516 {
8517 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
8518 new_item =
ItemBase.Cast(in_hands);
8519 if (new_item)
8520 {
8521 new_item.SetResultOfSplit(true);
8522 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8524 new_item.SetQuantity(split_quantity_new, false, true);
8525 }
8526 }
8527 }
8528 }
8529
8531 {
8533 float split_quantity_new = Math.Floor(quantity * 0.5);
8534
8536 return;
8537
8539
8540 if (new_item)
8541 {
8542 if (new_item.GetQuantityMax() < split_quantity_new)
8543 {
8544 split_quantity_new = new_item.GetQuantityMax();
8545 }
8546
8547 new_item.SetResultOfSplit(true);
8548 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8549
8551 {
8554 }
8555 else
8556 {
8558 new_item.
SetQuantity(split_quantity_new,
false,
true);
8559 }
8560 }
8561 }
8562
8564 {
8566 float split_quantity_new = Math.Floor(quantity / 2);
8567
8569 return;
8570
8571 InventoryLocation invloc = new InventoryLocation;
8573
8575 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
8576
8577 if (new_item)
8578 {
8579 if (new_item.GetQuantityMax() < split_quantity_new)
8580 {
8581 split_quantity_new = new_item.GetQuantityMax();
8582 }
8584 {
8587 }
8588 else if (split_quantity_new > 1)
8589 {
8591 new_item.
SetQuantity(split_quantity_new,
false,
true);
8592 }
8593 }
8594 }
8595
8598 {
8599 SetWeightDirty();
8601
8602 if (parent)
8603 parent.OnAttachmentQuantityChangedEx(this, delta);
8604
8606 {
8608 {
8610 }
8612 {
8613 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
8615 }
8616 }
8617 }
8618
8621 {
8622
8623 }
8624
8627 {
8629 }
8630
8632 {
8633 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
8634
8636 {
8637 if (newLevel == GameConstants.STATE_RUINED)
8638 {
8640 EntityAI parent = GetHierarchyParent();
8641 if (parent && parent.IsFireplace())
8642 {
8643 CargoBase cargo = GetInventory().GetCargo();
8644 if (cargo)
8645 {
8647 {
8649 }
8650 }
8651 }
8652 }
8653
8655 {
8656
8658 return;
8659 }
8660
8661 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
8662 {
8664 }
8665 }
8666 }
8667
8668
8670 {
8671 super.OnRightClick();
8672
8674 {
8676 {
8677 if (ScriptInputUserData.CanStoreInputUserData())
8678 {
8679 EntityAI root = GetHierarchyRoot();
8680 Man playerOwner = GetHierarchyRootPlayer();
8681 InventoryLocation dst = new InventoryLocation;
8682
8683
8684 if (!playerOwner && root && root == this)
8685 {
8687 }
8688 else
8689 {
8690
8691 GetInventory().GetCurrentInventoryLocation(dst);
8693 {
8694 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8696 {
8698 }
8699 else
8700 {
8702
8703
8704 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
8705 {
8707 }
8708 else
8709 {
8710 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
8711 }
8712 }
8713 }
8714 }
8715
8716 ScriptInputUserData ctx = new ScriptInputUserData;
8724 }
8725 }
8726 else if (!
g_Game.IsMultiplayer())
8727 {
8729 }
8730 }
8731 }
8732
8734 {
8735 if (root)
8736 {
8737 vector m4[4];
8738 root.GetTransform(m4);
8739 dst.SetGround(this, m4);
8740 }
8741 else
8742 {
8743 GetInventory().GetCurrentInventoryLocation(dst);
8744 }
8745 }
8746
8747 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
8748 {
8749
8750 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
8751 return false;
8752
8753 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
8754 return false;
8755
8756
8758 return false;
8759
8760
8761 Magazine mag = Magazine.Cast(this);
8762 if (mag)
8763 {
8764 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
8765 return false;
8766
8767 if (stack_max_limit)
8768 {
8769 Magazine other_mag = Magazine.Cast(other_item);
8770 if (other_item)
8771 {
8772 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
8773 return false;
8774 }
8775
8776 }
8777 }
8778 else
8779 {
8780
8782 return false;
8783
8785 return false;
8786 }
8787
8788 PlayerBase player = null;
8789 if (CastTo(player, GetHierarchyRootPlayer()))
8790 {
8791 if (player.GetInventory().HasAttachment(this))
8792 return false;
8793
8794 if (player.IsItemsToDelete())
8795 return false;
8796 }
8797
8798 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
8799 return false;
8800
8801 int slotID;
8803 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
8804 return false;
8805
8806 return true;
8807 }
8808
8810 {
8812 }
8813
8815 {
8816 return m_IsResultOfSplit;
8817 }
8818
8820 {
8821 m_IsResultOfSplit = value;
8822 }
8823
8825 {
8827 }
8828
8830 {
8831 float other_item_quantity = other_item.GetQuantity();
8832 float this_free_space;
8833
8835
8837
8838 if (other_item_quantity > this_free_space)
8839 {
8840 return this_free_space;
8841 }
8842 else
8843 {
8844 return other_item_quantity;
8845 }
8846 }
8847
8849 {
8851 }
8852
8854 {
8856 return;
8857
8858 if (!IsMagazine() && other_item)
8859 {
8861 if (quantity_used != 0)
8862 {
8863 float hp1 = GetHealth01("","");
8864 float hp2 = other_item.GetHealth01("","");
8865 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
8866 hpResult = hpResult / (
GetQuantity() + quantity_used);
8867
8868 hpResult *= GetMaxHealth();
8869 Math.Round(hpResult);
8870 SetHealth("", "Health", hpResult);
8871
8873 other_item.AddQuantity(-quantity_used);
8874 }
8875 }
8877 }
8878
8880 {
8881 #ifdef SERVER
8882 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
8883 GetHierarchyParent().IncreaseLifetimeUp();
8884 #endif
8885 };
8886
8888 {
8889 PlayerBase p = PlayerBase.Cast(player);
8890
8891 array<int> recipesIds = p.m_Recipes;
8892 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8893 if (moduleRecipesManager)
8894 {
8895 EntityAI itemInHands = player.GetEntityInHands();
8896 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
8897 }
8898
8899 for (int i = 0;i < recipesIds.Count(); i++)
8900 {
8901 int key = recipesIds.Get(i);
8902 string recipeName = moduleRecipesManager.GetRecipeName(key);
8904 }
8905 }
8906
8907
8908 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
8909 {
8910 super.GetDebugActions(outputList);
8911
8912
8918
8919
8924
8929
8930
8934
8935
8937 {
8941 }
8942
8945
8946
8950
8952
8953 InventoryLocation loc = new InventoryLocation();
8954 GetInventory().GetCurrentInventoryLocation(loc);
8956 {
8957 if (Gizmo_IsSupported())
8960 }
8961
8963 }
8964
8965
8966
8967
8969 {
8970 super.OnAction(action_id, player, ctx);
8971
8973 {
8974 switch (action_id)
8975 {
8979 return true;
8983 return true;
8984 }
8985 }
8986
8988 {
8989 switch (action_id)
8990 {
8992 Delete();
8993 return true;
8994 }
8995 }
8996
8997 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
8998 {
8999 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9000 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
9001 PlayerBase p = PlayerBase.Cast(player);
9002 if (
EActions.RECIPES_RANGE_START < 1000)
9003 {
9004 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
9005 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
9006 }
9007 }
9008 #ifndef SERVER
9009 else if (action_id ==
EActions.WATCH_PLAYER)
9010 {
9011 PluginDeveloper.SetDeveloperItemClientEx(player);
9012 }
9013 #endif
9015 {
9016 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
9017 {
9018 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
9019 OnDebugButtonPressServer(id + 1);
9020 }
9021
9022 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
9023 {
9024 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
9026 }
9027
9028 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
9029 {
9030 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
9032 }
9033
9034 else if (action_id ==
EActions.ADD_QUANTITY)
9035 {
9036 if (IsMagazine())
9037 {
9038 Magazine mag = Magazine.Cast(this);
9039 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
9040 }
9041 else
9042 {
9044 }
9045
9046 if (m_EM)
9047 {
9048 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
9049 }
9050
9051 }
9052
9053 else if (action_id ==
EActions.REMOVE_QUANTITY)
9054 {
9055 if (IsMagazine())
9056 {
9057 Magazine mag2 = Magazine.Cast(this);
9058 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
9059 }
9060 else
9061 {
9063 }
9064 if (m_EM)
9065 {
9066 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
9067 }
9068
9069 }
9070
9071 else if (action_id ==
EActions.SET_QUANTITY_0)
9072 {
9074
9075 if (m_EM)
9076 {
9077 m_EM.SetEnergy(0);
9078 }
9079 }
9080
9081 else if (action_id ==
EActions.SET_MAX_QUANTITY)
9082 {
9084
9085 if (m_EM)
9086 {
9087 m_EM.SetEnergy(m_EM.GetEnergyMax());
9088 }
9089 }
9090
9091 else if (action_id ==
EActions.ADD_HEALTH)
9092 {
9093 AddHealth("","",GetMaxHealth("","Health")/5);
9094 }
9095 else if (action_id ==
EActions.REMOVE_HEALTH)
9096 {
9097 AddHealth("","",-GetMaxHealth("","Health")/5);
9098 }
9099 else if (action_id ==
EActions.DESTROY_HEALTH)
9100 {
9101 SetHealth01("","",0);
9102 }
9103 else if (action_id ==
EActions.WATCH_ITEM)
9104 {
9106 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
9107 #ifdef DEVELOPER
9108 SetDebugDeveloper_item(this);
9109 #endif
9110 }
9111
9112 else if (action_id ==
EActions.ADD_TEMPERATURE)
9113 {
9114 AddTemperature(20);
9115
9116 }
9117
9118 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
9119 {
9120 AddTemperature(-20);
9121
9122 }
9123
9124 else if (action_id ==
EActions.FLIP_FROZEN)
9125 {
9126 SetFrozen(!GetIsFrozen());
9127
9128 }
9129
9130 else if (action_id ==
EActions.ADD_WETNESS)
9131 {
9133
9134 }
9135
9136 else if (action_id ==
EActions.REMOVE_WETNESS)
9137 {
9139
9140 }
9141
9142 else if (action_id ==
EActions.LIQUIDTYPE_UP)
9143 {
9146
9147
9148 }
9149
9150 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
9151 {
9154 }
9155
9156 else if (action_id ==
EActions.MAKE_SPECIAL)
9157 {
9158 auto debugParams = DebugSpawnParams.WithPlayer(player);
9159 OnDebugSpawnEx(debugParams);
9160 }
9161
9162 }
9163
9164
9165 return false;
9166 }
9167
9168
9169
9170
9174
9177
9178
9179
9181 {
9182 return false;
9183 }
9184
9185
9187 {
9188 return true;
9189 }
9190
9191
9193 {
9194 return true;
9195 }
9196
9197
9198
9200 {
9201 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
9202 return g_Game.ConfigIsExisting(config_path);
9203 }
9204
9207 {
9208 return null;
9209 }
9210
9212 {
9213 return false;
9214 }
9215
9217 {
9218 return false;
9219 }
9220
9224
9225
9227 {
9228 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9229 return module_repairing.CanRepair(this, item_repair_kit);
9230 }
9231
9232
9233 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
9234 {
9235 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9236 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
9237 }
9238
9239
9241 {
9242
9243
9244
9245
9246
9247
9248
9249
9250 return 1;
9251 }
9252
9253
9254
9256 {
9258 }
9259
9260
9261
9263 {
9265 }
9266
9267
9276 {
9277 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9278
9279 if (player)
9280 {
9281 player.MessageStatus(text);
9282 }
9283 }
9284
9285
9294 {
9295 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9296
9297 if (player)
9298 {
9299 player.MessageAction(text);
9300 }
9301 }
9302
9303
9312 {
9313 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9314
9315 if (player)
9316 {
9317 player.MessageFriendly(text);
9318 }
9319 }
9320
9321
9330 {
9331 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9332
9333 if (player)
9334 {
9335 player.MessageImportant(text);
9336 }
9337 }
9338
9340 {
9341 return true;
9342 }
9343
9344
9345 override bool KindOf(
string tag)
9346 {
9347 bool found = false;
9348 string item_name = this.
GetType();
9350 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
9351
9352 int array_size = item_tag_array.Count();
9353 for (int i = 0; i < array_size; i++)
9354 {
9355 if (item_tag_array.Get(i) == tag)
9356 {
9357 found = true;
9358 break;
9359 }
9360 }
9361 return found;
9362 }
9363
9364
9366 {
9367
9368 super.OnRPC(sender, rpc_type,ctx);
9369
9370
9371 switch (rpc_type)
9372 {
9373 #ifndef SERVER
9374 case ERPCs.RPC_SOUND_LOCK_ATTACH:
9375 Param2<bool, string> p = new Param2<bool, string>(false, "");
9376
9378 return;
9379
9380 bool play = p.param1;
9381 string soundSet = p.param2;
9382
9383 if (play)
9384 {
9386 {
9388 {
9390 }
9391 }
9392 else
9393 {
9395 }
9396 }
9397 else
9398 {
9400 }
9401
9402 break;
9403 #endif
9404
9405 }
9406
9408 {
9410 }
9411 }
9412
9413
9414
9415
9417 {
9418 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9419 return plugin.GetID(
name);
9420 }
9421
9423 {
9424 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9425 return plugin.GetName(id);
9426 }
9427
9430 {
9431
9432
9433 int varFlags;
9434 if (!ctx.
Read(varFlags))
9435 return;
9436
9437 if (varFlags & ItemVariableFlags.FLOAT)
9438 {
9440 }
9441 }
9442
9444 {
9445
9446 super.SerializeNumericalVars(floats_out);
9447
9448
9449
9451 {
9453 }
9454
9456 {
9458 }
9459
9461 {
9463 }
9464
9466 {
9471 }
9472
9474 {
9476 }
9477 }
9478
9480 {
9481
9482 super.DeSerializeNumericalVars(floats);
9483
9484
9485 int index = 0;
9486 int mask = Math.Round(floats.Get(index));
9487
9488 index++;
9489
9491 {
9493 {
9495 }
9496 else
9497 {
9498 float quantity = floats.Get(index);
9500 }
9501 index++;
9502 }
9503
9505 {
9506 float wet = floats.Get(index);
9508 index++;
9509 }
9510
9512 {
9513 int liquidtype = Math.Round(floats.Get(index));
9515 index++;
9516 }
9517
9519 {
9521 index++;
9523 index++;
9525 index++;
9527 index++;
9528 }
9529
9531 {
9532 int cleanness = Math.Round(floats.Get(index));
9534 index++;
9535 }
9536 }
9537
9539 {
9540 super.WriteVarsToCTX(ctx);
9541
9542
9544 {
9546 }
9547
9549 {
9551 }
9552
9554 {
9556 }
9557
9559 {
9560 int r,g,b,a;
9566 }
9567
9569 {
9571 }
9572 }
9573
9575 {
9576 if (!super.ReadVarsFromCTX(ctx,version))
9577 return false;
9578
9579 int intValue;
9580 float value;
9581
9582 if (version < 140)
9583 {
9584 if (!ctx.
Read(intValue))
9585 return false;
9586
9587 m_VariablesMask = intValue;
9588 }
9589
9591 {
9592 if (!ctx.
Read(value))
9593 return false;
9594
9596 {
9598 }
9599 else
9600 {
9602 }
9603 }
9604
9605 if (version < 140)
9606 {
9608 {
9609 if (!ctx.
Read(value))
9610 return false;
9611 SetTemperatureDirect(value);
9612 }
9613 }
9614
9616 {
9617 if (!ctx.
Read(value))
9618 return false;
9620 }
9621
9623 {
9624 if (!ctx.
Read(intValue))
9625 return false;
9627 }
9628
9630 {
9631 int r,g,b,a;
9633 return false;
9635 return false;
9637 return false;
9639 return false;
9640
9642 }
9643
9645 {
9646 if (!ctx.
Read(intValue))
9647 return false;
9649 }
9650
9651 if (version >= 138 && version < 140)
9652 {
9654 {
9655 if (!ctx.
Read(intValue))
9656 return false;
9657 SetFrozen(intValue);
9658 }
9659 }
9660
9661 return true;
9662 }
9663
9664
9666 {
9669 {
9671 }
9672
9673 if (!super.OnStoreLoad(ctx, version))
9674 {
9676 return false;
9677 }
9678
9679 if (version >= 114)
9680 {
9681 bool hasQuickBarIndexSaved;
9682
9683 if (!ctx.
Read(hasQuickBarIndexSaved))
9684 {
9686 return false;
9687 }
9688
9689 if (hasQuickBarIndexSaved)
9690 {
9691 int itmQBIndex;
9692
9693
9694 if (!ctx.
Read(itmQBIndex))
9695 {
9697 return false;
9698 }
9699
9700 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
9701 if (itmQBIndex != -1 && parentPlayer)
9702 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
9703 }
9704 }
9705 else
9706 {
9707
9708 PlayerBase player;
9709 int itemQBIndex;
9710 if (version ==
int.
MAX)
9711 {
9712 if (!ctx.
Read(itemQBIndex))
9713 {
9715 return false;
9716 }
9717 }
9718 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
9719 {
9720
9721 if (!ctx.
Read(itemQBIndex))
9722 {
9724 return false;
9725 }
9726 if (itemQBIndex != -1 && player)
9727 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
9728 }
9729 }
9730
9731 if (version < 140)
9732 {
9733
9734 if (!LoadVariables(ctx, version))
9735 {
9737 return false;
9738 }
9739 }
9740
9741
9743 {
9745 return false;
9746 }
9747 if (version >= 132)
9748 {
9750 if (raib)
9751 {
9753 {
9755 return false;
9756 }
9757 }
9758 }
9759
9761 return true;
9762 }
9763
9764
9765
9767 {
9768 super.OnStoreSave(ctx);
9769
9770 PlayerBase player;
9771 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
9772 {
9774
9775 int itemQBIndex = -1;
9776 itemQBIndex = player.FindQuickBarEntityIndex(this);
9777 ctx.
Write(itemQBIndex);
9778 }
9779 else
9780 {
9782 }
9783
9785
9787 if (raib)
9788 {
9790 }
9791 }
9792
9793
9795 {
9796 super.AfterStoreLoad();
9797
9799 {
9801 }
9802
9804 {
9807 }
9808 }
9809
9811 {
9812 super.EEOnAfterLoad();
9813
9815 {
9817 }
9818
9821 }
9822
9824 {
9825 return false;
9826 }
9827
9828
9829
9831 {
9833 {
9834 #ifdef PLATFORM_CONSOLE
9835
9837 {
9839 if (menu)
9840 {
9842 }
9843 }
9844 #endif
9845 }
9846
9848 {
9851 }
9852
9854 {
9855 SetWeightDirty();
9857 }
9859 {
9862 }
9863
9865 {
9868
9871 }
9873 {
9877 }
9878
9879 super.OnVariablesSynchronized();
9880 }
9881
9882
9883
9885 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
9886 {
9887 if (!IsServerCheck(allow_client))
9888 return false;
9889
9891 return false;
9892
9895
9896 if (value <= (min + 0.001))
9897 value = min;
9898
9899 if (value == min)
9900 {
9901 if (destroy_config)
9902 {
9903 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
9904 if (dstr)
9905 {
9907 this.Delete();
9908 return true;
9909 }
9910 }
9911 else if (destroy_forced)
9912 {
9914 this.Delete();
9915 return true;
9916 }
9917
9919 }
9920
9923
9925 {
9926 EntityAI parent = GetHierarchyRoot();
9927 InventoryLocation iLoc = new InventoryLocation();
9928 GetInventory().GetCurrentInventoryLocation(iLoc);
9930 {
9931 int iLocSlot = iLoc.
GetSlot();
9933 {
9935 }
9937 {
9939 }
9940 }
9941 }
9942
9944 {
9946
9947 if (delta)
9949 }
9950
9952
9953 return false;
9954 }
9955
9956
9958 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9959 {
9961 }
9962
9964 {
9967 }
9968
9970 {
9973 }
9974
9976 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9977 {
9978 float value_clamped = Math.Clamp(value, 0, 1);
9980 SetQuantity(result, destroy_config, destroy_forced);
9981 }
9982
9983
9986 {
9988 }
9989
9991 {
9993 }
9994
9995
9996
9997
9998
9999
10000
10001
10002
10003
10005 {
10006 int slot = -1;
10007 GameInventory inventory = GetInventory();
10008 if (inventory)
10009 {
10010 InventoryLocation il = new InventoryLocation;
10013 }
10014
10016 }
10017
10019 {
10020 float quantity_max = 0;
10021
10023 {
10024 if (attSlotID != -1)
10025 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
10026
10027 if (quantity_max <= 0)
10029 }
10030
10031 if (quantity_max <= 0)
10033
10034 return quantity_max;
10035 }
10036
10038 {
10040 }
10041
10043 {
10045 }
10046
10047
10049 {
10051 }
10052
10054 {
10056 }
10057
10059 {
10061 }
10062
10063
10065 {
10066
10067 float weightEx = GetWeightEx();
10068 float special = GetInventoryAndCargoWeight();
10069 return weightEx - special;
10070 }
10071
10072
10074 {
10076 }
10077
10079 {
10081 {
10082 #ifdef DEVELOPER
10083 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10084 {
10085 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
10087 }
10088 #endif
10089
10090 return GetQuantity() * GetConfigWeightModified();
10091 }
10092 else if (HasEnergyManager())
10093 {
10094 #ifdef DEVELOPER
10095 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10096 {
10097 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
10098 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
10099 }
10100 #endif
10101 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
10102 }
10103 else
10104 {
10105 #ifdef DEVELOPER
10106 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10107 {
10108 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
10109 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
10110 }
10111 #endif
10112 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
10113 }
10114 }
10115
10118 {
10119 int item_count = 0;
10121
10122 GameInventory inventory = GetInventory();
10123 CargoBase cargo = inventory.
GetCargo();
10124 if (cargo != NULL)
10125 {
10127 }
10128
10130 for (int i = 0; i < nAttachments; ++i)
10131 {
10133 if (item)
10134 item_count += item.GetNumberOfItems();
10135 }
10136 return item_count;
10137 }
10138
10141 {
10142 float weight = 0;
10143 float wetness = 1;
10144 if (include_wetness)
10147 {
10148 weight = wetness * m_ConfigWeight;
10149 }
10151 {
10152 weight = 1;
10153 }
10154 return weight;
10155 }
10156
10157
10158
10160 {
10161 GameInventory inventory = GetInventory();
10162 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
10163 {
10164 array<EntityAI> items = new array<EntityAI>;
10166 for (int i = 0; i < items.Count(); ++i)
10167 {
10169 if (item)
10170 {
10171 g_Game.ObjectDelete(item);
10172 }
10173 }
10174 }
10175 }
10176
10177
10178
10179
10181 {
10182 float energy = 0;
10183 if (HasEnergyManager())
10184 {
10185 energy = GetCompEM().GetEnergy();
10186 }
10187 return energy;
10188 }
10189
10190
10192 {
10193 super.OnEnergyConsumed();
10194
10196 }
10197
10199 {
10200 super.OnEnergyAdded();
10201
10203 }
10204
10205
10207 {
10208 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
10209 {
10211 {
10212 float energy_0to1 = GetCompEM().GetEnergy0To1();
10214 }
10215 }
10216 }
10217
10218
10220 {
10221 return ConfigGetFloat("heatIsolation");
10222 }
10223
10225 {
10227 }
10228
10230 {
10231 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
10232 if (
g_Game.ConfigIsExisting(paramPath))
10233 return g_Game.ConfigGetFloat(paramPath);
10234
10235 return 0.0;
10236 }
10237
10239 {
10240 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
10241 if (
g_Game.ConfigIsExisting(paramPath))
10242 return g_Game.ConfigGetFloat(paramPath);
10243
10244 return 0.0;
10245 }
10246
10247 override void SetWet(
float value,
bool allow_client =
false)
10248 {
10249 if (!IsServerCheck(allow_client))
10250 return;
10251
10254
10256
10257 m_VarWet = Math.Clamp(value, min, max);
10258
10260 {
10263 }
10264 }
10265
10266 override void AddWet(
float value)
10267 {
10269 }
10270
10272 {
10274 }
10275
10277 {
10279 }
10280
10282 {
10284 }
10285
10287 {
10289 }
10290
10292 {
10294 }
10295
10296 override void OnWetChanged(
float newVal,
float oldVal)
10297 {
10300 if (newLevel != oldLevel)
10301 {
10303 }
10304 }
10305
10307 {
10308 SetWeightDirty();
10309 }
10310
10312 {
10313 return GetWetLevelInternal(
m_VarWet);
10314 }
10315
10316
10317
10319 {
10321 }
10322
10324 {
10326 }
10327
10329 {
10331 }
10332
10334 {
10336 }
10337
10338
10339
10341 {
10342 if (ConfigIsExisting("itemModelLength"))
10343 {
10344 return ConfigGetFloat("itemModelLength");
10345 }
10346 return 0;
10347 }
10348
10350 {
10351 if (ConfigIsExisting("itemAttachOffset"))
10352 {
10353 return ConfigGetFloat("itemAttachOffset");
10354 }
10355 return 0;
10356 }
10357
10358 override void SetCleanness(
int value,
bool allow_client =
false)
10359 {
10360 if (!IsServerCheck(allow_client))
10361 return;
10362
10364
10366
10369 }
10370
10372 {
10374 }
10375
10377 {
10378 return true;
10379 }
10380
10381
10382
10383
10385 {
10387 }
10388
10390 {
10392 }
10393
10394
10395
10396
10397 override void SetColor(
int r,
int g,
int b,
int a)
10398 {
10404 }
10406 override void GetColor(out
int r,out
int g,out
int b,out
int a)
10407 {
10412 }
10413
10415 {
10417 }
10418
10421 {
10422 int r,g,b,a;
10424 r = r/255;
10425 g = g/255;
10426 b = b/255;
10427 a = a/255;
10428 return MiscGameplayFunctions.GetColorString(r, g, b, a);
10429 }
10430
10431
10432
10433 override void SetLiquidType(
int value,
bool allow_client =
false)
10434 {
10435 if (!IsServerCheck(allow_client))
10436 return;
10437
10442 }
10443
10445 {
10446 return ConfigGetInt("varLiquidTypeInit");
10447 }
10448
10450 {
10452 }
10453
10455 {
10457 SetFrozen(false);
10458 }
10459
10462 {
10463 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10464 }
10465
10466
10469 {
10470 PlayerBase nplayer;
10471 if (PlayerBase.CastTo(nplayer, player))
10472 {
10474 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10475 }
10476 }
10477
10478
10481 {
10482 PlayerBase nplayer;
10483 if (PlayerBase.CastTo(nplayer,player))
10484 {
10485 nplayer.SetEnableQuickBarEntityShortcut(this, false);
10486 }
10487
10488 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
10489
10490 if (HasEnergyManager())
10491 {
10492 GetCompEM().UpdatePlugState();
10493 }
10494 }
10495
10496
10498 {
10499 super.OnPlacementStarted(player);
10500
10502 }
10503
10504 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
10505 {
10507 {
10508 m_AdminLog.OnPlacementComplete(player,
this);
10509 }
10510
10511 super.OnPlacementComplete(player, position, orientation);
10512 }
10513
10514
10515
10516
10517
10519 {
10521 {
10522 return true;
10523 }
10524 else
10525 {
10526 return false;
10527 }
10528 }
10529
10530
10532 {
10534 {
10536 }
10537 }
10538
10539
10541 {
10543 }
10544
10546 {
10548 }
10549
10550 override void InsertAgent(
int agent,
float count = 1)
10551 {
10552 if (count < 1)
10553 return;
10554
10556 }
10557
10560 {
10562 }
10563
10564
10566 {
10568 }
10569
10570
10571
10572
10573
10574
10575
10576
10577
10578
10579
10580
10581
10582
10583
10584
10585
10586
10587
10588
10589
10590
10591
10592
10593
10594
10595
10596
10597
10598
10599
10600
10601
10602
10603
10604
10605
10606
10607
10608
10609
10610
10612 {
10614 return false;
10615 return true;
10616 }
10617
10619 {
10620
10622 }
10623
10624
10627 {
10628 super.CheckForRoofLimited(timeTresholdMS);
10629
10630 float time =
g_Game.GetTime();
10631 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
10632 {
10633 m_PreviousRoofTestTime = time;
10634 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
10635 }
10636 }
10637
10638
10640 {
10642 {
10643 return 0;
10644 }
10645
10646 if (GetInventory().GetAttachmentSlotsCount() != 0)
10647 {
10648 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
10649 if (filter)
10650 return filter.GetProtectionLevel(type, false, system);
10651 else
10652 return 0;
10653 }
10654
10655 string subclassPath, entryName;
10656
10657 switch (type)
10658 {
10660 entryName = "biological";
10661 break;
10663 entryName = "chemical";
10664 break;
10665 default:
10666 entryName = "biological";
10667 break;
10668 }
10669
10670 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
10671
10672 return g_Game.ConfigGetFloat(subclassPath + entryName);
10673 }
10674
10675
10676
10679 {
10680 if (!IsMagazine())
10682
10684 }
10685
10686
10687
10688
10689
10694 {
10695 return true;
10696 }
10697
10699 {
10701 }
10702
10703
10704
10705
10706
10708 {
10709 if (parent)
10710 {
10711 if (parent.IsInherited(DayZInfected))
10712 return true;
10713
10714 if (!parent.IsRuined())
10715 return true;
10716 }
10717
10718 return true;
10719 }
10720
10722 {
10723 if (!super.CanPutAsAttachment(parent))
10724 {
10725 return false;
10726 }
10727
10728 if (!IsRuined() && !parent.IsRuined())
10729 {
10730 return true;
10731 }
10732
10733 return false;
10734 }
10735
10737 {
10738
10739
10740
10741
10742 return super.CanReceiveItemIntoCargo(item);
10743 }
10744
10746 {
10747
10748
10749
10750
10751 GameInventory attachmentInv = attachment.GetInventory();
10753 {
10754 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
10755 return false;
10756 }
10757
10758 InventoryLocation loc = new InventoryLocation();
10759 attachment.GetInventory().GetCurrentInventoryLocation(loc);
10760 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
10761 return false;
10762
10763 return super.CanReceiveAttachment(attachment, slotId);
10764 }
10765
10767 {
10768 if (!super.CanReleaseAttachment(attachment))
10769 return false;
10770
10771 return GetInventory().AreChildrenAccessible();
10772 }
10773
10774
10775
10776
10777
10778
10779
10780
10781
10782
10783
10784
10785
10786
10787
10788
10789
10790
10791
10792
10793
10795 {
10796 int id = muzzle_owner.GetMuzzleID();
10797 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
10798
10799 if (WPOF_array)
10800 {
10801 for (int i = 0; i < WPOF_array.Count(); i++)
10802 {
10803 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
10804
10805 if (WPOF)
10806 {
10807 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
10808 }
10809 }
10810 }
10811 }
10812
10813
10815 {
10816 int id = muzzle_owner.GetMuzzleID();
10818
10819 if (WPOBE_array)
10820 {
10821 for (int i = 0; i < WPOBE_array.Count(); i++)
10822 {
10823 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
10824
10825 if (WPOBE)
10826 {
10827 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10828 }
10829 }
10830 }
10831 }
10832
10833
10835 {
10836 int id = muzzle_owner.GetMuzzleID();
10837 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10838
10839 if (WPOOH_array)
10840 {
10841 for (int i = 0; i < WPOOH_array.Count(); i++)
10842 {
10843 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10844
10845 if (WPOOH)
10846 {
10847 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10848 }
10849 }
10850 }
10851 }
10852
10853
10855 {
10856 int id = muzzle_owner.GetMuzzleID();
10857 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10858
10859 if (WPOOH_array)
10860 {
10861 for (int i = 0; i < WPOOH_array.Count(); i++)
10862 {
10863 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10864
10865 if (WPOOH)
10866 {
10867 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10868 }
10869 }
10870 }
10871 }
10872
10873
10875 {
10876 int id = muzzle_owner.GetMuzzleID();
10877 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10878
10879 if (WPOOH_array)
10880 {
10881 for (int i = 0; i < WPOOH_array.Count(); i++)
10882 {
10883 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10884
10885 if (WPOOH)
10886 {
10887 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10888 }
10889 }
10890 }
10891 }
10892
10893
10894
10896 {
10898 {
10899 return true;
10900 }
10901
10902 return false;
10903 }
10904
10906 {
10908 {
10909 return true;
10910 }
10911
10912 return false;
10913 }
10914
10916 {
10918 {
10919 return true;
10920 }
10921
10922 return false;
10923 }
10924
10926 {
10927 return false;
10928 }
10929
10932 {
10933 return UATimeSpent.DEFAULT_DEPLOY;
10934 }
10935
10936
10937
10938
10940 {
10942 SetSynchDirty();
10943 }
10944
10946 {
10948 }
10949
10950
10952 {
10953 return false;
10954 }
10955
10958 {
10959 string att_type = "None";
10960
10961 if (ConfigIsExisting("soundAttType"))
10962 {
10963 att_type = ConfigGetString("soundAttType");
10964 }
10965
10967 }
10968
10970 {
10972 }
10973
10974
10975
10976
10977
10983
10985 {
10988
10990 }
10991
10992
10994 {
10996 return;
10997
10999
11002
11005
11006 SoundParameters params = new SoundParameters();
11010 }
11011
11012
11014 {
11016 {
11019
11020 SetSynchDirty();
11021
11024 }
11025 }
11026
11028 {
11030 }
11031
11032
11034 {
11036 return;
11037
11039 SetSynchDirty();
11040
11043 }
11044
11046 {
11049 }
11050
11052 {
11054 }
11055
11056 void OnApply(PlayerBase player);
11057
11059 {
11060 return 1.0;
11061 };
11062
11064 {
11066 }
11067
11069 {
11071 }
11072
11074
11076 {
11077 SetDynamicPhysicsLifeTime(0.01);
11079 }
11080
11082 {
11083 array<string> zone_names = new array<string>;
11084 GetDamageZones(zone_names);
11085 for (int i = 0; i < zone_names.Count(); i++)
11086 {
11087 SetHealthMax(zone_names.Get(i),"Health");
11088 }
11089 SetHealthMax("","Health");
11090 }
11091
11094 {
11095 float global_health = GetHealth01("","Health");
11096 array<string> zones = new array<string>;
11097 GetDamageZones(zones);
11098
11099 for (int i = 0; i < zones.Count(); i++)
11100 {
11101 SetHealth01(zones.Get(i),"Health",global_health);
11102 }
11103 }
11104
11107 {
11108 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
11109 }
11110
11112 {
11113 if (!hasRootAsPlayer)
11114 {
11115 if (refParentIB)
11116 {
11117
11118 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
11119 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
11120
11121 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
11122 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
11123
11126 }
11127 else
11128 {
11129
11132 }
11133 }
11134 }
11135
11137 {
11139 {
11140 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
11141 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
11142 {
11143 float heatPermCoef = 1.0;
11145 while (ent)
11146 {
11147 heatPermCoef *= ent.GetHeatPermeabilityCoef();
11148 ent = ent.GetHierarchyParent();
11149 }
11150
11151 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
11152 }
11153 }
11154 }
11155
11157 {
11158
11159 EntityAI parent = GetHierarchyParent();
11160 if (!parent)
11161 {
11162 hasParent = false;
11163 hasRootAsPlayer = false;
11164 }
11165 else
11166 {
11167 hasParent = true;
11168 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
11169 refParentIB =
ItemBase.Cast(parent);
11170 }
11171 }
11172
11173 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
11174 {
11175
11176 }
11177
11179 {
11180
11181 return false;
11182 }
11183
11185 {
11186
11187
11188 return false;
11189 }
11190
11192 {
11193
11194 return false;
11195 }
11196
11199 {
11200 return !GetIsFrozen() &&
IsOpen();
11201 }
11202
11204 {
11205 bool hasParent = false, hasRootAsPlayer = false;
11207
11208 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
11209 bool foodDecay =
g_Game.IsFoodDecayEnabled();
11210
11211 if (wwtu || foodDecay)
11212 {
11216
11217 if (processWetness || processTemperature || processDecay)
11218 {
11220
11221 if (processWetness)
11222 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
11223
11224 if (processTemperature)
11226
11227 if (processDecay)
11228 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
11229 }
11230 }
11231 }
11232
11235 {
11237 }
11238
11240 {
11243
11244 return super.GetTemperatureFreezeThreshold();
11245 }
11246
11248 {
11251
11252 return super.GetTemperatureThawThreshold();
11253 }
11254
11256 {
11259
11260 return super.GetItemOverheatThreshold();
11261 }
11262
11264 {
11266 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
11267
11268 return super.GetTemperatureFreezeTime();
11269 }
11270
11272 {
11274 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
11275
11276 return super.GetTemperatureThawTime();
11277 }
11278
11283
11285 {
11286 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
11287 }
11288
11290 {
11291 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
11292 }
11293
11296 {
11298 }
11299
11301 {
11303 }
11304
11306 {
11308 }
11309
11312 {
11313 return null;
11314 }
11315
11318 {
11319 return false;
11320 }
11321
11323 {
11325 {
11328 if (!trg)
11329 {
11331 explosive = this;
11332 }
11333
11334 explosive.PairRemote(trg);
11336
11337 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
11338 trg.SetPersistentPairID(persistentID);
11339 explosive.SetPersistentPairID(persistentID);
11340
11341 return true;
11342 }
11343 return false;
11344 }
11345
11348 {
11349 float ret = 1.0;
11352 ret *= GetHealth01();
11353
11354 return ret;
11355 }
11356
11357 #ifdef DEVELOPER
11358 override void SetDebugItem()
11359 {
11360 super.SetDebugItem();
11361 _itemBase = this;
11362 }
11363
11365 {
11366 string text = super.GetDebugText();
11367
11369 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
11370
11371 return text;
11372 }
11373 #endif
11374
11376 {
11377 return true;
11378 }
11379
11381
11383
11385 {
11388 }
11389
11390
11398
11414
11415 [
Obsolete(
"Use ItemSoundHandler instead")]
11418 {
11419 if (!
g_Game.IsDedicatedServer())
11420 {
11421 if (ConfigIsExisting("attachSoundSet"))
11422 {
11423 string cfg_path = "";
11424 string soundset = "";
11425 string type_name =
GetType();
11426
11429 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
11430 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
11431
11432 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
11433 {
11434 for (int i = 0; i < cfg_soundset_array.Count(); i++)
11435 {
11436 if (cfg_slot_array[i] == slot_type)
11437 {
11438 soundset = cfg_soundset_array[i];
11439 break;
11440 }
11441 }
11442 }
11443
11444 if (soundset != "")
11445 {
11446 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
11448 }
11449 }
11450 }
11451 }
11452
11454}
11455
11457{
11459 if (entity)
11460 {
11461 bool is_item = entity.IsInherited(
ItemBase);
11462 if (is_item && full_quantity)
11463 {
11466 }
11467 }
11468 else
11469 {
11471 return NULL;
11472 }
11473 return entity;
11474}
11475
11477{
11478 if (item)
11479 {
11480 if (health > 0)
11481 item.SetHealth("", "", health);
11482
11483 if (item.CanHaveTemperature())
11484 {
11486 if (item.CanFreeze())
11487 item.SetFrozen(false);
11488 }
11489
11490 if (item.HasEnergyManager())
11491 {
11492 if (quantity >= 0)
11493 {
11494 item.GetCompEM().SetEnergy0To1(quantity);
11495 }
11496 else
11497 {
11499 }
11500 }
11501 else if (item.IsMagazine())
11502 {
11503 Magazine mag = Magazine.Cast(item);
11504 if (quantity >= 0)
11505 {
11506 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
11507 }
11508 else
11509 {
11511 }
11512
11513 }
11514 else
11515 {
11516 if (quantity >= 0)
11517 {
11518 item.SetQuantityNormalized(quantity, false);
11519 }
11520 else
11521 {
11523 }
11524
11525 }
11526 }
11527}
11528
11529#ifdef DEVELOPER
11531#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.