6716{
6718 {
6719 return true;
6720 }
6721};
6722
6724{
6725
6726};
6727
6728
6729
6731{
6735
6737
6740
6741
6742
6743
6744
6753
6759
6764
6769
6790 protected bool m_IsResultOfSplit
6791
6793
6798
6799
6800
6802
6806
6807
6808
6810
6813
6814
6815
6821
6822
6830
6833
6834
6836
6837
6839
6840
6845
6846
6851
6853
6854
6856
6857
6859 {
6864
6865 if (!
g_Game.IsDedicatedServer())
6866 {
6868 {
6870
6872 {
6874 }
6875 }
6876
6879 }
6880
6881 m_OldLocation = null;
6882
6884 {
6886 }
6887
6888 if (ConfigIsExisting("headSelectionsToHide"))
6889 {
6892 }
6893
6895 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
6896 {
6898 }
6899
6901
6902 m_IsResultOfSplit = false;
6903
6905 }
6906
6908 {
6909 super.InitItemVariables();
6910
6916 m_Count = ConfigGetInt(
"count");
6917
6920
6925
6928
6933
6945
6949
6950
6953 if (ConfigIsExisting("canBeSplit"))
6954 {
6957 }
6958
6960 if (ConfigIsExisting("itemBehaviour"))
6962
6963
6966 RegisterNetSyncVariableInt("m_VarLiquidType");
6967 RegisterNetSyncVariableInt("m_Cleanness",0,1);
6968
6969 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
6970 RegisterNetSyncVariableFloat("m_ImpactSpeed");
6971 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
6972
6973 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
6974 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
6975 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
6976 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
6977
6978 RegisterNetSyncVariableBool("m_IsBeingPlaced");
6979 RegisterNetSyncVariableBool("m_IsTakeable");
6980 RegisterNetSyncVariableBool("m_IsHologram");
6981
6984 {
6987 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
6988 }
6989
6991
6993 if (ConfigIsExisting("temperaturePerQuantityWeight"))
6995
6997 }
6998
7000 {
7002 }
7003
7005 {
7008 {
7013 }
7014 }
7015
7016 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
7017 {
7019 {
7022 }
7023
7025 }
7026
7028 {
7034 }
7035
7037
7039 {
7041
7042 if (!action)
7043 {
7044 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
7045 return;
7046 }
7047
7049 if (!ai)
7050 {
7052 return;
7053 }
7054
7056 if (!action_array)
7057 {
7058 action_array = new array<ActionBase_Basic>;
7060 }
7061 if (LogManager.IsActionLogEnable())
7062 {
7063 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
7064 }
7065
7066 if (action_array.Find(action) != -1)
7067 {
7068 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
7069 }
7070 else
7071 {
7072 action_array.Insert(action);
7073 }
7074 }
7075
7077 {
7078 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7079 ActionBase action = player.GetActionManager().GetAction(actionName);
7082
7083 if (action_array)
7084 {
7085 action_array.RemoveItem(action);
7086 }
7087 }
7088
7089
7090
7092 {
7093 ActionOverrideData overrideData = new ActionOverrideData();
7097
7099 if (!actionMap)
7100 {
7103 }
7104
7105 actionMap.Insert(this.
Type(), overrideData);
7106
7107 }
7108
7110
7112
7113
7115 {
7118
7121
7122 string config_to_search = "CfgVehicles";
7123 string muzzle_owner_config;
7124
7126 {
7127 if (IsInherited(Weapon))
7128 config_to_search = "CfgWeapons";
7129
7130 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7131
7132 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
7133
7134 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
7135
7136 if (config_OnFire_subclass_count > 0)
7137 {
7138 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
7139
7140 for (int i = 0; i < config_OnFire_subclass_count; i++)
7141 {
7142 string particle_class = "";
7143 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
7144 string config_OnFire_entry = config_OnFire_class + particle_class;
7145 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
7146 WPOF_array.Insert(WPOF);
7147 }
7148
7149
7151 }
7152 }
7153
7155 {
7156 config_to_search = "CfgWeapons";
7157 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7158
7159 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
7160
7161 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
7162
7163 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
7164 {
7165 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
7166
7167 for (i = 0; i < config_OnBulletCasingEject_count; i++)
7168 {
7169 string particle_class2 = "";
7170 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
7171 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
7172 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
7173 WPOBE_array.Insert(WPOBE);
7174 }
7175
7176
7178 }
7179 }
7180 }
7181
7182
7184 {
7187
7189 {
7190 string config_to_search = "CfgVehicles";
7191
7192 if (IsInherited(Weapon))
7193 config_to_search = "CfgWeapons";
7194
7195 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7196 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
7197
7198 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
7199 {
7200
7202
7204 {
7206 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
7208 return;
7209 }
7210
7213
7214
7215
7216 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
7217 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
7218
7219 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
7220 {
7221 string particle_class = "";
7222 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
7223 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
7224 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
7225
7226 if (entry_type == CT_CLASS)
7227 {
7228 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
7229 WPOOH_array.Insert(WPOF);
7230 }
7231 }
7232
7233
7235 }
7236 }
7237 }
7238
7240 {
7242 }
7243
7245 {
7247 {
7249
7252
7255
7256 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7257 }
7258 }
7259
7261 {
7263 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7264
7266 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7267
7269 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7270
7272 {
7274 }
7275 }
7276
7278 {
7280 }
7281
7283 {
7286 else
7288
7290 {
7293 }
7294 else
7295 {
7298
7301 }
7302
7304 }
7305
7307 {
7309 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7310 }
7311
7313 {
7315 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7317 }
7318
7320 {
7322 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7323 }
7324
7326 {
7329
7330 OverheatingParticle OP = new OverheatingParticle();
7335
7337 }
7338
7340 {
7343
7344 return -1;
7345 }
7346
7348 {
7350 {
7353
7354 for (int i = count; i > 0; --i)
7355 {
7356 int id = i - 1;
7359
7362
7363 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
7364 {
7365 if (p)
7366 {
7369 }
7370 }
7371 }
7372 }
7373 }
7374
7376 {
7378 {
7380 {
7381 int id = i - 1;
7383
7384 if (OP)
7385 {
7387
7388 if (p)
7389 {
7391 }
7392
7393 delete OP;
7394 }
7395 }
7396
7399 }
7400 }
7401
7404 {
7405 return 0.0;
7406 }
7407
7408
7410 {
7411 return 250;
7412 }
7413
7415 {
7416 return 0;
7417 }
7418
7421 {
7423 return true;
7424
7425 return false;
7426 }
7427
7430 {
7433
7435 {
7437 }
7438 else
7439 {
7440
7442 }
7443
7445 }
7446
7453 {
7454 return -1;
7455 }
7456
7457
7458
7459
7461 {
7463 {
7464 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7465 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7466
7467 if (r_index >= 0)
7468 {
7469 InventoryLocation r_il = new InventoryLocation;
7470 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7471
7472 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7475 {
7476 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7477 }
7479 {
7480 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7481 }
7482
7483 }
7484
7485 player.GetHumanInventory().ClearUserReservedLocation(this);
7486 }
7487
7490 }
7491
7492
7493
7494
7496 {
7497 return ItemBase.m_DebugActionsMask;
7498 }
7499
7501 {
7502 return ItemBase.m_DebugActionsMask & mask;
7503 }
7504
7506 {
7507 ItemBase.m_DebugActionsMask = mask;
7508 }
7509
7511 {
7512 ItemBase.m_DebugActionsMask |= mask;
7513 }
7514
7516 {
7517 ItemBase.m_DebugActionsMask &= ~mask;
7518 }
7519
7521 {
7523 {
7525 }
7526 else
7527 {
7529 }
7530 }
7531
7532
7534 {
7535 if (GetEconomyProfile())
7536 {
7537 float q_max = GetEconomyProfile().GetQuantityMax();
7538 if (q_max > 0)
7539 {
7540 float q_min = GetEconomyProfile().GetQuantityMin();
7541 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
7542
7544 {
7545 ComponentEnergyManager comp = GetCompEM();
7547 {
7549 }
7550 }
7552 {
7554
7555 }
7556
7557 }
7558 }
7559 }
7560
7563 {
7564 EntityAI parent = GetHierarchyParent();
7565
7566 if (parent)
7567 {
7568 InventoryLocation inventory_location_to_lock = new InventoryLocation;
7569 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
7570 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
7571 }
7572 }
7573
7576 {
7577 EntityAI parent = GetHierarchyParent();
7578
7579 if (parent)
7580 {
7581 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
7582 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
7583 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
7584 }
7585 }
7586
7588 {
7589
7590
7591
7592
7594
7596 {
7597 if (ScriptInputUserData.CanStoreInputUserData())
7598 {
7599 ScriptInputUserData ctx = new ScriptInputUserData;
7605 ctx.
Write(use_stack_max);
7608
7610 {
7611 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
7612 }
7613 }
7614 }
7615 else if (!
g_Game.IsMultiplayer())
7616 {
7618 }
7619 }
7620
7622 {
7624 }
7625
7627 {
7629 }
7630
7632 {
7634 }
7635
7637 {
7638
7639 return false;
7640 }
7641
7643 {
7644 return false;
7645 }
7646
7650 {
7651 return false;
7652 }
7653
7655 {
7656 return "";
7657 }
7658
7660
7662 {
7663 return false;
7664 }
7665
7667 {
7668 return true;
7669 }
7670
7671
7672
7674 {
7675 return true;
7676 }
7677
7679 {
7680 return true;
7681 }
7682
7684 {
7685 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7687 }
7688
7690 {
7692 }
7693
7695 {
7697 if (!is_being_placed)
7699 SetSynchDirty();
7700 }
7701
7702
7704
7706 {
7708 }
7709
7711 {
7713 }
7714
7716 {
7717 return 1;
7718 }
7719
7721 {
7722 return false;
7723 }
7724
7726 {
7728 SetSynchDirty();
7729 }
7730
7731
7732
7733
7734
7735
7736
7737
7738
7739
7740
7741
7742
7743
7744
7745
7746
7747
7748
7749
7750
7751
7752
7753
7754
7755
7756
7757
7758
7759
7760
7761
7762
7763
7764
7766 {
7767 super.OnMovedInsideCargo(container);
7768
7769 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7770 }
7771
7772 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
7773 {
7774 super.EEItemLocationChanged(oldLoc, newLoc);
7775
7776 PlayerBase newPlayer = null;
7777 PlayerBase oldPlayer = null;
7778
7779 if (newLoc.GetParent())
7780 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
7781
7782 if (oldLoc.GetParent())
7783 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
7784
7786 {
7787 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
7788
7789 if (rIndex >= 0)
7790 {
7791 InventoryLocation rIl = new InventoryLocation;
7792 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
7793
7794 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
7797 {
7798 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
7799 }
7801 {
7803 }
7804
7805 }
7806 }
7807
7809 {
7810 if (newPlayer)
7811 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
7812
7813 if (newPlayer == oldPlayer)
7814 {
7815 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
7816 {
7818 {
7819 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
7820 {
7821 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7822 }
7823 }
7824 else
7825 {
7826 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7827 }
7828 }
7829
7830 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
7831 {
7832 int type = oldLoc.GetType();
7834 {
7835 oldLoc.GetParent().GetOnSetLock().Invoke(this);
7836 }
7838 {
7839 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
7840 }
7841 }
7842 if (!m_OldLocation)
7843 {
7844 m_OldLocation = new InventoryLocation;
7845 }
7846 m_OldLocation.Copy(oldLoc);
7847 }
7848 else
7849 {
7850 if (m_OldLocation)
7851 {
7852 m_OldLocation.Reset();
7853 }
7854 }
7855
7856 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
7857 }
7858 else
7859 {
7860 if (newPlayer)
7861 {
7862 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
7863 if (resIndex >= 0)
7864 {
7865 InventoryLocation il = new InventoryLocation;
7866 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
7868 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
7871 {
7872 il.
GetParent().GetOnReleaseLock().Invoke(it);
7873 }
7875 {
7877 }
7878
7879 }
7880 }
7882 {
7883
7885 }
7886
7887 if (m_OldLocation)
7888 {
7889 m_OldLocation.Reset();
7890 }
7891 }
7892
7894 {
7895 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
7896 }
7897
7899 {
7900 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
7901 }
7902 }
7903
7904 override void EOnContact(IEntity other, Contact extra)
7905 {
7907 {
7908 int liquidType = -1;
7910 if (impactSpeed > 0.0)
7911 {
7913 #ifndef SERVER
7915 #else
7917 SetSynchDirty();
7918 #endif
7920 }
7921 }
7922
7923 #ifdef SERVER
7924 if (GetCompEM() && GetCompEM().IsPlugged())
7925 {
7926 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
7927 GetCompEM().UnplugThis();
7928 }
7929 #endif
7930 }
7931
7933
7935 {
7937 }
7938
7940 {
7941
7942 }
7943
7945 {
7946 super.OnItemLocationChanged(old_owner, new_owner);
7947
7948 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
7949 PlayerBase playerNew = PlayerBase.Cast(new_owner);
7950
7951 if (!relatedPlayer && playerNew)
7952 relatedPlayer = playerNew;
7953
7954 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
7955 {
7957 if (actionMgr)
7958 {
7959 ActionBase currentAction = actionMgr.GetRunningAction();
7960 if (currentAction)
7962 }
7963 }
7964
7965 Man ownerPlayerOld = null;
7966 Man ownerPlayerNew = null;
7967
7968 if (old_owner)
7969 {
7970 if (old_owner.
IsMan())
7971 {
7972 ownerPlayerOld = Man.Cast(old_owner);
7973 }
7974 else
7975 {
7976 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
7977 }
7978 }
7979 else
7980 {
7982 {
7984
7985 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
7986 {
7987 GetCompEM().UnplugThis();
7988 }
7989 }
7990 }
7991
7992 if (new_owner)
7993 {
7994 if (new_owner.
IsMan())
7995 {
7996 ownerPlayerNew = Man.Cast(new_owner);
7997 }
7998 else
7999 {
8000 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
8001 }
8002 }
8003
8004 if (ownerPlayerOld != ownerPlayerNew)
8005 {
8006 if (ownerPlayerOld)
8007 {
8008 array<EntityAI> subItemsExit = new array<EntityAI>;
8010 for (int i = 0; i < subItemsExit.Count(); i++)
8011 {
8014 }
8015 }
8016
8017 if (ownerPlayerNew)
8018 {
8019 array<EntityAI> subItemsEnter = new array<EntityAI>;
8021 for (int j = 0; j < subItemsEnter.Count(); j++)
8022 {
8025 }
8026 }
8027 }
8028 else if (ownerPlayerNew != null)
8029 {
8030 PlayerBase nplayer;
8031 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
8032 {
8033 array<EntityAI> subItemsUpdate = new array<EntityAI>;
8035 for (int k = 0; k < subItemsUpdate.Count(); k++)
8036 {
8038 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
8039 }
8040 }
8041 }
8042
8043 if (old_owner)
8044 old_owner.OnChildItemRemoved(this);
8045 if (new_owner)
8046 new_owner.OnChildItemReceived(this);
8047 }
8048
8049
8051 {
8052 super.EEDelete(parent);
8053 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
8054 if (player)
8055 {
8057
8058 if (player.IsAlive())
8059 {
8060 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8061 if (r_index >= 0)
8062 {
8063 InventoryLocation r_il = new InventoryLocation;
8064 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8065
8066 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8069 {
8070 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8071 }
8073 {
8074 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8075 }
8076
8077 }
8078
8079 player.RemoveQuickBarEntityShortcut(this);
8080 }
8081 }
8082 }
8083
8085 {
8086 super.EEKilled(killer);
8087
8090 {
8091 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
8092 {
8093 if (IsMagazine())
8094 {
8095 if (Magazine.Cast(this).GetAmmoCount() > 0)
8096 {
8098 }
8099 }
8100 else
8101 {
8103 }
8104 }
8105 }
8106 }
8107
8109 {
8110 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8111
8112 super.OnWasAttached(parent, slot_id);
8113
8116
8119 }
8120
8122 {
8123 super.OnWasDetached(parent, slot_id);
8124
8127
8130 }
8131
8133 {
8134 int idx;
8137
8138 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8139 if (inventory_slots.Count() < 1)
8140 {
8141 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
8142 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
8143 }
8144 else
8145 {
8146 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
8147 }
8148
8149 idx = inventory_slots.Find(slot);
8150 if (idx < 0)
8151 return "";
8152
8153 return attach_types.Get(idx);
8154 }
8155
8157 {
8158 int idx = -1;
8159 string slot;
8160
8163
8164 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8165 if (inventory_slots.Count() < 1)
8166 {
8167 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
8168 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8169 }
8170 else
8171 {
8172 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
8173 if (detach_types.Count() < 1)
8174 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8175 }
8176
8177 for (int i = 0; i < inventory_slots.Count(); i++)
8178 {
8179 slot = inventory_slots.Get(i);
8180 }
8181
8182 if (slot != "")
8183 {
8184 if (detach_types.Count() == 1)
8185 idx = 0;
8186 else
8187 idx = inventory_slots.Find(slot);
8188 }
8189 if (idx < 0)
8190 return "";
8191
8192 return detach_types.Get(idx);
8193 }
8194
8196 {
8197
8199
8200
8201 float min_time = 1;
8202 float max_time = 3;
8203 float delay = Math.RandomFloat(min_time, max_time);
8204
8205 explode_timer.Run(delay, this, "DoAmmoExplosion");
8206 }
8207
8209 {
8210 Magazine magazine = Magazine.Cast(this);
8211 int pop_sounds_count = 6;
8212 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
8213
8214
8215 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
8216 string sound_name = pop_sounds[ sound_idx ];
8217 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
8218
8219
8220 magazine.ServerAddAmmoCount(-1);
8221
8222
8223 float min_temp_to_explode = 100;
8224
8225 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
8226 {
8228 }
8229 }
8230
8231
8232 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
8233 {
8234 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
8235
8236 const int CHANCE_DAMAGE_CARGO = 4;
8237 const int CHANCE_DAMAGE_ATTACHMENT = 1;
8238 const int CHANCE_DAMAGE_NOTHING = 2;
8239
8241 {
8242 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
8243 int chances;
8244 int rnd;
8245
8246 if (GetInventory().GetCargo())
8247 {
8248 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8249 rnd = Math.RandomInt(0,chances);
8250
8251 if (rnd < CHANCE_DAMAGE_CARGO)
8252 {
8254 }
8255 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
8256 {
8258 }
8259 }
8260 else
8261 {
8262 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8263 rnd = Math.RandomInt(0,chances);
8264
8265 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
8266 {
8268 }
8269 }
8270 }
8271 }
8272
8274 {
8275 CargoBase cargo = GetInventory().GetCargo();
8276 if (cargo)
8277 {
8279 if (item_count > 0)
8280 {
8281 int random_pick = Math.RandomInt(0, item_count);
8283 if (!item.IsExplosive())
8284 {
8285 item.AddHealth("","",damage);
8286 return true;
8287 }
8288 }
8289 }
8290 return false;
8291 }
8292
8294 {
8295 GameInventory inventory = GetInventory();
8297 if (attachment_count > 0)
8298 {
8299 int random_pick = Math.RandomInt(0, attachment_count);
8301 if (!attachment.IsExplosive())
8302 {
8303 attachment.AddHealth("","",damage);
8304 return true;
8305 }
8306 }
8307 return false;
8308 }
8309
8311 {
8313 }
8314
8316 {
8318 return GetInventory().CanRemoveEntity();
8319
8320 return false;
8321 }
8322
8324 {
8325
8327 return false;
8328
8329
8331 return false;
8332
8333
8334
8336 if (delta == 0)
8337 return false;
8338
8339
8340 return true;
8341 }
8342
8344 {
8346 {
8347 if (ScriptInputUserData.CanStoreInputUserData())
8348 {
8349 ScriptInputUserData ctx = new ScriptInputUserData;
8354 ctx.
Write(destination_entity);
8358 }
8359 }
8360 else if (!
g_Game.IsMultiplayer())
8361 {
8363 }
8364 }
8365
8367 {
8368 float split_quantity_new;
8372 InventoryLocation loc = new InventoryLocation;
8373
8374 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8375 {
8377 split_quantity_new = stack_max;
8378 else
8380
8382 {
8383 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8384 if (new_item)
8385 {
8386 new_item.SetResultOfSplit(true);
8387 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8389 new_item.
SetQuantity(split_quantity_new,
false,
true);
8390 }
8391 }
8392 }
8393 else if (destination_entity && slot_id == -1)
8394 {
8395 if (quantity > stack_max)
8396 split_quantity_new = stack_max;
8397 else
8398 split_quantity_new = quantity;
8399
8401 {
8402 GameInventory destinationInventory = destination_entity.GetInventory();
8404 {
8407 }
8408
8409 if (new_item)
8410 {
8411 new_item.SetResultOfSplit(true);
8412 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8414 new_item.
SetQuantity(split_quantity_new,
false,
true);
8415 }
8416 }
8417 }
8418 else
8419 {
8420 if (stack_max != 0)
8421 {
8423 {
8425 }
8426
8427 if (split_quantity_new == 0)
8428 {
8429 if (!
g_Game.IsMultiplayer())
8430 player.PhysicalPredictiveDropItem(this);
8431 else
8432 player.ServerDropEntity(this);
8433 return;
8434 }
8435
8437 {
8439
8440 if (new_item)
8441 {
8442 new_item.SetResultOfSplit(true);
8443 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8446 new_item.PlaceOnSurface();
8447 }
8448 }
8449 }
8450 }
8451 }
8452
8454 {
8455 float split_quantity_new;
8459 InventoryLocation loc = new InventoryLocation;
8460
8461 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8462 {
8464 split_quantity_new = stack_max;
8465 else
8467
8469 {
8470 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8471 if (new_item)
8472 {
8473 new_item.SetResultOfSplit(true);
8474 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8476 new_item.
SetQuantity(split_quantity_new,
false,
true);
8477 }
8478 }
8479 }
8480 else if (destination_entity && slot_id == -1)
8481 {
8482 if (quantity > stack_max)
8483 split_quantity_new = stack_max;
8484 else
8485 split_quantity_new = quantity;
8486
8488 {
8489 GameInventory destinationInventory = destination_entity.GetInventory();
8491 {
8494 }
8495
8496 if (new_item)
8497 {
8498 new_item.SetResultOfSplit(true);
8499 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8501 new_item.
SetQuantity(split_quantity_new,
false,
true);
8502 }
8503 }
8504 }
8505 else
8506 {
8507 if (stack_max != 0)
8508 {
8510 {
8512 }
8513
8515 {
8517
8518 if (new_item)
8519 {
8520 new_item.SetResultOfSplit(true);
8521 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8524 new_item.PlaceOnSurface();
8525 }
8526 }
8527 }
8528 }
8529 }
8530
8532 {
8534 {
8535 if (ScriptInputUserData.CanStoreInputUserData())
8536 {
8537 ScriptInputUserData ctx = new ScriptInputUserData;
8542 dst.WriteToContext(ctx);
8544 }
8545 }
8546 else if (!
g_Game.IsMultiplayer())
8547 {
8549 }
8550 }
8551
8553 {
8555 {
8556 if (ScriptInputUserData.CanStoreInputUserData())
8557 {
8558 ScriptInputUserData ctx = new ScriptInputUserData;
8563 ctx.
Write(destination_entity);
8569 }
8570 }
8571 else if (!
g_Game.IsMultiplayer())
8572 {
8574 }
8575 }
8576
8578 {
8580 }
8581
8583 {
8585 float split_quantity_new;
8587 if (dst.IsValid())
8588 {
8589 int slot_id = dst.GetSlot();
8591
8592 if (quantity > stack_max)
8593 split_quantity_new = stack_max;
8594 else
8595 split_quantity_new = quantity;
8596
8598 {
8600
8601 if (new_item)
8602 {
8603 new_item.SetResultOfSplit(true);
8604 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8606 new_item.
SetQuantity(split_quantity_new,
false,
true);
8607 }
8608
8609 return new_item;
8610 }
8611 }
8612
8613 return null;
8614 }
8615
8617 {
8619 float split_quantity_new;
8621 if (destination_entity)
8622 {
8624 if (quantity > stackable)
8625 split_quantity_new = stackable;
8626 else
8627 split_quantity_new = quantity;
8628
8630 {
8631 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
8632 if (new_item)
8633 {
8634 new_item.SetResultOfSplit(true);
8635 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8637 new_item.
SetQuantity(split_quantity_new,
false,
true);
8638 }
8639 }
8640 }
8641 }
8642
8644 {
8646 {
8647 if (ScriptInputUserData.CanStoreInputUserData())
8648 {
8649 ScriptInputUserData ctx = new ScriptInputUserData;
8654 ItemBase destination_entity =
this;
8655 ctx.
Write(destination_entity);
8659 }
8660 }
8661 else if (!
g_Game.IsMultiplayer())
8662 {
8664 }
8665 }
8666
8668 {
8670 float split_quantity_new;
8672 if (player)
8673 {
8675 if (quantity > stackable)
8676 split_quantity_new = stackable;
8677 else
8678 split_quantity_new = quantity;
8679
8681 {
8682 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
8683 new_item =
ItemBase.Cast(in_hands);
8684 if (new_item)
8685 {
8686 new_item.SetResultOfSplit(true);
8687 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8689 new_item.SetQuantity(split_quantity_new, false, true);
8690 }
8691 }
8692 }
8693 }
8694
8696 {
8698 float split_quantity_new = Math.Floor(quantity * 0.5);
8699
8701 return;
8702
8704
8705 if (new_item)
8706 {
8707 if (new_item.GetQuantityMax() < split_quantity_new)
8708 {
8709 split_quantity_new = new_item.GetQuantityMax();
8710 }
8711
8712 new_item.SetResultOfSplit(true);
8713 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8714
8716 {
8719 }
8720 else
8721 {
8723 new_item.
SetQuantity(split_quantity_new,
false,
true);
8724 }
8725 }
8726 }
8727
8729 {
8731 float split_quantity_new = Math.Floor(quantity / 2);
8732
8734 return;
8735
8736 InventoryLocation invloc = new InventoryLocation;
8738
8740 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
8741
8742 if (new_item)
8743 {
8744 if (new_item.GetQuantityMax() < split_quantity_new)
8745 {
8746 split_quantity_new = new_item.GetQuantityMax();
8747 }
8749 {
8752 }
8753 else if (split_quantity_new > 1)
8754 {
8756 new_item.
SetQuantity(split_quantity_new,
false,
true);
8757 }
8758 }
8759 }
8760
8763 {
8764 SetWeightDirty();
8766
8767 if (parent)
8768 parent.OnAttachmentQuantityChangedEx(this, delta);
8769
8771 {
8773 {
8775 }
8777 {
8778 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
8780 }
8781 }
8782 }
8783
8786 {
8787
8788 }
8789
8792 {
8794 }
8795
8797 {
8798 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
8799
8801 {
8802 if (newLevel == GameConstants.STATE_RUINED)
8803 {
8805 EntityAI parent = GetHierarchyParent();
8806 if (parent && parent.IsFireplace())
8807 {
8808 CargoBase cargo = GetInventory().GetCargo();
8809 if (cargo)
8810 {
8812 {
8814 }
8815 }
8816 }
8817 }
8818
8820 {
8821
8823 return;
8824 }
8825
8826 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
8827 {
8829 }
8830 }
8831 }
8832
8833
8835 {
8836 super.OnRightClick();
8837
8839 {
8841 {
8842 if (ScriptInputUserData.CanStoreInputUserData())
8843 {
8844 EntityAI root = GetHierarchyRoot();
8845 Man playerOwner = GetHierarchyRootPlayer();
8846 InventoryLocation dst = new InventoryLocation;
8847
8848
8849 if (!playerOwner && root && root == this)
8850 {
8852 }
8853 else
8854 {
8855
8856 GetInventory().GetCurrentInventoryLocation(dst);
8858 {
8859 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8861 {
8863 }
8864 else
8865 {
8867
8868
8869 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
8870 {
8872 }
8873 else
8874 {
8875 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
8876 }
8877 }
8878 }
8879 }
8880
8881 ScriptInputUserData ctx = new ScriptInputUserData;
8889 }
8890 }
8891 else if (!
g_Game.IsMultiplayer())
8892 {
8894 }
8895 }
8896 }
8897
8899 {
8900 if (root)
8901 {
8902 vector m4[4];
8903 root.GetTransform(m4);
8904 dst.SetGround(this, m4);
8905 }
8906 else
8907 {
8908 GetInventory().GetCurrentInventoryLocation(dst);
8909 }
8910 }
8911
8912 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
8913 {
8914
8915 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
8916 return false;
8917
8918 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
8919 return false;
8920
8921
8923 return false;
8924
8925
8926 Magazine mag = Magazine.Cast(this);
8927 if (mag)
8928 {
8929 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
8930 return false;
8931
8932 if (stack_max_limit)
8933 {
8934 Magazine other_mag = Magazine.Cast(other_item);
8935 if (other_item)
8936 {
8937 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
8938 return false;
8939 }
8940
8941 }
8942 }
8943 else
8944 {
8945
8947 return false;
8948
8950 return false;
8951 }
8952
8953 PlayerBase player = null;
8954 if (CastTo(player, GetHierarchyRootPlayer()))
8955 {
8956 if (player.GetInventory().HasAttachment(this))
8957 return false;
8958
8959 if (player.IsItemsToDelete())
8960 return false;
8961 }
8962
8963 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
8964 return false;
8965
8966 int slotID;
8968 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
8969 return false;
8970
8971 return true;
8972 }
8973
8975 {
8977 }
8978
8980 {
8981 return m_IsResultOfSplit;
8982 }
8983
8985 {
8986 m_IsResultOfSplit = value;
8987 }
8988
8990 {
8992 }
8993
8995 {
8996 float other_item_quantity = other_item.GetQuantity();
8997 float this_free_space;
8998
9000
9002
9003 if (other_item_quantity > this_free_space)
9004 {
9005 return this_free_space;
9006 }
9007 else
9008 {
9009 return other_item_quantity;
9010 }
9011 }
9012
9014 {
9016 }
9017
9019 {
9021 return;
9022
9023 if (!IsMagazine() && other_item)
9024 {
9026 if (quantity_used != 0)
9027 {
9028 float hp1 = GetHealth01("","");
9029 float hp2 = other_item.GetHealth01("","");
9030 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
9031 hpResult = hpResult / (
GetQuantity() + quantity_used);
9032
9033 hpResult *= GetMaxHealth();
9034 Math.Round(hpResult);
9035 SetHealth("", "Health", hpResult);
9036
9038 other_item.AddQuantity(-quantity_used);
9039 }
9040 }
9042 }
9043
9045 {
9046 #ifdef SERVER
9047 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
9048 GetHierarchyParent().IncreaseLifetimeUp();
9049 #endif
9050 };
9051
9053 {
9054 PlayerBase p = PlayerBase.Cast(player);
9055
9056 array<int> recipesIds = p.m_Recipes;
9057 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9058 if (moduleRecipesManager)
9059 {
9060 EntityAI itemInHands = player.GetEntityInHands();
9061 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
9062 }
9063
9064 for (int i = 0;i < recipesIds.Count(); i++)
9065 {
9066 int key = recipesIds.Get(i);
9067 string recipeName = moduleRecipesManager.GetRecipeName(key);
9069 }
9070 }
9071
9072
9073 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
9074 {
9075 super.GetDebugActions(outputList);
9076
9077
9083
9084
9089
9094
9095
9099
9100
9102 {
9106 }
9107
9110
9111
9115
9117
9118 InventoryLocation loc = new InventoryLocation();
9119 GetInventory().GetCurrentInventoryLocation(loc);
9121 {
9122 if (Gizmo_IsSupported())
9125 }
9126
9128 }
9129
9130
9131
9132
9134 {
9135 super.OnAction(action_id, player, ctx);
9136
9138 {
9139 switch (action_id)
9140 {
9144 return true;
9148 return true;
9149 }
9150 }
9151
9153 {
9154 switch (action_id)
9155 {
9157 Delete();
9158 return true;
9159 }
9160 }
9161
9162 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
9163 {
9164 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9165 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
9166 PlayerBase p = PlayerBase.Cast(player);
9167 if (
EActions.RECIPES_RANGE_START < 1000)
9168 {
9169 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
9170 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
9171 }
9172 }
9173 #ifndef SERVER
9174 else if (action_id ==
EActions.WATCH_PLAYER)
9175 {
9176 PluginDeveloper.SetDeveloperItemClientEx(player);
9177 }
9178 #endif
9180 {
9181 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
9182 {
9183 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
9184 OnDebugButtonPressServer(id + 1);
9185 }
9186
9187 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
9188 {
9189 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
9191 }
9192
9193 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
9194 {
9195 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
9197 }
9198
9199 else if (action_id ==
EActions.ADD_QUANTITY)
9200 {
9201 if (IsMagazine())
9202 {
9203 Magazine mag = Magazine.Cast(this);
9204 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
9205 }
9206 else
9207 {
9209 }
9210
9211 if (m_EM)
9212 {
9213 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
9214 }
9215
9216 }
9217
9218 else if (action_id ==
EActions.REMOVE_QUANTITY)
9219 {
9220 if (IsMagazine())
9221 {
9222 Magazine mag2 = Magazine.Cast(this);
9223 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
9224 }
9225 else
9226 {
9228 }
9229 if (m_EM)
9230 {
9231 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
9232 }
9233
9234 }
9235
9236 else if (action_id ==
EActions.SET_QUANTITY_0)
9237 {
9239
9240 if (m_EM)
9241 {
9242 m_EM.SetEnergy(0);
9243 }
9244 }
9245
9246 else if (action_id ==
EActions.SET_MAX_QUANTITY)
9247 {
9249
9250 if (m_EM)
9251 {
9252 m_EM.SetEnergy(m_EM.GetEnergyMax());
9253 }
9254 }
9255
9256 else if (action_id ==
EActions.ADD_HEALTH)
9257 {
9258 AddHealth("","",GetMaxHealth("","Health")/5);
9259 }
9260 else if (action_id ==
EActions.REMOVE_HEALTH)
9261 {
9262 AddHealth("","",-GetMaxHealth("","Health")/5);
9263 }
9264 else if (action_id ==
EActions.DESTROY_HEALTH)
9265 {
9266 SetHealth01("","",0);
9267 }
9268 else if (action_id ==
EActions.WATCH_ITEM)
9269 {
9271 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
9272 #ifdef DEVELOPER
9273 SetDebugDeveloper_item(this);
9274 #endif
9275 }
9276
9277 else if (action_id ==
EActions.ADD_TEMPERATURE)
9278 {
9279 AddTemperature(20);
9280
9281 }
9282
9283 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
9284 {
9285 AddTemperature(-20);
9286
9287 }
9288
9289 else if (action_id ==
EActions.FLIP_FROZEN)
9290 {
9291 SetFrozen(!GetIsFrozen());
9292
9293 }
9294
9295 else if (action_id ==
EActions.ADD_WETNESS)
9296 {
9298
9299 }
9300
9301 else if (action_id ==
EActions.REMOVE_WETNESS)
9302 {
9304
9305 }
9306
9307 else if (action_id ==
EActions.LIQUIDTYPE_UP)
9308 {
9311
9312
9313 }
9314
9315 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
9316 {
9319 }
9320
9321 else if (action_id ==
EActions.MAKE_SPECIAL)
9322 {
9323 auto debugParams = DebugSpawnParams.WithPlayer(player);
9324 OnDebugSpawnEx(debugParams);
9325 }
9326
9327 }
9328
9329
9330 return false;
9331 }
9332
9333
9334
9335
9339
9342
9343
9344
9346 {
9347 return false;
9348 }
9349
9350
9352 {
9353 return true;
9354 }
9355
9356
9358 {
9359 return true;
9360 }
9361
9362
9363
9365 {
9366 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
9367 return g_Game.ConfigIsExisting(config_path);
9368 }
9369
9372 {
9373 return null;
9374 }
9375
9377 {
9378 return false;
9379 }
9380
9382 {
9383 return false;
9384 }
9385
9389
9390
9392 {
9393 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9394 return module_repairing.CanRepair(this, item_repair_kit);
9395 }
9396
9397
9398 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
9399 {
9400 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9401 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
9402 }
9403
9404
9406 {
9407
9408
9409
9410
9411
9412
9413
9414
9415 return 1;
9416 }
9417
9418
9419
9421 {
9423 }
9424
9425
9426
9428 {
9430 }
9431
9432
9441 {
9442 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9443
9444 if (player)
9445 {
9446 player.MessageStatus(text);
9447 }
9448 }
9449
9450
9459 {
9460 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9461
9462 if (player)
9463 {
9464 player.MessageAction(text);
9465 }
9466 }
9467
9468
9477 {
9478 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9479
9480 if (player)
9481 {
9482 player.MessageFriendly(text);
9483 }
9484 }
9485
9486
9495 {
9496 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9497
9498 if (player)
9499 {
9500 player.MessageImportant(text);
9501 }
9502 }
9503
9505 {
9506 return true;
9507 }
9508
9509
9510 override bool KindOf(
string tag)
9511 {
9512 bool found = false;
9513 string item_name = this.
GetType();
9515 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
9516
9517 int array_size = item_tag_array.Count();
9518 for (int i = 0; i < array_size; i++)
9519 {
9520 if (item_tag_array.Get(i) == tag)
9521 {
9522 found = true;
9523 break;
9524 }
9525 }
9526 return found;
9527 }
9528
9529
9531 {
9532
9533 super.OnRPC(sender, rpc_type,ctx);
9534
9535
9536 switch (rpc_type)
9537 {
9538 #ifndef SERVER
9539 case ERPCs.RPC_SOUND_LOCK_ATTACH:
9540 Param2<bool, string> p = new Param2<bool, string>(false, "");
9541
9543 return;
9544
9545 bool play = p.param1;
9546 string soundSet = p.param2;
9547
9548 if (play)
9549 {
9551 {
9553 {
9555 }
9556 }
9557 else
9558 {
9560 }
9561 }
9562 else
9563 {
9565 }
9566
9567 break;
9568 #endif
9569
9570 }
9571
9573 {
9575 }
9576 }
9577
9578
9579
9580
9582 {
9583 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9584 return plugin.GetID(
name);
9585 }
9586
9588 {
9589 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9590 return plugin.GetName(id);
9591 }
9592
9595 {
9596
9597
9598 int varFlags;
9599 if (!ctx.
Read(varFlags))
9600 return;
9601
9602 if (varFlags & ItemVariableFlags.FLOAT)
9603 {
9605 }
9606 }
9607
9609 {
9610
9611 super.SerializeNumericalVars(floats_out);
9612
9613
9614
9616 {
9618 }
9619
9621 {
9623 }
9624
9626 {
9628 }
9629
9631 {
9636 }
9637
9639 {
9641 }
9642 }
9643
9645 {
9646
9647 super.DeSerializeNumericalVars(floats);
9648
9649
9650 int index = 0;
9651 int mask = Math.Round(floats.Get(index));
9652
9653 index++;
9654
9656 {
9658 {
9660 }
9661 else
9662 {
9663 float quantity = floats.Get(index);
9665 }
9666 index++;
9667 }
9668
9670 {
9671 float wet = floats.Get(index);
9673 index++;
9674 }
9675
9677 {
9678 int liquidtype = Math.Round(floats.Get(index));
9680 index++;
9681 }
9682
9684 {
9686 index++;
9688 index++;
9690 index++;
9692 index++;
9693 }
9694
9696 {
9697 int cleanness = Math.Round(floats.Get(index));
9699 index++;
9700 }
9701 }
9702
9704 {
9705 super.WriteVarsToCTX(ctx);
9706
9707
9709 {
9711 }
9712
9714 {
9716 }
9717
9719 {
9721 }
9722
9724 {
9725 int r,g,b,a;
9731 }
9732
9734 {
9736 }
9737 }
9738
9740 {
9741 if (!super.ReadVarsFromCTX(ctx,version))
9742 return false;
9743
9744 int intValue;
9745 float value;
9746
9747 if (version < 140)
9748 {
9749 if (!ctx.
Read(intValue))
9750 return false;
9751
9752 m_VariablesMask = intValue;
9753 }
9754
9756 {
9757 if (!ctx.
Read(value))
9758 return false;
9759
9761 {
9763 }
9764 else
9765 {
9767 }
9768 }
9769
9770 if (version < 140)
9771 {
9773 {
9774 if (!ctx.
Read(value))
9775 return false;
9776 SetTemperatureDirect(value);
9777 }
9778 }
9779
9781 {
9782 if (!ctx.
Read(value))
9783 return false;
9785 }
9786
9788 {
9789 if (!ctx.
Read(intValue))
9790 return false;
9792 }
9793
9795 {
9796 int r,g,b,a;
9798 return false;
9800 return false;
9802 return false;
9804 return false;
9805
9807 }
9808
9810 {
9811 if (!ctx.
Read(intValue))
9812 return false;
9814 }
9815
9816 if (version >= 138 && version < 140)
9817 {
9819 {
9820 if (!ctx.
Read(intValue))
9821 return false;
9822 SetFrozen(intValue);
9823 }
9824 }
9825
9826 return true;
9827 }
9828
9829
9831 {
9834 {
9836 }
9837
9838 if (!super.OnStoreLoad(ctx, version))
9839 {
9841 return false;
9842 }
9843
9844 if (version >= 114)
9845 {
9846 bool hasQuickBarIndexSaved;
9847
9848 if (!ctx.
Read(hasQuickBarIndexSaved))
9849 {
9851 return false;
9852 }
9853
9854 if (hasQuickBarIndexSaved)
9855 {
9856 int itmQBIndex;
9857
9858
9859 if (!ctx.
Read(itmQBIndex))
9860 {
9862 return false;
9863 }
9864
9865 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
9866 if (itmQBIndex != -1 && parentPlayer)
9867 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
9868 }
9869 }
9870 else
9871 {
9872
9873 PlayerBase player;
9874 int itemQBIndex;
9875 if (version ==
int.
MAX)
9876 {
9877 if (!ctx.
Read(itemQBIndex))
9878 {
9880 return false;
9881 }
9882 }
9883 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
9884 {
9885
9886 if (!ctx.
Read(itemQBIndex))
9887 {
9889 return false;
9890 }
9891 if (itemQBIndex != -1 && player)
9892 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
9893 }
9894 }
9895
9896 if (version < 140)
9897 {
9898
9899 if (!LoadVariables(ctx, version))
9900 {
9902 return false;
9903 }
9904 }
9905
9906
9908 {
9910 return false;
9911 }
9912 if (version >= 132)
9913 {
9915 if (raib)
9916 {
9918 {
9920 return false;
9921 }
9922 }
9923 }
9924
9926 return true;
9927 }
9928
9929
9930
9932 {
9933 super.OnStoreSave(ctx);
9934
9935 PlayerBase player;
9936 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
9937 {
9939
9940 int itemQBIndex = -1;
9941 itemQBIndex = player.FindQuickBarEntityIndex(this);
9942 ctx.
Write(itemQBIndex);
9943 }
9944 else
9945 {
9947 }
9948
9950
9952 if (raib)
9953 {
9955 }
9956 }
9957
9958
9960 {
9961 super.AfterStoreLoad();
9962
9964 {
9966 }
9967
9969 {
9972 }
9973 }
9974
9976 {
9977 super.EEOnAfterLoad();
9978
9980 {
9982 }
9983
9986 }
9987
9989 {
9990 return false;
9991 }
9992
9993
9994
9996 {
9998 {
9999 #ifdef PLATFORM_CONSOLE
10000
10002 {
10004 if (menu)
10005 {
10007 }
10008 }
10009 #endif
10010 }
10011
10013 {
10016 }
10017
10019 {
10020 SetWeightDirty();
10022 }
10024 {
10027 }
10028
10030 {
10033
10036 }
10038 {
10042 }
10043
10044 super.OnVariablesSynchronized();
10045 }
10046
10047
10048
10050 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
10051 {
10052 if (!IsServerCheck(allow_client))
10053 return false;
10054
10056 return false;
10057
10060
10061 if (value <= (min + 0.001))
10062 value = min;
10063
10064 if (value == min)
10065 {
10066 if (destroy_config)
10067 {
10068 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
10069 if (dstr)
10070 {
10072 this.Delete();
10073 return true;
10074 }
10075 }
10076 else if (destroy_forced)
10077 {
10079 this.Delete();
10080 return true;
10081 }
10082
10084 }
10085
10088
10090 {
10091 EntityAI parent = GetHierarchyRoot();
10092 InventoryLocation iLoc = new InventoryLocation();
10093 GetInventory().GetCurrentInventoryLocation(iLoc);
10095 {
10096 int iLocSlot = iLoc.
GetSlot();
10098 {
10100 }
10102 {
10104 }
10105 }
10106 }
10107
10109 {
10111
10112 if (delta)
10114 }
10115
10117
10118 return false;
10119 }
10120
10121
10123 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10124 {
10126 }
10127
10129 {
10132 }
10133
10135 {
10138 }
10139
10141 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10142 {
10143 float value_clamped = Math.Clamp(value, 0, 1);
10145 SetQuantity(result, destroy_config, destroy_forced);
10146 }
10147
10148
10151 {
10153 }
10154
10156 {
10158 }
10159
10160
10161
10162
10163
10164
10165
10166
10167
10168
10170 {
10171 int slot = -1;
10172 GameInventory inventory = GetInventory();
10173 if (inventory)
10174 {
10175 InventoryLocation il = new InventoryLocation;
10178 }
10179
10181 }
10182
10184 {
10185 float quantity_max = 0;
10186
10188 {
10189 if (attSlotID != -1)
10190 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
10191
10192 if (quantity_max <= 0)
10194 }
10195
10196 if (quantity_max <= 0)
10198
10199 return quantity_max;
10200 }
10201
10203 {
10205 }
10206
10208 {
10210 }
10211
10212
10214 {
10216 }
10217
10219 {
10221 }
10222
10224 {
10226 }
10227
10228
10230 {
10231
10232 float weightEx = GetWeightEx();
10233 float special = GetInventoryAndCargoWeight();
10234 return weightEx - special;
10235 }
10236
10237
10239 {
10241 }
10242
10244 {
10246 {
10247 #ifdef DEVELOPER
10248 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10249 {
10250 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
10252 }
10253 #endif
10254
10255 return GetQuantity() * GetConfigWeightModified();
10256 }
10257 else if (HasEnergyManager())
10258 {
10259 #ifdef DEVELOPER
10260 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10261 {
10262 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
10263 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
10264 }
10265 #endif
10266 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
10267 }
10268 else
10269 {
10270 #ifdef DEVELOPER
10271 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10272 {
10273 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
10274 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
10275 }
10276 #endif
10277 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
10278 }
10279 }
10280
10283 {
10284 int item_count = 0;
10286
10287 GameInventory inventory = GetInventory();
10288 CargoBase cargo = inventory.
GetCargo();
10289 if (cargo != NULL)
10290 {
10292 }
10293
10295 for (int i = 0; i < nAttachments; ++i)
10296 {
10298 if (item)
10299 item_count += item.GetNumberOfItems();
10300 }
10301 return item_count;
10302 }
10303
10306 {
10307 float weight = 0;
10308 float wetness = 1;
10309 if (include_wetness)
10312 {
10313 weight = wetness * m_ConfigWeight;
10314 }
10316 {
10317 weight = 1;
10318 }
10319 return weight;
10320 }
10321
10322
10323
10325 {
10326 GameInventory inventory = GetInventory();
10327 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
10328 {
10329 array<EntityAI> items = new array<EntityAI>;
10331 for (int i = 0; i < items.Count(); ++i)
10332 {
10334 if (item)
10335 {
10336 g_Game.ObjectDelete(item);
10337 }
10338 }
10339 }
10340 }
10341
10342
10343
10344
10346 {
10347 float energy = 0;
10348 if (HasEnergyManager())
10349 {
10350 energy = GetCompEM().GetEnergy();
10351 }
10352 return energy;
10353 }
10354
10355
10357 {
10358 super.OnEnergyConsumed();
10359
10361 }
10362
10364 {
10365 super.OnEnergyAdded();
10366
10368 }
10369
10370
10372 {
10373 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
10374 {
10376 {
10377 float energy_0to1 = GetCompEM().GetEnergy0To1();
10379 }
10380 }
10381 }
10382
10383
10385 {
10386 return ConfigGetFloat("heatIsolation");
10387 }
10388
10390 {
10392 }
10393
10395 {
10396 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
10397 if (
g_Game.ConfigIsExisting(paramPath))
10398 return g_Game.ConfigGetFloat(paramPath);
10399
10400 return 0.0;
10401 }
10402
10404 {
10405 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
10406 if (
g_Game.ConfigIsExisting(paramPath))
10407 return g_Game.ConfigGetFloat(paramPath);
10408
10409 return 0.0;
10410 }
10411
10412 override void SetWet(
float value,
bool allow_client =
false)
10413 {
10414 if (!IsServerCheck(allow_client))
10415 return;
10416
10419
10421
10422 m_VarWet = Math.Clamp(value, min, max);
10423
10425 {
10428 }
10429 }
10430
10431 override void AddWet(
float value)
10432 {
10434 }
10435
10437 {
10439 }
10440
10442 {
10444 }
10445
10447 {
10449 }
10450
10452 {
10454 }
10455
10457 {
10459 }
10460
10461 override void OnWetChanged(
float newVal,
float oldVal)
10462 {
10465 if (newLevel != oldLevel)
10466 {
10468 }
10469 }
10470
10472 {
10473 SetWeightDirty();
10474 }
10475
10477 {
10478 return GetWetLevelInternal(
m_VarWet);
10479 }
10480
10481
10482
10484 {
10486 }
10487
10489 {
10491 }
10492
10494 {
10496 }
10497
10499 {
10501 }
10502
10503
10504
10506 {
10507 if (ConfigIsExisting("itemModelLength"))
10508 {
10509 return ConfigGetFloat("itemModelLength");
10510 }
10511 return 0;
10512 }
10513
10515 {
10516 if (ConfigIsExisting("itemAttachOffset"))
10517 {
10518 return ConfigGetFloat("itemAttachOffset");
10519 }
10520 return 0;
10521 }
10522
10523 override void SetCleanness(
int value,
bool allow_client =
false)
10524 {
10525 if (!IsServerCheck(allow_client))
10526 return;
10527
10529
10531
10534 }
10535
10537 {
10539 }
10540
10542 {
10543 return true;
10544 }
10545
10546
10547
10548
10550 {
10552 }
10553
10555 {
10557 }
10558
10559
10560
10561
10562 override void SetColor(
int r,
int g,
int b,
int a)
10563 {
10569 }
10571 override void GetColor(out
int r,out
int g,out
int b,out
int a)
10572 {
10577 }
10578
10580 {
10582 }
10583
10586 {
10587 int r,g,b,a;
10589 r = r/255;
10590 g = g/255;
10591 b = b/255;
10592 a = a/255;
10593 return MiscGameplayFunctions.GetColorString(r, g, b, a);
10594 }
10595
10596
10597
10598 override void SetLiquidType(
int value,
bool allow_client =
false)
10599 {
10600 if (!IsServerCheck(allow_client))
10601 return;
10602
10607 }
10608
10610 {
10611 return ConfigGetInt("varLiquidTypeInit");
10612 }
10613
10615 {
10617 }
10618
10620 {
10622 SetFrozen(false);
10623 }
10624
10627 {
10628 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10629 }
10630
10631
10634 {
10635 PlayerBase nplayer;
10636 if (PlayerBase.CastTo(nplayer, player))
10637 {
10639 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10640 }
10641 }
10642
10643
10646 {
10647 PlayerBase nplayer;
10648 if (PlayerBase.CastTo(nplayer,player))
10649 {
10650 nplayer.SetEnableQuickBarEntityShortcut(this, false);
10651 }
10652
10653 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
10654
10655 if (HasEnergyManager())
10656 {
10657 GetCompEM().UpdatePlugState();
10658 }
10659 }
10660
10661
10663 {
10664 super.OnPlacementStarted(player);
10665
10667 }
10668
10669 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
10670 {
10672 {
10673 m_AdminLog.OnPlacementComplete(player,
this);
10674 }
10675
10676 super.OnPlacementComplete(player, position, orientation);
10677 }
10678
10679
10680
10681
10682
10684 {
10686 {
10687 return true;
10688 }
10689 else
10690 {
10691 return false;
10692 }
10693 }
10694
10695
10697 {
10699 {
10701 }
10702 }
10703
10704
10706 {
10708 }
10709
10711 {
10713 }
10714
10715 override void InsertAgent(
int agent,
float count = 1)
10716 {
10717 if (count < 1)
10718 return;
10719
10721 }
10722
10725 {
10727 }
10728
10729
10731 {
10733 }
10734
10735
10736
10737
10738
10739
10740
10741
10742
10743
10744
10745
10746
10747
10748
10749
10750
10751
10752
10753
10754
10755
10756
10757
10758
10759
10760
10761
10762
10763
10764
10765
10766
10767
10768
10769
10770
10771
10772
10773
10774
10775
10777 {
10779 return false;
10780 return true;
10781 }
10782
10784 {
10785
10787 }
10788
10789
10792 {
10793 super.CheckForRoofLimited(timeTresholdMS);
10794
10795 float time =
g_Game.GetTime();
10796 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
10797 {
10798 m_PreviousRoofTestTime = time;
10799 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
10800 }
10801 }
10802
10803
10805 {
10807 {
10808 return 0;
10809 }
10810
10811 if (GetInventory().GetAttachmentSlotsCount() != 0)
10812 {
10813 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
10814 if (filter)
10815 return filter.GetProtectionLevel(type, false, system);
10816 else
10817 return 0;
10818 }
10819
10820 string subclassPath, entryName;
10821
10822 switch (type)
10823 {
10825 entryName = "biological";
10826 break;
10828 entryName = "chemical";
10829 break;
10830 default:
10831 entryName = "biological";
10832 break;
10833 }
10834
10835 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
10836
10837 return g_Game.ConfigGetFloat(subclassPath + entryName);
10838 }
10839
10840
10841
10844 {
10845 if (!IsMagazine())
10847
10849 }
10850
10851
10852
10853
10854
10859 {
10860 return true;
10861 }
10862
10864 {
10866 }
10867
10868
10869
10870
10871
10873 {
10874 if (parent)
10875 {
10876 if (parent.IsInherited(DayZInfected))
10877 return true;
10878
10879 if (!parent.IsRuined())
10880 return true;
10881 }
10882
10883 return true;
10884 }
10885
10887 {
10888 if (!super.CanPutAsAttachment(parent))
10889 {
10890 return false;
10891 }
10892
10893 if (!IsRuined() && !parent.IsRuined())
10894 {
10895 return true;
10896 }
10897
10898 return false;
10899 }
10900
10902 {
10903
10904
10905
10906
10907 return super.CanReceiveItemIntoCargo(item);
10908 }
10909
10911 {
10912
10913
10914
10915
10916 GameInventory attachmentInv = attachment.GetInventory();
10918 {
10919 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
10920 return false;
10921 }
10922
10923 InventoryLocation loc = new InventoryLocation();
10924 attachment.GetInventory().GetCurrentInventoryLocation(loc);
10925 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
10926 return false;
10927
10928 return super.CanReceiveAttachment(attachment, slotId);
10929 }
10930
10932 {
10933 if (!super.CanReleaseAttachment(attachment))
10934 return false;
10935
10936 return GetInventory().AreChildrenAccessible();
10937 }
10938
10939
10940
10941
10942
10943
10944
10945
10946
10947
10948
10949
10950
10951
10952
10953
10954
10955
10956
10957
10958
10960 {
10961 int id = muzzle_owner.GetMuzzleID();
10962 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
10963
10964 if (WPOF_array)
10965 {
10966 for (int i = 0; i < WPOF_array.Count(); i++)
10967 {
10968 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
10969
10970 if (WPOF)
10971 {
10972 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
10973 }
10974 }
10975 }
10976 }
10977
10978
10980 {
10981 int id = muzzle_owner.GetMuzzleID();
10983
10984 if (WPOBE_array)
10985 {
10986 for (int i = 0; i < WPOBE_array.Count(); i++)
10987 {
10988 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
10989
10990 if (WPOBE)
10991 {
10992 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10993 }
10994 }
10995 }
10996 }
10997
10998
11000 {
11001 int id = muzzle_owner.GetMuzzleID();
11002 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11003
11004 if (WPOOH_array)
11005 {
11006 for (int i = 0; i < WPOOH_array.Count(); i++)
11007 {
11008 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11009
11010 if (WPOOH)
11011 {
11012 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11013 }
11014 }
11015 }
11016 }
11017
11018
11020 {
11021 int id = muzzle_owner.GetMuzzleID();
11022 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11023
11024 if (WPOOH_array)
11025 {
11026 for (int i = 0; i < WPOOH_array.Count(); i++)
11027 {
11028 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11029
11030 if (WPOOH)
11031 {
11032 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11033 }
11034 }
11035 }
11036 }
11037
11038
11040 {
11041 int id = muzzle_owner.GetMuzzleID();
11042 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11043
11044 if (WPOOH_array)
11045 {
11046 for (int i = 0; i < WPOOH_array.Count(); i++)
11047 {
11048 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11049
11050 if (WPOOH)
11051 {
11052 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11053 }
11054 }
11055 }
11056 }
11057
11058
11059
11061 {
11063 {
11064 return true;
11065 }
11066
11067 return false;
11068 }
11069
11071 {
11073 {
11074 return true;
11075 }
11076
11077 return false;
11078 }
11079
11081 {
11083 {
11084 return true;
11085 }
11086
11087 return false;
11088 }
11089
11091 {
11092 return false;
11093 }
11094
11097 {
11098 return UATimeSpent.DEFAULT_DEPLOY;
11099 }
11100
11101
11102
11103
11105 {
11107 SetSynchDirty();
11108 }
11109
11111 {
11113 }
11114
11115
11117 {
11118 return false;
11119 }
11120
11123 {
11124 string att_type = "None";
11125
11126 if (ConfigIsExisting("soundAttType"))
11127 {
11128 att_type = ConfigGetString("soundAttType");
11129 }
11130
11132 }
11133
11135 {
11137 }
11138
11139
11140
11141
11142
11148
11150 {
11153
11155 }
11156
11157
11159 {
11161 return;
11162
11164
11167
11170
11171 SoundParameters params = new SoundParameters();
11175 }
11176
11177
11179 {
11181 {
11184
11185 SetSynchDirty();
11186
11189 }
11190 }
11191
11193 {
11195 }
11196
11197
11199 {
11201 return;
11202
11204 SetSynchDirty();
11205
11208 }
11209
11211 {
11214 }
11215
11217 {
11219 }
11220
11221 void OnApply(PlayerBase player);
11222
11224 {
11225 return 1.0;
11226 };
11227
11229 {
11231 }
11232
11234 {
11236 }
11237
11239
11241 {
11242 SetDynamicPhysicsLifeTime(0.01);
11244 }
11245
11247 {
11248 array<string> zone_names = new array<string>;
11249 GetDamageZones(zone_names);
11250 for (int i = 0; i < zone_names.Count(); i++)
11251 {
11252 SetHealthMax(zone_names.Get(i),"Health");
11253 }
11254 SetHealthMax("","Health");
11255 }
11256
11259 {
11260 float global_health = GetHealth01("","Health");
11261 array<string> zones = new array<string>;
11262 GetDamageZones(zones);
11263
11264 for (int i = 0; i < zones.Count(); i++)
11265 {
11266 SetHealth01(zones.Get(i),"Health",global_health);
11267 }
11268 }
11269
11272 {
11273 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
11274 }
11275
11277 {
11278 if (!hasRootAsPlayer)
11279 {
11280 if (refParentIB)
11281 {
11282
11283 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
11284 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
11285
11286 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
11287 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
11288
11291 }
11292 else
11293 {
11294
11297 }
11298 }
11299 }
11300
11302 {
11304 {
11305 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
11306 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
11307 {
11308 float heatPermCoef = 1.0;
11310 while (ent)
11311 {
11312 heatPermCoef *= ent.GetHeatPermeabilityCoef();
11313 ent = ent.GetHierarchyParent();
11314 }
11315
11316 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
11317 }
11318 }
11319 }
11320
11322 {
11323
11324 EntityAI parent = GetHierarchyParent();
11325 if (!parent)
11326 {
11327 hasParent = false;
11328 hasRootAsPlayer = false;
11329 }
11330 else
11331 {
11332 hasParent = true;
11333 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
11334 refParentIB =
ItemBase.Cast(parent);
11335 }
11336 }
11337
11338 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
11339 {
11340
11341 }
11342
11344 {
11345
11346 return false;
11347 }
11348
11350 {
11351
11352
11353 return false;
11354 }
11355
11357 {
11358
11359 return false;
11360 }
11361
11364 {
11365 return !GetIsFrozen() &&
IsOpen();
11366 }
11367
11369 {
11370 bool hasParent = false, hasRootAsPlayer = false;
11372
11373 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
11374 bool foodDecay =
g_Game.IsFoodDecayEnabled();
11375
11376 if (wwtu || foodDecay)
11377 {
11381
11382 if (processWetness || processTemperature || processDecay)
11383 {
11385
11386 if (processWetness)
11387 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
11388
11389 if (processTemperature)
11391
11392 if (processDecay)
11393 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
11394 }
11395 }
11396 }
11397
11400 {
11402 }
11403
11405 {
11408
11409 return super.GetTemperatureFreezeThreshold();
11410 }
11411
11413 {
11416
11417 return super.GetTemperatureThawThreshold();
11418 }
11419
11421 {
11424
11425 return super.GetItemOverheatThreshold();
11426 }
11427
11429 {
11431 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
11432
11433 return super.GetTemperatureFreezeTime();
11434 }
11435
11437 {
11439 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
11440
11441 return super.GetTemperatureThawTime();
11442 }
11443
11448
11450 {
11451 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
11452 }
11453
11455 {
11456 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
11457 }
11458
11461 {
11463 }
11464
11466 {
11468 }
11469
11471 {
11473 }
11474
11477 {
11478 return null;
11479 }
11480
11483 {
11484 return false;
11485 }
11486
11488 {
11490 {
11493 if (!trg)
11494 {
11496 explosive = this;
11497 }
11498
11499 explosive.PairRemote(trg);
11501
11502 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
11503 trg.SetPersistentPairID(persistentID);
11504 explosive.SetPersistentPairID(persistentID);
11505
11506 return true;
11507 }
11508 return false;
11509 }
11510
11513 {
11514 float ret = 1.0;
11517 ret *= GetHealth01();
11518
11519 return ret;
11520 }
11521
11522 #ifdef DEVELOPER
11523 override void SetDebugItem()
11524 {
11525 super.SetDebugItem();
11526 _itemBase = this;
11527 }
11528
11530 {
11531 string text = super.GetDebugText();
11532
11534 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
11535
11536 return text;
11537 }
11538 #endif
11539
11541 {
11542 return true;
11543 }
11544
11546
11548
11550 {
11553 }
11554
11555
11563
11579
11580 [
Obsolete(
"Use ItemSoundHandler instead")]
11583 {
11584 if (!
g_Game.IsDedicatedServer())
11585 {
11586 if (ConfigIsExisting("attachSoundSet"))
11587 {
11588 string cfg_path = "";
11589 string soundset = "";
11590 string type_name =
GetType();
11591
11594 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
11595 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
11596
11597 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
11598 {
11599 for (int i = 0; i < cfg_soundset_array.Count(); i++)
11600 {
11601 if (cfg_slot_array[i] == slot_type)
11602 {
11603 soundset = cfg_soundset_array[i];
11604 break;
11605 }
11606 }
11607 }
11608
11609 if (soundset != "")
11610 {
11611 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
11613 }
11614 }
11615 }
11616 }
11617
11619}
11620
11622{
11624 if (entity)
11625 {
11626 bool is_item = entity.IsInherited(
ItemBase);
11627 if (is_item && full_quantity)
11628 {
11631 }
11632 }
11633 else
11634 {
11636 return NULL;
11637 }
11638 return entity;
11639}
11640
11642{
11643 if (item)
11644 {
11645 if (health > 0)
11646 item.SetHealth("", "", health);
11647
11648 if (item.CanHaveTemperature())
11649 {
11651 if (item.CanFreeze())
11652 item.SetFrozen(false);
11653 }
11654
11655 if (item.HasEnergyManager())
11656 {
11657 if (quantity >= 0)
11658 {
11659 item.GetCompEM().SetEnergy0To1(quantity);
11660 }
11661 else
11662 {
11664 }
11665 }
11666 else if (item.IsMagazine())
11667 {
11668 Magazine mag = Magazine.Cast(item);
11669 if (quantity >= 0)
11670 {
11671 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
11672 }
11673 else
11674 {
11676 }
11677
11678 }
11679 else
11680 {
11681 if (quantity >= 0)
11682 {
11683 item.SetQuantityNormalized(quantity, false);
11684 }
11685 else
11686 {
11688 }
11689
11690 }
11691 }
11692}
11693
11694#ifdef DEVELOPER
11696#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.