6767{
6769 {
6770 return true;
6771 }
6772};
6773
6775{
6776
6777};
6778
6779
6780
6782{
6786
6788
6791
6792
6793
6794
6795
6804
6810
6815
6820
6841 protected bool m_IsResultOfSplit
6842
6844
6849
6850
6851
6853
6857
6858
6859
6861
6864
6865
6866
6872
6873
6881
6884
6885
6887
6888
6890
6891
6896
6897
6902
6904
6905
6907
6908
6910 {
6915
6916 if (!
g_Game.IsDedicatedServer())
6917 {
6919 {
6921
6923 {
6925 }
6926 }
6927
6930 }
6931
6932 m_OldLocation = null;
6933
6935 {
6937 }
6938
6939 if (ConfigIsExisting("headSelectionsToHide"))
6940 {
6943 }
6944
6946 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
6947 {
6949 }
6950
6952
6953 m_IsResultOfSplit = false;
6954
6956 }
6957
6959 {
6960 super.InitItemVariables();
6961
6967 m_Count = ConfigGetInt(
"count");
6968
6971
6976
6979
6984
6996
7000
7001
7004 if (ConfigIsExisting("canBeSplit"))
7005 {
7008 }
7009
7011 if (ConfigIsExisting("itemBehaviour"))
7013
7014
7017 RegisterNetSyncVariableInt("m_VarLiquidType");
7018 RegisterNetSyncVariableInt("m_Cleanness",0,1);
7019
7020 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
7021 RegisterNetSyncVariableFloat("m_ImpactSpeed");
7022 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
7023
7024 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
7025 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
7026 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
7027 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
7028
7029 RegisterNetSyncVariableBool("m_IsBeingPlaced");
7030 RegisterNetSyncVariableBool("m_IsTakeable");
7031 RegisterNetSyncVariableBool("m_IsHologram");
7032
7035 {
7038 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
7039 }
7040
7042
7044 if (ConfigIsExisting("temperaturePerQuantityWeight"))
7046
7048 }
7049
7051 {
7053 }
7054
7056 {
7059 {
7064 }
7065 }
7066
7067 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
7068 {
7070 {
7073 }
7074
7076 }
7077
7079 {
7085 }
7086
7088
7090 {
7092
7093 if (!action)
7094 {
7095 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
7096 return;
7097 }
7098
7100 if (!ai)
7101 {
7103 return;
7104 }
7105
7107 if (!action_array)
7108 {
7109 action_array = new array<ActionBase_Basic>;
7111 }
7112 if (LogManager.IsActionLogEnable())
7113 {
7114 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
7115 }
7116
7117 if (action_array.Find(action) != -1)
7118 {
7119 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
7120 }
7121 else
7122 {
7123 action_array.Insert(action);
7124 }
7125 }
7126
7128 {
7129 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7130 ActionBase action = player.GetActionManager().GetAction(actionName);
7133
7134 if (action_array)
7135 {
7136 action_array.RemoveItem(action);
7137 }
7138 }
7139
7140
7141
7143 {
7144 ActionOverrideData overrideData = new ActionOverrideData();
7148
7150 if (!actionMap)
7151 {
7154 }
7155
7156 actionMap.Insert(this.
Type(), overrideData);
7157
7158 }
7159
7161
7163
7164
7166 {
7169
7172
7173 string config_to_search = "CfgVehicles";
7174 string muzzle_owner_config;
7175
7177 {
7178 if (IsInherited(Weapon))
7179 config_to_search = "CfgWeapons";
7180
7181 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7182
7183 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
7184
7185 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
7186
7187 if (config_OnFire_subclass_count > 0)
7188 {
7189 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
7190
7191 for (int i = 0; i < config_OnFire_subclass_count; i++)
7192 {
7193 string particle_class = "";
7194 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
7195 string config_OnFire_entry = config_OnFire_class + particle_class;
7196 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
7197 WPOF_array.Insert(WPOF);
7198 }
7199
7200
7202 }
7203 }
7204
7206 {
7207 config_to_search = "CfgWeapons";
7208 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7209
7210 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
7211
7212 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
7213
7214 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
7215 {
7216 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
7217
7218 for (i = 0; i < config_OnBulletCasingEject_count; i++)
7219 {
7220 string particle_class2 = "";
7221 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
7222 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
7223 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
7224 WPOBE_array.Insert(WPOBE);
7225 }
7226
7227
7229 }
7230 }
7231 }
7232
7233
7235 {
7238
7240 {
7241 string config_to_search = "CfgVehicles";
7242
7243 if (IsInherited(Weapon))
7244 config_to_search = "CfgWeapons";
7245
7246 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7247 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
7248
7249 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
7250 {
7251
7253
7255 {
7257 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
7259 return;
7260 }
7261
7264
7265
7266
7267 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
7268 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
7269
7270 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
7271 {
7272 string particle_class = "";
7273 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
7274 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
7275 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
7276
7277 if (entry_type == CT_CLASS)
7278 {
7279 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
7280 WPOOH_array.Insert(WPOF);
7281 }
7282 }
7283
7284
7286 }
7287 }
7288 }
7289
7291 {
7293 }
7294
7296 {
7298 {
7300
7303
7306
7307 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7308 }
7309 }
7310
7312 {
7314 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7315
7317 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7318
7320 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7321
7323 {
7325 }
7326 }
7327
7329 {
7331 }
7332
7334 {
7337 else
7339
7341 {
7344 }
7345 else
7346 {
7349
7352 }
7353
7355 }
7356
7358 {
7360 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7361 }
7362
7364 {
7366 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7368 }
7369
7371 {
7373 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7374 }
7375
7377 {
7380
7381 OverheatingParticle OP = new OverheatingParticle();
7386
7388 }
7389
7391 {
7394
7395 return -1;
7396 }
7397
7399 {
7401 {
7404
7405 for (int i = count; i > 0; --i)
7406 {
7407 int id = i - 1;
7410
7413
7414 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
7415 {
7416 if (p)
7417 {
7420 }
7421 }
7422 }
7423 }
7424 }
7425
7427 {
7429 {
7431 {
7432 int id = i - 1;
7434
7435 if (OP)
7436 {
7438
7439 if (p)
7440 {
7442 }
7443
7444 delete OP;
7445 }
7446 }
7447
7450 }
7451 }
7452
7455 {
7456 return 0.0;
7457 }
7458
7459
7461 {
7462 return 250;
7463 }
7464
7466 {
7467 return 0;
7468 }
7469
7472 {
7474 return true;
7475
7476 return false;
7477 }
7478
7481 {
7484
7486 {
7488 }
7489 else
7490 {
7491
7493 }
7494
7496 }
7497
7504 {
7505 return -1;
7506 }
7507
7508
7509
7510
7512 {
7514 {
7515 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7516 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7517
7518 if (r_index >= 0)
7519 {
7520 InventoryLocation r_il = new InventoryLocation;
7521 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7522
7523 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7526 {
7527 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7528 }
7530 {
7531 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7532 }
7533
7534 }
7535
7536 player.GetHumanInventory().ClearUserReservedLocation(this);
7537 }
7538
7541 }
7542
7543
7544
7545
7547 {
7548 return ItemBase.m_DebugActionsMask;
7549 }
7550
7552 {
7553 return ItemBase.m_DebugActionsMask & mask;
7554 }
7555
7557 {
7558 ItemBase.m_DebugActionsMask = mask;
7559 }
7560
7562 {
7563 ItemBase.m_DebugActionsMask |= mask;
7564 }
7565
7567 {
7568 ItemBase.m_DebugActionsMask &= ~mask;
7569 }
7570
7572 {
7574 {
7576 }
7577 else
7578 {
7580 }
7581 }
7582
7583
7585 {
7586 if (GetEconomyProfile())
7587 {
7588 float q_max = GetEconomyProfile().GetQuantityMax();
7589 if (q_max > 0)
7590 {
7591 float q_min = GetEconomyProfile().GetQuantityMin();
7592 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
7593
7595 {
7596 ComponentEnergyManager comp = GetCompEM();
7598 {
7600 }
7601 }
7603 {
7605
7606 }
7607
7608 }
7609 }
7610 }
7611
7614 {
7615 EntityAI parent = GetHierarchyParent();
7616
7617 if (parent)
7618 {
7619 InventoryLocation inventory_location_to_lock = new InventoryLocation;
7620 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
7621 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
7622 }
7623 }
7624
7627 {
7628 EntityAI parent = GetHierarchyParent();
7629
7630 if (parent)
7631 {
7632 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
7633 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
7634 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
7635 }
7636 }
7637
7639 {
7640
7641
7642
7643
7645
7647 {
7648 if (ScriptInputUserData.CanStoreInputUserData())
7649 {
7650 ScriptInputUserData ctx = new ScriptInputUserData;
7656 ctx.
Write(use_stack_max);
7659
7661 {
7662 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
7663 }
7664 }
7665 }
7666 else if (!
g_Game.IsMultiplayer())
7667 {
7669 }
7670 }
7671
7673 {
7675 }
7676
7678 {
7680 }
7681
7683 {
7685 }
7686
7688 {
7689
7690 return false;
7691 }
7692
7694 {
7695 return false;
7696 }
7697
7701 {
7702 return false;
7703 }
7704
7706 {
7707 return "";
7708 }
7709
7711
7713 {
7714 return false;
7715 }
7716
7718 {
7719 return true;
7720 }
7721
7722
7723
7725 {
7726 return true;
7727 }
7728
7730 {
7731 return true;
7732 }
7733
7735 {
7736 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7738 }
7739
7741 {
7743 }
7744
7746 {
7748 if (!is_being_placed)
7750 SetSynchDirty();
7751 }
7752
7753
7755
7757 {
7759 }
7760
7762 {
7764 }
7765
7767 {
7768 return 1;
7769 }
7770
7772 {
7773 return false;
7774 }
7775
7777 {
7779 SetSynchDirty();
7780 }
7781
7782
7783
7784
7785
7786
7787
7788
7789
7790
7791
7792
7793
7794
7795
7796
7797
7798
7799
7800
7801
7802
7803
7804
7805
7806
7807
7808
7809
7810
7811
7812
7813
7814
7815
7817 {
7818 super.OnMovedInsideCargo(container);
7819
7820 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7821 }
7822
7823 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
7824 {
7825 super.EEItemLocationChanged(oldLoc, newLoc);
7826
7827 PlayerBase newPlayer = null;
7828 PlayerBase oldPlayer = null;
7829
7830 if (newLoc.GetParent())
7831 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
7832
7833 if (oldLoc.GetParent())
7834 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
7835
7837 {
7838 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
7839
7840 if (rIndex >= 0)
7841 {
7842 InventoryLocation rIl = new InventoryLocation;
7843 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
7844
7845 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
7848 {
7849 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
7850 }
7852 {
7854 }
7855
7856 }
7857 }
7858
7860 {
7861 if (newPlayer)
7862 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
7863
7864 if (newPlayer == oldPlayer)
7865 {
7866 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
7867 {
7869 {
7870 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
7871 {
7872 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7873 }
7874 }
7875 else
7876 {
7877 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7878 }
7879 }
7880
7881 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
7882 {
7883 int type = oldLoc.GetType();
7885 {
7886 oldLoc.GetParent().GetOnSetLock().Invoke(this);
7887 }
7889 {
7890 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
7891 }
7892 }
7893 if (!m_OldLocation)
7894 {
7895 m_OldLocation = new InventoryLocation;
7896 }
7897 m_OldLocation.Copy(oldLoc);
7898 }
7899 else
7900 {
7901 if (m_OldLocation)
7902 {
7903 m_OldLocation.Reset();
7904 }
7905 }
7906
7907 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
7908 }
7909 else
7910 {
7911 if (newPlayer)
7912 {
7913 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
7914 if (resIndex >= 0)
7915 {
7916 InventoryLocation il = new InventoryLocation;
7917 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
7919 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
7922 {
7923 il.
GetParent().GetOnReleaseLock().Invoke(it);
7924 }
7926 {
7928 }
7929
7930 }
7931 }
7933 {
7934
7936 }
7937
7938 if (m_OldLocation)
7939 {
7940 m_OldLocation.Reset();
7941 }
7942 }
7943
7945 {
7946 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
7947 }
7948
7950 {
7951 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
7952 }
7953 }
7954
7955 override void EOnContact(IEntity other, Contact extra)
7956 {
7958 {
7959 int liquidType = -1;
7961 if (impactSpeed > 0.0)
7962 {
7964 #ifndef SERVER
7966 #else
7968 SetSynchDirty();
7969 #endif
7971 }
7972 }
7973
7974 #ifdef SERVER
7975 if (GetCompEM() && GetCompEM().IsPlugged())
7976 {
7977 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
7978 GetCompEM().UnplugThis();
7979 }
7980 #endif
7981 }
7982
7984
7986 {
7988 }
7989
7991 {
7992
7993 }
7994
7996 {
7997 super.OnItemLocationChanged(old_owner, new_owner);
7998
7999 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
8000 PlayerBase playerNew = PlayerBase.Cast(new_owner);
8001
8002 if (!relatedPlayer && playerNew)
8003 relatedPlayer = playerNew;
8004
8005 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
8006 {
8008 if (actionMgr)
8009 {
8010 ActionBase currentAction = actionMgr.GetRunningAction();
8011 if (currentAction)
8013 }
8014 }
8015
8016 Man ownerPlayerOld = null;
8017 Man ownerPlayerNew = null;
8018
8019 if (old_owner)
8020 {
8021 if (old_owner.
IsMan())
8022 {
8023 ownerPlayerOld = Man.Cast(old_owner);
8024 }
8025 else
8026 {
8027 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
8028 }
8029 }
8030 else
8031 {
8033 {
8035
8036 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
8037 {
8038 GetCompEM().UnplugThis();
8039 }
8040 }
8041 }
8042
8043 if (new_owner)
8044 {
8045 if (new_owner.
IsMan())
8046 {
8047 ownerPlayerNew = Man.Cast(new_owner);
8048 }
8049 else
8050 {
8051 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
8052 }
8053 }
8054
8055 if (ownerPlayerOld != ownerPlayerNew)
8056 {
8057 if (ownerPlayerOld)
8058 {
8059 array<EntityAI> subItemsExit = new array<EntityAI>;
8061 for (int i = 0; i < subItemsExit.Count(); i++)
8062 {
8065 }
8066 }
8067
8068 if (ownerPlayerNew)
8069 {
8070 array<EntityAI> subItemsEnter = new array<EntityAI>;
8072 for (int j = 0; j < subItemsEnter.Count(); j++)
8073 {
8076 }
8077 }
8078 }
8079 else if (ownerPlayerNew != null)
8080 {
8081 PlayerBase nplayer;
8082 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
8083 {
8084 array<EntityAI> subItemsUpdate = new array<EntityAI>;
8086 for (int k = 0; k < subItemsUpdate.Count(); k++)
8087 {
8089 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
8090 }
8091 }
8092 }
8093
8094 if (old_owner)
8095 old_owner.OnChildItemRemoved(this);
8096 if (new_owner)
8097 new_owner.OnChildItemReceived(this);
8098 }
8099
8100
8102 {
8103 super.EEDelete(parent);
8104 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
8105 if (player)
8106 {
8108
8109 if (player.IsAlive())
8110 {
8111 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8112 if (r_index >= 0)
8113 {
8114 InventoryLocation r_il = new InventoryLocation;
8115 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8116
8117 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8120 {
8121 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8122 }
8124 {
8125 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8126 }
8127
8128 }
8129
8130 player.RemoveQuickBarEntityShortcut(this);
8131 }
8132 }
8133 }
8134
8136 {
8137 super.EEKilled(killer);
8138
8141 {
8142 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
8143 {
8144 if (IsMagazine())
8145 {
8146 if (Magazine.Cast(this).GetAmmoCount() > 0)
8147 {
8149 }
8150 }
8151 else
8152 {
8154 }
8155 }
8156 }
8157 }
8158
8160 {
8161 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8162
8163 super.OnWasAttached(parent, slot_id);
8164
8167
8170 }
8171
8173 {
8174 super.OnWasDetached(parent, slot_id);
8175
8178
8181 }
8182
8184 {
8185 int idx;
8188
8189 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8190 if (inventory_slots.Count() < 1)
8191 {
8192 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
8193 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
8194 }
8195 else
8196 {
8197 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
8198 }
8199
8200 idx = inventory_slots.Find(slot);
8201 if (idx < 0)
8202 return "";
8203
8204 return attach_types.Get(idx);
8205 }
8206
8208 {
8209 int idx = -1;
8210 string slot;
8211
8214
8215 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8216 if (inventory_slots.Count() < 1)
8217 {
8218 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
8219 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8220 }
8221 else
8222 {
8223 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
8224 if (detach_types.Count() < 1)
8225 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8226 }
8227
8228 for (int i = 0; i < inventory_slots.Count(); i++)
8229 {
8230 slot = inventory_slots.Get(i);
8231 }
8232
8233 if (slot != "")
8234 {
8235 if (detach_types.Count() == 1)
8236 idx = 0;
8237 else
8238 idx = inventory_slots.Find(slot);
8239 }
8240 if (idx < 0)
8241 return "";
8242
8243 return detach_types.Get(idx);
8244 }
8245
8247 {
8248
8250
8251
8252 float min_time = 1;
8253 float max_time = 3;
8254 float delay = Math.RandomFloat(min_time, max_time);
8255
8256 explode_timer.Run(delay, this, "DoAmmoExplosion");
8257 }
8258
8260 {
8261 Magazine magazine = Magazine.Cast(this);
8262 int pop_sounds_count = 6;
8263 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
8264
8265
8266 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
8267 string sound_name = pop_sounds[ sound_idx ];
8268 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
8269
8270
8271 magazine.ServerAddAmmoCount(-1);
8272
8273
8274 float min_temp_to_explode = 100;
8275
8276 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
8277 {
8279 }
8280 }
8281
8282
8283 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
8284 {
8285 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
8286
8287 const int CHANCE_DAMAGE_CARGO = 4;
8288 const int CHANCE_DAMAGE_ATTACHMENT = 1;
8289 const int CHANCE_DAMAGE_NOTHING = 2;
8290
8292 {
8293 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
8294 int chances;
8295 int rnd;
8296
8297 if (GetInventory().GetCargo())
8298 {
8299 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8300 rnd = Math.RandomInt(0,chances);
8301
8302 if (rnd < CHANCE_DAMAGE_CARGO)
8303 {
8305 }
8306 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
8307 {
8309 }
8310 }
8311 else
8312 {
8313 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8314 rnd = Math.RandomInt(0,chances);
8315
8316 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
8317 {
8319 }
8320 }
8321 }
8322 }
8323
8325 {
8326 CargoBase cargo = GetInventory().GetCargo();
8327 if (cargo)
8328 {
8330 if (item_count > 0)
8331 {
8332 int random_pick = Math.RandomInt(0, item_count);
8334 if (!item.IsExplosive())
8335 {
8336 item.AddHealth("","",damage);
8337 return true;
8338 }
8339 }
8340 }
8341 return false;
8342 }
8343
8345 {
8346 GameInventory inventory = GetInventory();
8348 if (attachment_count > 0)
8349 {
8350 int random_pick = Math.RandomInt(0, attachment_count);
8352 if (!attachment.IsExplosive())
8353 {
8354 attachment.AddHealth("","",damage);
8355 return true;
8356 }
8357 }
8358 return false;
8359 }
8360
8362 {
8364 }
8365
8367 {
8369 return GetInventory().CanRemoveEntity();
8370
8371 return false;
8372 }
8373
8375 {
8376
8378 return false;
8379
8380
8382 return false;
8383
8384
8385
8387 if (delta == 0)
8388 return false;
8389
8390
8391 return true;
8392 }
8393
8395 {
8397 {
8398 if (ScriptInputUserData.CanStoreInputUserData())
8399 {
8400 ScriptInputUserData ctx = new ScriptInputUserData;
8405 ctx.
Write(destination_entity);
8409 }
8410 }
8411 else if (!
g_Game.IsMultiplayer())
8412 {
8414 }
8415 }
8416
8418 {
8419 float split_quantity_new;
8423 InventoryLocation loc = new InventoryLocation;
8424
8425 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8426 {
8428 split_quantity_new = stack_max;
8429 else
8431
8433 {
8434 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8435 if (new_item)
8436 {
8437 new_item.SetResultOfSplit(true);
8438 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8440 new_item.
SetQuantity(split_quantity_new,
false,
true);
8441 }
8442 }
8443 }
8444 else if (destination_entity && slot_id == -1)
8445 {
8446 if (quantity > stack_max)
8447 split_quantity_new = stack_max;
8448 else
8449 split_quantity_new = quantity;
8450
8452 {
8453 GameInventory destinationInventory = destination_entity.GetInventory();
8455 {
8458 }
8459
8460 if (new_item)
8461 {
8462 new_item.SetResultOfSplit(true);
8463 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8465 new_item.
SetQuantity(split_quantity_new,
false,
true);
8466 }
8467 }
8468 }
8469 else
8470 {
8471 if (stack_max != 0)
8472 {
8474 {
8476 }
8477
8478 if (split_quantity_new == 0)
8479 {
8480 if (!
g_Game.IsMultiplayer())
8481 player.PhysicalPredictiveDropItem(this);
8482 else
8483 player.ServerDropEntity(this);
8484 return;
8485 }
8486
8488 {
8490
8491 if (new_item)
8492 {
8493 new_item.SetResultOfSplit(true);
8494 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8497 new_item.PlaceOnSurface();
8498 }
8499 }
8500 }
8501 }
8502 }
8503
8505 {
8506 float split_quantity_new;
8510 InventoryLocation loc = new InventoryLocation;
8511
8512 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8513 {
8515 split_quantity_new = stack_max;
8516 else
8518
8520 {
8521 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8522 if (new_item)
8523 {
8524 new_item.SetResultOfSplit(true);
8525 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8527 new_item.
SetQuantity(split_quantity_new,
false,
true);
8528 }
8529 }
8530 }
8531 else if (destination_entity && slot_id == -1)
8532 {
8533 if (quantity > stack_max)
8534 split_quantity_new = stack_max;
8535 else
8536 split_quantity_new = quantity;
8537
8539 {
8540 GameInventory destinationInventory = destination_entity.GetInventory();
8542 {
8545 }
8546
8547 if (new_item)
8548 {
8549 new_item.SetResultOfSplit(true);
8550 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8552 new_item.
SetQuantity(split_quantity_new,
false,
true);
8553 }
8554 }
8555 }
8556 else
8557 {
8558 if (stack_max != 0)
8559 {
8561 {
8563 }
8564
8566 {
8568
8569 if (new_item)
8570 {
8571 new_item.SetResultOfSplit(true);
8572 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8575 new_item.PlaceOnSurface();
8576 }
8577 }
8578 }
8579 }
8580 }
8581
8583 {
8585 {
8586 if (ScriptInputUserData.CanStoreInputUserData())
8587 {
8588 ScriptInputUserData ctx = new ScriptInputUserData;
8593 dst.WriteToContext(ctx);
8595 }
8596 }
8597 else if (!
g_Game.IsMultiplayer())
8598 {
8600 }
8601 }
8602
8604 {
8606 {
8607 if (ScriptInputUserData.CanStoreInputUserData())
8608 {
8609 ScriptInputUserData ctx = new ScriptInputUserData;
8614 ctx.
Write(destination_entity);
8620 }
8621 }
8622 else if (!
g_Game.IsMultiplayer())
8623 {
8625 }
8626 }
8627
8629 {
8631 }
8632
8634 {
8636 float split_quantity_new;
8638 if (dst.IsValid())
8639 {
8640 int slot_id = dst.GetSlot();
8642
8643 if (quantity > stack_max)
8644 split_quantity_new = stack_max;
8645 else
8646 split_quantity_new = quantity;
8647
8649 {
8651
8652 if (new_item)
8653 {
8654 new_item.SetResultOfSplit(true);
8655 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8657 new_item.
SetQuantity(split_quantity_new,
false,
true);
8658 }
8659
8660 return new_item;
8661 }
8662 }
8663
8664 return null;
8665 }
8666
8668 {
8670 float split_quantity_new;
8672 if (destination_entity)
8673 {
8675 if (quantity > stackable)
8676 split_quantity_new = stackable;
8677 else
8678 split_quantity_new = quantity;
8679
8681 {
8682 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
8683 if (new_item)
8684 {
8685 new_item.SetResultOfSplit(true);
8686 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8688 new_item.
SetQuantity(split_quantity_new,
false,
true);
8689 }
8690 }
8691 }
8692 }
8693
8695 {
8697 {
8698 if (ScriptInputUserData.CanStoreInputUserData())
8699 {
8700 ScriptInputUserData ctx = new ScriptInputUserData;
8705 ItemBase destination_entity =
this;
8706 ctx.
Write(destination_entity);
8710 }
8711 }
8712 else if (!
g_Game.IsMultiplayer())
8713 {
8715 }
8716 }
8717
8719 {
8721 float split_quantity_new;
8723 if (player)
8724 {
8726 if (quantity > stackable)
8727 split_quantity_new = stackable;
8728 else
8729 split_quantity_new = quantity;
8730
8732 {
8733 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
8734 new_item =
ItemBase.Cast(in_hands);
8735 if (new_item)
8736 {
8737 new_item.SetResultOfSplit(true);
8738 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8740 new_item.SetQuantity(split_quantity_new, false, true);
8741 }
8742 }
8743 }
8744 }
8745
8747 {
8749 float split_quantity_new = Math.Floor(quantity * 0.5);
8750
8752 return;
8753
8755
8756 if (new_item)
8757 {
8758 if (new_item.GetQuantityMax() < split_quantity_new)
8759 {
8760 split_quantity_new = new_item.GetQuantityMax();
8761 }
8762
8763 new_item.SetResultOfSplit(true);
8764 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8765
8767 {
8770 }
8771 else
8772 {
8774 new_item.
SetQuantity(split_quantity_new,
false,
true);
8775 }
8776 }
8777 }
8778
8780 {
8782 float split_quantity_new = Math.Floor(quantity / 2);
8783
8785 return;
8786
8787 InventoryLocation invloc = new InventoryLocation;
8789
8791 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
8792
8793 if (new_item)
8794 {
8795 if (new_item.GetQuantityMax() < split_quantity_new)
8796 {
8797 split_quantity_new = new_item.GetQuantityMax();
8798 }
8800 {
8803 }
8804 else if (split_quantity_new > 1)
8805 {
8807 new_item.
SetQuantity(split_quantity_new,
false,
true);
8808 }
8809 }
8810 }
8811
8814 {
8815 SetWeightDirty();
8817
8818 if (parent)
8819 parent.OnAttachmentQuantityChangedEx(this, delta);
8820
8822 {
8824 {
8826 }
8828 {
8829 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
8831 }
8832 }
8833 }
8834
8837 {
8838
8839 }
8840
8843 {
8845 }
8846
8848 {
8849 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
8850
8852 {
8853 if (newLevel == GameConstants.STATE_RUINED)
8854 {
8856 EntityAI parent = GetHierarchyParent();
8857 if (parent && parent.IsFireplace())
8858 {
8859 CargoBase cargo = GetInventory().GetCargo();
8860 if (cargo)
8861 {
8863 {
8865 }
8866 }
8867 }
8868 }
8869
8871 {
8872
8874 return;
8875 }
8876
8877 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
8878 {
8880 }
8881 }
8882 }
8883
8884
8886 {
8887 super.OnRightClick();
8888
8890 {
8892 {
8893 if (ScriptInputUserData.CanStoreInputUserData())
8894 {
8895 EntityAI root = GetHierarchyRoot();
8896 Man playerOwner = GetHierarchyRootPlayer();
8897 InventoryLocation dst = new InventoryLocation;
8898
8899
8900 if (!playerOwner && root && root == this)
8901 {
8903 }
8904 else
8905 {
8906
8907 GetInventory().GetCurrentInventoryLocation(dst);
8909 {
8910 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8912 {
8914 }
8915 else
8916 {
8918
8919
8920 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
8921 {
8923 }
8924 else
8925 {
8926 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
8927 }
8928 }
8929 }
8930 }
8931
8932 ScriptInputUserData ctx = new ScriptInputUserData;
8940 }
8941 }
8942 else if (!
g_Game.IsMultiplayer())
8943 {
8945 }
8946 }
8947 }
8948
8950 {
8951 if (root)
8952 {
8953 vector m4[4];
8954 root.GetTransform(m4);
8955 dst.SetGround(this, m4);
8956 }
8957 else
8958 {
8959 GetInventory().GetCurrentInventoryLocation(dst);
8960 }
8961 }
8962
8963 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
8964 {
8965
8966 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
8967 return false;
8968
8969 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
8970 return false;
8971
8972
8974 return false;
8975
8976
8977 Magazine mag = Magazine.Cast(this);
8978 if (mag)
8979 {
8980 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
8981 return false;
8982
8983 if (stack_max_limit)
8984 {
8985 Magazine other_mag = Magazine.Cast(other_item);
8986 if (other_item)
8987 {
8988 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
8989 return false;
8990 }
8991
8992 }
8993 }
8994 else
8995 {
8996
8998 return false;
8999
9001 return false;
9002 }
9003
9004 PlayerBase player = null;
9005 if (CastTo(player, GetHierarchyRootPlayer()))
9006 {
9007 if (player.GetInventory().HasAttachment(this))
9008 return false;
9009
9010 if (player.IsItemsToDelete())
9011 return false;
9012 }
9013
9014 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
9015 return false;
9016
9017 int slotID;
9019 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
9020 return false;
9021
9022 return true;
9023 }
9024
9026 {
9028 }
9029
9031 {
9032 return m_IsResultOfSplit;
9033 }
9034
9036 {
9037 m_IsResultOfSplit = value;
9038 }
9039
9041 {
9043 }
9044
9046 {
9047 float other_item_quantity = other_item.GetQuantity();
9048 float this_free_space;
9049
9051
9053
9054 if (other_item_quantity > this_free_space)
9055 {
9056 return this_free_space;
9057 }
9058 else
9059 {
9060 return other_item_quantity;
9061 }
9062 }
9063
9065 {
9067 }
9068
9070 {
9072 return;
9073
9074 if (!IsMagazine() && other_item)
9075 {
9077 if (quantity_used != 0)
9078 {
9079 float hp1 = GetHealth01("","");
9080 float hp2 = other_item.GetHealth01("","");
9081 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
9082 hpResult = hpResult / (
GetQuantity() + quantity_used);
9083
9084 hpResult *= GetMaxHealth();
9085 Math.Round(hpResult);
9086 SetHealth("", "Health", hpResult);
9087
9089 other_item.AddQuantity(-quantity_used);
9090 }
9091 }
9093 }
9094
9096 {
9097 #ifdef SERVER
9098 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
9099 GetHierarchyParent().IncreaseLifetimeUp();
9100 #endif
9101 };
9102
9104 {
9105 PlayerBase p = PlayerBase.Cast(player);
9106
9107 array<int> recipesIds = p.m_Recipes;
9108 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9109 if (moduleRecipesManager)
9110 {
9111 EntityAI itemInHands = player.GetEntityInHands();
9112 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
9113 }
9114
9115 for (int i = 0;i < recipesIds.Count(); i++)
9116 {
9117 int key = recipesIds.Get(i);
9118 string recipeName = moduleRecipesManager.GetRecipeName(key);
9120 }
9121 }
9122
9123
9124 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
9125 {
9126 super.GetDebugActions(outputList);
9127
9128
9134
9135
9140
9145
9146
9150
9151
9153 {
9157 }
9158
9161
9162
9166
9168
9169 InventoryLocation loc = new InventoryLocation();
9170 GetInventory().GetCurrentInventoryLocation(loc);
9172 {
9173 if (Gizmo_IsSupported())
9176 }
9177
9179 }
9180
9181
9182
9183
9185 {
9186 super.OnAction(action_id, player, ctx);
9187
9189 {
9190 switch (action_id)
9191 {
9195 return true;
9199 return true;
9200 }
9201 }
9202
9204 {
9205 switch (action_id)
9206 {
9208 Delete();
9209 return true;
9210 }
9211 }
9212
9213 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
9214 {
9215 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9216 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
9217 PlayerBase p = PlayerBase.Cast(player);
9218 if (
EActions.RECIPES_RANGE_START < 1000)
9219 {
9220 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
9221 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
9222 }
9223 }
9224 #ifndef SERVER
9225 else if (action_id ==
EActions.WATCH_PLAYER)
9226 {
9227 PluginDeveloper.SetDeveloperItemClientEx(player);
9228 }
9229 #endif
9231 {
9232 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
9233 {
9234 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
9235 OnDebugButtonPressServer(id + 1);
9236 }
9237
9238 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
9239 {
9240 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
9242 }
9243
9244 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
9245 {
9246 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
9248 }
9249
9250 else if (action_id ==
EActions.ADD_QUANTITY)
9251 {
9252 if (IsMagazine())
9253 {
9254 Magazine mag = Magazine.Cast(this);
9255 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
9256 }
9257 else
9258 {
9260 }
9261
9262 if (m_EM)
9263 {
9264 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
9265 }
9266
9267 }
9268
9269 else if (action_id ==
EActions.REMOVE_QUANTITY)
9270 {
9271 if (IsMagazine())
9272 {
9273 Magazine mag2 = Magazine.Cast(this);
9274 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
9275 }
9276 else
9277 {
9279 }
9280 if (m_EM)
9281 {
9282 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
9283 }
9284
9285 }
9286
9287 else if (action_id ==
EActions.SET_QUANTITY_0)
9288 {
9290
9291 if (m_EM)
9292 {
9293 m_EM.SetEnergy(0);
9294 }
9295 }
9296
9297 else if (action_id ==
EActions.SET_MAX_QUANTITY)
9298 {
9300
9301 if (m_EM)
9302 {
9303 m_EM.SetEnergy(m_EM.GetEnergyMax());
9304 }
9305 }
9306
9307 else if (action_id ==
EActions.ADD_HEALTH)
9308 {
9309 AddHealth("","",GetMaxHealth("","Health")/5);
9310 }
9311 else if (action_id ==
EActions.REMOVE_HEALTH)
9312 {
9313 AddHealth("","",-GetMaxHealth("","Health")/5);
9314 }
9315 else if (action_id ==
EActions.DESTROY_HEALTH)
9316 {
9317 SetHealth01("","",0);
9318 }
9319 else if (action_id ==
EActions.WATCH_ITEM)
9320 {
9322 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
9323 #ifdef DEVELOPER
9324 SetDebugDeveloper_item(this);
9325 #endif
9326 }
9327
9328 else if (action_id ==
EActions.ADD_TEMPERATURE)
9329 {
9330 AddTemperature(20);
9331
9332 }
9333
9334 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
9335 {
9336 AddTemperature(-20);
9337
9338 }
9339
9340 else if (action_id ==
EActions.FLIP_FROZEN)
9341 {
9342 SetFrozen(!GetIsFrozen());
9343
9344 }
9345
9346 else if (action_id ==
EActions.ADD_WETNESS)
9347 {
9349
9350 }
9351
9352 else if (action_id ==
EActions.REMOVE_WETNESS)
9353 {
9355
9356 }
9357
9358 else if (action_id ==
EActions.LIQUIDTYPE_UP)
9359 {
9362
9363
9364 }
9365
9366 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
9367 {
9370 }
9371
9372 else if (action_id ==
EActions.MAKE_SPECIAL)
9373 {
9374 auto debugParams = DebugSpawnParams.WithPlayer(player);
9375 OnDebugSpawnEx(debugParams);
9376 }
9377
9378 }
9379
9380
9381 return false;
9382 }
9383
9384
9385
9386
9390
9393
9394
9395
9397 {
9398 return false;
9399 }
9400
9401
9403 {
9404 return true;
9405 }
9406
9407
9409 {
9410 return true;
9411 }
9412
9413
9414
9416 {
9417 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
9418 return g_Game.ConfigIsExisting(config_path);
9419 }
9420
9423 {
9424 return null;
9425 }
9426
9428 {
9429 return false;
9430 }
9431
9433 {
9434 return false;
9435 }
9436
9440
9441
9443 {
9444 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9445 return module_repairing.CanRepair(this, item_repair_kit);
9446 }
9447
9448
9449 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
9450 {
9451 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9452 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
9453 }
9454
9455
9457 {
9458
9459
9460
9461
9462
9463
9464
9465
9466 return 1;
9467 }
9468
9469
9470
9472 {
9474 }
9475
9476
9477
9479 {
9481 }
9482
9483
9492 {
9493 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9494
9495 if (player)
9496 {
9497 player.MessageStatus(text);
9498 }
9499 }
9500
9501
9510 {
9511 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9512
9513 if (player)
9514 {
9515 player.MessageAction(text);
9516 }
9517 }
9518
9519
9528 {
9529 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9530
9531 if (player)
9532 {
9533 player.MessageFriendly(text);
9534 }
9535 }
9536
9537
9546 {
9547 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9548
9549 if (player)
9550 {
9551 player.MessageImportant(text);
9552 }
9553 }
9554
9556 {
9557 return true;
9558 }
9559
9560
9561 override bool KindOf(
string tag)
9562 {
9563 bool found = false;
9564 string item_name = this.
GetType();
9566 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
9567
9568 int array_size = item_tag_array.Count();
9569 for (int i = 0; i < array_size; i++)
9570 {
9571 if (item_tag_array.Get(i) == tag)
9572 {
9573 found = true;
9574 break;
9575 }
9576 }
9577 return found;
9578 }
9579
9580
9582 {
9583
9584 super.OnRPC(sender, rpc_type,ctx);
9585
9586
9587 switch (rpc_type)
9588 {
9589 #ifndef SERVER
9590 case ERPCs.RPC_SOUND_LOCK_ATTACH:
9591 Param2<bool, string> p = new Param2<bool, string>(false, "");
9592
9594 return;
9595
9596 bool play = p.param1;
9597 string soundSet = p.param2;
9598
9599 if (play)
9600 {
9602 {
9604 {
9606 }
9607 }
9608 else
9609 {
9611 }
9612 }
9613 else
9614 {
9616 }
9617
9618 break;
9619 #endif
9620
9621 }
9622
9624 {
9626 }
9627 }
9628
9629
9630
9631
9633 {
9634 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9635 return plugin.GetID(
name);
9636 }
9637
9639 {
9640 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9641 return plugin.GetName(id);
9642 }
9643
9646 {
9647
9648
9649 int varFlags;
9650 if (!ctx.
Read(varFlags))
9651 return;
9652
9653 if (varFlags & ItemVariableFlags.FLOAT)
9654 {
9656 }
9657 }
9658
9660 {
9661
9662 super.SerializeNumericalVars(floats_out);
9663
9664
9665
9667 {
9669 }
9670
9672 {
9674 }
9675
9677 {
9679 }
9680
9682 {
9687 }
9688
9690 {
9692 }
9693 }
9694
9696 {
9697
9698 super.DeSerializeNumericalVars(floats);
9699
9700
9701 int index = 0;
9702 int mask = Math.Round(floats.Get(index));
9703
9704 index++;
9705
9707 {
9709 {
9711 }
9712 else
9713 {
9714 float quantity = floats.Get(index);
9716 }
9717 index++;
9718 }
9719
9721 {
9722 float wet = floats.Get(index);
9724 index++;
9725 }
9726
9728 {
9729 int liquidtype = Math.Round(floats.Get(index));
9731 index++;
9732 }
9733
9735 {
9737 index++;
9739 index++;
9741 index++;
9743 index++;
9744 }
9745
9747 {
9748 int cleanness = Math.Round(floats.Get(index));
9750 index++;
9751 }
9752 }
9753
9755 {
9756 super.WriteVarsToCTX(ctx);
9757
9758
9760 {
9762 }
9763
9765 {
9767 }
9768
9770 {
9772 }
9773
9775 {
9776 int r,g,b,a;
9782 }
9783
9785 {
9787 }
9788 }
9789
9791 {
9792 if (!super.ReadVarsFromCTX(ctx,version))
9793 return false;
9794
9795 int intValue;
9796 float value;
9797
9798 if (version < 140)
9799 {
9800 if (!ctx.
Read(intValue))
9801 return false;
9802
9803 m_VariablesMask = intValue;
9804 }
9805
9807 {
9808 if (!ctx.
Read(value))
9809 return false;
9810
9812 {
9814 }
9815 else
9816 {
9818 }
9819 }
9820
9821 if (version < 140)
9822 {
9824 {
9825 if (!ctx.
Read(value))
9826 return false;
9827 SetTemperatureDirect(value);
9828 }
9829 }
9830
9832 {
9833 if (!ctx.
Read(value))
9834 return false;
9836 }
9837
9839 {
9840 if (!ctx.
Read(intValue))
9841 return false;
9843 }
9844
9846 {
9847 int r,g,b,a;
9849 return false;
9851 return false;
9853 return false;
9855 return false;
9856
9858 }
9859
9861 {
9862 if (!ctx.
Read(intValue))
9863 return false;
9865 }
9866
9867 if (version >= 138 && version < 140)
9868 {
9870 {
9871 if (!ctx.
Read(intValue))
9872 return false;
9873 SetFrozen(intValue);
9874 }
9875 }
9876
9877 return true;
9878 }
9879
9880
9882 {
9885 {
9887 }
9888
9889 if (!super.OnStoreLoad(ctx, version))
9890 {
9892 return false;
9893 }
9894
9895 if (version >= 114)
9896 {
9897 bool hasQuickBarIndexSaved;
9898
9899 if (!ctx.
Read(hasQuickBarIndexSaved))
9900 {
9902 return false;
9903 }
9904
9905 if (hasQuickBarIndexSaved)
9906 {
9907 int itmQBIndex;
9908
9909
9910 if (!ctx.
Read(itmQBIndex))
9911 {
9913 return false;
9914 }
9915
9916 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
9917 if (itmQBIndex != -1 && parentPlayer)
9918 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
9919 }
9920 }
9921 else
9922 {
9923
9924 PlayerBase player;
9925 int itemQBIndex;
9926 if (version ==
int.
MAX)
9927 {
9928 if (!ctx.
Read(itemQBIndex))
9929 {
9931 return false;
9932 }
9933 }
9934 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
9935 {
9936
9937 if (!ctx.
Read(itemQBIndex))
9938 {
9940 return false;
9941 }
9942 if (itemQBIndex != -1 && player)
9943 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
9944 }
9945 }
9946
9947 if (version < 140)
9948 {
9949
9950 if (!LoadVariables(ctx, version))
9951 {
9953 return false;
9954 }
9955 }
9956
9957
9959 {
9961 return false;
9962 }
9963 if (version >= 132)
9964 {
9966 if (raib)
9967 {
9969 {
9971 return false;
9972 }
9973 }
9974 }
9975
9977 return true;
9978 }
9979
9980
9981
9983 {
9984 super.OnStoreSave(ctx);
9985
9986 PlayerBase player;
9987 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
9988 {
9990
9991 int itemQBIndex = -1;
9992 itemQBIndex = player.FindQuickBarEntityIndex(this);
9993 ctx.
Write(itemQBIndex);
9994 }
9995 else
9996 {
9998 }
9999
10001
10003 if (raib)
10004 {
10006 }
10007 }
10008
10009
10011 {
10012 super.AfterStoreLoad();
10013
10015 {
10017 }
10018
10020 {
10023 }
10024 }
10025
10027 {
10028 super.EEOnAfterLoad();
10029
10031 {
10033 }
10034
10037 }
10038
10040 {
10041 return false;
10042 }
10043
10044
10045
10047 {
10049 {
10050 #ifdef PLATFORM_CONSOLE
10051
10053 {
10055 if (menu)
10056 {
10058 }
10059 }
10060 #endif
10061 }
10062
10064 {
10067 }
10068
10070 {
10071 SetWeightDirty();
10073 }
10075 {
10078 }
10079
10081 {
10084
10087 }
10089 {
10093 }
10094
10095 super.OnVariablesSynchronized();
10096 }
10097
10098
10099
10101 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
10102 {
10103 if (!IsServerCheck(allow_client))
10104 return false;
10105
10107 return false;
10108
10111
10112 if (value <= (min + 0.001))
10113 value = min;
10114
10115 if (value == min)
10116 {
10117 if (destroy_config)
10118 {
10119 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
10120 if (dstr)
10121 {
10123 this.Delete();
10124 return true;
10125 }
10126 }
10127 else if (destroy_forced)
10128 {
10130 this.Delete();
10131 return true;
10132 }
10133
10135 }
10136
10139
10141 {
10142 EntityAI parent = GetHierarchyRoot();
10143 InventoryLocation iLoc = new InventoryLocation();
10144 GetInventory().GetCurrentInventoryLocation(iLoc);
10146 {
10147 int iLocSlot = iLoc.
GetSlot();
10149 {
10151 }
10153 {
10155 }
10156 }
10157 }
10158
10160 {
10162
10163 if (delta)
10165 }
10166
10168
10169 return false;
10170 }
10171
10172
10174 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10175 {
10177 }
10178
10180 {
10183 }
10184
10186 {
10189 }
10190
10192 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10193 {
10194 float value_clamped = Math.Clamp(value, 0, 1);
10196 SetQuantity(result, destroy_config, destroy_forced);
10197 }
10198
10199
10202 {
10204 }
10205
10207 {
10209 }
10210
10211
10212
10213
10214
10215
10216
10217
10218
10219
10221 {
10222 int slot = -1;
10223 GameInventory inventory = GetInventory();
10224 if (inventory)
10225 {
10226 InventoryLocation il = new InventoryLocation;
10229 }
10230
10232 }
10233
10235 {
10236 float quantity_max = 0;
10237
10239 {
10240 if (attSlotID != -1)
10241 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
10242
10243 if (quantity_max <= 0)
10245 }
10246
10247 if (quantity_max <= 0)
10249
10250 return quantity_max;
10251 }
10252
10254 {
10256 }
10257
10259 {
10261 }
10262
10263
10265 {
10267 }
10268
10270 {
10272 }
10273
10275 {
10277 }
10278
10279
10281 {
10282
10283 float weightEx = GetWeightEx();
10284 float special = GetInventoryAndCargoWeight();
10285 return weightEx - special;
10286 }
10287
10288
10290 {
10292 }
10293
10295 {
10297 {
10298 #ifdef DEVELOPER
10299 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10300 {
10301 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
10303 }
10304 #endif
10305
10306 return GetQuantity() * GetConfigWeightModified();
10307 }
10308 else if (HasEnergyManager())
10309 {
10310 #ifdef DEVELOPER
10311 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10312 {
10313 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
10314 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
10315 }
10316 #endif
10317 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
10318 }
10319 else
10320 {
10321 #ifdef DEVELOPER
10322 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10323 {
10324 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
10325 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
10326 }
10327 #endif
10328 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
10329 }
10330 }
10331
10334 {
10335 int item_count = 0;
10337
10338 GameInventory inventory = GetInventory();
10339 CargoBase cargo = inventory.
GetCargo();
10340 if (cargo != NULL)
10341 {
10343 }
10344
10346 for (int i = 0; i < nAttachments; ++i)
10347 {
10349 if (item)
10350 item_count += item.GetNumberOfItems();
10351 }
10352 return item_count;
10353 }
10354
10357 {
10358 float weight = 0;
10359 float wetness = 1;
10360 if (include_wetness)
10363 {
10364 weight = wetness * m_ConfigWeight;
10365 }
10367 {
10368 weight = 1;
10369 }
10370 return weight;
10371 }
10372
10373
10374
10376 {
10377 GameInventory inventory = GetInventory();
10378 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
10379 {
10380 array<EntityAI> items = new array<EntityAI>;
10382 for (int i = 0; i < items.Count(); ++i)
10383 {
10385 if (item)
10386 {
10387 g_Game.ObjectDelete(item);
10388 }
10389 }
10390 }
10391 }
10392
10393
10394
10395
10397 {
10398 float energy = 0;
10399 if (HasEnergyManager())
10400 {
10401 energy = GetCompEM().GetEnergy();
10402 }
10403 return energy;
10404 }
10405
10406
10408 {
10409 super.OnEnergyConsumed();
10410
10412 }
10413
10415 {
10416 super.OnEnergyAdded();
10417
10419 }
10420
10421
10423 {
10424 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
10425 {
10427 {
10428 float energy_0to1 = GetCompEM().GetEnergy0To1();
10430 }
10431 }
10432 }
10433
10434
10436 {
10437 return ConfigGetFloat("heatIsolation");
10438 }
10439
10441 {
10443 }
10444
10446 {
10447 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
10448 if (
g_Game.ConfigIsExisting(paramPath))
10449 return g_Game.ConfigGetFloat(paramPath);
10450
10451 return 0.0;
10452 }
10453
10455 {
10456 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
10457 if (
g_Game.ConfigIsExisting(paramPath))
10458 return g_Game.ConfigGetFloat(paramPath);
10459
10460 return 0.0;
10461 }
10462
10463 override void SetWet(
float value,
bool allow_client =
false)
10464 {
10465 if (!IsServerCheck(allow_client))
10466 return;
10467
10470
10472
10473 m_VarWet = Math.Clamp(value, min, max);
10474
10476 {
10479 }
10480 }
10481
10482 override void AddWet(
float value)
10483 {
10485 }
10486
10488 {
10490 }
10491
10493 {
10495 }
10496
10498 {
10500 }
10501
10503 {
10505 }
10506
10508 {
10510 }
10511
10512 override void OnWetChanged(
float newVal,
float oldVal)
10513 {
10516 if (newLevel != oldLevel)
10517 {
10519 }
10520 }
10521
10523 {
10524 SetWeightDirty();
10525 }
10526
10528 {
10529 return GetWetLevelInternal(
m_VarWet);
10530 }
10531
10532
10533
10535 {
10537 }
10538
10540 {
10542 }
10543
10545 {
10547 }
10548
10550 {
10552 }
10553
10554
10555
10557 {
10558 if (ConfigIsExisting("itemModelLength"))
10559 {
10560 return ConfigGetFloat("itemModelLength");
10561 }
10562 return 0;
10563 }
10564
10566 {
10567 if (ConfigIsExisting("itemAttachOffset"))
10568 {
10569 return ConfigGetFloat("itemAttachOffset");
10570 }
10571 return 0;
10572 }
10573
10574 override void SetCleanness(
int value,
bool allow_client =
false)
10575 {
10576 if (!IsServerCheck(allow_client))
10577 return;
10578
10580
10582
10585 }
10586
10588 {
10590 }
10591
10593 {
10594 return true;
10595 }
10596
10597
10598
10599
10601 {
10603 }
10604
10606 {
10608 }
10609
10610
10611
10612
10613 override void SetColor(
int r,
int g,
int b,
int a)
10614 {
10620 }
10622 override void GetColor(out
int r,out
int g,out
int b,out
int a)
10623 {
10628 }
10629
10631 {
10633 }
10634
10637 {
10638 int r,g,b,a;
10640 r = r/255;
10641 g = g/255;
10642 b = b/255;
10643 a = a/255;
10644 return MiscGameplayFunctions.GetColorString(r, g, b, a);
10645 }
10646
10647
10648
10649 override void SetLiquidType(
int value,
bool allow_client =
false)
10650 {
10651 if (!IsServerCheck(allow_client))
10652 return;
10653
10658 }
10659
10661 {
10662 return ConfigGetInt("varLiquidTypeInit");
10663 }
10664
10666 {
10668 }
10669
10671 {
10673 SetFrozen(false);
10674 }
10675
10678 {
10679 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10680 }
10681
10682
10685 {
10686 PlayerBase nplayer;
10687 if (PlayerBase.CastTo(nplayer, player))
10688 {
10690 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10691 }
10692 }
10693
10694
10697 {
10698 PlayerBase nplayer;
10699 if (PlayerBase.CastTo(nplayer,player))
10700 {
10701 nplayer.SetEnableQuickBarEntityShortcut(this, false);
10702 }
10703
10704 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
10705
10706 if (HasEnergyManager())
10707 {
10708 GetCompEM().UpdatePlugState();
10709 }
10710 }
10711
10712
10714 {
10715 super.OnPlacementStarted(player);
10716
10718 }
10719
10720 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
10721 {
10723 {
10724 m_AdminLog.OnPlacementComplete(player,
this);
10725 }
10726
10727 super.OnPlacementComplete(player, position, orientation);
10728 }
10729
10730
10731
10732
10733
10735 {
10737 {
10738 return true;
10739 }
10740 else
10741 {
10742 return false;
10743 }
10744 }
10745
10746
10748 {
10750 {
10752 }
10753 }
10754
10755
10757 {
10759 }
10760
10762 {
10764 }
10765
10766 override void InsertAgent(
int agent,
float count = 1)
10767 {
10768 if (count < 1)
10769 return;
10770
10772 }
10773
10776 {
10778 }
10779
10780
10782 {
10784 }
10785
10786
10787
10788
10789
10790
10791
10792
10793
10794
10795
10796
10797
10798
10799
10800
10801
10802
10803
10804
10805
10806
10807
10808
10809
10810
10811
10812
10813
10814
10815
10816
10817
10818
10819
10820
10821
10822
10823
10824
10825
10826
10828 {
10830 return false;
10831 return true;
10832 }
10833
10835 {
10836
10838 }
10839
10840
10843 {
10844 super.CheckForRoofLimited(timeTresholdMS);
10845
10846 float time =
g_Game.GetTime();
10847 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
10848 {
10849 m_PreviousRoofTestTime = time;
10850 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
10851 }
10852 }
10853
10854
10856 {
10858 {
10859 return 0;
10860 }
10861
10862 if (GetInventory().GetAttachmentSlotsCount() != 0)
10863 {
10864 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
10865 if (filter)
10866 return filter.GetProtectionLevel(type, false, system);
10867 else
10868 return 0;
10869 }
10870
10871 string subclassPath, entryName;
10872
10873 switch (type)
10874 {
10876 entryName = "biological";
10877 break;
10879 entryName = "chemical";
10880 break;
10881 default:
10882 entryName = "biological";
10883 break;
10884 }
10885
10886 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
10887
10888 return g_Game.ConfigGetFloat(subclassPath + entryName);
10889 }
10890
10891
10892
10895 {
10896 if (!IsMagazine())
10898
10900 }
10901
10902
10903
10904
10905
10910 {
10911 return true;
10912 }
10913
10915 {
10917 }
10918
10919
10920
10921
10922
10924 {
10925 if (parent)
10926 {
10927 if (parent.IsInherited(DayZInfected))
10928 return true;
10929
10930 if (!parent.IsRuined())
10931 return true;
10932 }
10933
10934 return true;
10935 }
10936
10938 {
10939 if (!super.CanPutAsAttachment(parent))
10940 {
10941 return false;
10942 }
10943
10944 if (!IsRuined() && !parent.IsRuined())
10945 {
10946 return true;
10947 }
10948
10949 return false;
10950 }
10951
10953 {
10954
10955
10956
10957
10958 return super.CanReceiveItemIntoCargo(item);
10959 }
10960
10962 {
10963
10964
10965
10966
10967 GameInventory attachmentInv = attachment.GetInventory();
10969 {
10970 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
10971 return false;
10972 }
10973
10974 InventoryLocation loc = new InventoryLocation();
10975 attachment.GetInventory().GetCurrentInventoryLocation(loc);
10976 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
10977 return false;
10978
10979 return super.CanReceiveAttachment(attachment, slotId);
10980 }
10981
10983 {
10984 if (!super.CanReleaseAttachment(attachment))
10985 return false;
10986
10987 return GetInventory().AreChildrenAccessible();
10988 }
10989
10990
10991
10992
10993
10994
10995
10996
10997
10998
10999
11000
11001
11002
11003
11004
11005
11006
11007
11008
11009
11011 {
11012 int id = muzzle_owner.GetMuzzleID();
11013 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
11014
11015 if (WPOF_array)
11016 {
11017 for (int i = 0; i < WPOF_array.Count(); i++)
11018 {
11019 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
11020
11021 if (WPOF)
11022 {
11023 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
11024 }
11025 }
11026 }
11027 }
11028
11029
11031 {
11032 int id = muzzle_owner.GetMuzzleID();
11034
11035 if (WPOBE_array)
11036 {
11037 for (int i = 0; i < WPOBE_array.Count(); i++)
11038 {
11039 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
11040
11041 if (WPOBE)
11042 {
11043 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11044 }
11045 }
11046 }
11047 }
11048
11049
11051 {
11052 int id = muzzle_owner.GetMuzzleID();
11053 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11054
11055 if (WPOOH_array)
11056 {
11057 for (int i = 0; i < WPOOH_array.Count(); i++)
11058 {
11059 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11060
11061 if (WPOOH)
11062 {
11063 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11064 }
11065 }
11066 }
11067 }
11068
11069
11071 {
11072 int id = muzzle_owner.GetMuzzleID();
11073 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11074
11075 if (WPOOH_array)
11076 {
11077 for (int i = 0; i < WPOOH_array.Count(); i++)
11078 {
11079 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11080
11081 if (WPOOH)
11082 {
11083 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11084 }
11085 }
11086 }
11087 }
11088
11089
11091 {
11092 int id = muzzle_owner.GetMuzzleID();
11093 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11094
11095 if (WPOOH_array)
11096 {
11097 for (int i = 0; i < WPOOH_array.Count(); i++)
11098 {
11099 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11100
11101 if (WPOOH)
11102 {
11103 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11104 }
11105 }
11106 }
11107 }
11108
11109
11110
11112 {
11114 {
11115 return true;
11116 }
11117
11118 return false;
11119 }
11120
11122 {
11124 {
11125 return true;
11126 }
11127
11128 return false;
11129 }
11130
11132 {
11134 {
11135 return true;
11136 }
11137
11138 return false;
11139 }
11140
11142 {
11143 return false;
11144 }
11145
11148 {
11149 return UATimeSpent.DEFAULT_DEPLOY;
11150 }
11151
11152
11153
11154
11156 {
11158 SetSynchDirty();
11159 }
11160
11162 {
11164 }
11165
11166
11168 {
11169 return false;
11170 }
11171
11174 {
11175 string att_type = "None";
11176
11177 if (ConfigIsExisting("soundAttType"))
11178 {
11179 att_type = ConfigGetString("soundAttType");
11180 }
11181
11183 }
11184
11186 {
11188 }
11189
11190
11191
11192
11193
11199
11201 {
11204
11206 }
11207
11208
11210 {
11212 return;
11213
11215
11218
11221
11222 SoundParameters params = new SoundParameters();
11226 }
11227
11228
11230 {
11232 {
11235
11236 SetSynchDirty();
11237
11240 }
11241 }
11242
11244 {
11246 }
11247
11248
11250 {
11252 return;
11253
11255 SetSynchDirty();
11256
11259 }
11260
11262 {
11265 }
11266
11268 {
11270 }
11271
11272 void OnApply(PlayerBase player);
11273
11275 {
11276 return 1.0;
11277 };
11278
11280 {
11282 }
11283
11285 {
11287 }
11288
11290
11292 {
11293 SetDynamicPhysicsLifeTime(0.01);
11295 }
11296
11298 {
11299 array<string> zone_names = new array<string>;
11300 GetDamageZones(zone_names);
11301 for (int i = 0; i < zone_names.Count(); i++)
11302 {
11303 SetHealthMax(zone_names.Get(i),"Health");
11304 }
11305 SetHealthMax("","Health");
11306 }
11307
11310 {
11311 float global_health = GetHealth01("","Health");
11312 array<string> zones = new array<string>;
11313 GetDamageZones(zones);
11314
11315 for (int i = 0; i < zones.Count(); i++)
11316 {
11317 SetHealth01(zones.Get(i),"Health",global_health);
11318 }
11319 }
11320
11323 {
11324 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
11325 }
11326
11328 {
11329 if (!hasRootAsPlayer)
11330 {
11331 if (refParentIB)
11332 {
11333
11334 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
11335 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
11336
11337 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
11338 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
11339
11342 }
11343 else
11344 {
11345
11348 }
11349 }
11350 }
11351
11353 {
11355 {
11356 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
11357 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
11358 {
11359 float heatPermCoef = 1.0;
11361 while (ent)
11362 {
11363 heatPermCoef *= ent.GetHeatPermeabilityCoef();
11364 ent = ent.GetHierarchyParent();
11365 }
11366
11367 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
11368 }
11369 }
11370 }
11371
11373 {
11374
11375 EntityAI parent = GetHierarchyParent();
11376 if (!parent)
11377 {
11378 hasParent = false;
11379 hasRootAsPlayer = false;
11380 }
11381 else
11382 {
11383 hasParent = true;
11384 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
11385 refParentIB =
ItemBase.Cast(parent);
11386 }
11387 }
11388
11389 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
11390 {
11391
11392 }
11393
11395 {
11396
11397 return false;
11398 }
11399
11401 {
11402
11403
11404 return false;
11405 }
11406
11408 {
11409
11410 return false;
11411 }
11412
11415 {
11416 return !GetIsFrozen() &&
IsOpen();
11417 }
11418
11420 {
11421 bool hasParent = false, hasRootAsPlayer = false;
11423
11424 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
11425 bool foodDecay =
g_Game.IsFoodDecayEnabled();
11426
11427 if (wwtu || foodDecay)
11428 {
11432
11433 if (processWetness || processTemperature || processDecay)
11434 {
11436
11437 if (processWetness)
11438 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
11439
11440 if (processTemperature)
11442
11443 if (processDecay)
11444 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
11445 }
11446 }
11447 }
11448
11451 {
11453 }
11454
11456 {
11459
11460 return super.GetTemperatureFreezeThreshold();
11461 }
11462
11464 {
11467
11468 return super.GetTemperatureThawThreshold();
11469 }
11470
11472 {
11475
11476 return super.GetItemOverheatThreshold();
11477 }
11478
11480 {
11482 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
11483
11484 return super.GetTemperatureFreezeTime();
11485 }
11486
11488 {
11490 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
11491
11492 return super.GetTemperatureThawTime();
11493 }
11494
11499
11501 {
11502 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
11503 }
11504
11506 {
11507 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
11508 }
11509
11512 {
11514 }
11515
11517 {
11519 }
11520
11522 {
11524 }
11525
11528 {
11529 return null;
11530 }
11531
11534 {
11535 return false;
11536 }
11537
11539 {
11541 {
11544 if (!trg)
11545 {
11547 explosive = this;
11548 }
11549
11550 explosive.PairRemote(trg);
11552
11553 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
11554 trg.SetPersistentPairID(persistentID);
11555 explosive.SetPersistentPairID(persistentID);
11556
11557 return true;
11558 }
11559 return false;
11560 }
11561
11564 {
11565 float ret = 1.0;
11568 ret *= GetHealth01();
11569
11570 return ret;
11571 }
11572
11573 #ifdef DEVELOPER
11574 override void SetDebugItem()
11575 {
11576 super.SetDebugItem();
11577 _itemBase = this;
11578 }
11579
11581 {
11582 string text = super.GetDebugText();
11583
11585 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
11586
11587 return text;
11588 }
11589 #endif
11590
11592 {
11593 return true;
11594 }
11595
11597
11599
11601 {
11604 }
11605
11606
11614
11630
11631 [
Obsolete(
"Use ItemSoundHandler instead")]
11634 {
11635 if (!
g_Game.IsDedicatedServer())
11636 {
11637 if (ConfigIsExisting("attachSoundSet"))
11638 {
11639 string cfg_path = "";
11640 string soundset = "";
11641 string type_name =
GetType();
11642
11645 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
11646 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
11647
11648 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
11649 {
11650 for (int i = 0; i < cfg_soundset_array.Count(); i++)
11651 {
11652 if (cfg_slot_array[i] == slot_type)
11653 {
11654 soundset = cfg_soundset_array[i];
11655 break;
11656 }
11657 }
11658 }
11659
11660 if (soundset != "")
11661 {
11662 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
11664 }
11665 }
11666 }
11667 }
11668
11670}
11671
11673{
11675 if (entity)
11676 {
11677 bool is_item = entity.IsInherited(
ItemBase);
11678 if (is_item && full_quantity)
11679 {
11682 }
11683 }
11684 else
11685 {
11687 return NULL;
11688 }
11689 return entity;
11690}
11691
11693{
11694 if (item)
11695 {
11696 if (health > 0)
11697 item.SetHealth("", "", health);
11698
11699 if (item.CanHaveTemperature())
11700 {
11702 if (item.CanFreeze())
11703 item.SetFrozen(false);
11704 }
11705
11706 if (item.HasEnergyManager())
11707 {
11708 if (quantity >= 0)
11709 {
11710 item.GetCompEM().SetEnergy0To1(quantity);
11711 }
11712 else
11713 {
11715 }
11716 }
11717 else if (item.IsMagazine())
11718 {
11719 Magazine mag = Magazine.Cast(item);
11720 if (quantity >= 0)
11721 {
11722 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
11723 }
11724 else
11725 {
11727 }
11728
11729 }
11730 else
11731 {
11732 if (quantity >= 0)
11733 {
11734 item.SetQuantityNormalized(quantity, false);
11735 }
11736 else
11737 {
11739 }
11740
11741 }
11742 }
11743}
11744
11745#ifdef DEVELOPER
11747#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.