6801{
6803 {
6804 return true;
6805 }
6806};
6807
6809{
6810
6811};
6812
6813
6814
6816{
6820
6822
6825
6826
6827
6828
6829
6838
6844
6849
6854
6875 protected bool m_IsResultOfSplit
6876
6878
6883
6884
6885
6887
6891
6892
6893
6895
6898
6899
6900
6906
6907
6915
6918
6919
6921
6922
6924
6925
6930
6931
6936
6938
6939
6941
6942
6944 {
6949
6950 if (!
g_Game.IsDedicatedServer())
6951 {
6953 {
6955
6957 {
6959 }
6960 }
6961
6964 }
6965
6966 m_OldLocation = null;
6967
6969 {
6971 }
6972
6973 if (ConfigIsExisting("headSelectionsToHide"))
6974 {
6977 }
6978
6980 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
6981 {
6983 }
6984
6986
6987 m_IsResultOfSplit = false;
6988
6990 }
6991
6993 {
6994 super.InitItemVariables();
6995
7001 m_Count = ConfigGetInt(
"count");
7002
7005
7010
7013
7018
7030
7034
7035
7038 if (ConfigIsExisting("canBeSplit"))
7039 {
7042 }
7043
7045 if (ConfigIsExisting("itemBehaviour"))
7047
7048
7051 RegisterNetSyncVariableInt("m_VarLiquidType");
7052 RegisterNetSyncVariableInt("m_Cleanness",0,1);
7053
7054 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
7055 RegisterNetSyncVariableFloat("m_ImpactSpeed");
7056 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
7057
7058 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
7059 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
7060 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
7061 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
7062
7063 RegisterNetSyncVariableBool("m_IsBeingPlaced");
7064 RegisterNetSyncVariableBool("m_IsTakeable");
7065 RegisterNetSyncVariableBool("m_IsHologram");
7066
7069 {
7072 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
7073 }
7074
7076
7078 if (ConfigIsExisting("temperaturePerQuantityWeight"))
7080
7082 }
7083
7085 {
7087 }
7088
7090 {
7093 {
7098 }
7099 }
7100
7101 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
7102 {
7104 {
7107 }
7108
7110 }
7111
7113 {
7119 }
7120
7122
7124 {
7126
7127 if (!action)
7128 {
7129 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
7130 return;
7131 }
7132
7134 if (!ai)
7135 {
7137 return;
7138 }
7139
7141 if (!action_array)
7142 {
7143 action_array = new array<ActionBase_Basic>;
7145 }
7146 if (LogManager.IsActionLogEnable())
7147 {
7148 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
7149 }
7150
7151 if (action_array.Find(action) != -1)
7152 {
7153 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
7154 }
7155 else
7156 {
7157 action_array.Insert(action);
7158 }
7159 }
7160
7162 {
7163 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7164 ActionBase action = player.GetActionManager().GetAction(actionName);
7167
7168 if (action_array)
7169 {
7170 action_array.RemoveItem(action);
7171 }
7172 }
7173
7174
7175
7177 {
7178 ActionOverrideData overrideData = new ActionOverrideData();
7182
7184 if (!actionMap)
7185 {
7188 }
7189
7190 actionMap.Insert(this.
Type(), overrideData);
7191
7192 }
7193
7195
7197
7198
7200 {
7203
7206
7207 string config_to_search = "CfgVehicles";
7208 string muzzle_owner_config;
7209
7211 {
7212 if (IsInherited(Weapon))
7213 config_to_search = "CfgWeapons";
7214
7215 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7216
7217 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
7218
7219 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
7220
7221 if (config_OnFire_subclass_count > 0)
7222 {
7223 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
7224
7225 for (int i = 0; i < config_OnFire_subclass_count; i++)
7226 {
7227 string particle_class = "";
7228 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
7229 string config_OnFire_entry = config_OnFire_class + particle_class;
7230 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
7231 WPOF_array.Insert(WPOF);
7232 }
7233
7234
7236 }
7237 }
7238
7240 {
7241 config_to_search = "CfgWeapons";
7242 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7243
7244 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
7245
7246 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
7247
7248 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
7249 {
7250 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
7251
7252 for (i = 0; i < config_OnBulletCasingEject_count; i++)
7253 {
7254 string particle_class2 = "";
7255 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
7256 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
7257 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
7258 WPOBE_array.Insert(WPOBE);
7259 }
7260
7261
7263 }
7264 }
7265 }
7266
7267
7269 {
7272
7274 {
7275 string config_to_search = "CfgVehicles";
7276
7277 if (IsInherited(Weapon))
7278 config_to_search = "CfgWeapons";
7279
7280 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7281 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
7282
7283 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
7284 {
7285
7287
7289 {
7291 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
7293 return;
7294 }
7295
7298
7299
7300
7301 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
7302 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
7303
7304 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
7305 {
7306 string particle_class = "";
7307 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
7308 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
7309 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
7310
7311 if (entry_type == CT_CLASS)
7312 {
7313 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
7314 WPOOH_array.Insert(WPOF);
7315 }
7316 }
7317
7318
7320 }
7321 }
7322 }
7323
7325 {
7327 }
7328
7330 {
7332 {
7334
7337
7340
7341 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7342 }
7343 }
7344
7346 {
7348 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7349
7351 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7352
7354 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7355
7357 {
7359 }
7360 }
7361
7363 {
7365 }
7366
7368 {
7371 else
7373
7375 {
7378 }
7379 else
7380 {
7383
7386 }
7387
7389 }
7390
7392 {
7394 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7395 }
7396
7398 {
7400 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7402 }
7403
7405 {
7407 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7408 }
7409
7411 {
7414
7415 OverheatingParticle OP = new OverheatingParticle();
7420
7422 }
7423
7425 {
7428
7429 return -1;
7430 }
7431
7433 {
7435 {
7438
7439 for (int i = count; i > 0; --i)
7440 {
7441 int id = i - 1;
7444
7447
7448 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
7449 {
7450 if (p)
7451 {
7454 }
7455 }
7456 }
7457 }
7458 }
7459
7461 {
7463 {
7465 {
7466 int id = i - 1;
7468
7469 if (OP)
7470 {
7472
7473 if (p)
7474 {
7476 }
7477
7478 delete OP;
7479 }
7480 }
7481
7484 }
7485 }
7486
7489 {
7490 return 0.0;
7491 }
7492
7493
7495 {
7496 return 250;
7497 }
7498
7500 {
7501 return 0;
7502 }
7503
7506 {
7508 return true;
7509
7510 return false;
7511 }
7512
7515 {
7518
7520 {
7522 }
7523 else
7524 {
7525
7527 }
7528
7530 }
7531
7538 {
7539 return -1;
7540 }
7541
7542
7543
7544
7546 {
7548 {
7549 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7550 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7551
7552 if (r_index >= 0)
7553 {
7554 InventoryLocation r_il = new InventoryLocation;
7555 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7556
7557 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7560 {
7561 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7562 }
7564 {
7565 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7566 }
7567
7568 }
7569
7570 player.GetHumanInventory().ClearUserReservedLocation(this);
7571 }
7572
7575 }
7576
7577
7578
7579
7581 {
7582 return ItemBase.m_DebugActionsMask;
7583 }
7584
7586 {
7587 return ItemBase.m_DebugActionsMask & mask;
7588 }
7589
7591 {
7592 ItemBase.m_DebugActionsMask = mask;
7593 }
7594
7596 {
7597 ItemBase.m_DebugActionsMask |= mask;
7598 }
7599
7601 {
7602 ItemBase.m_DebugActionsMask &= ~mask;
7603 }
7604
7606 {
7608 {
7610 }
7611 else
7612 {
7614 }
7615 }
7616
7617
7619 {
7620 if (GetEconomyProfile())
7621 {
7622 float q_max = GetEconomyProfile().GetQuantityMax();
7623 if (q_max > 0)
7624 {
7625 float q_min = GetEconomyProfile().GetQuantityMin();
7626 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
7627
7629 {
7630 ComponentEnergyManager comp = GetCompEM();
7632 {
7634 }
7635 }
7637 {
7639
7640 }
7641
7642 }
7643 }
7644 }
7645
7648 {
7649 EntityAI parent = GetHierarchyParent();
7650
7651 if (parent)
7652 {
7653 InventoryLocation inventory_location_to_lock = new InventoryLocation;
7654 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
7655 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
7656 }
7657 }
7658
7661 {
7662 EntityAI parent = GetHierarchyParent();
7663
7664 if (parent)
7665 {
7666 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
7667 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
7668 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
7669 }
7670 }
7671
7673 {
7674
7675
7676
7677
7679
7681 {
7682 if (ScriptInputUserData.CanStoreInputUserData())
7683 {
7684 ScriptInputUserData ctx = new ScriptInputUserData;
7690 ctx.
Write(use_stack_max);
7693
7695 {
7696 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
7697 }
7698 }
7699 }
7700 else if (!
g_Game.IsMultiplayer())
7701 {
7703 }
7704 }
7705
7707 {
7709 }
7710
7712 {
7714 }
7715
7717 {
7719 }
7720
7722 {
7723
7724 return false;
7725 }
7726
7728 {
7729 return false;
7730 }
7731
7735 {
7736 return false;
7737 }
7738
7740 {
7741 return "";
7742 }
7743
7745
7747 {
7748 return false;
7749 }
7750
7752 {
7753 return true;
7754 }
7755
7756
7757
7759 {
7760 return true;
7761 }
7762
7764 {
7765 return true;
7766 }
7767
7769 {
7770 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7772 }
7773
7775 {
7777 }
7778
7780 {
7782 if (!is_being_placed)
7784 SetSynchDirty();
7785 }
7786
7787
7789
7791 {
7793 }
7794
7796 {
7798 }
7799
7801 {
7802 return 1;
7803 }
7804
7806 {
7807 return false;
7808 }
7809
7811 {
7813 SetSynchDirty();
7814 }
7815
7816
7817
7818
7819
7820
7821
7822
7823
7824
7825
7826
7827
7828
7829
7830
7831
7832
7833
7834
7835
7836
7837
7838
7839
7840
7841
7842
7843
7844
7845
7846
7847
7848
7849
7851 {
7852 super.OnMovedInsideCargo(container);
7853
7854 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7855 }
7856
7857 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
7858 {
7859 super.EEItemLocationChanged(oldLoc, newLoc);
7860
7861 PlayerBase newPlayer = null;
7862 PlayerBase oldPlayer = null;
7863
7864 if (newLoc.GetParent())
7865 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
7866
7867 if (oldLoc.GetParent())
7868 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
7869
7871 {
7872 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
7873
7874 if (rIndex >= 0)
7875 {
7876 InventoryLocation rIl = new InventoryLocation;
7877 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
7878
7879 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
7882 {
7883 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
7884 }
7886 {
7888 }
7889
7890 }
7891 }
7892
7894 {
7895 if (newPlayer)
7896 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
7897
7898 if (newPlayer == oldPlayer)
7899 {
7900 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
7901 {
7903 {
7904 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
7905 {
7906 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7907 }
7908 }
7909 else
7910 {
7911 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7912 }
7913 }
7914
7915 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
7916 {
7917 int type = oldLoc.GetType();
7919 {
7920 oldLoc.GetParent().GetOnSetLock().Invoke(this);
7921 }
7923 {
7924 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
7925 }
7926 }
7927 if (!m_OldLocation)
7928 {
7929 m_OldLocation = new InventoryLocation;
7930 }
7931 m_OldLocation.Copy(oldLoc);
7932 }
7933 else
7934 {
7935 if (m_OldLocation)
7936 {
7937 m_OldLocation.Reset();
7938 }
7939 }
7940
7941 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
7942 }
7943 else
7944 {
7945 if (newPlayer)
7946 {
7947 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
7948 if (resIndex >= 0)
7949 {
7950 InventoryLocation il = new InventoryLocation;
7951 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
7953 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
7956 {
7957 il.
GetParent().GetOnReleaseLock().Invoke(it);
7958 }
7960 {
7962 }
7963
7964 }
7965 }
7967 {
7968
7970 }
7971
7972 if (m_OldLocation)
7973 {
7974 m_OldLocation.Reset();
7975 }
7976 }
7977
7979 {
7980 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
7981 }
7982
7984 {
7985 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
7986 }
7987 }
7988
7989 override void EOnContact(IEntity other, Contact extra)
7990 {
7992 {
7993 int liquidType = -1;
7995 if (impactSpeed > 0.0)
7996 {
7998 #ifndef SERVER
8000 #else
8002 SetSynchDirty();
8003 #endif
8005 }
8006 }
8007
8008 #ifdef SERVER
8009 if (GetCompEM() && GetCompEM().IsPlugged())
8010 {
8011 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
8012 GetCompEM().UnplugThis();
8013 }
8014 #endif
8015 }
8016
8018
8020 {
8022 }
8023
8025 {
8026
8027 }
8028
8030 {
8031 super.OnItemLocationChanged(old_owner, new_owner);
8032
8033 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
8034 PlayerBase playerNew = PlayerBase.Cast(new_owner);
8035
8036 if (!relatedPlayer && playerNew)
8037 relatedPlayer = playerNew;
8038
8039 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
8040 {
8042 if (actionMgr)
8043 {
8044 ActionBase currentAction = actionMgr.GetRunningAction();
8045 if (currentAction)
8047 }
8048 }
8049
8050 Man ownerPlayerOld = null;
8051 Man ownerPlayerNew = null;
8052
8053 if (old_owner)
8054 {
8055 if (old_owner.
IsMan())
8056 {
8057 ownerPlayerOld = Man.Cast(old_owner);
8058 }
8059 else
8060 {
8061 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
8062 }
8063 }
8064 else
8065 {
8067 {
8069
8070 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
8071 {
8072 GetCompEM().UnplugThis();
8073 }
8074 }
8075 }
8076
8077 if (new_owner)
8078 {
8079 if (new_owner.
IsMan())
8080 {
8081 ownerPlayerNew = Man.Cast(new_owner);
8082 }
8083 else
8084 {
8085 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
8086 }
8087 }
8088
8089 if (ownerPlayerOld != ownerPlayerNew)
8090 {
8091 if (ownerPlayerOld)
8092 {
8093 array<EntityAI> subItemsExit = new array<EntityAI>;
8095 for (int i = 0; i < subItemsExit.Count(); i++)
8096 {
8099 }
8100 }
8101
8102 if (ownerPlayerNew)
8103 {
8104 array<EntityAI> subItemsEnter = new array<EntityAI>;
8106 for (int j = 0; j < subItemsEnter.Count(); j++)
8107 {
8110 }
8111 }
8112 }
8113 else if (ownerPlayerNew != null)
8114 {
8115 PlayerBase nplayer;
8116 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
8117 {
8118 array<EntityAI> subItemsUpdate = new array<EntityAI>;
8120 for (int k = 0; k < subItemsUpdate.Count(); k++)
8121 {
8123 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
8124 }
8125 }
8126 }
8127
8128 if (old_owner)
8129 old_owner.OnChildItemRemoved(this);
8130 if (new_owner)
8131 new_owner.OnChildItemReceived(this);
8132 }
8133
8134
8136 {
8137 super.EEDelete(parent);
8138 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
8139 if (player)
8140 {
8142
8143 if (player.IsAlive())
8144 {
8145 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8146 if (r_index >= 0)
8147 {
8148 InventoryLocation r_il = new InventoryLocation;
8149 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8150
8151 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8154 {
8155 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8156 }
8158 {
8159 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8160 }
8161
8162 }
8163
8164 player.RemoveQuickBarEntityShortcut(this);
8165 }
8166 }
8167 }
8168
8170 {
8171 super.EEKilled(killer);
8172
8175 {
8176 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
8177 {
8178 if (IsMagazine())
8179 {
8180 if (Magazine.Cast(this).GetAmmoCount() > 0)
8181 {
8183 }
8184 }
8185 else
8186 {
8188 }
8189 }
8190 }
8191 }
8192
8194 {
8195 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8196
8197 super.OnWasAttached(parent, slot_id);
8198
8201
8204 }
8205
8207 {
8208 super.OnWasDetached(parent, slot_id);
8209
8212
8215 }
8216
8218 {
8219 int idx;
8222
8223 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8224 if (inventory_slots.Count() < 1)
8225 {
8226 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
8227 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
8228 }
8229 else
8230 {
8231 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
8232 }
8233
8234 idx = inventory_slots.Find(slot);
8235 if (idx < 0)
8236 return "";
8237
8238 return attach_types.Get(idx);
8239 }
8240
8242 {
8243 int idx = -1;
8244 string slot;
8245
8248
8249 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8250 if (inventory_slots.Count() < 1)
8251 {
8252 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
8253 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8254 }
8255 else
8256 {
8257 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
8258 if (detach_types.Count() < 1)
8259 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8260 }
8261
8262 for (int i = 0; i < inventory_slots.Count(); i++)
8263 {
8264 slot = inventory_slots.Get(i);
8265 }
8266
8267 if (slot != "")
8268 {
8269 if (detach_types.Count() == 1)
8270 idx = 0;
8271 else
8272 idx = inventory_slots.Find(slot);
8273 }
8274 if (idx < 0)
8275 return "";
8276
8277 return detach_types.Get(idx);
8278 }
8279
8281 {
8282
8284
8285
8286 float min_time = 1;
8287 float max_time = 3;
8288 float delay = Math.RandomFloat(min_time, max_time);
8289
8290 explode_timer.Run(delay, this, "DoAmmoExplosion");
8291 }
8292
8294 {
8295 Magazine magazine = Magazine.Cast(this);
8296 int pop_sounds_count = 6;
8297 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
8298
8299
8300 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
8301 string sound_name = pop_sounds[ sound_idx ];
8302 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
8303
8304
8305 magazine.ServerAddAmmoCount(-1);
8306
8307
8308 float min_temp_to_explode = 100;
8309
8310 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
8311 {
8313 }
8314 }
8315
8316
8317 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
8318 {
8319 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
8320
8321 const int CHANCE_DAMAGE_CARGO = 4;
8322 const int CHANCE_DAMAGE_ATTACHMENT = 1;
8323 const int CHANCE_DAMAGE_NOTHING = 2;
8324
8326 {
8327 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
8328 int chances;
8329 int rnd;
8330
8331 if (GetInventory().GetCargo())
8332 {
8333 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8334 rnd = Math.RandomInt(0,chances);
8335
8336 if (rnd < CHANCE_DAMAGE_CARGO)
8337 {
8339 }
8340 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
8341 {
8343 }
8344 }
8345 else
8346 {
8347 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8348 rnd = Math.RandomInt(0,chances);
8349
8350 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
8351 {
8353 }
8354 }
8355 }
8356 }
8357
8359 {
8360 CargoBase cargo = GetInventory().GetCargo();
8361 if (cargo)
8362 {
8364 if (item_count > 0)
8365 {
8366 int random_pick = Math.RandomInt(0, item_count);
8368 if (!item.IsExplosive())
8369 {
8370 item.AddHealth("","",damage);
8371 return true;
8372 }
8373 }
8374 }
8375 return false;
8376 }
8377
8379 {
8380 GameInventory inventory = GetInventory();
8382 if (attachment_count > 0)
8383 {
8384 int random_pick = Math.RandomInt(0, attachment_count);
8386 if (!attachment.IsExplosive())
8387 {
8388 attachment.AddHealth("","",damage);
8389 return true;
8390 }
8391 }
8392 return false;
8393 }
8394
8396 {
8398 }
8399
8401 {
8403 return GetInventory().CanRemoveEntity();
8404
8405 return false;
8406 }
8407
8409 {
8410
8412 return false;
8413
8414
8416 return false;
8417
8418
8419
8421 if (delta == 0)
8422 return false;
8423
8424
8425 return true;
8426 }
8427
8429 {
8431 {
8432 if (ScriptInputUserData.CanStoreInputUserData())
8433 {
8434 ScriptInputUserData ctx = new ScriptInputUserData;
8439 ctx.
Write(destination_entity);
8443 }
8444 }
8445 else if (!
g_Game.IsMultiplayer())
8446 {
8448 }
8449 }
8450
8452 {
8453 float split_quantity_new;
8457 InventoryLocation loc = new InventoryLocation;
8458
8459 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8460 {
8462 split_quantity_new = stack_max;
8463 else
8465
8467 {
8468 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8469 if (new_item)
8470 {
8471 new_item.SetResultOfSplit(true);
8472 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8474 new_item.
SetQuantity(split_quantity_new,
false,
true);
8475 }
8476 }
8477 }
8478 else if (destination_entity && slot_id == -1)
8479 {
8480 if (quantity > stack_max)
8481 split_quantity_new = stack_max;
8482 else
8483 split_quantity_new = quantity;
8484
8486 {
8487 GameInventory destinationInventory = destination_entity.GetInventory();
8489 {
8492 }
8493
8494 if (new_item)
8495 {
8496 new_item.SetResultOfSplit(true);
8497 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8499 new_item.
SetQuantity(split_quantity_new,
false,
true);
8500 }
8501 }
8502 }
8503 else
8504 {
8505 if (stack_max != 0)
8506 {
8508 {
8510 }
8511
8512 if (split_quantity_new == 0)
8513 {
8514 if (!
g_Game.IsMultiplayer())
8515 player.PhysicalPredictiveDropItem(this);
8516 else
8517 player.ServerDropEntity(this);
8518 return;
8519 }
8520
8522 {
8524
8525 if (new_item)
8526 {
8527 new_item.SetResultOfSplit(true);
8528 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8531 new_item.PlaceOnSurface();
8532 }
8533 }
8534 }
8535 }
8536 }
8537
8539 {
8540 float split_quantity_new;
8544 InventoryLocation loc = new InventoryLocation;
8545
8546 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8547 {
8549 split_quantity_new = stack_max;
8550 else
8552
8554 {
8555 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8556 if (new_item)
8557 {
8558 new_item.SetResultOfSplit(true);
8559 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8561 new_item.
SetQuantity(split_quantity_new,
false,
true);
8562 }
8563 }
8564 }
8565 else if (destination_entity && slot_id == -1)
8566 {
8567 if (quantity > stack_max)
8568 split_quantity_new = stack_max;
8569 else
8570 split_quantity_new = quantity;
8571
8573 {
8574 GameInventory destinationInventory = destination_entity.GetInventory();
8576 {
8579 }
8580
8581 if (new_item)
8582 {
8583 new_item.SetResultOfSplit(true);
8584 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8586 new_item.
SetQuantity(split_quantity_new,
false,
true);
8587 }
8588 }
8589 }
8590 else
8591 {
8592 if (stack_max != 0)
8593 {
8595 {
8597 }
8598
8600 {
8602
8603 if (new_item)
8604 {
8605 new_item.SetResultOfSplit(true);
8606 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8609 new_item.PlaceOnSurface();
8610 }
8611 }
8612 }
8613 }
8614 }
8615
8617 {
8619 {
8620 if (ScriptInputUserData.CanStoreInputUserData())
8621 {
8622 ScriptInputUserData ctx = new ScriptInputUserData;
8627 dst.WriteToContext(ctx);
8629 }
8630 }
8631 else if (!
g_Game.IsMultiplayer())
8632 {
8634 }
8635 }
8636
8638 {
8640 {
8641 if (ScriptInputUserData.CanStoreInputUserData())
8642 {
8643 ScriptInputUserData ctx = new ScriptInputUserData;
8648 ctx.
Write(destination_entity);
8654 }
8655 }
8656 else if (!
g_Game.IsMultiplayer())
8657 {
8659 }
8660 }
8661
8663 {
8665 }
8666
8668 {
8670 float split_quantity_new;
8672 if (dst.IsValid())
8673 {
8674 int slot_id = dst.GetSlot();
8676
8677 if (quantity > stack_max)
8678 split_quantity_new = stack_max;
8679 else
8680 split_quantity_new = quantity;
8681
8683 {
8685
8686 if (new_item)
8687 {
8688 new_item.SetResultOfSplit(true);
8689 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8691 new_item.
SetQuantity(split_quantity_new,
false,
true);
8692 }
8693
8694 return new_item;
8695 }
8696 }
8697
8698 return null;
8699 }
8700
8702 {
8704 float split_quantity_new;
8706 if (destination_entity)
8707 {
8709 if (quantity > stackable)
8710 split_quantity_new = stackable;
8711 else
8712 split_quantity_new = quantity;
8713
8715 {
8716 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
8717 if (new_item)
8718 {
8719 new_item.SetResultOfSplit(true);
8720 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8722 new_item.
SetQuantity(split_quantity_new,
false,
true);
8723 }
8724 }
8725 }
8726 }
8727
8729 {
8731 {
8732 if (ScriptInputUserData.CanStoreInputUserData())
8733 {
8734 ScriptInputUserData ctx = new ScriptInputUserData;
8739 ItemBase destination_entity =
this;
8740 ctx.
Write(destination_entity);
8744 }
8745 }
8746 else if (!
g_Game.IsMultiplayer())
8747 {
8749 }
8750 }
8751
8753 {
8755 float split_quantity_new;
8757 if (player)
8758 {
8760 if (quantity > stackable)
8761 split_quantity_new = stackable;
8762 else
8763 split_quantity_new = quantity;
8764
8766 {
8767 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
8768 new_item =
ItemBase.Cast(in_hands);
8769 if (new_item)
8770 {
8771 new_item.SetResultOfSplit(true);
8772 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8774 new_item.SetQuantity(split_quantity_new, false, true);
8775 }
8776 }
8777 }
8778 }
8779
8781 {
8783 float split_quantity_new = Math.Floor(quantity * 0.5);
8784
8786 return;
8787
8789
8790 if (new_item)
8791 {
8792 if (new_item.GetQuantityMax() < split_quantity_new)
8793 {
8794 split_quantity_new = new_item.GetQuantityMax();
8795 }
8796
8797 new_item.SetResultOfSplit(true);
8798 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8799
8801 {
8804 }
8805 else
8806 {
8808 new_item.
SetQuantity(split_quantity_new,
false,
true);
8809 }
8810 }
8811 }
8812
8814 {
8816 float split_quantity_new = Math.Floor(quantity / 2);
8817
8819 return;
8820
8821 InventoryLocation invloc = new InventoryLocation;
8823
8825 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
8826
8827 if (new_item)
8828 {
8829 if (new_item.GetQuantityMax() < split_quantity_new)
8830 {
8831 split_quantity_new = new_item.GetQuantityMax();
8832 }
8834 {
8837 }
8838 else if (split_quantity_new > 1)
8839 {
8841 new_item.
SetQuantity(split_quantity_new,
false,
true);
8842 }
8843 }
8844 }
8845
8848 {
8849 SetWeightDirty();
8851
8852 if (parent)
8853 parent.OnAttachmentQuantityChangedEx(this, delta);
8854
8856 {
8858 {
8860 }
8862 {
8863 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
8865 }
8866 }
8867 }
8868
8871 {
8872
8873 }
8874
8877 {
8879 }
8880
8882 {
8883 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
8884
8886 {
8887 if (newLevel == GameConstants.STATE_RUINED)
8888 {
8890 EntityAI parent = GetHierarchyParent();
8891 if (parent && parent.IsFireplace())
8892 {
8893 CargoBase cargo = GetInventory().GetCargo();
8894 if (cargo)
8895 {
8897 {
8899 }
8900 }
8901 }
8902 }
8903
8905 {
8906
8908 return;
8909 }
8910
8911 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
8912 {
8914 }
8915 }
8916 }
8917
8918
8920 {
8921 super.OnRightClick();
8922
8924 {
8926 {
8927 if (ScriptInputUserData.CanStoreInputUserData())
8928 {
8929 EntityAI root = GetHierarchyRoot();
8930 Man playerOwner = GetHierarchyRootPlayer();
8931 InventoryLocation dst = new InventoryLocation;
8932
8933
8934 if (!playerOwner && root && root == this)
8935 {
8937 }
8938 else
8939 {
8940
8941 GetInventory().GetCurrentInventoryLocation(dst);
8943 {
8944 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8946 {
8948 }
8949 else
8950 {
8952
8953
8954 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
8955 {
8957 }
8958 else
8959 {
8960 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
8961 }
8962 }
8963 }
8964 }
8965
8966 ScriptInputUserData ctx = new ScriptInputUserData;
8974 }
8975 }
8976 else if (!
g_Game.IsMultiplayer())
8977 {
8979 }
8980 }
8981 }
8982
8984 {
8985 if (root)
8986 {
8987 vector m4[4];
8988 root.GetTransform(m4);
8989 dst.SetGround(this, m4);
8990 }
8991 else
8992 {
8993 GetInventory().GetCurrentInventoryLocation(dst);
8994 }
8995 }
8996
8997 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
8998 {
8999
9000 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
9001 return false;
9002
9003 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
9004 return false;
9005
9006
9008 return false;
9009
9010
9011 Magazine mag = Magazine.Cast(this);
9012 if (mag)
9013 {
9014 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
9015 return false;
9016
9017 if (stack_max_limit)
9018 {
9019 Magazine other_mag = Magazine.Cast(other_item);
9020 if (other_item)
9021 {
9022 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
9023 return false;
9024 }
9025
9026 }
9027 }
9028 else
9029 {
9030
9032 return false;
9033
9035 return false;
9036 }
9037
9038 PlayerBase player = null;
9039 if (CastTo(player, GetHierarchyRootPlayer()))
9040 {
9041 if (player.GetInventory().HasAttachment(this))
9042 return false;
9043
9044 if (player.IsItemsToDelete())
9045 return false;
9046 }
9047
9048 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
9049 return false;
9050
9051 int slotID;
9053 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
9054 return false;
9055
9056 return true;
9057 }
9058
9060 {
9062 }
9063
9065 {
9066 return m_IsResultOfSplit;
9067 }
9068
9070 {
9071 m_IsResultOfSplit = value;
9072 }
9073
9075 {
9077 }
9078
9080 {
9081 float other_item_quantity = other_item.GetQuantity();
9082 float this_free_space;
9083
9085
9087
9088 if (other_item_quantity > this_free_space)
9089 {
9090 return this_free_space;
9091 }
9092 else
9093 {
9094 return other_item_quantity;
9095 }
9096 }
9097
9099 {
9101 }
9102
9104 {
9106 return;
9107
9108 if (!IsMagazine() && other_item)
9109 {
9111 if (quantity_used != 0)
9112 {
9113 float hp1 = GetHealth01("","");
9114 float hp2 = other_item.GetHealth01("","");
9115 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
9116 hpResult = hpResult / (
GetQuantity() + quantity_used);
9117
9118 hpResult *= GetMaxHealth();
9119 Math.Round(hpResult);
9120 SetHealth("", "Health", hpResult);
9121
9123 other_item.AddQuantity(-quantity_used);
9124 }
9125 }
9127 }
9128
9130 {
9131 #ifdef SERVER
9132 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
9133 GetHierarchyParent().IncreaseLifetimeUp();
9134 #endif
9135 };
9136
9138 {
9139 PlayerBase p = PlayerBase.Cast(player);
9140
9141 array<int> recipesIds = p.m_Recipes;
9142 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9143 if (moduleRecipesManager)
9144 {
9145 EntityAI itemInHands = player.GetEntityInHands();
9146 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
9147 }
9148
9149 for (int i = 0;i < recipesIds.Count(); i++)
9150 {
9151 int key = recipesIds.Get(i);
9152 string recipeName = moduleRecipesManager.GetRecipeName(key);
9154 }
9155 }
9156
9157
9158 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
9159 {
9160 super.GetDebugActions(outputList);
9161
9162
9168
9169
9174
9179
9180
9184
9185
9187 {
9191 }
9192
9195
9196
9200
9202
9203 InventoryLocation loc = new InventoryLocation();
9204 GetInventory().GetCurrentInventoryLocation(loc);
9206 {
9207 if (Gizmo_IsSupported())
9210 }
9211
9213 }
9214
9215
9216
9217
9219 {
9220 super.OnAction(action_id, player, ctx);
9221
9223 {
9224 switch (action_id)
9225 {
9229 return true;
9233 return true;
9234 }
9235 }
9236
9238 {
9239 switch (action_id)
9240 {
9242 Delete();
9243 return true;
9244 }
9245 }
9246
9247 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
9248 {
9249 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9250 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
9251 PlayerBase p = PlayerBase.Cast(player);
9252 if (
EActions.RECIPES_RANGE_START < 1000)
9253 {
9254 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
9255 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
9256 }
9257 }
9258 #ifndef SERVER
9259 else if (action_id ==
EActions.WATCH_PLAYER)
9260 {
9261 PluginDeveloper.SetDeveloperItemClientEx(player);
9262 }
9263 #endif
9265 {
9266 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
9267 {
9268 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
9269 OnDebugButtonPressServer(id + 1);
9270 }
9271
9272 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
9273 {
9274 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
9276 }
9277
9278 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
9279 {
9280 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
9282 }
9283
9284 else if (action_id ==
EActions.ADD_QUANTITY)
9285 {
9286 if (IsMagazine())
9287 {
9288 Magazine mag = Magazine.Cast(this);
9289 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
9290 }
9291 else
9292 {
9294 }
9295
9296 if (m_EM)
9297 {
9298 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
9299 }
9300
9301 }
9302
9303 else if (action_id ==
EActions.REMOVE_QUANTITY)
9304 {
9305 if (IsMagazine())
9306 {
9307 Magazine mag2 = Magazine.Cast(this);
9308 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
9309 }
9310 else
9311 {
9313 }
9314 if (m_EM)
9315 {
9316 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
9317 }
9318
9319 }
9320
9321 else if (action_id ==
EActions.SET_QUANTITY_0)
9322 {
9324
9325 if (m_EM)
9326 {
9327 m_EM.SetEnergy(0);
9328 }
9329 }
9330
9331 else if (action_id ==
EActions.SET_MAX_QUANTITY)
9332 {
9334
9335 if (m_EM)
9336 {
9337 m_EM.SetEnergy(m_EM.GetEnergyMax());
9338 }
9339 }
9340
9341 else if (action_id ==
EActions.ADD_HEALTH)
9342 {
9343 AddHealth("","",GetMaxHealth("","Health")/5);
9344 }
9345 else if (action_id ==
EActions.REMOVE_HEALTH)
9346 {
9347 AddHealth("","",-GetMaxHealth("","Health")/5);
9348 }
9349 else if (action_id ==
EActions.DESTROY_HEALTH)
9350 {
9351 SetHealth01("","",0);
9352 }
9353 else if (action_id ==
EActions.WATCH_ITEM)
9354 {
9356 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
9357 #ifdef DEVELOPER
9358 SetDebugDeveloper_item(this);
9359 #endif
9360 }
9361
9362 else if (action_id ==
EActions.ADD_TEMPERATURE)
9363 {
9364 AddTemperature(20);
9365
9366 }
9367
9368 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
9369 {
9370 AddTemperature(-20);
9371
9372 }
9373
9374 else if (action_id ==
EActions.FLIP_FROZEN)
9375 {
9376 SetFrozen(!GetIsFrozen());
9377
9378 }
9379
9380 else if (action_id ==
EActions.ADD_WETNESS)
9381 {
9383
9384 }
9385
9386 else if (action_id ==
EActions.REMOVE_WETNESS)
9387 {
9389
9390 }
9391
9392 else if (action_id ==
EActions.LIQUIDTYPE_UP)
9393 {
9396
9397
9398 }
9399
9400 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
9401 {
9404 }
9405
9406 else if (action_id ==
EActions.MAKE_SPECIAL)
9407 {
9408 auto debugParams = DebugSpawnParams.WithPlayer(player);
9409 OnDebugSpawnEx(debugParams);
9410 }
9411
9412 }
9413
9414
9415 return false;
9416 }
9417
9418
9419
9420
9424
9427
9428
9429
9431 {
9432 return false;
9433 }
9434
9435
9437 {
9438 return true;
9439 }
9440
9441
9443 {
9444 return true;
9445 }
9446
9447
9448
9450 {
9451 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
9452 return g_Game.ConfigIsExisting(config_path);
9453 }
9454
9457 {
9458 return null;
9459 }
9460
9462 {
9463 return false;
9464 }
9465
9467 {
9468 return false;
9469 }
9470
9474
9475
9477 {
9478 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9479 return module_repairing.CanRepair(this, item_repair_kit);
9480 }
9481
9482
9483 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
9484 {
9485 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9486 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
9487 }
9488
9489
9491 {
9492
9493
9494
9495
9496
9497
9498
9499
9500 return 1;
9501 }
9502
9503
9504
9506 {
9508 }
9509
9510
9511
9513 {
9515 }
9516
9517
9526 {
9527 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9528
9529 if (player)
9530 {
9531 player.MessageStatus(text);
9532 }
9533 }
9534
9535
9544 {
9545 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9546
9547 if (player)
9548 {
9549 player.MessageAction(text);
9550 }
9551 }
9552
9553
9562 {
9563 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9564
9565 if (player)
9566 {
9567 player.MessageFriendly(text);
9568 }
9569 }
9570
9571
9580 {
9581 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9582
9583 if (player)
9584 {
9585 player.MessageImportant(text);
9586 }
9587 }
9588
9590 {
9591 return true;
9592 }
9593
9594
9595 override bool KindOf(
string tag)
9596 {
9597 bool found = false;
9598 string item_name = this.
GetType();
9600 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
9601
9602 int array_size = item_tag_array.Count();
9603 for (int i = 0; i < array_size; i++)
9604 {
9605 if (item_tag_array.Get(i) == tag)
9606 {
9607 found = true;
9608 break;
9609 }
9610 }
9611 return found;
9612 }
9613
9614
9616 {
9617
9618 super.OnRPC(sender, rpc_type,ctx);
9619
9620
9621 switch (rpc_type)
9622 {
9623 #ifndef SERVER
9624 case ERPCs.RPC_SOUND_LOCK_ATTACH:
9625 Param2<bool, string> p = new Param2<bool, string>(false, "");
9626
9628 return;
9629
9630 bool play = p.param1;
9631 string soundSet = p.param2;
9632
9633 if (play)
9634 {
9636 {
9638 {
9640 }
9641 }
9642 else
9643 {
9645 }
9646 }
9647 else
9648 {
9650 }
9651
9652 break;
9653 #endif
9654
9655 }
9656
9658 {
9660 }
9661 }
9662
9663
9664
9665
9667 {
9668 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9669 return plugin.GetID(
name);
9670 }
9671
9673 {
9674 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9675 return plugin.GetName(id);
9676 }
9677
9680 {
9681
9682
9683 int varFlags;
9684 if (!ctx.
Read(varFlags))
9685 return;
9686
9687 if (varFlags & ItemVariableFlags.FLOAT)
9688 {
9690 }
9691 }
9692
9694 {
9695
9696 super.SerializeNumericalVars(floats_out);
9697
9698
9699
9701 {
9703 }
9704
9706 {
9708 }
9709
9711 {
9713 }
9714
9716 {
9721 }
9722
9724 {
9726 }
9727 }
9728
9730 {
9731
9732 super.DeSerializeNumericalVars(floats);
9733
9734
9735 int index = 0;
9736 int mask = Math.Round(floats.Get(index));
9737
9738 index++;
9739
9741 {
9743 {
9745 }
9746 else
9747 {
9748 float quantity = floats.Get(index);
9750 }
9751 index++;
9752 }
9753
9755 {
9756 float wet = floats.Get(index);
9758 index++;
9759 }
9760
9762 {
9763 int liquidtype = Math.Round(floats.Get(index));
9765 index++;
9766 }
9767
9769 {
9771 index++;
9773 index++;
9775 index++;
9777 index++;
9778 }
9779
9781 {
9782 int cleanness = Math.Round(floats.Get(index));
9784 index++;
9785 }
9786 }
9787
9789 {
9790 super.WriteVarsToCTX(ctx);
9791
9792
9794 {
9796 }
9797
9799 {
9801 }
9802
9804 {
9806 }
9807
9809 {
9810 int r,g,b,a;
9816 }
9817
9819 {
9821 }
9822 }
9823
9825 {
9826 if (!super.ReadVarsFromCTX(ctx,version))
9827 return false;
9828
9829 int intValue;
9830 float value;
9831
9832 if (version < 140)
9833 {
9834 if (!ctx.
Read(intValue))
9835 return false;
9836
9837 m_VariablesMask = intValue;
9838 }
9839
9841 {
9842 if (!ctx.
Read(value))
9843 return false;
9844
9846 {
9848 }
9849 else
9850 {
9852 }
9853 }
9854
9855 if (version < 140)
9856 {
9858 {
9859 if (!ctx.
Read(value))
9860 return false;
9861 SetTemperatureDirect(value);
9862 }
9863 }
9864
9866 {
9867 if (!ctx.
Read(value))
9868 return false;
9870 }
9871
9873 {
9874 if (!ctx.
Read(intValue))
9875 return false;
9877 }
9878
9880 {
9881 int r,g,b,a;
9883 return false;
9885 return false;
9887 return false;
9889 return false;
9890
9892 }
9893
9895 {
9896 if (!ctx.
Read(intValue))
9897 return false;
9899 }
9900
9901 if (version >= 138 && version < 140)
9902 {
9904 {
9905 if (!ctx.
Read(intValue))
9906 return false;
9907 SetFrozen(intValue);
9908 }
9909 }
9910
9911 return true;
9912 }
9913
9914
9916 {
9919 {
9921 }
9922
9923 if (!super.OnStoreLoad(ctx, version))
9924 {
9926 return false;
9927 }
9928
9929 if (version >= 114)
9930 {
9931 bool hasQuickBarIndexSaved;
9932
9933 if (!ctx.
Read(hasQuickBarIndexSaved))
9934 {
9936 return false;
9937 }
9938
9939 if (hasQuickBarIndexSaved)
9940 {
9941 int itmQBIndex;
9942
9943
9944 if (!ctx.
Read(itmQBIndex))
9945 {
9947 return false;
9948 }
9949
9950 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
9951 if (itmQBIndex != -1 && parentPlayer)
9952 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
9953 }
9954 }
9955 else
9956 {
9957
9958 PlayerBase player;
9959 int itemQBIndex;
9960 if (version ==
int.
MAX)
9961 {
9962 if (!ctx.
Read(itemQBIndex))
9963 {
9965 return false;
9966 }
9967 }
9968 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
9969 {
9970
9971 if (!ctx.
Read(itemQBIndex))
9972 {
9974 return false;
9975 }
9976 if (itemQBIndex != -1 && player)
9977 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
9978 }
9979 }
9980
9981 if (version < 140)
9982 {
9983
9984 if (!LoadVariables(ctx, version))
9985 {
9987 return false;
9988 }
9989 }
9990
9991
9993 {
9995 return false;
9996 }
9997 if (version >= 132)
9998 {
10000 if (raib)
10001 {
10003 {
10005 return false;
10006 }
10007 }
10008 }
10009
10011 return true;
10012 }
10013
10014
10015
10017 {
10018 super.OnStoreSave(ctx);
10019
10020 PlayerBase player;
10021 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
10022 {
10024
10025 int itemQBIndex = -1;
10026 itemQBIndex = player.FindQuickBarEntityIndex(this);
10027 ctx.
Write(itemQBIndex);
10028 }
10029 else
10030 {
10032 }
10033
10035
10037 if (raib)
10038 {
10040 }
10041 }
10042
10043
10045 {
10046 super.AfterStoreLoad();
10047
10049 {
10051 }
10052
10054 {
10057 }
10058 }
10059
10061 {
10062 super.EEOnAfterLoad();
10063
10065 {
10067 }
10068
10071 }
10072
10074 {
10075 return false;
10076 }
10077
10078
10079
10081 {
10083 {
10084 #ifdef PLATFORM_CONSOLE
10085
10087 {
10089 if (menu)
10090 {
10092 }
10093 }
10094 #endif
10095 }
10096
10098 {
10101 }
10102
10104 {
10105 SetWeightDirty();
10107 }
10109 {
10112 }
10113
10115 {
10118
10121 }
10123 {
10127 }
10128
10129 super.OnVariablesSynchronized();
10130 }
10131
10132
10133
10135 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
10136 {
10137 if (!IsServerCheck(allow_client))
10138 return false;
10139
10141 return false;
10142
10145
10146 if (value <= (min + 0.001))
10147 value = min;
10148
10149 if (value == min)
10150 {
10151 if (destroy_config)
10152 {
10153 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
10154 if (dstr)
10155 {
10157 this.Delete();
10158 return true;
10159 }
10160 }
10161 else if (destroy_forced)
10162 {
10164 this.Delete();
10165 return true;
10166 }
10167
10169 }
10170
10173
10175 {
10176 EntityAI parent = GetHierarchyRoot();
10177 InventoryLocation iLoc = new InventoryLocation();
10178 GetInventory().GetCurrentInventoryLocation(iLoc);
10180 {
10181 int iLocSlot = iLoc.
GetSlot();
10183 {
10185 }
10187 {
10189 }
10190 }
10191 }
10192
10194 {
10196
10197 if (delta)
10199 }
10200
10202
10203 return false;
10204 }
10205
10206
10208 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10209 {
10211 }
10212
10214 {
10217 }
10218
10220 {
10223 }
10224
10226 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10227 {
10228 float value_clamped = Math.Clamp(value, 0, 1);
10230 SetQuantity(result, destroy_config, destroy_forced);
10231 }
10232
10233
10236 {
10238 }
10239
10241 {
10243 }
10244
10245
10246
10247
10248
10249
10250
10251
10252
10253
10255 {
10256 int slot = -1;
10257 GameInventory inventory = GetInventory();
10258 if (inventory)
10259 {
10260 InventoryLocation il = new InventoryLocation;
10263 }
10264
10266 }
10267
10269 {
10270 float quantity_max = 0;
10271
10273 {
10274 if (attSlotID != -1)
10275 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
10276
10277 if (quantity_max <= 0)
10279 }
10280
10281 if (quantity_max <= 0)
10283
10284 return quantity_max;
10285 }
10286
10288 {
10290 }
10291
10293 {
10295 }
10296
10297
10299 {
10301 }
10302
10304 {
10306 }
10307
10309 {
10311 }
10312
10313
10315 {
10316
10317 float weightEx = GetWeightEx();
10318 float special = GetInventoryAndCargoWeight();
10319 return weightEx - special;
10320 }
10321
10322
10324 {
10326 }
10327
10329 {
10331 {
10332 #ifdef DEVELOPER
10333 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10334 {
10335 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
10337 }
10338 #endif
10339
10340 return GetQuantity() * GetConfigWeightModified();
10341 }
10342 else if (HasEnergyManager())
10343 {
10344 #ifdef DEVELOPER
10345 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10346 {
10347 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
10348 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
10349 }
10350 #endif
10351 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
10352 }
10353 else
10354 {
10355 #ifdef DEVELOPER
10356 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10357 {
10358 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
10359 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
10360 }
10361 #endif
10362 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
10363 }
10364 }
10365
10368 {
10369 int item_count = 0;
10371
10372 GameInventory inventory = GetInventory();
10373 CargoBase cargo = inventory.
GetCargo();
10374 if (cargo != NULL)
10375 {
10377 }
10378
10380 for (int i = 0; i < nAttachments; ++i)
10381 {
10383 if (item)
10384 item_count += item.GetNumberOfItems();
10385 }
10386 return item_count;
10387 }
10388
10391 {
10392 float weight = 0;
10393 float wetness = 1;
10394 if (include_wetness)
10397 {
10398 weight = wetness * m_ConfigWeight;
10399 }
10401 {
10402 weight = 1;
10403 }
10404 return weight;
10405 }
10406
10407
10408
10410 {
10411 GameInventory inventory = GetInventory();
10412 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
10413 {
10414 array<EntityAI> items = new array<EntityAI>;
10416 for (int i = 0; i < items.Count(); ++i)
10417 {
10419 if (item)
10420 {
10421 g_Game.ObjectDelete(item);
10422 }
10423 }
10424 }
10425 }
10426
10427
10428
10429
10431 {
10432 float energy = 0;
10433 if (HasEnergyManager())
10434 {
10435 energy = GetCompEM().GetEnergy();
10436 }
10437 return energy;
10438 }
10439
10440
10442 {
10443 super.OnEnergyConsumed();
10444
10446 }
10447
10449 {
10450 super.OnEnergyAdded();
10451
10453 }
10454
10455
10457 {
10458 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
10459 {
10461 {
10462 float energy_0to1 = GetCompEM().GetEnergy0To1();
10464 }
10465 }
10466 }
10467
10468
10470 {
10471 return ConfigGetFloat("heatIsolation");
10472 }
10473
10475 {
10477 }
10478
10480 {
10481 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
10482 if (
g_Game.ConfigIsExisting(paramPath))
10483 return g_Game.ConfigGetFloat(paramPath);
10484
10485 return 0.0;
10486 }
10487
10489 {
10490 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
10491 if (
g_Game.ConfigIsExisting(paramPath))
10492 return g_Game.ConfigGetFloat(paramPath);
10493
10494 return 0.0;
10495 }
10496
10497 override void SetWet(
float value,
bool allow_client =
false)
10498 {
10499 if (!IsServerCheck(allow_client))
10500 return;
10501
10504
10506
10507 m_VarWet = Math.Clamp(value, min, max);
10508
10510 {
10513 }
10514 }
10515
10516 override void AddWet(
float value)
10517 {
10519 }
10520
10522 {
10524 }
10525
10527 {
10529 }
10530
10532 {
10534 }
10535
10537 {
10539 }
10540
10542 {
10544 }
10545
10546 override void OnWetChanged(
float newVal,
float oldVal)
10547 {
10550 if (newLevel != oldLevel)
10551 {
10553 }
10554 }
10555
10557 {
10558 SetWeightDirty();
10559 }
10560
10562 {
10563 return GetWetLevelInternal(
m_VarWet);
10564 }
10565
10566
10567
10569 {
10571 }
10572
10574 {
10576 }
10577
10579 {
10581 }
10582
10584 {
10586 }
10587
10588
10589
10591 {
10592 if (ConfigIsExisting("itemModelLength"))
10593 {
10594 return ConfigGetFloat("itemModelLength");
10595 }
10596 return 0;
10597 }
10598
10600 {
10601 if (ConfigIsExisting("itemAttachOffset"))
10602 {
10603 return ConfigGetFloat("itemAttachOffset");
10604 }
10605 return 0;
10606 }
10607
10608 override void SetCleanness(
int value,
bool allow_client =
false)
10609 {
10610 if (!IsServerCheck(allow_client))
10611 return;
10612
10614
10616
10619 }
10620
10622 {
10624 }
10625
10627 {
10628 return true;
10629 }
10630
10631
10632
10633
10635 {
10637 }
10638
10640 {
10642 }
10643
10644
10645
10646
10647 override void SetColor(
int r,
int g,
int b,
int a)
10648 {
10654 }
10656 override void GetColor(out
int r,out
int g,out
int b,out
int a)
10657 {
10662 }
10663
10665 {
10667 }
10668
10671 {
10672 int r,g,b,a;
10674 r = r/255;
10675 g = g/255;
10676 b = b/255;
10677 a = a/255;
10678 return MiscGameplayFunctions.GetColorString(r, g, b, a);
10679 }
10680
10681
10682
10683 override void SetLiquidType(
int value,
bool allow_client =
false)
10684 {
10685 if (!IsServerCheck(allow_client))
10686 return;
10687
10692 }
10693
10695 {
10696 return ConfigGetInt("varLiquidTypeInit");
10697 }
10698
10700 {
10702 }
10703
10705 {
10707 SetFrozen(false);
10708 }
10709
10712 {
10713 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10714 }
10715
10716
10719 {
10720 PlayerBase nplayer;
10721 if (PlayerBase.CastTo(nplayer, player))
10722 {
10724 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10725 }
10726 }
10727
10728
10731 {
10732 PlayerBase nplayer;
10733 if (PlayerBase.CastTo(nplayer,player))
10734 {
10735 nplayer.SetEnableQuickBarEntityShortcut(this, false);
10736 }
10737
10738 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
10739
10740 if (HasEnergyManager())
10741 {
10742 GetCompEM().UpdatePlugState();
10743 }
10744 }
10745
10746
10748 {
10749 super.OnPlacementStarted(player);
10750
10752 }
10753
10754 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
10755 {
10757 {
10758 m_AdminLog.OnPlacementComplete(player,
this);
10759 }
10760
10761 super.OnPlacementComplete(player, position, orientation);
10762 }
10763
10764
10765
10766
10767
10769 {
10771 {
10772 return true;
10773 }
10774 else
10775 {
10776 return false;
10777 }
10778 }
10779
10780
10782 {
10784 {
10786 }
10787 }
10788
10789
10791 {
10793 }
10794
10796 {
10798 }
10799
10800 override void InsertAgent(
int agent,
float count = 1)
10801 {
10802 if (count < 1)
10803 return;
10804
10806 }
10807
10810 {
10812 }
10813
10814
10816 {
10818 }
10819
10820
10821
10822
10823
10824
10825
10826
10827
10828
10829
10830
10831
10832
10833
10834
10835
10836
10837
10838
10839
10840
10841
10842
10843
10844
10845
10846
10847
10848
10849
10850
10851
10852
10853
10854
10855
10856
10857
10858
10859
10860
10862 {
10864 return false;
10865 return true;
10866 }
10867
10869 {
10870
10872 }
10873
10874
10877 {
10878 super.CheckForRoofLimited(timeTresholdMS);
10879
10880 float time =
g_Game.GetTime();
10881 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
10882 {
10883 m_PreviousRoofTestTime = time;
10884 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
10885 }
10886 }
10887
10888
10890 {
10892 {
10893 return 0;
10894 }
10895
10896 if (GetInventory().GetAttachmentSlotsCount() != 0)
10897 {
10898 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
10899 if (filter)
10900 return filter.GetProtectionLevel(type, false, system);
10901 else
10902 return 0;
10903 }
10904
10905 string subclassPath, entryName;
10906
10907 switch (type)
10908 {
10910 entryName = "biological";
10911 break;
10913 entryName = "chemical";
10914 break;
10915 default:
10916 entryName = "biological";
10917 break;
10918 }
10919
10920 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
10921
10922 return g_Game.ConfigGetFloat(subclassPath + entryName);
10923 }
10924
10925
10926
10929 {
10930 if (!IsMagazine())
10932
10934 }
10935
10936
10937
10938
10939
10944 {
10945 return true;
10946 }
10947
10949 {
10951 }
10952
10953
10954
10955
10956
10958 {
10959 if (parent)
10960 {
10961 if (parent.IsInherited(DayZInfected))
10962 return true;
10963
10964 if (!parent.IsRuined())
10965 return true;
10966 }
10967
10968 return true;
10969 }
10970
10972 {
10973 if (!super.CanPutAsAttachment(parent))
10974 {
10975 return false;
10976 }
10977
10978 if (!IsRuined() && !parent.IsRuined())
10979 {
10980 return true;
10981 }
10982
10983 return false;
10984 }
10985
10987 {
10988
10989
10990
10991
10992 return super.CanReceiveItemIntoCargo(item);
10993 }
10994
10996 {
10997
10998
10999
11000
11001 GameInventory attachmentInv = attachment.GetInventory();
11003 {
11004 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
11005 return false;
11006 }
11007
11008 InventoryLocation loc = new InventoryLocation();
11009 attachment.GetInventory().GetCurrentInventoryLocation(loc);
11010 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
11011 return false;
11012
11013 return super.CanReceiveAttachment(attachment, slotId);
11014 }
11015
11017 {
11018 if (!super.CanReleaseAttachment(attachment))
11019 return false;
11020
11021 return GetInventory().AreChildrenAccessible();
11022 }
11023
11024
11025
11026
11027
11028
11029
11030
11031
11032
11033
11034
11035
11036
11037
11038
11039
11040
11041
11042
11043
11045 {
11046 int id = muzzle_owner.GetMuzzleID();
11047 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
11048
11049 if (WPOF_array)
11050 {
11051 for (int i = 0; i < WPOF_array.Count(); i++)
11052 {
11053 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
11054
11055 if (WPOF)
11056 {
11057 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
11058 }
11059 }
11060 }
11061 }
11062
11063
11065 {
11066 int id = muzzle_owner.GetMuzzleID();
11068
11069 if (WPOBE_array)
11070 {
11071 for (int i = 0; i < WPOBE_array.Count(); i++)
11072 {
11073 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
11074
11075 if (WPOBE)
11076 {
11077 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11078 }
11079 }
11080 }
11081 }
11082
11083
11085 {
11086 int id = muzzle_owner.GetMuzzleID();
11087 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11088
11089 if (WPOOH_array)
11090 {
11091 for (int i = 0; i < WPOOH_array.Count(); i++)
11092 {
11093 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11094
11095 if (WPOOH)
11096 {
11097 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11098 }
11099 }
11100 }
11101 }
11102
11103
11105 {
11106 int id = muzzle_owner.GetMuzzleID();
11107 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11108
11109 if (WPOOH_array)
11110 {
11111 for (int i = 0; i < WPOOH_array.Count(); i++)
11112 {
11113 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11114
11115 if (WPOOH)
11116 {
11117 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11118 }
11119 }
11120 }
11121 }
11122
11123
11125 {
11126 int id = muzzle_owner.GetMuzzleID();
11127 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11128
11129 if (WPOOH_array)
11130 {
11131 for (int i = 0; i < WPOOH_array.Count(); i++)
11132 {
11133 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11134
11135 if (WPOOH)
11136 {
11137 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11138 }
11139 }
11140 }
11141 }
11142
11143
11144
11146 {
11148 {
11149 return true;
11150 }
11151
11152 return false;
11153 }
11154
11156 {
11158 {
11159 return true;
11160 }
11161
11162 return false;
11163 }
11164
11166 {
11168 {
11169 return true;
11170 }
11171
11172 return false;
11173 }
11174
11176 {
11177 return false;
11178 }
11179
11182 {
11183 return UATimeSpent.DEFAULT_DEPLOY;
11184 }
11185
11186
11187
11188
11190 {
11192 SetSynchDirty();
11193 }
11194
11196 {
11198 }
11199
11200
11202 {
11203 return false;
11204 }
11205
11208 {
11209 string att_type = "None";
11210
11211 if (ConfigIsExisting("soundAttType"))
11212 {
11213 att_type = ConfigGetString("soundAttType");
11214 }
11215
11217 }
11218
11220 {
11222 }
11223
11224
11225
11226
11227
11233
11235 {
11238
11240 }
11241
11242
11244 {
11246 return;
11247
11249
11252
11255
11256 SoundParameters params = new SoundParameters();
11260 }
11261
11262
11264 {
11266 {
11269
11270 SetSynchDirty();
11271
11274 }
11275 }
11276
11278 {
11280 }
11281
11282
11284 {
11286 return;
11287
11289 SetSynchDirty();
11290
11293 }
11294
11296 {
11299 }
11300
11302 {
11304 }
11305
11306 void OnApply(PlayerBase player);
11307
11309 {
11310 return 1.0;
11311 };
11312
11314 {
11316 }
11317
11319 {
11321 }
11322
11324
11326 {
11327 SetDynamicPhysicsLifeTime(0.01);
11329 }
11330
11332 {
11333 array<string> zone_names = new array<string>;
11334 GetDamageZones(zone_names);
11335 for (int i = 0; i < zone_names.Count(); i++)
11336 {
11337 SetHealthMax(zone_names.Get(i),"Health");
11338 }
11339 SetHealthMax("","Health");
11340 }
11341
11344 {
11345 float global_health = GetHealth01("","Health");
11346 array<string> zones = new array<string>;
11347 GetDamageZones(zones);
11348
11349 for (int i = 0; i < zones.Count(); i++)
11350 {
11351 SetHealth01(zones.Get(i),"Health",global_health);
11352 }
11353 }
11354
11357 {
11358 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
11359 }
11360
11362 {
11363 if (!hasRootAsPlayer)
11364 {
11365 if (refParentIB)
11366 {
11367
11368 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
11369 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
11370
11371 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
11372 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
11373
11376 }
11377 else
11378 {
11379
11382 }
11383 }
11384 }
11385
11387 {
11389 {
11390 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
11391 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
11392 {
11393 float heatPermCoef = 1.0;
11395 while (ent)
11396 {
11397 heatPermCoef *= ent.GetHeatPermeabilityCoef();
11398 ent = ent.GetHierarchyParent();
11399 }
11400
11401 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
11402 }
11403 }
11404 }
11405
11407 {
11408
11409 EntityAI parent = GetHierarchyParent();
11410 if (!parent)
11411 {
11412 hasParent = false;
11413 hasRootAsPlayer = false;
11414 }
11415 else
11416 {
11417 hasParent = true;
11418 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
11419 refParentIB =
ItemBase.Cast(parent);
11420 }
11421 }
11422
11423 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
11424 {
11425
11426 }
11427
11429 {
11430
11431 return false;
11432 }
11433
11435 {
11436
11437
11438 return false;
11439 }
11440
11442 {
11443
11444 return false;
11445 }
11446
11449 {
11450 return !GetIsFrozen() &&
IsOpen();
11451 }
11452
11454 {
11455 bool hasParent = false, hasRootAsPlayer = false;
11457
11458 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
11459 bool foodDecay =
g_Game.IsFoodDecayEnabled();
11460
11461 if (wwtu || foodDecay)
11462 {
11466
11467 if (processWetness || processTemperature || processDecay)
11468 {
11470
11471 if (processWetness)
11472 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
11473
11474 if (processTemperature)
11476
11477 if (processDecay)
11478 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
11479 }
11480 }
11481 }
11482
11485 {
11487 }
11488
11490 {
11493
11494 return super.GetTemperatureFreezeThreshold();
11495 }
11496
11498 {
11501
11502 return super.GetTemperatureThawThreshold();
11503 }
11504
11506 {
11509
11510 return super.GetItemOverheatThreshold();
11511 }
11512
11514 {
11516 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
11517
11518 return super.GetTemperatureFreezeTime();
11519 }
11520
11522 {
11524 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
11525
11526 return super.GetTemperatureThawTime();
11527 }
11528
11533
11535 {
11536 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
11537 }
11538
11540 {
11541 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
11542 }
11543
11546 {
11548 }
11549
11551 {
11553 }
11554
11556 {
11558 }
11559
11562 {
11563 return null;
11564 }
11565
11568 {
11569 return false;
11570 }
11571
11573 {
11575 {
11578 if (!trg)
11579 {
11581 explosive = this;
11582 }
11583
11584 explosive.PairRemote(trg);
11586
11587 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
11588 trg.SetPersistentPairID(persistentID);
11589 explosive.SetPersistentPairID(persistentID);
11590
11591 return true;
11592 }
11593 return false;
11594 }
11595
11598 {
11599 float ret = 1.0;
11602 ret *= GetHealth01();
11603
11604 return ret;
11605 }
11606
11607 #ifdef DEVELOPER
11608 override void SetDebugItem()
11609 {
11610 super.SetDebugItem();
11611 _itemBase = this;
11612 }
11613
11615 {
11616 string text = super.GetDebugText();
11617
11619 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
11620
11621 return text;
11622 }
11623 #endif
11624
11626 {
11627 return true;
11628 }
11629
11631
11633
11635 {
11638 }
11639
11640
11648
11664
11665 [
Obsolete(
"Use ItemSoundHandler instead")]
11668 {
11669 if (!
g_Game.IsDedicatedServer())
11670 {
11671 if (ConfigIsExisting("attachSoundSet"))
11672 {
11673 string cfg_path = "";
11674 string soundset = "";
11675 string type_name =
GetType();
11676
11679 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
11680 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
11681
11682 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
11683 {
11684 for (int i = 0; i < cfg_soundset_array.Count(); i++)
11685 {
11686 if (cfg_slot_array[i] == slot_type)
11687 {
11688 soundset = cfg_soundset_array[i];
11689 break;
11690 }
11691 }
11692 }
11693
11694 if (soundset != "")
11695 {
11696 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
11698 }
11699 }
11700 }
11701 }
11702
11704}
11705
11707{
11709 if (entity)
11710 {
11711 bool is_item = entity.IsInherited(
ItemBase);
11712 if (is_item && full_quantity)
11713 {
11716 }
11717 }
11718 else
11719 {
11721 return NULL;
11722 }
11723 return entity;
11724}
11725
11727{
11728 if (item)
11729 {
11730 if (health > 0)
11731 item.SetHealth("", "", health);
11732
11733 if (item.CanHaveTemperature())
11734 {
11736 if (item.CanFreeze())
11737 item.SetFrozen(false);
11738 }
11739
11740 if (item.HasEnergyManager())
11741 {
11742 if (quantity >= 0)
11743 {
11744 item.GetCompEM().SetEnergy0To1(quantity);
11745 }
11746 else
11747 {
11749 }
11750 }
11751 else if (item.IsMagazine())
11752 {
11753 Magazine mag = Magazine.Cast(item);
11754 if (quantity >= 0)
11755 {
11756 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
11757 }
11758 else
11759 {
11761 }
11762
11763 }
11764 else
11765 {
11766 if (quantity >= 0)
11767 {
11768 item.SetQuantityNormalized(quantity, false);
11769 }
11770 else
11771 {
11773 }
11774
11775 }
11776 }
11777}
11778
11779#ifdef DEVELOPER
11781#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.